* Renamed item array in 'struct guild_storage' from 'storage_' to 'items' to match 'struct storage_data' (related r12933).
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14607 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
30d36bd8a1
commit
08684261f6
@ -1,6 +1,7 @@
|
|||||||
Date Added
|
Date Added
|
||||||
|
|
||||||
2010/12/18
|
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]
|
* 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 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).
|
- Fixed missing check, whether or not the character has already an open storage (follow up to r4562).
|
||||||
|
@ -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);
|
str_p+=sprintf(str,"%d,%d\t",p->guild_id,p->storage_amount);
|
||||||
|
|
||||||
for(i=0;i<MAX_GUILD_STORAGE;i++)
|
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",
|
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->items[i].id,p->items[i].nameid,p->items[i].amount,p->items[i].equip,
|
||||||
p->storage_[i].identify,p->storage_[i].refine,p->storage_[i].attribute);
|
p->items[i].identify,p->items[i].refine,p->items[i].attribute);
|
||||||
for(j=0; j<MAX_SLOTS; j++)
|
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," ");
|
str_p += sprintf(str_p," ");
|
||||||
f++;
|
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[0], &tmp_int[1], &tmp_int[2], &tmp_int[3],
|
||||||
&tmp_int[4], &tmp_int[5], &tmp_int[6], tmp_str, &len) == 8)
|
&tmp_int[4], &tmp_int[5], &tmp_int[6], tmp_str, &len) == 8)
|
||||||
{
|
{
|
||||||
p->storage_[i].id = tmp_int[0];
|
p->items[i].id = tmp_int[0];
|
||||||
p->storage_[i].nameid = tmp_int[1];
|
p->items[i].nameid = tmp_int[1];
|
||||||
p->storage_[i].amount = tmp_int[2];
|
p->items[i].amount = tmp_int[2];
|
||||||
p->storage_[i].equip = tmp_int[3];
|
p->items[i].equip = tmp_int[3];
|
||||||
p->storage_[i].identify = tmp_int[4];
|
p->items[i].identify = tmp_int[4];
|
||||||
p->storage_[i].refine = tmp_int[5];
|
p->items[i].refine = tmp_int[5];
|
||||||
p->storage_[i].attribute = tmp_int[6];
|
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++)
|
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;
|
next += len;
|
||||||
if (str[next] == ' ')
|
if (str[next] == ' ')
|
||||||
next++;
|
next++;
|
||||||
@ -371,8 +371,8 @@ int inter_guild_storage_delete(int guild_id)
|
|||||||
if(gs) {
|
if(gs) {
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<gs->storage_amount;i++){
|
for(i=0;i<gs->storage_amount;i++){
|
||||||
if(gs->storage_[i].card[0] == (short)0xff00)
|
if(gs->items[i].card[0] == (short)0xff00)
|
||||||
inter_pet_delete( MakeDWord(gs->storage_[i].card[1],gs->storage_[i].card[2]) );
|
inter_pet_delete( MakeDWord(gs->items[i].card[1],gs->items[i].card[2]) );
|
||||||
}
|
}
|
||||||
idb_remove(guild_storage_db,guild_id);
|
idb_remove(guild_storage_db,guild_id);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ int storage_fromsql(int account_id, struct storage_data* p)
|
|||||||
/// Save guild_storage data to sql
|
/// Save guild_storage data to sql
|
||||||
int guild_storage_tosql(int guild_id, struct guild_storage* p)
|
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);
|
ShowInfo ("guild storage save to DB - guild: %d\n", guild_id);
|
||||||
return 0;
|
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 )
|
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, 0, &data, NULL); item->id = atoi(data);
|
||||||
Sql_GetData(sql_handle, 1, &data, NULL); item->nameid = atoi(data);
|
Sql_GetData(sql_handle, 1, &data, NULL); item->nameid = atoi(data);
|
||||||
Sql_GetData(sql_handle, 2, &data, NULL); item->amount = atoi(data);
|
Sql_GetData(sql_handle, 2, &data, NULL); item->amount = atoi(data);
|
||||||
|
@ -238,7 +238,7 @@ struct guild_storage {
|
|||||||
int guild_id;
|
int guild_id;
|
||||||
short storage_status;
|
short storage_status;
|
||||||
short storage_amount;
|
short storage_amount;
|
||||||
struct item storage_[MAX_GUILD_STORAGE];
|
struct item items[MAX_GUILD_STORAGE];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct s_pet {
|
struct s_pet {
|
||||||
|
@ -379,8 +379,8 @@ int storage_guild_storageopen(struct map_session_data* sd)
|
|||||||
|
|
||||||
gstor->storage_status = 1;
|
gstor->storage_status = 1;
|
||||||
sd->state.storage_flag = 2;
|
sd->state.storage_flag = 2;
|
||||||
storage_sortitem(gstor->storage_, ARRAYLENGTH(gstor->storage_));
|
storage_sortitem(gstor->items, ARRAYLENGTH(gstor->items));
|
||||||
clif_storagelist(sd, gstor->storage_, ARRAYLENGTH(gstor->storage_));
|
clif_storagelist(sd, gstor->items, ARRAYLENGTH(gstor->items));
|
||||||
clif_updateguildstorageamount(sd,gstor->storage_amount);
|
clif_updateguildstorageamount(sd,gstor->storage_amount);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -406,11 +406,11 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
|
|||||||
|
|
||||||
if(itemdb_isstackable2(data)){ //Stackable
|
if(itemdb_isstackable2(data)){ //Stackable
|
||||||
for(i=0;i<MAX_GUILD_STORAGE;i++){
|
for(i=0;i<MAX_GUILD_STORAGE;i++){
|
||||||
if(compare_item(&stor->storage_[i], item_data)) {
|
if(compare_item(&stor->items[i], item_data)) {
|
||||||
if(stor->storage_[i].amount+amount > MAX_AMOUNT)
|
if(stor->items[i].amount+amount > MAX_AMOUNT)
|
||||||
return 1;
|
return 1;
|
||||||
stor->storage_[i].amount+=amount;
|
stor->items[i].amount+=amount;
|
||||||
clif_storageitemadded(sd,&stor->storage_[i],i,amount);
|
clif_storageitemadded(sd,&stor->items[i],i,amount);
|
||||||
stor->dirty = 1;
|
stor->dirty = 1;
|
||||||
if(log_config.enable_logs&0x1000)
|
if(log_config.enable_logs&0x1000)
|
||||||
log_pick_pc(sd, "G", item_data->nameid, -amount, item_data);
|
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
|
//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)
|
if(i>=MAX_GUILD_STORAGE)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
memcpy(&stor->storage_[i],item_data,sizeof(stor->storage_[0]));
|
memcpy(&stor->items[i],item_data,sizeof(stor->items[0]));
|
||||||
stor->storage_[i].amount=amount;
|
stor->items[i].amount=amount;
|
||||||
stor->storage_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);
|
clif_updateguildstorageamount(sd,stor->storage_amount);
|
||||||
stor->dirty = 1;
|
stor->dirty = 1;
|
||||||
if(log_config.enable_logs&0x1000)
|
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, sd);
|
||||||
nullpo_retr(1, stor);
|
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;
|
return 1;
|
||||||
|
|
||||||
stor->storage_[n].amount-=amount;
|
stor->items[n].amount-=amount;
|
||||||
if(log_config.enable_logs&0x1000)
|
if(log_config.enable_logs&0x1000)
|
||||||
log_pick_pc(sd, "G", stor->storage_[n].nameid, amount, &stor->storage_[n]);
|
log_pick_pc(sd, "G", stor->items[n].nameid, amount, &stor->items[n]);
|
||||||
if(stor->storage_[n].amount==0){
|
if(stor->items[n].amount==0){
|
||||||
memset(&stor->storage_[n],0,sizeof(stor->storage_[0]));
|
memset(&stor->items[n],0,sizeof(stor->items[0]));
|
||||||
stor->storage_amount--;
|
stor->storage_amount--;
|
||||||
clif_updateguildstorageamount(sd,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)
|
if(index<0 || index>=MAX_GUILD_STORAGE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(stor->storage_[index].nameid <= 0)
|
if(stor->items[index].nameid <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(amount < 1 || amount > stor->storage_[index].amount)
|
if(amount < 1 || amount > stor->items[index].amount)
|
||||||
return 0;
|
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);
|
guild_storage_delitem(sd,stor,index,amount);
|
||||||
else
|
else
|
||||||
clif_additem(sd,0,0,flag);
|
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)
|
if(index<0 || index>=MAX_GUILD_STORAGE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(stor->storage_[index].nameid<=0)
|
if(stor->items[index].nameid<=0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(amount < 1 || amount > stor->storage_[index].amount)
|
if(amount < 1 || amount > stor->items[index].amount)
|
||||||
return 0;
|
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);
|
guild_storage_delitem(sd,stor,index,amount);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user