summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Baldeck <alexander@archlinux.org>2004-09-26 21:33:45 +0000
committerAlexander Baldeck <alexander@archlinux.org>2004-09-26 21:33:45 +0000
commite9e155f9bea014471ace6245fbd3c838343906c5 (patch)
tree3f98577e284d7c15271ee160da2480abe4786213
parent797449d426443d4420c6e425a6babd8b92e99f9b (diff)
downloadmana-client-e9e155f9bea014471ace6245fbd3c838343906c5.tar.gz
mana-client-e9e155f9bea014471ace6245fbd3c838343906c5.tar.bz2
mana-client-e9e155f9bea014471ace6245fbd3c838343906c5.tar.xz
mana-client-e9e155f9bea014471ace6245fbd3c838343906c5.zip
*** empty log message ***
-rw-r--r--src/gui/inventory.cpp62
1 files changed, 32 insertions, 30 deletions
diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp
index b19eba10..add7a99d 100644
--- a/src/gui/inventory.cpp
+++ b/src/gui/inventory.cpp
@@ -210,39 +210,41 @@ void TmwInventory::show(int val) {
areDisplaying = 0;
}
-int TmwInventory::addItem(int idnum, int antal)
-{
-int found, tempi, tempii;
-found = 0;
-tempi = -1;
-for(int i = 0; i< 10; i++)
- {
- for(int ii = 0; ii< 10; ii++)
- {
- if(items[i][ii].itemIDNum == idnum)
- { found = 1; items[i][ii].num = antal; return -2; }
+int TmwInventory::addItem(int idnum, int antal) {
+ int found, tempi, tempii = 0;
+ found = 0;
+ tempi = -1;
+ for(int i = 0; i< 10; i++) {
+ for(int ii = 0; ii< 10; ii++) {
+ if(items[i][ii].itemIDNum == idnum) {
+ found = 1; items[i][ii].num = antal;
+ return -2;
+ }
+ }
}
- }
-if(!found)
-{
-for(int ii = 0; ii< 10; ii++)
- {
- for(int i = 0; i< 10; i++)
- {
- if(items[i][ii].flag == 0)
- {tempi = i; tempii = ii; ii=10;i=10;}
+
+ if(!found) {
+ for(int ii = 0; ii< 10; ii++) {
+ for(int i = 0; i< 10; i++) {
+ if(items[i][ii].flag == 0) {
+ tempi = i;
+ tempii = ii;
+ ii=10;
+ i=10;
+ }
+ }
+ }
+
+ if(tempi != -1) {
+ items[tempi][tempii].flag = 1;
+ items[tempi][tempii].itemIDNum = idnum;
+ items[tempi][tempii].num = antal;
+ return 1;
+ } else {
+ return -1;
}
}
- if(tempi != -1)
- {
- items[tempi][tempii].flag = 1;
- items[tempi][tempii].itemIDNum = idnum;
- items[tempi][tempii].num = antal;
- return 1;
- } else { return -1; }
-
-}
-return -3;
+ return -3;
}
int TmwInventory::rmItem(int idnum)