summaryrefslogtreecommitdiff
path: root/src/char_sql
diff options
context:
space:
mode:
author(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-23 20:38:44 +0000
committer(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-23 20:38:44 +0000
commit2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b (patch)
tree89c47d81729687d5a69cadde99ee350306eb814f /src/char_sql
parentc4e6857d4774b25dcd9b9137f76c14c92015d691 (diff)
downloadhercules-2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b.tar.gz
hercules-2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b.tar.bz2
hercules-2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b.tar.xz
hercules-2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b.zip
update
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@968 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql')
-rw-r--r--src/char_sql/char.c96
-rw-r--r--src/char_sql/char.h6
-rw-r--r--src/char_sql/int_guild.c196
-rw-r--r--src/char_sql/int_party.c2
-rw-r--r--src/char_sql/int_pet.c2
-rw-r--r--src/char_sql/int_storage.c4
-rw-r--r--src/char_sql/inter.c4
-rw-r--r--src/char_sql/itemdb.c8
-rw-r--r--src/char_sql/itemdb.h2
9 files changed, 160 insertions, 160 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index d7f17515b..876ea991d 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -73,7 +73,7 @@ char login_db_level[32] = "level";
int lowest_gm_level = 1;
-unsigned char *SQL_CONF_NAME = "conf/inter_athena.conf";
+char *SQL_CONF_NAME = "conf/inter_athena.conf";
struct mmo_map_server server[MAX_MAP_SERVERS];
int server_fd[MAX_MAP_SERVERS];
@@ -206,9 +206,9 @@ void set_char_offline(int char_id, int account_id) {
if ( char_id == 99 )
sprintf(tmp_sql,"UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id);
else {
- cp = numdb_search(char_db_,char_id);
+ cp = (struct mmo_charstatus*)numdb_search(char_db_,char_id);
if (cp != NULL) {
- free(cp);
+ aFree(cp);
numdb_erase(char_db_,char_id);
}
@@ -229,7 +229,7 @@ void set_char_offline(int char_id, int account_id) {
//-----------------------------------------------------
// Function to suppress control characters in a string.
//-----------------------------------------------------
-int remove_control_chars(unsigned char *str) {
+int remove_control_chars(char *str) {
int i;
int change = 0;
@@ -259,7 +259,7 @@ int isGM(int account_id) {
void read_gm_account(void) {
if (gm_account != NULL)
- free(gm_account);
+ aFree(gm_account);
GM_num = 0;
sprintf(tmp_lsql, "SELECT `%s`,`%s` FROM `%s` WHERE `%s`>='%d'",login_db_account_id,login_db_level,login_db,login_db_level,lowest_gm_level);
@@ -268,7 +268,7 @@ void read_gm_account(void) {
}
lsql_res = mysql_store_result(&lmysql_handle);
if (lsql_res) {
- gm_account = aCalloc(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1);
+ gm_account = (struct gm_account*)aCalloc(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1);
while ((lsql_row = mysql_fetch_row(lsql_res))) {
gm_account[GM_num].account_id = atoi(lsql_row[0]);
gm_account[GM_num].level = atoi(lsql_row[1]);
@@ -329,7 +329,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
if (char_id!=p->char_id) return 0;
- cp = numdb_search(char_db_,char_id);
+ cp = (struct mmo_charstatus*)numdb_search(char_db_,char_id);
if (cp == NULL) {
cp = (struct mmo_charstatus *) aMalloc(sizeof(struct mmo_charstatus));
@@ -441,7 +441,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
//=====================================================================================================
- if ((p->base_exp != cp->base_exp) || (p->class_ != cp->class_) ||
+ if ((p->base_exp != cp->base_exp) || (p->class_ != cp->class_) ||
(p->base_level != cp->base_level) || (p->job_level != cp->job_level) ||
(p->job_exp != cp->job_exp) || (p->zeny != cp->zeny) ||
(p->last_point.x != cp->last_point.x) || (p->last_point.y != cp->last_point.y) ||
@@ -457,7 +457,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
(p->shield != cp->shield) || (p->head_top != cp->head_top) ||
(p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) ||
(p->partner_id != cp->partner_id)) {
-
+
//}//---------------------------test count------------------------------
//check party_exist
party_exist=0;
@@ -546,7 +546,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
diff = 0;
for(i=0;i<MAX_SKILL;i++) {
- if ((p->skill[i].lv != 0) && (p->skill[i].id == 0))
+ if ((p->skill[i].lv != 0) && (p->skill[i].id == 0))
p->skill[i].id = i; // Fix skill tree
if((p->skill[i].id != cp->skill[i].id) || (p->skill[i].lv != cp->skill[i].lv) ||
@@ -589,7 +589,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
break;
}
}
-
+
if (diff) {
//printf("- Save global_reg_value data to MySQL!\n");
//`global_reg_value` (`char_id`, `str`, `value`)
@@ -603,7 +603,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
if (p->global_reg[i].str) {
if(p->global_reg[i].value !=0){
sprintf(tmp_sql,"INSERT INTO `%s` (`char_id`, `str`, `value`) VALUES ('%d', '%s','%d')",
- reg_db, char_id, jstrescapecpy(temp_str,(unsigned char*)p->global_reg[i].str), p->global_reg[i].value);
+ reg_db, char_id, jstrescapecpy(temp_str,p->global_reg[i].str), p->global_reg[i].value);
if(mysql_query(&mysql_handle, tmp_sql)) {
printf("DB server Error (insert `global_reg_value`)- %s\n", mysql_error(&mysql_handle));
}
@@ -612,9 +612,9 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
}
}
- // Friends list
+ // Friends list
// account_id, friend_id0, name0, ...
-
+
tmp_p += sprintf(tmp_p, "REPLACE INTO `%s` (`id`, `account_id`",friend_db);
diff = 0;
@@ -623,7 +623,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
tmp_p += sprintf(tmp_p, ", `friend_id%d`, `name%d`", i, i);
tmp_p += sprintf(tmp_p, ") VALUES (NULL, '%d'", char_id);
-
+
for (i=0;i<20;i++) {
tmp_p += sprintf(tmp_p, ", '%d', '%s'", p->friend_id[i], p->friend_name[i]);
if ((p->friend_id[i] != cp->friend_id[i]) ||
@@ -633,7 +633,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){
tmp_p += sprintf(tmp_p, ")");
- if (diff)
+ if (diff)
mysql_query(&mysql_handle, tmp_sql);
printf("saving char is done.\n");
@@ -882,9 +882,9 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus *p, int online){
char *tmp_p = tmp_sql;
struct mmo_charstatus *cp;
- cp = numdb_search(char_db_,char_id);
+ cp = (struct mmo_charstatus*)numdb_search(char_db_,char_id);
if (cp != NULL)
- free(cp);
+ aFree(cp);
memset(p, 0, sizeof(struct mmo_charstatus));
@@ -966,10 +966,10 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus *p, int online){
} else
printf("char2 - failed\n"); //Error?! ERRRRRR WHAT THAT SAY!?
- if (p->last_point.x == 0 || p->last_point.y == 0 || p->last_point.map[0] == '\0')
+ if (p->last_point.x == 0 || p->last_point.y == 0 || p->last_point.map[0] == '\0')
memcpy(&p->last_point, &start_point, sizeof(start_point));
- if (p->save_point.x == 0 || p->save_point.y == 0 || p->save_point.map[0] == '\0')
+ if (p->save_point.x == 0 || p->save_point.y == 0 || p->save_point.map[0] == '\0')
memcpy(&p->save_point, &start_point, sizeof(start_point));
printf("char2 ");
@@ -1102,10 +1102,10 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus *p, int online){
sql_row = mysql_fetch_row(sql_res);
i=mysql_num_rows(sql_res);
-
+
// debugg
//printf("mysql: %d\n",i);
-
+
// Create an entry for the character if it doesnt already have one
if(!i) {
@@ -1188,15 +1188,15 @@ int mmo_char_sql_init(void) {
printf("set char_id_count: %d.......\n",char_id_count);
sprintf(tmp_sql , "REPLACE INTO `%s` SET `online`=0", char_db);
- if (mysql_query(&mysql_handle, tmp_sql))
+ if (mysql_query(&mysql_handle, tmp_sql))
printf("DB server Error - %s\n", mysql_error(&mysql_handle));
sprintf(tmp_sql , "REPLACE INTO `%s` SET `online`=0", guild_member_db);
- if (mysql_query(&mysql_handle, tmp_sql))
+ if (mysql_query(&mysql_handle, tmp_sql))
printf("DB server Error - %s\n", mysql_error(&mysql_handle));
sprintf(tmp_sql , "REPLACE INTO `%s` SET `connect_member`=0", guild_db);
- if (mysql_query(&mysql_handle, tmp_sql))
+ if (mysql_query(&mysql_handle, tmp_sql))
printf("DB server Error - %s\n", mysql_error(&mysql_handle));
printf("init end.......\n");
@@ -1212,10 +1212,10 @@ int make_new_char_sql(int fd, unsigned char *dat) {
int i;
//aphostropy error check! - fixed!
- jstrescapecpy(t_name, dat);
+ jstrescapecpy(t_name, (char*)dat);
printf("making new char -");
- sd = session[fd]->session_data;
+ sd = (struct char_session_data*)session[fd]->session_data;
// Check Authorised letters/symbols in the name of the character
if (char_name_option == 1) { // only letters/symbols in char_name_letters are authorised
@@ -1477,7 +1477,7 @@ int parse_tologin(int fd) {
return 0;
}
- sd = session[fd]->session_data;
+ sd = (struct char_session_data*)session[fd]->session_data;
// hehe. no need to set user limite on SQL version. :P
// but char limitation is good way to maintain server. :D
@@ -1513,7 +1513,7 @@ int parse_tologin(int fd) {
if(RFIFOREST(fd)<51)
return 0;
for(i = 0; i < fd_max; i++) {
- if (session[i] && (sd = session[i]->session_data) && sd->account_id == RFIFOL(fd,2)) {
+ if (session[i] && (sd = (struct char_session_data*)session[i]->session_data) && sd->account_id == RFIFOL(fd,2)) {
if (RFIFOB(fd,6) != 0) {
WFIFOW(i,0) = 0x6c;
WFIFOB(i,2) = 0x42;
@@ -1546,7 +1546,7 @@ int parse_tologin(int fd) {
if (RFIFOREST(fd) < 50)
return 0;
for(i = 0; i < fd_max; i++) {
- if (session[i] && (sd = session[i]->session_data)) {
+ if (session[i] && (sd = (struct char_session_data*)session[i]->session_data)) {
if (sd->account_id == RFIFOL(fd,2)) {
sd->connect_until_time = (time_t)RFIFOL(fd,46);
break;
@@ -1606,22 +1606,22 @@ int parse_tologin(int fd) {
sql_res = mysql_store_result(&mysql_handle);
if (sql_res) {
- int char_id, jobclass, skill_point, class;
+ int char_id, jobclass, skill_point, class_;
sql_row = mysql_fetch_row(sql_res);
char_id = atoi(sql_row[0]);
jobclass = atoi(sql_row[1]);
skill_point = atoi(sql_row[2]);
- class = jobclass;
+ class_ = jobclass;
if (jobclass == 19 || jobclass == 20 ||
jobclass == 4020 || jobclass == 4021 ||
jobclass == 4042 || jobclass == 4043) {
// job modification
if (jobclass == 19 || jobclass == 20) {
- class = (sex) ? 19 : 20;
+ class_ = (sex) ? 19 : 20;
} else if (jobclass == 4020 || jobclass == 4021) {
- class = (sex) ? 4020 : 4021;
+ class_ = (sex) ? 4020 : 4021;
} else if (jobclass == 4042 || jobclass == 4043) {
- class = (sex) ? 4042 : 4043;
+ class_ = (sex) ? 4042 : 4043;
}
// remove specifical skills of classes 19,20 4020,4021 and 4042,4043
sprintf(tmp_sql, "SELECT `lv` FROM `%s` WHERE `char_id` = '%d' AND `id` >= '315' AND `id` <= '330'",skill_db, char_id);
@@ -1644,7 +1644,7 @@ int parse_tologin(int fd) {
if (mysql_query(&mysql_handle, tmp_sql)) {
printf("DB server Error (select `char`)- %s\n", mysql_error(&mysql_handle));
}
- sprintf(tmp_sql, "UPDATE `%s` SET `class`='%d' , `skill_point`='%d' , `weapon`='0' , `shield='0' , `head_top`='0' , `head_mid`='0' , `head_bottom`='0' WHERE `char_id` = '%d'",char_db, class, skill_point, char_id);
+ sprintf(tmp_sql, "UPDATE `%s` SET `class`='%d' , `skill_point`='%d' , `weapon`='0' , `shield='0' , `head_top`='0' , `head_mid`='0' , `head_bottom`='0' WHERE `char_id` = '%d'",char_db, class_, skill_point, char_id);
if (mysql_query(&mysql_handle, tmp_sql)) {
printf("DB server Error (select `char`)- %s\n", mysql_error(&mysql_handle));
}
@@ -1652,7 +1652,7 @@ int parse_tologin(int fd) {
}
// disconnect player if online on char-server
for(i = 0; i < fd_max; i++) {
- if (session[i] && (sd = session[i]->session_data)) {
+ if (session[i] && (sd = (struct char_session_data*)session[i]->session_data)) {
if (sd->account_id == acc) {
session[i]->eof = 1;
break;
@@ -1706,7 +1706,7 @@ int parse_tologin(int fd) {
}
// disconnect player if online on char-server
for(i = 0; i < fd_max; i++) {
- if (session[i] && (sd = session[i]->session_data)) {
+ if (session[i] && (sd = (struct char_session_data*)session[i]->session_data)) {
if (sd->account_id == RFIFOL(fd,2)) {
session[i]->eof = 1;
break;
@@ -2296,7 +2296,7 @@ int parse_char(int fd) {
struct char_session_data *sd;
unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr;
- sd = session[fd]->session_data;
+ sd = (struct char_session_data*)session[fd]->session_data;
if(login_fd < 0)
session[fd]->eof = 1;
@@ -2353,7 +2353,7 @@ int parse_char(int fd) {
*/
if (sd == NULL) {
CREATE(session[fd]->session_data, struct char_session_data, 1);
- sd = session[fd]->session_data;
+ sd = (struct char_session_data*)session[fd]->session_data;
sd->connect_until_time = 0; // unknow or illimited (not displaying on map-server)
}
sd->account_id = RFIFOL(fd, 2);
@@ -2843,15 +2843,15 @@ int parse_console(char *buf) {
printf("Type of command: %s || Command: %s \n",type,command);
- if(buf) free(buf);
- if(type) free(type);
- if(command) free(command);
+ if(buf) aFree(buf);
+ if(type) aFree(type);
+ if(command) aFree(command);
return 0;
}
// MAP send all
-int mapif_sendall(unsigned char *buf, unsigned int len) {
+int mapif_sendall(char *buf, unsigned int len) {
int i, c;
int fd;
@@ -2867,7 +2867,7 @@ int mapif_sendall(unsigned char *buf, unsigned int len) {
return c;
}
-int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) {
+int mapif_sendallwos(int sfd, char *buf, unsigned int len) {
int i, c;
int fd;
@@ -2883,7 +2883,7 @@ int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) {
return c;
}
-int mapif_send(int fd, unsigned char *buf, unsigned int len) {
+int mapif_send(int fd, char *buf, unsigned int len) {
int i;
if (fd >= 0) {
@@ -3016,12 +3016,12 @@ void do_final(void) {
printf("DB server Error (insert `char`)- %s\n", mysql_error(&mysql_handle));
if(gm_account) {
- free(gm_account);
+ aFree(gm_account);
gm_account = 0;
}
if(char_dat) {
- free(char_dat);
+ aFree(char_dat);
char_dat = 0;
}
diff --git a/src/char_sql/char.h b/src/char_sql/char.h
index c7261650b..17a938780 100644
--- a/src/char_sql/char.h
+++ b/src/char_sql/char.h
@@ -41,9 +41,9 @@ struct itemtemp{
struct itemtmp equip[MAX_GUILD_STORAGE],notequip[MAX_GUILD_STORAGE];
};
int memitemdata_to_sql(struct itemtemp mapitem, int eqcount, int noteqcount, int char_id,int tableswitch);
-int mapif_sendall(unsigned char *buf,unsigned int len);
-int mapif_sendallwos(int fd,unsigned char *buf,unsigned int len);
-int mapif_send(int fd,unsigned char *buf,unsigned int len);
+int mapif_sendall(char *buf,unsigned int len);
+int mapif_sendallwos(int fd,char *buf,unsigned int len);
+int mapif_send(int fd,char *buf,unsigned int len);
extern int autosave_interval;
extern char db_path[];
diff --git a/src/char_sql/int_guild.c b/src/char_sql/int_guild.c
index 3f9243bfe..e3b8d30a8 100644
--- a/src/char_sql/int_guild.c
+++ b/src/char_sql/int_guild.c
@@ -46,7 +46,7 @@ static int _erase_guild(void *key, void *data, va_list ap) {
int guild = va_arg(ap, int);
struct guild_castle * castle = (struct guild_castle *) data;
if (castle->guild_id == guild) {
- free(castle);
+ aFree(castle);
db_erase(castle_db_, key);
}
@@ -60,21 +60,21 @@ int inter_guild_tosql(struct guild *g,int flag)
// 2 `guild_member` (`guild_id`,`account_id`,`char_id`,`hair`,`hair_color`,`gender`,`class`,`lv`,`exp`,`exp_payper`,`online`,`position`,`rsv1`,`rsv2`,`name`)
// 4 `guild_position` (`guild_id`,`position`,`name`,`mode`,`exp_mode`)
// 8 `guild_alliance` (`guild_id`,`opposition`,`alliance_id`,`name`)
- // 16 `guild_expulsion` (`guild_id`,`name`,`mes`,`acc`,`account_id`,`rsv1`,`rsv2`,`rsv3`)
+ // 16 `guild_expulsion` (`guild_id`,`name`,`mes`,`acc`,`account_id`,`rsv1`,`rsv2`,`rsv3`)
// 32 `guild_skill` (`guild_id`,`id`,`lv`)
-
+
char t_name[100],t_master[24],t_mes1[60],t_mes2[240],t_member[24],t_position[24],t_alliance[24]; // temporay storage for str convertion;
char t_ename[24],t_emes[40];
char emblem_data[4096];
int i=0;
int guild_exist=0,guild_member=0,guild_online_member=0;
-
+
if (g->guild_id<=0) return -1;
-
+
printf("(\033[1;35m%d\033[0m) Request save guild -(flag 0x%x) ",g->guild_id, flag);
-
+
jstrescapecpy(t_name, g->name);
-
+
//printf("- Check if guild %d exists\n",g->guild_id);
sprintf(tmp_sql, "SELECT count(*) FROM `%s` WHERE `guild_id`='%d'",guild_db,g->guild_id);
if(mysql_query(&mysql_handle, tmp_sql) ) {
@@ -87,7 +87,7 @@ int inter_guild_tosql(struct guild *g,int flag)
//printf("- Check if guild %d exists : %s\n",g->guild_id,((guild_exist==0)?"No":"Yes"));
}
mysql_free_result(sql_res) ; //resource free
-
+
if (guild_exist >0){
// Check members in party
sprintf(tmp_sql,"SELECT count(*) FROM `%s` WHERE `guild_id`='%d'",guild_member_db, g->guild_id);
@@ -98,13 +98,13 @@ int inter_guild_tosql(struct guild *g,int flag)
sql_res = mysql_store_result(&mysql_handle) ;
if (sql_res!=NULL && mysql_num_rows(sql_res)>0) {
sql_row = mysql_fetch_row(sql_res);
-
+
guild_member = atoi (sql_row[0]);
// printf("- Check members in guild %d : %d \n",g->guild_id,guild_member);
}
mysql_free_result(sql_res) ; //resource free
-
+
// Delete old guild from sql
if (flag&1||guild_member==0){
// printf("- Delete guild %d from guild\n",g->guild_id);
@@ -164,7 +164,7 @@ int inter_guild_tosql(struct guild *g,int flag)
sprintf(tmp_sql, "DELETE FROM `%s` WHERE `guild_id`='%d'",guild_castle_db, g->guild_id);
if(mysql_query(&mysql_handle, tmp_sql) ) {
printf("DB server Error (delete `guild_castle`)- %s\n", mysql_error(&mysql_handle) );
- }
+ }
db_foreach(castle_db_, _erase_guild, g->guild_id);
}
}
@@ -175,14 +175,14 @@ int inter_guild_tosql(struct guild *g,int flag)
if (g->member[i].account_id>0) guild_online_member++;
i++;
}
-
+
// No member in guild , no need to create it in sql
if (guild_member <= 0 && guild_online_member <=0) {
inter_guild_storage_delete(g->guild_id);
printf("No member in guild %d , break it! \n",g->guild_id);
return -2;
}
-
+
// Insert new guild to sqlserver
if (flag&1||guild_member==0){
int len=0;
@@ -190,7 +190,7 @@ int inter_guild_tosql(struct guild *g,int flag)
for(i=0;i<g->emblem_len;i++){
len+=sprintf(emblem_data+len,"%02x",(unsigned char)(g->emblem_data[i]));
//printf("%02x",(unsigned char)(g->emblem_data[i]));
- }
+ }
emblem_data[len] = '\0';
//printf("- emblem_len = %d \n",g->emblem_len);
sprintf(tmp_sql,"INSERT INTO `%s` "
@@ -204,7 +204,7 @@ int inter_guild_tosql(struct guild *g,int flag)
printf("DB server Error (insert `guild`)- %s\n", mysql_error(&mysql_handle) );
}
}
-
+
if (flag&2||guild_member==0){
struct StringBuf sbuf;
struct StringBuf sbuf2;
@@ -238,16 +238,16 @@ int inter_guild_tosql(struct guild *g,int flag)
}
StringBuf_Printf(&sbuf2,")");
- if(mysql_query(&mysql_handle, StringBuf_Value(&sbuf)))
+ if(mysql_query(&mysql_handle, StringBuf_Value(&sbuf)))
printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
- if(mysql_query(&mysql_handle, StringBuf_Value(&sbuf2)))
+ if(mysql_query(&mysql_handle, StringBuf_Value(&sbuf2)))
printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
StringBuf_Destroy(&sbuf2);
StringBuf_Destroy(&sbuf);
}
-
+
if (flag&4||guild_member==0){
//printf("- Insert guild %d to guild_position\n",g->guild_id);
for(i=0;i<MAX_GUILDPOSITION;i++){
@@ -279,7 +279,7 @@ int inter_guild_tosql(struct guild *g,int flag)
//printf(" %s\n",tmp_sql);
if(mysql_query(&mysql_handle, tmp_sql) ) {
printf("DB server Error (insert `guild_alliance`)- %s\n", mysql_error(&mysql_handle) );
- }
+ }
}
}
}
@@ -314,7 +314,7 @@ int inter_guild_tosql(struct guild *g,int flag)
}
}
}
-
+
printf("Save guild done\n");
return 0;
}
@@ -332,10 +332,10 @@ struct guild * inter_guild_fromsql(int guild_id)
g = numdb_search(guild_db_,guild_id);
if (g != NULL)
return g;
-
+
g = (struct guild *) aMalloc(sizeof(struct guild));
memset(g,0,sizeof(struct guild));
-
+
// printf("Retrieve guild information from sql ......\n");
// printf("- Read guild %d from sql \n",guild_id);
@@ -344,19 +344,19 @@ struct guild * inter_guild_fromsql(int guild_id)
//printf(" %s\n",tmp_sql);
if(mysql_query(&mysql_handle, tmp_sql) ) {
printf("DB server Error (select `guild`)- %s\n", mysql_error(&mysql_handle) );
- free(g);
+ aFree(g);
return 0;
}
-
+
sql_res = mysql_store_result(&mysql_handle) ;
if (sql_res!=NULL && mysql_num_rows(sql_res)>0) {
sql_row = mysql_fetch_row(sql_res);
if (sql_row==NULL) {
mysql_free_result(sql_res);
- free(g);
+ aFree(g);
return 0;
}
-
+
g->guild_id=atoi(sql_row[0]);
strncpy(g->name,sql_row[1],24);
strncpy(g->master,sql_row[2],24);
@@ -382,7 +382,7 @@ struct guild * inter_guild_fromsql(int guild_id)
if(c2>='a' && c2<='f')x2=c2-'a'+10;
if(c2>='A' && c2<='F')x2=c2-'A'+10;
g->emblem_data[i]=(x1<<4)|x2;
- }
+ }
}
mysql_free_result(sql_res);
@@ -392,7 +392,7 @@ struct guild * inter_guild_fromsql(int guild_id)
//printf(" %s\n",tmp_sql);
if(mysql_query(&mysql_handle, tmp_sql) ) {
printf("DB server Error (select `guild_member`)- %s\n", mysql_error(&mysql_handle) );
- free(g);
+ aFree(g);
return 0;
}
sql_res = mysql_store_result(&mysql_handle) ;
@@ -415,33 +415,33 @@ struct guild * inter_guild_fromsql(int guild_id)
}
}
mysql_free_result(sql_res);
-
+
//printf("- Read guild_position %d from sql \n",guild_id);
sprintf(tmp_sql,"SELECT `guild_id`,`position`,`name`,`mode`,`exp_mode` FROM `%s` WHERE `guild_id`='%d'",guild_position_db, guild_id);
//printf(" %s\n",tmp_sql);
if(mysql_query(&mysql_handle, tmp_sql) ) {
printf("DB server Error (select `guild_position`)- %s\n", mysql_error(&mysql_handle) );
- free(g);
+ aFree(g);
return 0;
}
sql_res = mysql_store_result(&mysql_handle) ;
if (sql_res!=NULL && mysql_num_rows(sql_res)>0) {
int i;
for(i=0;((sql_row = mysql_fetch_row(sql_res))&&i<MAX_GUILDPOSITION);i++){
- int position = atoi(sql_row[1]);
+ int position = atoi(sql_row[1]);
struct guild_position *p = &g->position[position];
- strncpy(p->name,sql_row[2],24);
+ strncpy(p->name,sql_row[2],24);
p->mode=atoi(sql_row[3]);
- p->exp_mode=atoi(sql_row[4]);
+ p->exp_mode=atoi(sql_row[4]);
}
}
- mysql_free_result(sql_res);
+ mysql_free_result(sql_res);
//printf("- Read guild_alliance %d from sql \n",guild_id);
sprintf(tmp_sql,"SELECT `guild_id`,`opposition`,`alliance_id`,`name` FROM `%s` WHERE `guild_id`='%d'",guild_alliance_db, guild_id);
if(mysql_query(&mysql_handle, tmp_sql) ) {
printf("DB server Error (select `guild_alliance`)- %s\n", mysql_error(&mysql_handle) );
- free(g);
+ aFree(g);
return 0;
}
sql_res = mysql_store_result(&mysql_handle) ;
@@ -455,12 +455,12 @@ struct guild * inter_guild_fromsql(int guild_id)
}
}
mysql_free_result(sql_res);
-
+
//printf("- Read guild_expulsion %d from sql \n",guild_id);
sprintf(tmp_sql,"SELECT `guild_id`,`name`,`mes`,`acc`,`account_id`,`rsv1`,`rsv2`,`rsv3` FROM `%s` WHERE `guild_id`='%d'",guild_expulsion_db, guild_id);
if(mysql_query(&mysql_handle, tmp_sql) ) {
printf("DB server Error (select `guild_expulsion`)- %s\n", mysql_error(&mysql_handle) );
- free(g);
+ aFree(g);
return 0;
}
sql_res = mysql_store_result(&mysql_handle) ;
@@ -476,16 +476,16 @@ struct guild * inter_guild_fromsql(int guild_id)
e->rsv1=atoi(sql_row[5]);
e->rsv2=atoi(sql_row[6]);
e->rsv3=atoi(sql_row[7]);
-
+
}
}
mysql_free_result(sql_res);
-
+
//printf("- Read guild_skill %d from sql \n",guild_id);
sprintf(tmp_sql,"SELECT `guild_id`,`id`,`lv` FROM `%s` WHERE `guild_id`='%d' ORDER BY `id`",guild_skill_db, guild_id);
if(mysql_query(&mysql_handle, tmp_sql) ) {
printf("DB server Error (select `guild_skill`)- %s\n", mysql_error(&mysql_handle) );
- free(g);
+ aFree(g);
return 0;
}
sql_res = mysql_store_result(&mysql_handle) ;
@@ -497,7 +497,7 @@ struct guild * inter_guild_fromsql(int guild_id)
}
}
mysql_free_result(sql_res);
-
+
// printf("Successfully retrieve guild information from sql!\n");
numdb_insert(guild_db_, guild_id,g);
@@ -542,8 +542,8 @@ int inter_guildcastle_tosql(struct guild_castle *gc)
"(`castle_id`, `guild_id`, `economy`, `defense`, `triggerE`, `triggerD`, `nextTime`, `payTime`, `createTime`,"
"`visibleC`, `visibleG0`, `visibleG1`, `visibleG2`, `visibleG3`, `visibleG4`, `visibleG5`, `visibleG6`, `visibleG7`,"
"`Ghp0`, `Ghp1`, `Ghp2`, `Ghp3`, `Ghp4`, `Ghp5`, `Ghp6`, `Ghp7`)"
- "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d')",
- guild_castle_db, gc->castle_id, gc->guild_id, gc->economy, gc->defense, gc->triggerE, gc->triggerD, gc->nextTime, gc->payTime,
+ "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d')",
+ guild_castle_db, gc->castle_id, gc->guild_id, gc->economy, gc->defense, gc->triggerE, gc->triggerD, gc->nextTime, gc->payTime,
gc->createTime, gc->visibleC, gc->visibleG0, gc->visibleG1, gc->visibleG2, gc->visibleG3, gc->visibleG4, gc->visibleG5,
gc->visibleG6, gc->visibleG7, gc->Ghp0, gc->Ghp1, gc->Ghp2, gc->Ghp3, gc->Ghp4, gc->Ghp5, gc->Ghp6, gc->Ghp7);
//printf(" %s\n",tmp_sql);
@@ -558,7 +558,7 @@ int inter_guildcastle_tosql(struct guild_castle *gc)
printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
return 0;
}
-
+
sprintf(tmp_sql,"UPDATE `%s` SET `castle_id`='%d' WHERE `guild_id`='%d'",guild_db, gc->castle_id,gc->guild_id);
//printf(" %s\n",tmp_sql);
if(mysql_query(&mysql_handle, tmp_sql) ) {
@@ -567,7 +567,7 @@ int inter_guildcastle_tosql(struct guild_castle *gc)
}
db_foreach(guild_db_, _set_guild_castle, gc->castle_id,gc->guild_id);
-
+
return 0;
}
// Read guild_castle from sql
@@ -603,7 +603,7 @@ int inter_guildcastle_fromsql(int castle_id,struct guild_castle *gc)
mysql_free_result(sql_res);
return 0;
}
-
+
gc->guild_id = atoi (sql_row[1]);
gc->economy = atoi (sql_row[2]);
gc->defense = atoi (sql_row[3]);
@@ -629,7 +629,7 @@ int inter_guildcastle_fromsql(int castle_id,struct guild_castle *gc)
gc->Ghp5 = atoi (sql_row[23]);
gc->Ghp6 = atoi (sql_row[24]);
gc->Ghp7 = atoi (sql_row[25]);
-
+
//printf("Read Castle %d of guild %d from sql \n",castle_id,gc->guild_id);
}
@@ -647,7 +647,7 @@ int inter_guild_readdb()
FILE *fp;
char line[1024];
for (i=0;i<100;i++) guild_exp[i]=0;
-
+
fp=fopen("db/exp_guild.txt","r");
if(fp==NULL){
printf("can't read db/exp_guild.txt\n");
@@ -676,14 +676,14 @@ int inter_guild_sql_init()
guild_expcache_db_=numdb_init();
guild_infoevent_db_=numdb_init();
guild_castleinfoevent_db_=numdb_init();
-
+
printf("interserver guild memory initialize.... (%d byte)\n",sizeof(struct guild));
guild_pt = aCalloc(sizeof(struct guild), 1);
guild_pt2= aCalloc(sizeof(struct guild), 1);
guildcastle_pt=aCalloc(sizeof(struct guild_castle), 1);
-
+
inter_guild_readdb(); // Read exp
-
+
sprintf (tmp_sql , "SELECT count(*) FROM `%s`",guild_db);
if(mysql_query(&mysql_handle, tmp_sql) ) {
printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
@@ -702,13 +702,13 @@ int inter_guild_sql_init()
printf("DB server Error - %s\n", mysql_error(&mysql_handle) );
exit(0);
}
-
+
sql_res = mysql_store_result(&mysql_handle) ;
sql_row = mysql_fetch_row(sql_res);
guild_newid = atoi(sql_row[0])+1;
mysql_free_result(sql_res);
}
-
+
printf("set guild_newid: %d.......\n",guild_newid);
return 0;
@@ -743,7 +743,7 @@ int guild_check_empty(struct guild *g)
return 0;
}
}
-
+
// 誰もいないので解散
mapif_guild_broken(g->guild_id,0);
inter_guild_storage_delete(g->guild_id);
@@ -795,7 +795,7 @@ int guild_calcinfo(struct guild *g)
nextexp = guild_nextexp(g->guild_lv);
}
}
-
+
// ギルドの次の経験値
g->next_exp = guild_nextexp(g->guild_lv);
@@ -809,13 +809,13 @@ int guild_calcinfo(struct guild *g)
if(g->member[i].account_id>0){
g->average_lv+=g->member[i].lv;
c++;
-
+
if(g->member[i].online>0)
g->connect_member++;
}
}
if(c) g->average_lv/=c;
-
+
// 全データを送る必要がありそう
if( g->max_member!=before.max_member ||
g->guild_lv!=before.guild_lv ||
@@ -823,7 +823,7 @@ int guild_calcinfo(struct guild *g)
mapif_guild_info(-1,g);
return 1;
}
-
+
return 0;
}
@@ -906,7 +906,7 @@ int mapif_guild_memberinfoshort(struct guild *g,int idx)
WBUFL(buf, 2)=g->guild_id;
WBUFL(buf, 6)=g->member[idx].account_id;
WBUFL(buf,10)=g->member[idx].char_id;
- WBUFB(buf,14)=g->member[idx].online;
+ WBUFB(buf,14)=(unsigned char)g->member[idx].online;
WBUFW(buf,15)=g->member[idx].lv;
WBUFW(buf,17)=g->member[idx].class_;
mapif_sendall(buf,19);
@@ -1121,7 +1121,7 @@ int mapif_parse_CreateGuild(int fd,int account_id,char *name,struct guild_member
{
struct guild *g;
int i;
-
+
printf("CreateGuild\n");
g=search_guildname(name);
if(g!=NULL&&g->guild_id>0){
@@ -1135,38 +1135,38 @@ int mapif_parse_CreateGuild(int fd,int account_id,char *name,struct guild_member
memcpy(g->name,name,24);
memcpy(g->master,master->name,24);
memcpy(&g->member[0],master,sizeof(struct guild_member));
-
+
g->position[0].mode=0x11;
strcpy(g->position[ 0].name,"GuildMaster");
strcpy(g->position[MAX_GUILDPOSITION-1].name,"Newbie");
for(i=1;i<MAX_GUILDPOSITION-1;i++)
sprintf(g->position[i].name,"Position %d",i+1);
-
+
// Initialize guild property
g->max_member=16;
g->average_lv=master->lv;
g->castle_id=-1;
for(i=0;i<MAX_GUILDSKILL;i++)
g->skill[i].id=i + GD_SKILLBASE;
-
+
// Save to sql
printf("Create initialize OK!\n");
i=inter_guild_tosql(g,255);
-
+
if (i<0) {
mapif_guild_created(fd,account_id,NULL);
return 0;
}
-
+
// Report to client
mapif_guild_created(fd,account_id,g);
mapif_guild_info(fd,g);
-
+
if(log_inter)
inter_log("guild %s (id=%d) created by master %s (id=%d)" RETCODE,
name, g->guild_id, master->name, master->account_id );
-
-
+
+
return 0;
}
// Return guild info to client
@@ -1191,10 +1191,10 @@ int mapif_parse_GuildAddMember(int fd,int guild_id,struct guild_member *m)
mapif_guild_memberadded(fd,guild_id,m->account_id,m->char_id,1);
return 0;
}
-
+
for(i=0;i<g->max_member;i++){
if(g->member[i].account_id==0){
-
+
memcpy(&g->member[i],m,sizeof(struct guild_member));
mapif_guild_memberadded(fd,guild_id,m->account_id,m->char_id,0);
guild_calcinfo(g);
@@ -1211,7 +1211,7 @@ int mapif_parse_GuildAddMember(int fd,int guild_id,struct guild_member *m)
int mapif_parse_GuildLeave(int fd,int guild_id,int account_id,int char_id,int flag,const char *mes)
{
struct guild *g= inter_guild_fromsql(guild_id);
-
+
if(g!=NULL&&g->guild_id>0){
int i;
for(i=0;i<g->max_member;i++){
@@ -1219,7 +1219,7 @@ int mapif_parse_GuildLeave(int fd,int guild_id,int account_id,int char_id,int fl
g->member[i].char_id==char_id){
printf("%d %d\n",i, (int)(&g->member[i]));
printf("%d %s\n",i, g->member[i].name);
-
+
if(flag){ // 追放の場合追放リストに入れる
int j;
for(j=0;j<MAX_GUILDEXPLUSION;j++){
@@ -1236,12 +1236,12 @@ int mapif_parse_GuildLeave(int fd,int guild_id,int account_id,int char_id,int fl
memcpy(g->explusion[j].name,g->member[i].name,24);
memcpy(g->explusion[j].mes,mes,40);
}
-
+
mapif_guild_leaved(guild_id,account_id,char_id,flag,g->member[i].name,mes);
printf("%d %d\n",i, (int)(&g->member[i]));
printf("%d %s\n",i, (&g->member[i])->name);
memset(&g->member[i],0,sizeof(struct guild_member));
-
+
if( guild_check_empty(g)==0 )
mapif_guild_info(-1,g);// まだ人がいるのでデータ送信
/*
@@ -1259,12 +1259,12 @@ int mapif_parse_GuildLeave(int fd,int guild_id,int account_id,int char_id,int fl
}
/* mapif_guild_leaved(guild_id,account_id,char_id,flag,g->member[i].name,mes); */
}
-
+
return 0;
}
// Change member info
int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id,
- int account_id,int char_id,int online,int lv,int class)
+ int account_id,int char_id,int online,int lv,int class_)
{
// Could speed up by manipulating only guild_member
struct guild * g= inter_guild_fromsql(guild_id);
@@ -1272,18 +1272,18 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id,
if(g==NULL||g->guild_id<=0)
return 0;
-
+
g->connect_member=0;
idx = -1;
-
+
for(i=0,alv=0,c=0;i<g->max_member;i++){
if( g->member[i].account_id==account_id &&
g->member[i].char_id==char_id){
-
+
g->member[i].online=online;
g->member[i].lv=lv;
- g->member[i].class_=class;
+ g->member[i].class_=class_;
mapif_guild_memberinfoshort(g,i);
idx = i;
}
@@ -1300,13 +1300,13 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id,
g->average_lv=alv/c;
sprintf(tmp_sql, "UPDATE `%s` SET `connect_member`=%d,`average_lv`=%d WHERE `guild_id`='%d'", guild_db, g->connect_member, g->average_lv, g->guild_id);
- if(mysql_query(&mysql_handle, tmp_sql) )
+ if(mysql_query(&mysql_handle, tmp_sql) )
printf("DB server Error: %s - %s\n", tmp_sql, mysql_error(&mysql_handle) );
sprintf(tmp_sql, "UPDATE `%s` SET `online`=%d,`lv`=%d,`class`=%d WHERE `char_id`=%d", guild_member_db, g->member[idx].online, g->member[idx].lv, g->member[idx].class_, g->member[idx].char_id);
- if(mysql_query(&mysql_handle, tmp_sql) )
+ if(mysql_query(&mysql_handle, tmp_sql) )
printf("DB server Error: %s - %s\n", tmp_sql, mysql_error(&mysql_handle) );
-
+
return 0;
}
@@ -1316,7 +1316,7 @@ int mapif_parse_BreakGuild(int fd,int guild_id)
struct guild *g= inter_guild_fromsql(guild_id);
if(g==NULL)
return 0;
-
+
// Delete guild from sql
//printf("- Delete guild %d from guild\n",guild_id);
sprintf(tmp_sql, "DELETE FROM `%s` WHERE `guild_id`='%d'",guild_db, guild_id);
@@ -1348,7 +1348,7 @@ int mapif_parse_BreakGuild(int fd,int guild_id)
if(mysql_query(&mysql_handle, tmp_sql) ) {
printf("DB server Error (delete `guild_position`)- %s\n", mysql_error(&mysql_handle) );
}
-
+
//printf("- Delete guild %d from guild_castle\n",guild_id);
sprintf(tmp_sql, "DELETE FROM `%s` WHERE `guild_id`='%d'",guild_castle_db, guild_id);
if(mysql_query(&mysql_handle, tmp_sql) ) {
@@ -1356,19 +1356,19 @@ int mapif_parse_BreakGuild(int fd,int guild_id)
}
db_foreach(castle_db_, _erase_guild, guild_id);
-
+
//printf("- Update guild %d of char\n",guild_id);
sprintf(tmp_sql, "UPDATE `%s` SET `guild_id`='0' WHERE `guild_id`='%d'",char_db, guild_id);
if(mysql_query(&mysql_handle, tmp_sql) ) {
printf("DB server Error (delete `guild_position`)- %s\n", mysql_error(&mysql_handle) );
}
-
+
inter_guild_storage_delete(guild_id);
mapif_guild_broken(guild_id,0);
-
+
if(log_inter)
inter_log("guild %s (id=%d) broken" RETCODE,g->name,guild_id);
-
+
return 0;
}
@@ -1416,7 +1416,7 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha
struct guild * g = inter_guild_fromsql(guild_id);
//printf("GuildMemberInfoChange %s \n",(type==GMI_EXP)?"GMI_EXP":"OTHER");
-
+
if(g==NULL){
return 0;
}
@@ -1437,7 +1437,7 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha
inter_guild_tosql(g,3); // Change guild & guild_member
break;
}
- case GMI_EXP:
+ case GMI_EXP:
{ // EXP
int exp,oldexp=g->member[i].exp;
exp=g->member[i].exp=*((unsigned int *)data);
@@ -1447,11 +1447,11 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha
mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
sprintf(tmp_sql, "UPDATE `%s` SET `guild_lv`=%d,`connect_member`=%d,`max_member`=%d,`average_lv`=%d,`exp`=%d,`next_exp`=%d,`skill_point`=%d WHERE `guild_id`='%d'", guild_db, g->guild_lv, g->connect_member, g->max_member, g->average_lv, g->exp, g->next_exp, g->skill_point, g->guild_id);
- if(mysql_query(&mysql_handle, tmp_sql) )
+ if(mysql_query(&mysql_handle, tmp_sql) )
printf("DB server Error: %s - %s\n", tmp_sql, mysql_error(&mysql_handle) );
sprintf(tmp_sql, "UPDATE `%s` SET `exp`=%d WHERE `char_id`=%d", guild_member_db, g->member[i].exp, g->member[i].char_id);
- if(mysql_query(&mysql_handle, tmp_sql) )
+ if(mysql_query(&mysql_handle, tmp_sql) )
printf("DB server Error: %s - %s\n", tmp_sql, mysql_error(&mysql_handle) );
break;
}
@@ -1488,7 +1488,7 @@ int mapif_parse_GuildSkillUp(int fd,int guild_id,int skill_num,int account_id)
if(g == NULL || idx < 0 || idx >= MAX_GUILDSKILL)
return 0;
//printf("GuildSkillUp\n");
-
+
if( g->skill_point>0 && g->skill[idx].id>0 &&
g->skill[idx].lv<10 ){
g->skill[idx].lv++;
@@ -1511,10 +1511,10 @@ int mapif_parse_GuildAlliance(int fd,int guild_id1,int guild_id2,
int j,i;
g[0]= inter_guild_fromsql(guild_id1);
g[1]= inter_guild_fromsql(guild_id2);
-
+
if(g[0]==NULL || g[1]==NULL || g[0]->guild_id ==0 || g[1]->guild_id==0)
return 0;
-
+
if(!(flag&0x8)){
for(i=0;i<2-(flag&1);i++){
for(j=0;j<MAX_GUILDALLIANCE;j++)
@@ -1545,7 +1545,7 @@ int mapif_parse_GuildAlliance(int fd,int guild_id1,int guild_id2,
int mapif_parse_GuildNotice(int fd,int guild_id,const char *mes1,const char *mes2)
{
struct guild *g= inter_guild_fromsql(guild_id);
-
+
if(g==NULL||g->guild_id<=0)
return 0;
memcpy(g->mes1,mes1,60);
@@ -1557,7 +1557,7 @@ int mapif_parse_GuildNotice(int fd,int guild_id,const char *mes1,const char *mes
int mapif_parse_GuildEmblem(int fd,int len,int guild_id,int dummy,const char *data)
{
struct guild * g= inter_guild_fromsql(guild_id);
-
+
if(g==NULL||g->guild_id<=0)
return 0;
memcpy(g->emblem_data,data,len);
diff --git a/src/char_sql/int_party.c b/src/char_sql/int_party.c
index af3ad7dc3..9ea3a5635 100644
--- a/src/char_sql/int_party.c
+++ b/src/char_sql/int_party.c
@@ -207,7 +207,7 @@ int inter_party_sql_init(){
//memory alloc
printf("interserver party memory initialize.... (%d byte)\n",sizeof(struct party));
- party_pt = calloc(sizeof(struct party), 1);
+ party_pt = aCalloc(sizeof(struct party), 1);
sprintf (tmp_sql , "SELECT count(*) FROM `%s`",party_db);
if(mysql_query(&mysql_handle, tmp_sql) ) {
diff --git a/src/char_sql/int_pet.c b/src/char_sql/int_pet.c
index 44151c8e4..18172b066 100644
--- a/src/char_sql/int_pet.c
+++ b/src/char_sql/int_pet.c
@@ -105,7 +105,7 @@ int inter_pet_sql_init(){
//memory alloc
printf("interserver pet memory initialize.... (%d byte)\n",sizeof(struct s_pet));
- pet_pt = calloc(sizeof(struct s_pet), 1);
+ pet_pt = aCalloc(sizeof(struct s_pet), 1);
sprintf (tmp_sql , "SELECT count(*) FROM `%s`", pet_db);
if(mysql_query(&mysql_handle, tmp_sql) ) {
diff --git a/src/char_sql/int_storage.c b/src/char_sql/int_storage.c
index 69eaf2469..e2d4010a1 100644
--- a/src/char_sql/int_storage.c
+++ b/src/char_sql/int_storage.c
@@ -191,8 +191,8 @@ int inter_storage_sql_init(){
//memory alloc
printf("interserver storage memory initialize....(%d byte)\n",sizeof(struct storage));
- storage_pt=calloc(sizeof(struct storage), 1);
- guild_storage_pt=calloc(sizeof(struct guild_storage), 1);
+ storage_pt=aCalloc(sizeof(struct storage), 1);
+ guild_storage_pt=aCalloc(sizeof(struct guild_storage), 1);
memset(storage_pt,0,sizeof(struct storage));
memset(guild_storage_pt,0,sizeof(struct guild_storage));
diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c
index 52a53f702..92a002898 100644
--- a/src/char_sql/inter.c
+++ b/src/char_sql/inter.c
@@ -402,7 +402,7 @@ int check_ttl_wisdata() {
// removed. not send information after a timeout. Just no answer for the player
//mapif_wis_end(wd, 1); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
numdb_erase(wis_db, wd->id);
- free(wd);
+ aFree(wd);
}
} while(wis_delnum >= WISDELLIST_MAX);
@@ -490,7 +490,7 @@ int mapif_parse_WisReply(int fd) {
if ((--wd->count) <= 0 || flag != 1) {
mapif_wis_end(wd, flag); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
numdb_erase(wis_db, id);
- free(wd);
+ aFree(wd);
}
return 0;
diff --git a/src/char_sql/itemdb.c b/src/char_sql/itemdb.c
index 0bed07c23..efd3df84b 100644
--- a/src/char_sql/itemdb.c
+++ b/src/char_sql/itemdb.c
@@ -172,7 +172,7 @@ static int itemdb_read_sqldb(void) // sql item_db read, shortened version of map
// Insert a new row into the item database
/*
- id = calloc(sizeof(struct item_data), 1);
+ id = aCalloc(sizeof(struct item_data), 1);
if (id == NULL) {
printf("out of memory : itemdb_read_sqldb\n");
@@ -214,10 +214,10 @@ static int itemdb_final(void *key,void *data,va_list ap)
id=data;
if(id->use_script)
- free(id->use_script);
+ aFree(id->use_script);
if(id->equip_script)
- free(id->equip_script);
- free(id);
+ aFree(id->equip_script);
+ aFree(id);
return 0;
}
diff --git a/src/char_sql/itemdb.h b/src/char_sql/itemdb.h
index dea835e78..762873c8e 100644
--- a/src/char_sql/itemdb.h
+++ b/src/char_sql/itemdb.h
@@ -6,7 +6,7 @@ struct item_data {
char name[24],jname[24];
int value_buy,value_sell,value_notdc,value_notoc;
int type;
- int class;
+ int class_;
int sex;
int equip;
int weight;