Corrected Storage dirty flag check
* Follow up to ade1b17.
This commit is contained in:
parent
00fd5e7078
commit
d1cc320769
@ -299,7 +299,7 @@ int chrif_save(struct map_session_data *sd, int flag) {
|
||||
|
||||
chrif_bsdata_save(sd, (flag && (flag != 3)));
|
||||
|
||||
if (sd->state.storage_flag == 1)
|
||||
if (&sd->storage && sd->storage.dirty)
|
||||
intif_storage_save(sd,&sd->storage);
|
||||
intif_storage_save(sd,&sd->inventory);
|
||||
intif_storage_save(sd,&sd->cart);
|
||||
|
@ -3162,7 +3162,9 @@ static bool intif_parse_StorageReceived(int fd)
|
||||
p = (struct s_storage *)RFIFOP(fd,10);
|
||||
|
||||
switch (type) {
|
||||
case TABLE_INVENTORY: stor = &sd->inventory; break;
|
||||
case TABLE_INVENTORY:
|
||||
stor = &sd->inventory;
|
||||
break;
|
||||
case TABLE_STORAGE:
|
||||
if (p->stor_id == 0)
|
||||
stor = &sd->storage;
|
||||
@ -3172,7 +3174,8 @@ static bool intif_parse_StorageReceived(int fd)
|
||||
case TABLE_CART:
|
||||
stor = &sd->cart;
|
||||
break;
|
||||
default: return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (stor->stor_id == p->stor_id) {
|
||||
|
@ -441,22 +441,57 @@ void storage_storagegettocart(struct map_session_data* sd, struct s_storage *sto
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make player close his storage
|
||||
* @author : [massdriller] / modified by [Valaris]
|
||||
* @param sd : player
|
||||
* Request to save storage
|
||||
* @param sd: Player who has the storage
|
||||
*/
|
||||
void storage_storageclose(struct map_session_data* sd)
|
||||
void storage_storagesave(struct map_session_data *sd)
|
||||
{
|
||||
nullpo_retv(sd);
|
||||
|
||||
clif_storageclose(sd);
|
||||
if (!&sd->storage)
|
||||
return;
|
||||
|
||||
if (save_settings&CHARSAVE_STORAGE)
|
||||
chrif_save(sd,0);
|
||||
intif_storage_save(sd, &sd->storage);
|
||||
}
|
||||
|
||||
sd->state.storage_flag = 0;
|
||||
/**
|
||||
* Ack of storage has been saved
|
||||
* @param sd: Player who has the storage
|
||||
*/
|
||||
void storage_storagesaved(struct map_session_data *sd)
|
||||
{
|
||||
if (!sd)
|
||||
return;
|
||||
|
||||
if (&sd->storage)
|
||||
sd->storage.dirty = false;
|
||||
if (sd->state.storage_flag == 1) {
|
||||
sd->state.storage_flag = 0;
|
||||
clif_storageclose(sd);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make player close his storage
|
||||
* @param sd: Player who has the storage
|
||||
* @author [massdriller] / modified by [Valaris]
|
||||
*/
|
||||
void storage_storageclose(struct map_session_data *sd)
|
||||
{
|
||||
nullpo_retv(sd);
|
||||
|
||||
if (!&sd->storage)
|
||||
return;
|
||||
|
||||
if (sd->storage.dirty) {
|
||||
intif_storage_save(sd, &sd->storage);
|
||||
if (sd->state.storage_flag == 1) {
|
||||
sd->state.storage_flag = 0;
|
||||
clif_storageclose(sd);
|
||||
}
|
||||
} else
|
||||
storage_storagesaved(sd);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -471,10 +506,10 @@ void storage_storage_quit(struct map_session_data* sd, int flag)
|
||||
{
|
||||
nullpo_retv(sd);
|
||||
|
||||
if (save_settings&CHARSAVE_STORAGE)
|
||||
chrif_save(sd,0);
|
||||
if (!&sd->storage)
|
||||
return;
|
||||
|
||||
sd->state.storage_flag = 0;
|
||||
intif_storage_save(sd, &sd->storage);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user