Renamed 'struct storage' to 'struct storage_data' (to make 'storage' available as a variable name).
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12932 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
9df0adf347
commit
a35279667d
@ -28,7 +28,7 @@ static DBMap* storage_db; // int account_id -> struct storage*
|
|||||||
static DBMap* guild_storage_db; // int guild_id -> struct guild_storage*
|
static DBMap* guild_storage_db; // int guild_id -> struct guild_storage*
|
||||||
|
|
||||||
// 倉庫データを文字列に変換
|
// 倉庫データを文字列に変換
|
||||||
int storage_tostr(char *str,struct storage *p)
|
int storage_tostr(char *str,struct storage_data *p)
|
||||||
{
|
{
|
||||||
int i,j,f=0;
|
int i,j,f=0;
|
||||||
char *str_p = str;
|
char *str_p = str;
|
||||||
@ -54,7 +54,7 @@ int storage_tostr(char *str,struct storage *p)
|
|||||||
}
|
}
|
||||||
#endif //TXT_SQL_CONVERT
|
#endif //TXT_SQL_CONVERT
|
||||||
// 文字列を倉庫データに変換
|
// 文字列を倉庫データに変換
|
||||||
int storage_fromstr(char *str,struct storage *p)
|
int storage_fromstr(char *str,struct storage_data *p)
|
||||||
{
|
{
|
||||||
int tmp_int[256];
|
int tmp_int[256];
|
||||||
char tmp_str[256];
|
char tmp_str[256];
|
||||||
@ -159,17 +159,17 @@ int guild_storage_fromstr(char *str,struct guild_storage *p)
|
|||||||
}
|
}
|
||||||
#ifndef TXT_SQL_CONVERT
|
#ifndef TXT_SQL_CONVERT
|
||||||
static void* create_storage(DBKey key, va_list args) {
|
static void* create_storage(DBKey key, va_list args) {
|
||||||
struct storage *s;
|
struct storage_data *s;
|
||||||
s = (struct storage *) aCalloc(sizeof(struct storage), 1);
|
s = (struct storage_data *) aCalloc(sizeof(struct storage_data), 1);
|
||||||
s->account_id=key.i;
|
s->account_id=key.i;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
// アカウントから倉庫データインデックスを得る(新規倉庫追加可能)
|
// アカウントから倉庫データインデックスを得る(新規倉庫追加可能)
|
||||||
struct storage *account2storage(int account_id)
|
struct storage_data *account2storage(int account_id)
|
||||||
{
|
{
|
||||||
struct storage *s;
|
struct storage_data *s;
|
||||||
s = (struct storage*)idb_ensure(storage_db, account_id, create_storage);
|
s = (struct storage_data*)idb_ensure(storage_db, account_id, create_storage);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ int inter_storage_init()
|
|||||||
{
|
{
|
||||||
char line[65536];
|
char line[65536];
|
||||||
int c=0,tmp_int;
|
int c=0,tmp_int;
|
||||||
struct storage *s;
|
struct storage_data *s;
|
||||||
struct guild_storage *gs;
|
struct guild_storage *gs;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ int inter_storage_init()
|
|||||||
while(fgets(line, sizeof(line), fp))
|
while(fgets(line, sizeof(line), fp))
|
||||||
{
|
{
|
||||||
sscanf(line,"%d",&tmp_int);
|
sscanf(line,"%d",&tmp_int);
|
||||||
s = (struct storage*)aCalloc(sizeof(struct storage), 1);
|
s = (struct storage_data*)aCalloc(sizeof(struct storage_data), 1);
|
||||||
if(s==NULL){
|
if(s==NULL){
|
||||||
ShowFatalError("int_storage: out of memory!\n");
|
ShowFatalError("int_storage: out of memory!\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -268,7 +268,7 @@ int inter_storage_save_sub(DBKey key,void *data,va_list ap)
|
|||||||
{
|
{
|
||||||
char line[65536];
|
char line[65536];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
storage_tostr(line,(struct storage *)data);
|
storage_tostr(line,(struct storage_data *)data);
|
||||||
fp=va_arg(ap,FILE *);
|
fp=va_arg(ap,FILE *);
|
||||||
if(*line)
|
if(*line)
|
||||||
fprintf(fp,"%s\n",line);
|
fprintf(fp,"%s\n",line);
|
||||||
@ -319,7 +319,7 @@ int inter_guild_storage_save()
|
|||||||
// 倉庫データ削除
|
// 倉庫データ削除
|
||||||
int inter_storage_delete(int account_id)
|
int inter_storage_delete(int account_id)
|
||||||
{
|
{
|
||||||
struct storage *s = (struct storage*)idb_get(storage_db,account_id);
|
struct storage_data *s = (struct storage_data*)idb_get(storage_db,account_id);
|
||||||
if(s) {
|
if(s) {
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<s->storage_amount;i++){
|
for(i=0;i<s->storage_amount;i++){
|
||||||
@ -352,12 +352,12 @@ int inter_guild_storage_delete(int guild_id)
|
|||||||
// 倉庫データの送信
|
// 倉庫データの送信
|
||||||
int mapif_load_storage(int fd,int account_id)
|
int mapif_load_storage(int fd,int account_id)
|
||||||
{
|
{
|
||||||
struct storage *s=account2storage(account_id);
|
struct storage_data *s=account2storage(account_id);
|
||||||
WFIFOHEAD(fd, sizeof(struct storage)+8);
|
WFIFOHEAD(fd, sizeof(struct storage_data)+8);
|
||||||
WFIFOW(fd,0)=0x3810;
|
WFIFOW(fd,0)=0x3810;
|
||||||
WFIFOW(fd,2)=sizeof(struct storage)+8;
|
WFIFOW(fd,2)=sizeof(struct storage_data)+8;
|
||||||
WFIFOL(fd,4)=account_id;
|
WFIFOL(fd,4)=account_id;
|
||||||
memcpy(WFIFOP(fd,8),s,sizeof(struct storage));
|
memcpy(WFIFOP(fd,8),s,sizeof(struct storage_data));
|
||||||
WFIFOSET(fd,WFIFOW(fd,2));
|
WFIFOSET(fd,WFIFOW(fd,2));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -416,17 +416,17 @@ int mapif_parse_LoadStorage(int fd)
|
|||||||
// 倉庫データ受信&保存
|
// 倉庫データ受信&保存
|
||||||
int mapif_parse_SaveStorage(int fd)
|
int mapif_parse_SaveStorage(int fd)
|
||||||
{
|
{
|
||||||
struct storage *s;
|
struct storage_data *s;
|
||||||
int account_id, len;
|
int account_id, len;
|
||||||
RFIFOHEAD(fd);
|
RFIFOHEAD(fd);
|
||||||
account_id=RFIFOL(fd,4);
|
account_id=RFIFOL(fd,4);
|
||||||
len=RFIFOW(fd,2);
|
len=RFIFOW(fd,2);
|
||||||
if(sizeof(struct storage)!=len-8){
|
if(sizeof(struct storage_data)!=len-8){
|
||||||
ShowError("inter storage: data size error %d %d\n",sizeof(struct storage),len-8);
|
ShowError("inter storage: data size error %d %d\n",sizeof(struct storage_data),len-8);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
s=account2storage(account_id);
|
s=account2storage(account_id);
|
||||||
memcpy(s,RFIFOP(fd,8),sizeof(struct storage));
|
memcpy(s,RFIFOP(fd,8),sizeof(struct storage_data));
|
||||||
mapif_save_storage_ack(fd,account_id);
|
mapif_save_storage_ack(fd,account_id);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#ifndef _INT_STORAGE_H_
|
#ifndef _INT_STORAGE_H_
|
||||||
#define _INT_STORAGE_H_
|
#define _INT_STORAGE_H_
|
||||||
|
|
||||||
struct storage;
|
struct storage_data;
|
||||||
struct guild_storage;
|
struct guild_storage;
|
||||||
|
|
||||||
int inter_storage_init(void);
|
int inter_storage_init(void);
|
||||||
@ -19,7 +19,7 @@ extern char storage_txt[1024];
|
|||||||
extern char guild_storage_txt[1024];
|
extern char guild_storage_txt[1024];
|
||||||
|
|
||||||
//Exported for use in the TXT-SQL converter.
|
//Exported for use in the TXT-SQL converter.
|
||||||
int storage_fromstr(char *str,struct storage *p);
|
int storage_fromstr(char *str,struct storage_data *p);
|
||||||
int guild_storage_fromstr(char *str,struct guild_storage *p);
|
int guild_storage_fromstr(char *str,struct guild_storage *p);
|
||||||
|
|
||||||
#endif /* _INT_STORAGE_H_ */
|
#endif /* _INT_STORAGE_H_ */
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#define STORAGE_MEMINC 16
|
#define STORAGE_MEMINC 16
|
||||||
|
|
||||||
/// Save guild_storage data to sql
|
/// Save guild_storage data to sql
|
||||||
int storage_tosql(int account_id, struct storage* p)
|
int storage_tosql(int account_id, struct storage_data* p)
|
||||||
{
|
{
|
||||||
memitemdata_to_sql(p->storage_, MAX_STORAGE, account_id, TABLE_STORAGE);
|
memitemdata_to_sql(p->storage_, MAX_STORAGE, account_id, TABLE_STORAGE);
|
||||||
//ShowInfo ("storage save to DB - account: %d\n", account_id);
|
//ShowInfo ("storage save to DB - account: %d\n", account_id);
|
||||||
@ -27,7 +27,7 @@ int storage_tosql(int account_id, struct storage* p)
|
|||||||
|
|
||||||
#ifndef TXT_SQL_CONVERT
|
#ifndef TXT_SQL_CONVERT
|
||||||
/// Load guild_storage data to mem
|
/// Load guild_storage data to mem
|
||||||
int storage_fromsql(int account_id, struct storage* p)
|
int storage_fromsql(int account_id, struct storage_data* p)
|
||||||
{
|
{
|
||||||
StringBuf buf;
|
StringBuf buf;
|
||||||
struct item* item;
|
struct item* item;
|
||||||
@ -35,7 +35,7 @@ int storage_fromsql(int account_id, struct storage* p)
|
|||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
memset(p, 0, sizeof(struct storage)); //clean up memory
|
memset(p, 0, sizeof(struct storage_data)); //clean up memory
|
||||||
p->storage_amount = 0;
|
p->storage_amount = 0;
|
||||||
p->account_id = account_id;
|
p->account_id = account_id;
|
||||||
|
|
||||||
@ -163,11 +163,11 @@ int inter_guild_storage_delete(int guild_id)
|
|||||||
int mapif_load_storage(int fd,int account_id)
|
int mapif_load_storage(int fd,int account_id)
|
||||||
{
|
{
|
||||||
//load from DB
|
//load from DB
|
||||||
WFIFOHEAD(fd, sizeof(struct storage)+8);
|
WFIFOHEAD(fd, sizeof(struct storage_data)+8);
|
||||||
WFIFOW(fd,0)=0x3810;
|
WFIFOW(fd,0)=0x3810;
|
||||||
WFIFOW(fd,2)=sizeof(struct storage)+8;
|
WFIFOW(fd,2)=sizeof(struct storage_data)+8;
|
||||||
WFIFOL(fd,4)=account_id;
|
WFIFOL(fd,4)=account_id;
|
||||||
storage_fromsql(account_id, (struct storage*)WFIFOP(fd,8));
|
storage_fromsql(account_id, (struct storage_data*)WFIFOP(fd,8));
|
||||||
WFIFOSET(fd,WFIFOW(fd,2));
|
WFIFOSET(fd,WFIFOW(fd,2));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -234,10 +234,10 @@ int mapif_parse_SaveStorage(int fd)
|
|||||||
int len = RFIFOW(fd,2);
|
int len = RFIFOW(fd,2);
|
||||||
int account_id = RFIFOL(fd,4);
|
int account_id = RFIFOL(fd,4);
|
||||||
|
|
||||||
if(sizeof(struct storage)!=len-8){
|
if(sizeof(struct storage_data)!=len-8){
|
||||||
ShowError("inter storage: data size error %d %d\n",sizeof(struct storage),len-8);
|
ShowError("inter storage: data size error %d %d\n",sizeof(struct storage_data),len-8);
|
||||||
}else{
|
}else{
|
||||||
storage_tosql(account_id, (struct storage*)RFIFOP(fd,8));
|
storage_tosql(account_id, (struct storage_data*)RFIFOP(fd,8));
|
||||||
mapif_save_storage_ack(fd,account_id);
|
mapif_save_storage_ack(fd,account_id);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#ifndef _INT_STORAGE_SQL_H_
|
#ifndef _INT_STORAGE_SQL_H_
|
||||||
#define _INT_STORAGE_SQL_H_
|
#define _INT_STORAGE_SQL_H_
|
||||||
|
|
||||||
struct storage;
|
struct storage_data;
|
||||||
struct guild_storage;
|
struct guild_storage;
|
||||||
|
|
||||||
int inter_storage_sql_init(void);
|
int inter_storage_sql_init(void);
|
||||||
@ -15,7 +15,7 @@ int inter_guild_storage_delete(int guild_id);
|
|||||||
int inter_storage_parse_frommap(int fd);
|
int inter_storage_parse_frommap(int fd);
|
||||||
|
|
||||||
//Exported for use in the TXT-SQL converter.
|
//Exported for use in the TXT-SQL converter.
|
||||||
int storage_tosql(int account_id,struct storage *p);
|
int storage_tosql(int account_id,struct storage_data *p);
|
||||||
int guild_storage_tosql(int guild_id, struct guild_storage *p);
|
int guild_storage_tosql(int guild_id, struct guild_storage *p);
|
||||||
|
|
||||||
#endif /* _INT_STORAGE_SQL_H_ */
|
#endif /* _INT_STORAGE_SQL_H_ */
|
||||||
|
@ -329,7 +329,7 @@ struct registry {
|
|||||||
struct global_reg account2[ACCOUNT_REG2_NUM];
|
struct global_reg account2[ACCOUNT_REG2_NUM];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct storage {
|
struct storage_data {
|
||||||
int dirty;
|
int dirty;
|
||||||
int account_id;
|
int account_id;
|
||||||
short storage_status;
|
short storage_status;
|
||||||
|
@ -1155,7 +1155,7 @@ int atcommand_storage(const int fd, struct map_session_data* sd, const char* com
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int atcommand_guildstorage(const int fd, struct map_session_data* sd, const char* command, const char* message)
|
int atcommand_guildstorage(const int fd, struct map_session_data* sd, const char* command, const char* message)
|
||||||
{
|
{
|
||||||
struct storage *stor; //changes from Freya/Yor
|
struct storage_data *stor; //changes from Freya/Yor
|
||||||
nullpo_retr(-1, sd);
|
nullpo_retr(-1, sd);
|
||||||
|
|
||||||
if (!sd->status.guild_id) {
|
if (!sd->status.guild_id) {
|
||||||
|
@ -606,7 +606,7 @@ int charcommand_effect(const int fd, struct map_session_data* sd, const char* co
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int charcommand_storagelist(const int fd, struct map_session_data* sd, const char* command, const char* message)
|
int charcommand_storagelist(const int fd, struct map_session_data* sd, const char* command, const char* message)
|
||||||
{
|
{
|
||||||
struct storage *stor;
|
struct storage_data *stor;
|
||||||
struct map_session_data *pl_sd;
|
struct map_session_data *pl_sd;
|
||||||
struct item_data *item_data, *item_temp;
|
struct item_data *item_data, *item_temp;
|
||||||
int i, j, count, counter, counter2;
|
int i, j, count, counter, counter2;
|
||||||
@ -1643,7 +1643,7 @@ int charcommand_storage(const int fd, struct map_session_data* sd, const char* c
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int charcommand_guildstorage(const int fd, struct map_session_data* sd, const char* command, const char* message)
|
int charcommand_guildstorage(const int fd, struct map_session_data* sd, const char* command, const char* message)
|
||||||
{
|
{
|
||||||
struct storage *stor; //changes from Freya/Yor
|
struct storage_data *stor; //changes from Freya/Yor
|
||||||
char character[NAME_LENGTH];
|
char character[NAME_LENGTH];
|
||||||
|
|
||||||
struct map_session_data *pl_sd;
|
struct map_session_data *pl_sd;
|
||||||
|
@ -1868,7 +1868,7 @@ void clif_equiplist(struct map_session_data *sd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Unified storage function which sends all of the storage (requires two packets, one for equipable items and one for stackable ones. [Skotlex]
|
//Unified storage function which sends all of the storage (requires two packets, one for equipable items and one for stackable ones. [Skotlex]
|
||||||
void clif_storagelist(struct map_session_data *sd,struct storage *stor)
|
void clif_storagelist(struct map_session_data *sd,struct storage_data *stor)
|
||||||
{
|
{
|
||||||
struct item_data *id;
|
struct item_data *id;
|
||||||
int i,n,ne,fd=sd->fd;
|
int i,n,ne,fd=sd->fd;
|
||||||
@ -3184,7 +3184,7 @@ void clif_tradecompleted(struct map_session_data* sd, int fail)
|
|||||||
/*==========================================
|
/*==========================================
|
||||||
* カプラ倉庫のアイテム数を更新
|
* カプラ倉庫のアイテム数を更新
|
||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int clif_updatestorageamount(struct map_session_data *sd,struct storage *stor)
|
int clif_updatestorageamount(struct map_session_data *sd,struct storage_data *stor)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
@ -3204,7 +3204,7 @@ int clif_updatestorageamount(struct map_session_data *sd,struct storage *stor)
|
|||||||
/*==========================================
|
/*==========================================
|
||||||
* カプラ倉庫にアイテムを追加する
|
* カプラ倉庫にアイテムを追加する
|
||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int clif_storageitemadded(struct map_session_data *sd,struct storage *stor,int index,int amount)
|
int clif_storageitemadded(struct map_session_data *sd,struct storage_data *stor,int index,int amount)
|
||||||
{
|
{
|
||||||
int view,fd;
|
int view,fd;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "../common/cbasetypes.h"
|
#include "../common/cbasetypes.h"
|
||||||
//#include "../common/mmo.h"
|
//#include "../common/mmo.h"
|
||||||
struct storage;
|
struct storage_data;
|
||||||
struct guild_storage;
|
struct guild_storage;
|
||||||
//#include "map.h"
|
//#include "map.h"
|
||||||
struct block_list;
|
struct block_list;
|
||||||
@ -192,9 +192,9 @@ void clif_tradecompleted(struct map_session_data* sd, int fail);
|
|||||||
|
|
||||||
// storage
|
// storage
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
void clif_storagelist(struct map_session_data *sd,struct storage *stor);
|
void clif_storagelist(struct map_session_data *sd,struct storage_data *stor);
|
||||||
int clif_updatestorageamount(struct map_session_data *sd,struct storage *stor);
|
int clif_updatestorageamount(struct map_session_data *sd,struct storage_data *stor);
|
||||||
int clif_storageitemadded(struct map_session_data *sd,struct storage *stor,int index,int amount);
|
int clif_storageitemadded(struct map_session_data *sd,struct storage_data *stor,int index,int amount);
|
||||||
int clif_storageitemremoved(struct map_session_data *sd,int index,int amount);
|
int clif_storageitemremoved(struct map_session_data *sd,int index,int amount);
|
||||||
int clif_storageclose(struct map_session_data *sd);
|
int clif_storageclose(struct map_session_data *sd);
|
||||||
void clif_guildstoragelist(struct map_session_data *sd,struct guild_storage *stor);
|
void clif_guildstoragelist(struct map_session_data *sd,struct guild_storage *stor);
|
||||||
|
@ -338,16 +338,16 @@ int intif_request_storage(int account_id)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// 倉庫データ送信
|
// 倉庫データ送信
|
||||||
int intif_send_storage(struct storage *stor)
|
int intif_send_storage(struct storage_data *stor)
|
||||||
{
|
{
|
||||||
if (CheckForCharServer())
|
if (CheckForCharServer())
|
||||||
return 0;
|
return 0;
|
||||||
nullpo_retr(0, stor);
|
nullpo_retr(0, stor);
|
||||||
WFIFOHEAD(inter_fd,sizeof(struct storage)+8);
|
WFIFOHEAD(inter_fd,sizeof(struct storage_data)+8);
|
||||||
WFIFOW(inter_fd,0) = 0x3011;
|
WFIFOW(inter_fd,0) = 0x3011;
|
||||||
WFIFOW(inter_fd,2) = sizeof(struct storage)+8;
|
WFIFOW(inter_fd,2) = sizeof(struct storage_data)+8;
|
||||||
WFIFOL(inter_fd,4) = stor->account_id;
|
WFIFOL(inter_fd,4) = stor->account_id;
|
||||||
memcpy( WFIFOP(inter_fd,8),stor, sizeof(struct storage) );
|
memcpy( WFIFOP(inter_fd,8),stor, sizeof(struct storage_data) );
|
||||||
WFIFOSET(inter_fd,WFIFOW(inter_fd,2));
|
WFIFOSET(inter_fd,WFIFOW(inter_fd,2));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -971,7 +971,7 @@ int intif_parse_Registers(int fd)
|
|||||||
// 倉庫データ受信
|
// 倉庫データ受信
|
||||||
int intif_parse_LoadStorage(int fd)
|
int intif_parse_LoadStorage(int fd)
|
||||||
{
|
{
|
||||||
struct storage *stor;
|
struct storage_data *stor;
|
||||||
struct map_session_data *sd;
|
struct map_session_data *sd;
|
||||||
|
|
||||||
sd=map_id2sd( RFIFOL(fd,4) );
|
sd=map_id2sd( RFIFOL(fd,4) );
|
||||||
@ -990,13 +990,13 @@ int intif_parse_LoadStorage(int fd)
|
|||||||
ShowWarning("intif_parse_LoadStorage: received storage for an already modified non-saved storage! (User %d:%d)\n", sd->status.account_id, sd->status.char_id);
|
ShowWarning("intif_parse_LoadStorage: received storage for an already modified non-saved storage! (User %d:%d)\n", sd->status.account_id, sd->status.char_id);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (RFIFOW(fd,2)-8 != sizeof(struct storage)) {
|
if (RFIFOW(fd,2)-8 != sizeof(struct storage_data)) {
|
||||||
ShowError("intif_parse_LoadStorage: data size error %d %d\n", RFIFOW(fd,2)-8, sizeof(struct storage));
|
ShowError("intif_parse_LoadStorage: data size error %d %d\n", RFIFOW(fd,2)-8, sizeof(struct storage_data));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if(battle_config.save_log)
|
if(battle_config.save_log)
|
||||||
ShowInfo("intif_openstorage: %d\n",RFIFOL(fd,4) );
|
ShowInfo("intif_openstorage: %d\n",RFIFOL(fd,4) );
|
||||||
memcpy(stor,RFIFOP(fd,8),sizeof(struct storage));
|
memcpy(stor,RFIFOP(fd,8),sizeof(struct storage_data));
|
||||||
stor->dirty=0;
|
stor->dirty=0;
|
||||||
stor->storage_status=1;
|
stor->storage_status=1;
|
||||||
sd->state.storage_flag = 1;
|
sd->state.storage_flag = 1;
|
||||||
|
@ -25,7 +25,7 @@ int intif_saveregistry(struct map_session_data *sd, int type);
|
|||||||
int intif_request_registry(struct map_session_data *sd, int flag);
|
int intif_request_registry(struct map_session_data *sd, int flag);
|
||||||
|
|
||||||
int intif_request_storage(int account_id);
|
int intif_request_storage(int account_id);
|
||||||
int intif_send_storage(struct storage *stor);
|
int intif_send_storage(struct storage_data *stor);
|
||||||
int intif_request_guild_storage(int account_id, int guild_id);
|
int intif_request_guild_storage(int account_id, int guild_id);
|
||||||
int intif_send_guild_storage(int account_id, struct guild_storage *gstor);
|
int intif_send_guild_storage(int account_id, struct guild_storage *gstor);
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ int storage_comp_item(const void *_i1, const void *_i2)
|
|||||||
return i1->nameid - i2->nameid;
|
return i1->nameid - i2->nameid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void storage_sortitem (struct storage *stor)
|
void storage_sortitem (struct storage_data *stor)
|
||||||
{
|
{
|
||||||
nullpo_retv(stor);
|
nullpo_retv(stor);
|
||||||
qsort(stor->storage_, MAX_STORAGE, sizeof(struct item), storage_comp_item);
|
qsort(stor->storage_, MAX_STORAGE, sizeof(struct item), storage_comp_item);
|
||||||
@ -83,7 +83,7 @@ static int storage_reconnect_sub(DBKey key,void *data,va_list ap)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ //Account Storage
|
{ //Account Storage
|
||||||
struct storage* stor = (struct storage*) data;
|
struct storage_data* stor = (struct storage_data*) data;
|
||||||
if (stor->dirty && stor->storage_status == 0) //Save closed storages.
|
if (stor->dirty && stor->storage_status == 0) //Save closed storages.
|
||||||
storage_storage_save(stor->account_id, stor->dirty==2?1:0);
|
storage_storage_save(stor->account_id, stor->dirty==2?1:0);
|
||||||
}
|
}
|
||||||
@ -99,20 +99,20 @@ void do_reconnect_storage(void)
|
|||||||
|
|
||||||
static void* create_storage(DBKey key, va_list args)
|
static void* create_storage(DBKey key, va_list args)
|
||||||
{
|
{
|
||||||
struct storage *stor;
|
struct storage_data *stor;
|
||||||
stor = (struct storage *) aCallocA (sizeof(struct storage), 1);
|
stor = (struct storage_data *) aCallocA (sizeof(struct storage_data), 1);
|
||||||
stor->account_id = key.i;
|
stor->account_id = key.i;
|
||||||
return stor;
|
return stor;
|
||||||
}
|
}
|
||||||
struct storage *account2storage(int account_id)
|
struct storage_data *account2storage(int account_id)
|
||||||
{
|
{
|
||||||
return (struct storage*)idb_ensure(storage_db,account_id,create_storage);
|
return (struct storage_data*)idb_ensure(storage_db,account_id,create_storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just to ask storage, without creation
|
// Just to ask storage, without creation
|
||||||
struct storage *account2storage2(int account_id)
|
struct storage_data *account2storage2(int account_id)
|
||||||
{
|
{
|
||||||
return (struct storage*)idb_get(storage_db, account_id);
|
return (struct storage_data*)idb_get(storage_db, account_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int storage_delete(int account_id)
|
int storage_delete(int account_id)
|
||||||
@ -129,7 +129,7 @@ int storage_delete(int account_id)
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int storage_storageopen(struct map_session_data *sd)
|
int storage_storageopen(struct map_session_data *sd)
|
||||||
{
|
{
|
||||||
struct storage *stor;
|
struct storage_data *stor;
|
||||||
nullpo_retr(0, sd);
|
nullpo_retr(0, sd);
|
||||||
|
|
||||||
if(sd->state.storage_flag)
|
if(sd->state.storage_flag)
|
||||||
@ -141,7 +141,7 @@ int storage_storageopen(struct map_session_data *sd)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((stor = (struct storage*)idb_get(storage_db,sd->status.account_id)) == NULL)
|
if((stor = (struct storage_data*)idb_get(storage_db,sd->status.account_id)) == NULL)
|
||||||
{ //Request storage.
|
{ //Request storage.
|
||||||
intif_request_storage(sd->status.account_id);
|
intif_request_storage(sd->status.account_id);
|
||||||
return 2;
|
return 2;
|
||||||
@ -175,7 +175,7 @@ int compare_item(struct item *a, struct item *b)
|
|||||||
/*==========================================
|
/*==========================================
|
||||||
* Internal add-item function.
|
* Internal add-item function.
|
||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
static int storage_additem(struct map_session_data *sd,struct storage *stor,struct item *item_data,int amount)
|
static int storage_additem(struct map_session_data *sd,struct storage_data *stor,struct item *item_data,int amount)
|
||||||
{
|
{
|
||||||
struct item_data *data;
|
struct item_data *data;
|
||||||
int i;
|
int i;
|
||||||
@ -224,7 +224,7 @@ static int storage_additem(struct map_session_data *sd,struct storage *stor,stru
|
|||||||
/*==========================================
|
/*==========================================
|
||||||
* Internal del-item function
|
* Internal del-item function
|
||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
static int storage_delitem(struct map_session_data *sd,struct storage *stor,int n,int amount)
|
static int storage_delitem(struct map_session_data *sd,struct storage_data *stor,int n,int amount)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(stor->storage_[n].nameid==0 || stor->storage_[n].amount<amount)
|
if(stor->storage_[n].nameid==0 || stor->storage_[n].amount<amount)
|
||||||
@ -248,7 +248,7 @@ static int storage_delitem(struct map_session_data *sd,struct storage *stor,int
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int storage_storageadd(struct map_session_data *sd,int index,int amount)
|
int storage_storageadd(struct map_session_data *sd,int index,int amount)
|
||||||
{
|
{
|
||||||
struct storage *stor;
|
struct storage_data *stor;
|
||||||
|
|
||||||
nullpo_retr(0, sd);
|
nullpo_retr(0, sd);
|
||||||
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
||||||
@ -278,7 +278,7 @@ int storage_storageadd(struct map_session_data *sd,int index,int amount)
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int storage_storageget(struct map_session_data *sd,int index,int amount)
|
int storage_storageget(struct map_session_data *sd,int index,int amount)
|
||||||
{
|
{
|
||||||
struct storage *stor;
|
struct storage_data *stor;
|
||||||
int flag;
|
int flag;
|
||||||
|
|
||||||
nullpo_retr(0, sd);
|
nullpo_retr(0, sd);
|
||||||
@ -306,7 +306,7 @@ int storage_storageget(struct map_session_data *sd,int index,int amount)
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int storage_storageaddfromcart(struct map_session_data *sd,int index,int amount)
|
int storage_storageaddfromcart(struct map_session_data *sd,int index,int amount)
|
||||||
{
|
{
|
||||||
struct storage *stor;
|
struct storage_data *stor;
|
||||||
|
|
||||||
nullpo_retr(0, sd);
|
nullpo_retr(0, sd);
|
||||||
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
||||||
@ -334,7 +334,7 @@ int storage_storageaddfromcart(struct map_session_data *sd,int index,int amount)
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int storage_storagegettocart(struct map_session_data *sd,int index,int amount)
|
int storage_storagegettocart(struct map_session_data *sd,int index,int amount)
|
||||||
{
|
{
|
||||||
struct storage *stor;
|
struct storage_data *stor;
|
||||||
|
|
||||||
nullpo_retr(0, sd);
|
nullpo_retr(0, sd);
|
||||||
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
||||||
@ -363,7 +363,7 @@ int storage_storagegettocart(struct map_session_data *sd,int index,int amount)
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int storage_storageclose(struct map_session_data *sd)
|
int storage_storageclose(struct map_session_data *sd)
|
||||||
{
|
{
|
||||||
struct storage *stor;
|
struct storage_data *stor;
|
||||||
|
|
||||||
nullpo_retr(0, sd);
|
nullpo_retr(0, sd);
|
||||||
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
||||||
@ -386,7 +386,7 @@ int storage_storageclose(struct map_session_data *sd)
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int storage_storage_quit(struct map_session_data *sd, int flag)
|
int storage_storage_quit(struct map_session_data *sd, int flag)
|
||||||
{
|
{
|
||||||
struct storage *stor;
|
struct storage_data *stor;
|
||||||
|
|
||||||
nullpo_retr(0, sd);
|
nullpo_retr(0, sd);
|
||||||
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
nullpo_retr(0, stor=account2storage2(sd->status.account_id));
|
||||||
@ -405,7 +405,7 @@ int storage_storage_quit(struct map_session_data *sd, int flag)
|
|||||||
|
|
||||||
void storage_storage_dirty(struct map_session_data *sd)
|
void storage_storage_dirty(struct map_session_data *sd)
|
||||||
{
|
{
|
||||||
struct storage *stor;
|
struct storage_data *stor;
|
||||||
|
|
||||||
stor=account2storage2(sd->status.account_id);
|
stor=account2storage2(sd->status.account_id);
|
||||||
|
|
||||||
@ -415,7 +415,7 @@ void storage_storage_dirty(struct map_session_data *sd)
|
|||||||
|
|
||||||
int storage_storage_save(int account_id, int final)
|
int storage_storage_save(int account_id, int final)
|
||||||
{
|
{
|
||||||
struct storage *stor;
|
struct storage_data *stor;
|
||||||
|
|
||||||
stor=account2storage2(account_id);
|
stor=account2storage2(account_id);
|
||||||
if(!stor) return 0;
|
if(!stor) return 0;
|
||||||
@ -441,7 +441,7 @@ int storage_storage_save(int account_id, int final)
|
|||||||
//Ack from Char-server indicating the storage was saved. [Skotlex]
|
//Ack from Char-server indicating the storage was saved. [Skotlex]
|
||||||
int storage_storage_saved(int account_id)
|
int storage_storage_saved(int account_id)
|
||||||
{
|
{
|
||||||
struct storage *stor;
|
struct storage_data *stor;
|
||||||
|
|
||||||
if((stor=account2storage2(account_id)) == NULL)
|
if((stor=account2storage2(account_id)) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#define _STORAGE_H_
|
#define _STORAGE_H_
|
||||||
|
|
||||||
//#include "../common/mmo.h"
|
//#include "../common/mmo.h"
|
||||||
struct storage;
|
struct storage_data;
|
||||||
struct guild_storage;
|
struct guild_storage;
|
||||||
struct item;
|
struct item;
|
||||||
//#include "map.h"
|
//#include "map.h"
|
||||||
@ -20,8 +20,8 @@ int storage_storageclose(struct map_session_data *sd);
|
|||||||
int do_init_storage(void);
|
int do_init_storage(void);
|
||||||
void do_final_storage(void);
|
void do_final_storage(void);
|
||||||
void do_reconnect_storage(void);
|
void do_reconnect_storage(void);
|
||||||
struct storage* account2storage(int account_id);
|
struct storage_data* account2storage(int account_id);
|
||||||
struct storage* account2storage2(int account_id);
|
struct storage_data* account2storage2(int account_id);
|
||||||
int storage_storage_quit(struct map_session_data *sd, int flag);
|
int storage_storage_quit(struct map_session_data *sd, int flag);
|
||||||
int storage_storage_save(int account_id, int final);
|
int storage_storage_save(int account_id, int final);
|
||||||
int storage_storage_saved(int account_id); //Ack from char server that guild store was saved.
|
int storage_storage_saved(int account_id); //Ack from char server that guild store was saved.
|
||||||
@ -43,7 +43,7 @@ int storage_guild_storagesaved(int guild_id); //Ack from char server that guild
|
|||||||
|
|
||||||
int storage_comp_item(const void *_i1, const void *_i2);
|
int storage_comp_item(const void *_i1, const void *_i2);
|
||||||
//int storage_comp_item(const struct item* i1, const struct item* i2);
|
//int storage_comp_item(const struct item* i1, const struct item* i2);
|
||||||
void storage_sortitem(struct storage* stor);
|
void storage_sortitem(struct storage_data* stor);
|
||||||
void storage_gsortitem(struct guild_storage* gstor);
|
void storage_gsortitem(struct guild_storage* gstor);
|
||||||
|
|
||||||
#endif /* _STORAGE_H_ */
|
#endif /* _STORAGE_H_ */
|
||||||
|
@ -107,7 +107,7 @@ int convert_init(void)
|
|||||||
input = getchar();
|
input = getchar();
|
||||||
if(input == 'y' || input == 'Y')
|
if(input == 'y' || input == 'Y')
|
||||||
{
|
{
|
||||||
struct storage storage_;
|
struct storage_data storage_;
|
||||||
ShowMessage("\n");
|
ShowMessage("\n");
|
||||||
ShowStatus("Converting Storage Database...\n");
|
ShowStatus("Converting Storage Database...\n");
|
||||||
if( (fp = fopen(storage_txt,"r")) == NULL )
|
if( (fp = fopen(storage_txt,"r")) == NULL )
|
||||||
@ -121,7 +121,7 @@ int convert_init(void)
|
|||||||
lineno++;
|
lineno++;
|
||||||
set=sscanf(line,"%d,%d",&tmp_int[0],&tmp_int[1]);
|
set=sscanf(line,"%d,%d",&tmp_int[0],&tmp_int[1]);
|
||||||
if(set==2) {
|
if(set==2) {
|
||||||
memset(&storage_, 0, sizeof(struct storage));
|
memset(&storage_, 0, sizeof(struct storage_data));
|
||||||
storage_.account_id=tmp_int[0];
|
storage_.account_id=tmp_int[0];
|
||||||
if (storage_fromstr(line,&storage_) == 0) {
|
if (storage_fromstr(line,&storage_) == 0) {
|
||||||
count++;
|
count++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user