diff options
-rw-r--r-- | Changelog-Trunk.txt | 1 | ||||
-rw-r--r-- | src/char/int_storage.c | 28 | ||||
-rw-r--r-- | src/char_sql/int_storage.c | 4 | ||||
-rw-r--r-- | src/common/mmo.h | 2 | ||||
-rw-r--r-- | src/map/storage.c | 42 |
5 files changed, 39 insertions, 38 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 4e25a1f9b..818b00228 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -1,6 +1,7 @@ Date Added 2010/12/18 + * Renamed item array in 'struct guild_storage' from 'storage_' to 'items' to match 'struct storage_data' (related r12933). [Ai4rei] * Bunch of intif_parse_LoadGuildStorage fixes. [Ai4rei] - Fixed guild storage not being sorted, when the storage had to be requested first (follow up to r14605). - Fixed missing check, whether or not the character has already an open storage (follow up to r4562). diff --git a/src/char/int_storage.c b/src/char/int_storage.c index bae72fcf4..2a041b286 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -101,12 +101,12 @@ int guild_storage_tostr(char *str,struct guild_storage *p) str_p+=sprintf(str,"%d,%d\t",p->guild_id,p->storage_amount); for(i=0;i<MAX_GUILD_STORAGE;i++) - if( (p->storage_[i].nameid) && (p->storage_[i].amount) ){ + if( (p->items[i].nameid) && (p->items[i].amount) ){ str_p += sprintf(str_p,"%d,%d,%d,%d,%d,%d,%d", - p->storage_[i].id,p->storage_[i].nameid,p->storage_[i].amount,p->storage_[i].equip, - p->storage_[i].identify,p->storage_[i].refine,p->storage_[i].attribute); + p->items[i].id,p->items[i].nameid,p->items[i].amount,p->items[i].equip, + p->items[i].identify,p->items[i].refine,p->items[i].attribute); for(j=0; j<MAX_SLOTS; j++) - str_p += sprintf(str_p,",%d",p->storage_[i].card[j]); + str_p += sprintf(str_p,",%d",p->items[i].card[j]); str_p += sprintf(str_p," "); f++; } @@ -138,15 +138,15 @@ int guild_storage_fromstr(char *str,struct guild_storage *p) &tmp_int[0], &tmp_int[1], &tmp_int[2], &tmp_int[3], &tmp_int[4], &tmp_int[5], &tmp_int[6], tmp_str, &len) == 8) { - p->storage_[i].id = tmp_int[0]; - p->storage_[i].nameid = tmp_int[1]; - p->storage_[i].amount = tmp_int[2]; - p->storage_[i].equip = tmp_int[3]; - p->storage_[i].identify = tmp_int[4]; - p->storage_[i].refine = tmp_int[5]; - p->storage_[i].attribute = tmp_int[6]; + p->items[i].id = tmp_int[0]; + p->items[i].nameid = tmp_int[1]; + p->items[i].amount = tmp_int[2]; + p->items[i].equip = tmp_int[3]; + p->items[i].identify = tmp_int[4]; + p->items[i].refine = tmp_int[5]; + p->items[i].attribute = tmp_int[6]; for(j = 0; j < MAX_SLOTS && tmp_str[0] && sscanf(tmp_str, ",%d%[0-9,-]",&tmp_int[0], tmp_str) > 0; j++) - p->storage_[i].card[j] = tmp_int[0]; + p->items[i].card[j] = tmp_int[0]; next += len; if (str[next] == ' ') next++; @@ -371,8 +371,8 @@ int inter_guild_storage_delete(int guild_id) if(gs) { int i; for(i=0;i<gs->storage_amount;i++){ - if(gs->storage_[i].card[0] == (short)0xff00) - inter_pet_delete( MakeDWord(gs->storage_[i].card[1],gs->storage_[i].card[2]) ); + if(gs->items[i].card[0] == (short)0xff00) + inter_pet_delete( MakeDWord(gs->items[i].card[1],gs->items[i].card[2]) ); } idb_remove(guild_storage_db,guild_id); } diff --git a/src/char_sql/int_storage.c b/src/char_sql/int_storage.c index 7cab6d5d9..0719685ae 100644 --- a/src/char_sql/int_storage.c +++ b/src/char_sql/int_storage.c @@ -76,7 +76,7 @@ int storage_fromsql(int account_id, struct storage_data* p) /// Save guild_storage data to sql int guild_storage_tosql(int guild_id, struct guild_storage* p) { - memitemdata_to_sql(p->storage_, MAX_GUILD_STORAGE, guild_id, TABLE_GUILD_STORAGE); + memitemdata_to_sql(p->items, MAX_GUILD_STORAGE, guild_id, TABLE_GUILD_STORAGE); ShowInfo ("guild storage save to DB - guild: %d\n", guild_id); return 0; } @@ -109,7 +109,7 @@ int guild_storage_fromsql(int guild_id, struct guild_storage* p) for( i = 0; i < MAX_GUILD_STORAGE && SQL_SUCCESS == Sql_NextRow(sql_handle); ++i ) { - item = &p->storage_[i]; + item = &p->items[i]; Sql_GetData(sql_handle, 0, &data, NULL); item->id = atoi(data); Sql_GetData(sql_handle, 1, &data, NULL); item->nameid = atoi(data); Sql_GetData(sql_handle, 2, &data, NULL); item->amount = atoi(data); diff --git a/src/common/mmo.h b/src/common/mmo.h index 994a1d6a2..92adf8af0 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -238,7 +238,7 @@ struct guild_storage { int guild_id; short storage_status; short storage_amount; - struct item storage_[MAX_GUILD_STORAGE]; + struct item items[MAX_GUILD_STORAGE]; }; struct s_pet { diff --git a/src/map/storage.c b/src/map/storage.c index e2749bfd9..eb64d3eb4 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -379,8 +379,8 @@ int storage_guild_storageopen(struct map_session_data* sd) gstor->storage_status = 1; sd->state.storage_flag = 2; - storage_sortitem(gstor->storage_, ARRAYLENGTH(gstor->storage_)); - clif_storagelist(sd, gstor->storage_, ARRAYLENGTH(gstor->storage_)); + storage_sortitem(gstor->items, ARRAYLENGTH(gstor->items)); + clif_storagelist(sd, gstor->items, ARRAYLENGTH(gstor->items)); clif_updateguildstorageamount(sd,gstor->storage_amount); return 0; } @@ -406,11 +406,11 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto if(itemdb_isstackable2(data)){ //Stackable for(i=0;i<MAX_GUILD_STORAGE;i++){ - if(compare_item(&stor->storage_[i], item_data)) { - if(stor->storage_[i].amount+amount > MAX_AMOUNT) + if(compare_item(&stor->items[i], item_data)) { + if(stor->items[i].amount+amount > MAX_AMOUNT) return 1; - stor->storage_[i].amount+=amount; - clif_storageitemadded(sd,&stor->storage_[i],i,amount); + stor->items[i].amount+=amount; + clif_storageitemadded(sd,&stor->items[i],i,amount); stor->dirty = 1; if(log_config.enable_logs&0x1000) log_pick_pc(sd, "G", item_data->nameid, -amount, item_data); @@ -419,15 +419,15 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto } } //Add item - for(i=0;i<MAX_GUILD_STORAGE && stor->storage_[i].nameid;i++); + for(i=0;i<MAX_GUILD_STORAGE && stor->items[i].nameid;i++); if(i>=MAX_GUILD_STORAGE) return 1; - memcpy(&stor->storage_[i],item_data,sizeof(stor->storage_[0])); - stor->storage_[i].amount=amount; + memcpy(&stor->items[i],item_data,sizeof(stor->items[0])); + stor->items[i].amount=amount; stor->storage_amount++; - clif_storageitemadded(sd,&stor->storage_[i],i,amount); + clif_storageitemadded(sd,&stor->items[i],i,amount); clif_updateguildstorageamount(sd,stor->storage_amount); stor->dirty = 1; if(log_config.enable_logs&0x1000) @@ -440,14 +440,14 @@ int guild_storage_delitem(struct map_session_data* sd, struct guild_storage* sto nullpo_retr(1, sd); nullpo_retr(1, stor); - if(stor->storage_[n].nameid==0 || stor->storage_[n].amount<amount) + if(stor->items[n].nameid==0 || stor->items[n].amount<amount) return 1; - stor->storage_[n].amount-=amount; + stor->items[n].amount-=amount; if(log_config.enable_logs&0x1000) - log_pick_pc(sd, "G", stor->storage_[n].nameid, amount, &stor->storage_[n]); - if(stor->storage_[n].amount==0){ - memset(&stor->storage_[n],0,sizeof(stor->storage_[0])); + log_pick_pc(sd, "G", stor->items[n].nameid, amount, &stor->items[n]); + if(stor->items[n].amount==0){ + memset(&stor->items[n],0,sizeof(stor->items[0])); stor->storage_amount--; clif_updateguildstorageamount(sd,stor->storage_amount); } @@ -496,13 +496,13 @@ int storage_guild_storageget(struct map_session_data* sd, int index, int amount) if(index<0 || index>=MAX_GUILD_STORAGE) return 0; - if(stor->storage_[index].nameid <= 0) + if(stor->items[index].nameid <= 0) return 0; - if(amount < 1 || amount > stor->storage_[index].amount) + if(amount < 1 || amount > stor->items[index].amount) return 0; - if((flag = pc_additem(sd,&stor->storage_[index],amount)) == 0) + if((flag = pc_additem(sd,&stor->items[index],amount)) == 0) guild_storage_delitem(sd,stor,index,amount); else clif_additem(sd,0,0,flag); @@ -549,13 +549,13 @@ int storage_guild_storagegettocart(struct map_session_data* sd, int index, int a if(index<0 || index>=MAX_GUILD_STORAGE) return 0; - if(stor->storage_[index].nameid<=0) + if(stor->items[index].nameid<=0) return 0; - if(amount < 1 || amount > stor->storage_[index].amount) + if(amount < 1 || amount > stor->items[index].amount) return 0; - if(pc_cart_additem(sd,&stor->storage_[index],amount)==0) + if(pc_cart_additem(sd,&stor->items[index],amount)==0) guild_storage_delitem(sd,stor,index,amount); return 1; |