summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt4
-rw-r--r--src/char/char.c38
-rw-r--r--src/char/int_guild.c44
-rw-r--r--src/char/int_homun.c17
-rw-r--r--src/char/int_party.c21
-rw-r--r--src/char/int_pet.c6
-rw-r--r--src/char/int_status.c15
-rw-r--r--src/char/int_storage.c8
-rw-r--r--src/char/inter.c48
-rw-r--r--src/char_sql/char.c40
-rw-r--r--src/char_sql/int_auction.c4
-rw-r--r--src/char_sql/int_guild.c6
-rw-r--r--src/char_sql/int_homun.c2
-rw-r--r--src/char_sql/int_mail.c4
-rw-r--r--src/char_sql/int_party.c4
-rw-r--r--src/char_sql/inter.c29
-rw-r--r--src/common/db.c35
-rw-r--r--src/common/mmo.h6
-rw-r--r--src/common/plugin.h3
-rw-r--r--src/common/plugins.c49
-rw-r--r--src/common/plugins.h7
-rw-r--r--src/common/strlib.c2
-rw-r--r--src/common/strlib.h6
-rw-r--r--src/common/timer.h2
-rw-r--r--src/login/login.c14
-rw-r--r--src/login_sql/login.c20
-rw-r--r--src/map/atcommand.c9
-rw-r--r--src/map/battle.c27
-rw-r--r--src/map/battle.h7
-rw-r--r--src/map/chrif.c7
-rw-r--r--src/map/clif.c104
-rw-r--r--src/map/clif.h12
-rw-r--r--src/map/guild.c28
-rw-r--r--src/map/intif.c8
-rw-r--r--src/map/itemdb.c10
-rw-r--r--src/map/log.c4
-rw-r--r--src/map/log.h4
-rw-r--r--src/map/map.c18
-rw-r--r--src/map/map.h5
-rw-r--r--src/map/mercenary.c2
-rw-r--r--src/map/mercenary.h11
-rw-r--r--src/map/mob.c16
-rw-r--r--src/map/npc.c16
-rw-r--r--src/map/party.c8
-rw-r--r--src/map/pc.c26
-rw-r--r--src/map/pc.h52
-rw-r--r--src/map/pet.h79
-rw-r--r--src/map/script.c102
-rw-r--r--src/map/script.h4
-rw-r--r--src/map/skill.c135
-rw-r--r--src/map/status.c74
-rw-r--r--src/map/status.h10
-rw-r--r--src/map/storage.c8
-rw-r--r--src/tool/Makefile.in12
-rw-r--r--src/tool/adduser.c9
-rw-r--r--src/tool/convert.c300
-rw-r--r--src/txt-converter/login-converter.c9
-rw-r--r--vcproj-9/char-server_sql.vcproj9
-rw-r--r--vcproj-9/char-server_txt.vcproj9
-rw-r--r--vcproj-9/ladmin.vcproj7
-rw-r--r--vcproj-9/login-server_sql.vcproj9
-rw-r--r--vcproj-9/login-server_txt.vcproj10
-rw-r--r--vcproj-9/map-server_sql.vcproj11
-rw-r--r--vcproj-9/map-server_txt.vcproj11
-rw-r--r--vcproj-9/mapcache.vcproj7
-rw-r--r--vcproj-9/txt-converter-char.vcproj7
-rw-r--r--vcproj-9/txt-converter-login.vcproj7
67 files changed, 682 insertions, 955 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 3405a3651..c17590a29 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,8 +3,10 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2008/03/26
+ * Adjusted eAthena code to compile cleanly in C++ mode.
2008/03/24
- * Reorganized the contents of the mapserver's header files.
+ * Reorganized the contents of the mapserver's header files. [ultramage]
- map.h is no longer a generic dumping spot of all the shared structs,
and instead, each such structure now resides in its logical component
- map.h now only holds mostly map-related things (needs more cleaning)
diff --git a/src/char/char.c b/src/char/char.c
index 76dad5203..566cd1e21 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -287,7 +287,7 @@ int search_character_online(int aid, int cid)
{
//Look for online character.
struct online_char_data* character;
- character = idb_get(online_char_db, aid);
+ character = (struct online_char_data*)idb_get(online_char_db, aid);
if(character &&
character->char_id == cid &&
character->server > -1)
@@ -297,7 +297,7 @@ int search_character_online(int aid, int cid)
static void * create_online_char_data(DBKey key, va_list args)
{
struct online_char_data* character;
- character = aCalloc(1, sizeof(struct online_char_data));
+ character = (struct online_char_data*)aCalloc(1, sizeof(struct online_char_data));
character->account_id = key.i;
character->char_id = -1;
character->server = -1;
@@ -327,7 +327,7 @@ void set_char_online(int map_id, int char_id, int account_id)
}
}
- character = idb_ensure(online_char_db, account_id, create_online_char_data);
+ character = (struct online_char_data*)idb_ensure(online_char_db, account_id, create_online_char_data);
if (online_check && character->char_id != -1 && character->server > -1 && character->server != map_id)
{
//char == 99 <- Character logging in, so someone has logged in while one
@@ -362,7 +362,7 @@ void set_char_offline(int char_id, int account_id)
{
struct online_char_data* character;
- if ((character = idb_get(online_char_db, account_id)) != NULL)
+ if ((character = (struct online_char_data*)idb_get(online_char_db, account_id)) != NULL)
{ //We don't free yet to avoid aCalloc/aFree spamming during char change. [Skotlex]
if( character->server > -1 )
server[character->server].users--;
@@ -1911,7 +1911,7 @@ static void char_auth_ok(int fd, struct char_session_data *sd)
return;
}
- if( online_check && (character = idb_get(online_char_db, sd->account_id)) != NULL )
+ if( online_check && (character = (struct online_char_data*)idb_get(online_char_db, sd->account_id)) != NULL )
{ // check if character is not online already. [Skotlex]
if (character->server > -1)
{ //Character already online. KICK KICK KICK
@@ -2301,7 +2301,7 @@ int parse_fromlogin(int fd)
if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
return 0;
{
- unsigned char buf[32000];
+ unsigned char buf[32000]; //FIXME: this will crash
if (gm_account != NULL)
aFree(gm_account);
CREATE(gm_account, struct gm_account, (RFIFOW(fd,2) - 4)/5);
@@ -2330,7 +2330,7 @@ int parse_fromlogin(int fd)
{
struct online_char_data* character;
int aid = RFIFOL(fd,2);
- if ((character = idb_get(online_char_db, aid)) != NULL)
+ if ((character = (struct online_char_data*)idb_get(online_char_db, aid)) != NULL)
{ //Kick out this player.
if (character->server > -1)
{ //Kick it from the map server it is on.
@@ -2434,10 +2434,10 @@ int char_parse_Registry(int account_id, int char_id, unsigned char *buf, int buf
if(i >= char_num) //Character not found?
return 1;
for(j=0,p=0;j<GLOBAL_REG_NUM && p<buf_len;j++){
- sscanf(WBUFP(buf,p), "%31c%n",char_dat[i].global[j].str,&len);
+ sscanf((char*)WBUFP(buf,p), "%31c%n",char_dat[i].global[j].str,&len);
char_dat[i].global[j].str[len]='\0';
p +=len+1; //+1 to skip the '\0' between strings.
- sscanf(WBUFP(buf,p), "%255c%n",char_dat[i].global[j].value,&len);
+ sscanf((char*)WBUFP(buf,p), "%255c%n",char_dat[i].global[j].value,&len);
char_dat[i].global[j].value[len]='\0';
p +=len+1;
}
@@ -2463,8 +2463,8 @@ int char_account_reg_reply(int fd,int account_id,int char_id)
}else{
for (p=13,j = 0; j < char_dat[i].global_num; j++) {
if (char_dat[i].global[j].str[0]) {
- p+= sprintf(WFIFOP(fd,p), "%s", char_dat[i].global[j].str)+1; //We add 1 to consider the '\0' in place.
- p+= sprintf(WFIFOP(fd,p), "%s", char_dat[i].global[j].value)+1;
+ p+= sprintf((char*)WFIFOP(fd,p), "%s", char_dat[i].global[j].str)+1; //We add 1 to consider the '\0' in place.
+ p+= sprintf((char*)WFIFOP(fd,p), "%s", char_dat[i].global[j].value)+1;
}
}
WFIFOW(fd,2)=p;
@@ -2581,7 +2581,7 @@ int char_send_fame_list(int fd)
void char_update_fame_list(int type, int index, int fame)
{
- char buf[9];
+ unsigned char buf[9];
WBUFW(buf,0) = 0x2b22;
WBUFB(buf,2) = type;
WBUFB(buf,3) = index;
@@ -2767,7 +2767,7 @@ int parse_frommap(int fd)
struct online_char_data* character;
aid = RFIFOL(fd,6+i*8);
cid = RFIFOL(fd,6+i*8+4);
- character = idb_ensure(online_char_db, aid, create_online_char_data);
+ character = (struct online_char_data*)idb_ensure(online_char_db, aid, create_online_char_data);
if (online_check && character->server > -1 && character->server != id)
{
ShowNotice("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n",
@@ -2863,7 +2863,7 @@ int parse_frommap(int fd)
memcpy(WFIFOP(map_fd,20), char_data, sizeof(struct mmo_charstatus));
WFIFOSET(map_fd, WFIFOW(map_fd,2));
- data = idb_ensure(online_char_db, RFIFOL(fd,2), create_online_char_data);
+ data = (struct online_char_data*)idb_ensure(online_char_db, RFIFOL(fd,2), create_online_char_data);
data->char_id = char_data->char_id;
data->server = map_id; //Update server where char is.
@@ -3134,7 +3134,7 @@ int parse_frommap(int fd)
if (data->count != count)
{
data->count = count;
- data->data = aRealloc(data->data, count*sizeof(struct status_change_data));
+ data->data = (struct status_change_data*)aRealloc(data->data, count*sizeof(struct status_change_data));
}
for (i = 0; i < count; i++)
memcpy (&data->data[i], RFIFOP(fd, 14+i*sizeof(struct status_change_data)), sizeof(struct status_change_data));
@@ -3237,7 +3237,7 @@ int parse_char(int fd)
{
if (sd != NULL)
{
- struct online_char_data* data = idb_get(online_char_db, sd->account_id);
+ struct online_char_data* data = (struct online_char_data*)idb_get(online_char_db, sd->account_id);
if (!data || data->server == -1) //If it is not in any server, send it offline. [Skotlex]
set_char_offline(99,sd->account_id);
if (data && data->fd == fd)
@@ -3631,8 +3631,8 @@ int parse_char(int fd)
if (RFIFOREST(fd) < 60)
return 0;
{
- char* l_user = RFIFOP(fd,2);
- char* l_pass = RFIFOP(fd,26);
+ char* l_user = (char*)RFIFOP(fd,2);
+ char* l_pass = (char*)RFIFOP(fd,26);
l_user[23] = '\0';
l_pass[23] = '\0';
ARR_FIND( 0, MAX_MAP_SERVERS, i, server[i].fd <= 0 );
@@ -3899,7 +3899,7 @@ int ping_login_server(int tid, unsigned int tick, int id, int data)
static int chardb_waiting_disconnect(int tid, unsigned int tick, int id, int data)
{
struct online_char_data* character;
- if ((character = idb_get(online_char_db, id)) != NULL && character->waiting_disconnect == tid)
+ if ((character = (struct online_char_data*)idb_get(online_char_db, id)) != NULL && character->waiting_disconnect == tid)
{ //Mark it offline due to timeout.
character->waiting_disconnect = -1;
set_char_offline(character->char_id, character->account_id);
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index ac15b9a0a..e8379c130 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -485,7 +485,7 @@ void inter_guild_final()
struct guild *inter_guild_search(int guild_id)
{
- return idb_get(guild_db, guild_id);
+ return (struct guild*)idb_get(guild_db, guild_id);
}
// ギルドデータのセーブ
@@ -504,7 +504,7 @@ int inter_guild_save()
}
iter = guild_db->iterator(guild_db);
- for( g = iter->first(iter,NULL); iter->exists(iter); g = iter->next(iter,NULL) )
+ for( g = (struct guild*)iter->first(iter,NULL); iter->exists(iter); g = (struct guild*)iter->next(iter,NULL) )
{
char line[16384];
inter_guild_tostr(line, g);
@@ -522,7 +522,7 @@ int inter_guild_save()
}
iter = castle_db->iterator(castle_db);
- for( gc = iter->first(iter,NULL); iter->exists(iter); gc = iter->next(iter,NULL) )
+ for( gc = (struct guild_castle*)iter->first(iter,NULL); iter->exists(iter); gc = (struct guild_castle*)iter->next(iter,NULL) )
{
char line[16384];
inter_guildcastle_tostr(line, gc);
@@ -542,7 +542,7 @@ struct guild* search_guildname(char *str)
struct guild* g;
iter = guild_db->iterator(guild_db);
- for( g = iter->first(iter,NULL); iter->exists(iter); g = iter->next(iter,NULL) )
+ for( g = (struct guild*)iter->first(iter,NULL); iter->exists(iter); g = (struct guild*)iter->next(iter,NULL) )
{
if (strcmpi(g->name, str) == 0)
break;
@@ -933,7 +933,7 @@ int mapif_guild_castle_alldataload(int fd)
WFIFOHEAD(fd, 4 + MAX_GUILDCASTLE*sizeof(struct guild_castle));
WFIFOW(fd,0) = 0x3842;
iter = castle_db->iterator(castle_db);
- for( gc = iter->first(iter,NULL); iter->exists(iter); gc = iter->next(iter,NULL) )
+ for( gc = (struct guild_castle*)iter->first(iter,NULL); iter->exists(iter); gc = (struct guild_castle*)iter->next(iter,NULL) )
{
memcpy(WFIFOP(fd,len), gc, sizeof(struct guild_castle));
len += sizeof(struct guild_castle);
@@ -1025,7 +1025,7 @@ int mapif_parse_GuildInfo(int fd, int guild_id)
{
struct guild *g;
- g = idb_get(guild_db, guild_id);
+ g = (struct guild*)idb_get(guild_db, guild_id);
if (g != NULL){
guild_calcinfo(g);
mapif_guild_info(fd, g);
@@ -1041,7 +1041,7 @@ int mapif_parse_GuildAddMember(int fd, int guild_id, struct guild_member *m)
struct guild *g;
int i;
- g = idb_get(guild_db, guild_id);
+ g = (struct guild*)idb_get(guild_db, guild_id);
if (g == NULL) {
mapif_guild_memberadded(fd, guild_id, m->account_id, m->char_id, 1);
return 0;
@@ -1066,7 +1066,7 @@ int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, in
{
int i, j;
- struct guild* g = idb_get(guild_db, guild_id);
+ struct guild* g = (struct guild*)idb_get(guild_db, guild_id);
if( g == NULL )
{
//TODO
@@ -1112,7 +1112,7 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id,
struct guild *g;
int i, sum, c;
- g = idb_get(guild_db, guild_id);
+ g = (struct guild*)idb_get(guild_db, guild_id);
if (g == NULL)
return 0;
@@ -1168,7 +1168,7 @@ int mapif_parse_BreakGuild(int fd, int guild_id)
{
struct guild *g;
- g = idb_get(guild_db, guild_id);
+ g = (struct guild*)idb_get(guild_db, guild_id);
if(g == NULL)
return 0;
@@ -1195,7 +1195,7 @@ int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const char
struct guild *g;
short dw = *((short *)data);
- g = idb_get(guild_db, guild_id);
+ g = (struct guild*)idb_get(guild_db, guild_id);
if (g == NULL)
return 0;
@@ -1223,7 +1223,7 @@ int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int
int i;
struct guild *g;
- g = idb_get(guild_db, guild_id);
+ g = (struct guild*)idb_get(guild_db, guild_id);
if(g == NULL)
return 0;
@@ -1304,7 +1304,7 @@ int inter_guild_sex_changed(int guild_id,int account_id,int char_id, int gender)
// ギルド役職名変更要求
int mapif_parse_GuildPosition(int fd, int guild_id, int idx, struct guild_position *p)
{
- struct guild *g = idb_get(guild_db, guild_id);
+ struct guild *g = (struct guild*)idb_get(guild_db, guild_id);
if (g == NULL || idx < 0 || idx >= MAX_GUILDPOSITION) {
return 0;
@@ -1319,7 +1319,7 @@ int mapif_parse_GuildPosition(int fd, int guild_id, int idx, struct guild_positi
// ギルドスキルアップ要求
int mapif_parse_GuildSkillUp(int fd, int guild_id, int skill_num, int account_id)
{
- struct guild *g = idb_get(guild_db, guild_id);
+ struct guild *g = (struct guild*)idb_get(guild_db, guild_id);
int idx = skill_num - GD_SKILLBASE;
if (g == NULL || idx < 0 || idx >= MAX_GUILDSKILL)
@@ -1361,8 +1361,8 @@ int mapif_parse_GuildAlliance(int fd, int guild_id1, int guild_id2, int account_
struct guild *g[2];
int j, i;
- g[0] = idb_get(guild_db, guild_id1);
- g[1] = idb_get(guild_db, guild_id2);
+ g[0] = (struct guild*)idb_get(guild_db, guild_id1);
+ g[1] = (struct guild*)idb_get(guild_db, guild_id2);
if(g[0] && g[1]==NULL && (flag&0x8)) //Requested to remove an alliance with a not found guild.
return mapif_parse_GuildDeleteAlliance(g[0], guild_id2,
@@ -1400,7 +1400,7 @@ int mapif_parse_GuildNotice(int fd, int guild_id, const char *mes1, const char *
{
struct guild *g;
- g = idb_get(guild_db, guild_id);
+ g = (struct guild*)idb_get(guild_db, guild_id);
if (g == NULL)
return 0;
memcpy(g->mes1, mes1, 60);
@@ -1414,7 +1414,7 @@ int mapif_parse_GuildEmblem(int fd, int len, int guild_id, int dummy, const char
{
struct guild *g;
- g = idb_get(guild_db, guild_id);
+ g = (struct guild*)idb_get(guild_db, guild_id);
if (g == NULL)
return 0;
memcpy(g->emblem_data, data, len);
@@ -1426,7 +1426,7 @@ int mapif_parse_GuildEmblem(int fd, int len, int guild_id, int dummy, const char
int mapif_parse_GuildCastleDataLoad(int fd, int castle_id, int index)
{
- struct guild_castle *gc = idb_get(castle_db, castle_id);
+ struct guild_castle *gc = (struct guild_castle*)idb_get(castle_db, castle_id);
if (gc == NULL) {
return mapif_guild_castle_dataload(castle_id, 0, 0);
@@ -1460,7 +1460,7 @@ int mapif_parse_GuildCastleDataLoad(int fd, int castle_id, int index)
int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value)
{
- struct guild_castle *gc= idb_get(castle_db, castle_id);
+ struct guild_castle *gc = (struct guild_castle*)idb_get(castle_db, castle_id);
if (gc == NULL)
return mapif_guild_castle_datasave(castle_id, index, value);
@@ -1469,7 +1469,7 @@ int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value)
case 1:
if (gc->guild_id != value) {
int gid = (value) ? value : gc->guild_id;
- struct guild *g = idb_get(guild_db, gid);
+ struct guild *g = (struct guild*)idb_get(guild_db, gid);
if(log_inter)
inter_log("guild %s (id=%d) %s castle id=%d\n",
(g) ? g->name : "??", gid, (value) ? "occupy" : "abandon", castle_id);
@@ -1507,7 +1507,7 @@ int mapif_parse_GuildCastleDataSave(int fd, int castle_id, int index, int value)
int mapif_parse_GuildMasterChange(int fd, int guild_id, const char* name, int len)
{
- struct guild *g = idb_get(guild_db, guild_id);
+ struct guild *g = (struct guild*)idb_get(guild_db, guild_id);
struct guild_member gm;
int pos;
diff --git a/src/char/int_homun.c b/src/char/int_homun.c
index 49434cd90..d547b60f7 100644
--- a/src/char/int_homun.c
+++ b/src/char/int_homun.c
@@ -175,7 +175,7 @@ int inter_homun_save()
int inter_homun_delete(int hom_id)
{
struct s_homunculus *p;
- p = idb_get(homun_db,hom_id);
+ p = (struct s_homunculus*)idb_get(homun_db,hom_id);
if( p == NULL)
return 0;
idb_remove(homun_db,hom_id);
@@ -255,7 +255,6 @@ int mapif_rename_homun_ack(int fd, int account_id, int char_id, int flag, char *
int mapif_create_homun(int fd)
{
struct s_homunculus *p;
- RFIFOHEAD(fd);
p= (struct s_homunculus *) aCalloc(sizeof(struct s_homunculus), 1);
if(p==NULL){
ShowFatalError("int_homun: out of memory !\n");
@@ -274,10 +273,9 @@ int mapif_load_homun(int fd)
{
struct s_homunculus *p;
int account_id;
- RFIFOHEAD(fd);
account_id = RFIFOL(fd,2);
- p= idb_get(homun_db,RFIFOL(fd,6));
+ p = (struct s_homunculus*)idb_get(homun_db,RFIFOL(fd,6));
if(p==NULL) {
mapif_homun_noinfo(fd,account_id);
return 0;
@@ -300,7 +298,7 @@ int mapif_save_homun(int fd,int account_id,struct s_homunculus *data)
if (data->hom_id == 0)
data->hom_id = homun_newid++;
hom_id = data->hom_id;
- p= idb_ensure(homun_db,hom_id,create_homun);
+ p = (struct s_homunculus*)idb_ensure(homun_db,hom_id,create_homun);
memcpy(p,data,sizeof(struct s_homunculus));
mapif_save_homun_ack(fd,account_id,1);
return 0;
@@ -336,27 +334,24 @@ int mapif_rename_homun(int fd, int account_id, int char_id, char *name){
int mapif_parse_SaveHomun(int fd)
{
- RFIFOHEAD(fd);
mapif_save_homun(fd,RFIFOL(fd,4),(struct s_homunculus *)RFIFOP(fd,8));
return 0;
}
int mapif_parse_DeleteHomun(int fd)
{
- RFIFOHEAD(fd);
mapif_delete_homun(fd,RFIFOL(fd,2));
return 0;
}
-int mapif_parse_RenameHomun(int fd){
- RFIFOHEAD(fd);
- mapif_rename_homun(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOP(fd, 10));
+int mapif_parse_RenameHomun(int fd)
+{
+ mapif_rename_homun(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), (char*)RFIFOP(fd, 10));
return 0;
}
int inter_homun_parse_frommap(int fd)
{
- RFIFOHEAD(fd);
switch(RFIFOW(fd,0)){
case 0x3090: mapif_create_homun(fd); break;
case 0x3091: mapif_load_homun(fd); break;
diff --git a/src/char/int_party.c b/src/char/int_party.c
index 64facec47..f0668a820 100644
--- a/src/char/int_party.c
+++ b/src/char/int_party.c
@@ -505,10 +505,11 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part
}
// パ?ティ情報要求
-int mapif_parse_PartyInfo(int fd, int party_id) {
+int mapif_parse_PartyInfo(int fd, int party_id)
+{
struct party_data *p;
- p = idb_get(party_db, party_id);
+ p = (struct party_data*)idb_get(party_db, party_id);
if (p != NULL)
mapif_party_info(fd, &p->party);
else {
@@ -525,7 +526,7 @@ int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member
struct party_data *p;
int i;
- p = idb_get(party_db, party_id);
+ p = (struct party_data*)idb_get(party_db, party_id);
if( p == NULL || p->size == MAX_PARTY ) {
mapif_party_memberadded(fd, party_id, member->account_id, member->char_id, 1);
return 0;
@@ -557,11 +558,12 @@ int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member
}
// パ?ティ?設定?更要求
-int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp, int item) {
+int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp, int item)
+{
struct party_data *p;
int flag = 0;
- p = idb_get(party_db, party_id);
+ p = (struct party_data*)idb_get(party_db, party_id);
if (p == NULL)
return 0;
@@ -576,11 +578,12 @@ int mapif_parse_PartyChangeOption(int fd, int party_id, int account_id, int exp,
}
// パ?ティ?退要求
-int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id) {
+int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id)
+{
struct party_data *p;
int i,lv;
- p = idb_get(party_db, party_id);
+ p = (struct party_data*)idb_get(party_db, party_id);
if (!p) return 0;
for(i = 0; i < MAX_PARTY; i++) {
@@ -610,7 +613,7 @@ int mapif_parse_PartyChangeMap(int fd, int party_id, int account_id, int char_id
struct party_data *p;
int i;
- p = idb_get(party_db, party_id);
+ p = (struct party_data*)idb_get(party_db, party_id);
if (p == NULL)
return 0;
@@ -682,7 +685,7 @@ int mapif_parse_PartyLeaderChange(int fd,int party_id,int account_id,int char_id
struct party_data *p;
int i;
- p = idb_get(party_db, party_id);
+ p = (struct party_data*)idb_get(party_db, party_id);
if (p == NULL)
return 0;
diff --git a/src/char/int_pet.c b/src/char/int_pet.c
index 59c705620..41d61fbc3 100644
--- a/src/char/int_pet.c
+++ b/src/char/int_pet.c
@@ -145,7 +145,7 @@ int inter_pet_save()
int inter_pet_delete(int pet_id)
{
struct s_pet *p;
- p = idb_get(pet_db,pet_id);
+ p = (struct s_pet*)idb_get(pet_db,pet_id);
if( p == NULL)
return 1;
else {
@@ -267,7 +267,7 @@ int mapif_create_pet(int fd,int account_id,int char_id,short pet_class,short pet
int mapif_load_pet(int fd,int account_id,int char_id,int pet_id)
{
struct s_pet *p;
- p= idb_get(pet_db,pet_id);
+ p = (struct s_pet*)idb_get(pet_db,pet_id);
if(p!=NULL) {
if(p->incuvate == 1) {
p->account_id = p->char_id = 0;
@@ -304,7 +304,7 @@ int mapif_save_pet(int fd,int account_id,struct s_pet *data)
pet_id = data->pet_id;
if (pet_id == 0)
pet_id = data->pet_id = pet_newid++;
- p= idb_ensure(pet_db,pet_id,create_pet);
+ p = (struct s_pet*)idb_ensure(pet_db,pet_id,create_pet);
if(data->hungry < 0)
data->hungry = 0;
else if(data->hungry > 100)
diff --git a/src/char/int_status.c b/src/char/int_status.c
index 29886d45c..bf5d94155 100644
--- a/src/char/int_status.c
+++ b/src/char/int_status.c
@@ -15,9 +15,10 @@ static DBMap* scdata_db = NULL; // int char_id -> struct scdata*
char scdata_txt[1024]="save/scdata.txt"; //By [Skotlex]
#ifdef ENABLE_SC_SAVING
-static void* create_scdata(DBKey key, va_list args) {
+static void* create_scdata(DBKey key, va_list args)
+{
struct scdata *data;
- data = aCalloc(1, sizeof(struct scdata));
+ data = (struct scdata*)aCalloc(1, sizeof(struct scdata));
data->account_id = va_arg(args, int);
data->char_id = key.i;
return data;
@@ -28,9 +29,7 @@ static void* create_scdata(DBKey key, va_list args) {
*------------------------------------------*/
struct scdata* status_search_scdata(int aid, int cid)
{
- struct scdata *data;
- data = scdata_db->ensure(scdata_db, i2key(cid), create_scdata, aid);
- return data;
+ return (struct scdata*)scdata_db->ensure(scdata_db, i2key(cid), create_scdata, aid);
}
/*==========================================
@@ -39,7 +38,7 @@ struct scdata* status_search_scdata(int aid, int cid)
*------------------------------------------*/
void status_delete_scdata(int aid, int cid)
{
- struct scdata *scdata = idb_remove(scdata_db, cid);
+ struct scdata* scdata = (struct scdata*)idb_remove(scdata_db, cid);
if (scdata)
{
if (scdata->data)
@@ -71,7 +70,7 @@ static int inter_scdata_fromstr(char *line, struct scdata *sc_data)
if (sc_data->count < 1)
return 0;
- sc_data->data = aCalloc(sc_data->count, sizeof (struct status_change_data));
+ sc_data->data = (struct status_change_data*)aCalloc(sc_data->count, sizeof (struct status_change_data));
for (i = 0; i < sc_data->count; i++)
{
@@ -106,7 +105,7 @@ void status_load_scdata(const char* filename)
if (inter_scdata_fromstr(line, sc)) {
sd_count++;
sc_count+= sc->count;
- sc = idb_put(scdata_db, sc->char_id, sc);
+ sc = (struct scdata*)idb_put(scdata_db, sc->char_id, sc);
if (sc) {
ShowError("Duplicate entry in %s for character %d\n", filename, sc->char_id);
if (sc->data) aFree(sc->data);
diff --git a/src/char/int_storage.c b/src/char/int_storage.c
index 4aefd231b..5ae51b833 100644
--- a/src/char/int_storage.c
+++ b/src/char/int_storage.c
@@ -169,7 +169,7 @@ static void* create_storage(DBKey key, va_list args) {
struct storage *account2storage(int account_id)
{
struct storage *s;
- s= idb_ensure(storage_db, account_id, create_storage);
+ s = (struct storage*)idb_ensure(storage_db, account_id, create_storage);
return s;
}
@@ -184,7 +184,7 @@ struct guild_storage *guild2storage(int guild_id)
{
struct guild_storage *gs = NULL;
if(inter_guild_search(guild_id) != NULL)
- gs= idb_ensure(guild_storage_db, guild_id, create_guildstorage);
+ gs = (struct guild_storage*)idb_ensure(guild_storage_db, guild_id, create_guildstorage);
return gs;
}
@@ -319,7 +319,7 @@ int inter_guild_storage_save()
// 倉庫データ削除
int inter_storage_delete(int account_id)
{
- struct storage *s = idb_get(storage_db,account_id);
+ struct storage *s = (struct storage*)idb_get(storage_db,account_id);
if(s) {
int i;
for(i=0;i<s->storage_amount;i++){
@@ -334,7 +334,7 @@ int inter_storage_delete(int account_id)
// ギルド倉庫データ削除
int inter_guild_storage_delete(int guild_id)
{
- struct guild_storage *gs = idb_get(guild_storage_db,guild_id);
+ struct guild_storage *gs = (struct guild_storage*)idb_get(guild_storage_db,guild_id);
if(gs) {
int i;
for(i=0;i<gs->storage_amount;i++){
diff --git a/src/char/inter.c b/src/char/inter.c
index 8472d36d1..bb4b86367 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -359,7 +359,8 @@ int mapif_wis_fail(int fd, char *src) {
}
// Wisp/page transmission result to map-server
-int mapif_wis_end(struct WisData *wd, int flag) {
+int mapif_wis_end(struct WisData *wd, int flag)
+{
unsigned char buf[27];
WBUFW(buf, 0) = 0x3802;
@@ -370,22 +371,17 @@ int mapif_wis_end(struct WisData *wd, int flag) {
return 0;
}
-// アカウント変数送信
-int mapif_account_reg(int fd, unsigned char *src) {
- unsigned char *buf = aCalloc(1,WBUFW(src,2));
-
- memcpy(WBUFP(buf,0),src,WBUFW(src,2));
- WBUFW(buf, 0) = 0x3804;
- mapif_sendallwos(fd, buf, WBUFW(buf,2));
-
- aFree(buf);
-
- return 0;
+// Account registry transfer to map-server
+static void mapif_account_reg(int fd, unsigned char *src)
+{
+ WBUFW(src,0)=0x3804; //NOTE: writing to RFIFO
+ mapif_sendallwos(fd, src, WBUFW(src,2));
}
// アカウント変数要求返信
-int mapif_account_reg_reply(int fd,int account_id, int char_id) {
- struct accreg *reg = idb_get(accreg_db,account_id);
+int mapif_account_reg_reply(int fd,int account_id, int char_id)
+{
+ struct accreg *reg = (struct accreg*)idb_get(accreg_db,account_id);
WFIFOHEAD(fd, ACCOUNT_REG_NUM * 288+ 13);
WFIFOW(fd,0) = 0x3804;
@@ -397,8 +393,8 @@ int mapif_account_reg_reply(int fd,int account_id, int char_id) {
} else {
int i, p;
for (p=13,i = 0; i < reg->reg_num; i++) {
- p+= sprintf(WFIFOP(fd,p), "%s", reg->reg[i].str)+1; //We add 1 to consider the '\0' in place.
- p+= sprintf(WFIFOP(fd,p), "%s", reg->reg[i].value)+1;
+ p+= sprintf((char*)WFIFOP(fd,p), "%s", reg->reg[i].str)+1; //We add 1 to consider the '\0' in place.
+ p+= sprintf((char*)WFIFOP(fd,p), "%s", reg->reg[i].value)+1;
}
WFIFOW(fd,2)=p;
}
@@ -443,7 +439,7 @@ int check_ttl_wisdata(void) {
wis_delnum = 0;
wis_db->foreach(wis_db, check_ttl_wisdata_sub, tick);
for(i = 0; i < wis_delnum; i++) {
- struct WisData *wd = idb_get(wis_db, wis_dellist[i]);
+ struct WisData *wd = (struct WisData*)idb_get(wis_db, wis_dellist[i]);
ShowWarning("inter: wis data id=%d time out : from %s to %s\n", wd->id, wd->src, wd->dst);
// 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
@@ -505,7 +501,7 @@ int mapif_parse_WisRequest(int fd) {
// search if character exists before to ask all map-servers
char_status = search_character_byname(name);
if (char_status == NULL)
- return mapif_wis_fail(fd, RFIFOP(fd, 4));
+ return mapif_wis_fail(fd, (char*)RFIFOP(fd, 4));
// Character exists.
// to be sure of the correct name, rewrite it
@@ -513,19 +509,19 @@ int mapif_parse_WisRequest(int fd) {
strncpy(name, char_status->name, NAME_LENGTH);
// if source is destination, don't ask other servers.
if (strcmp((char*)RFIFOP(fd,4),name) == 0)
- return mapif_wis_fail(fd, RFIFOP(fd, 4));
+ return mapif_wis_fail(fd, (char*)RFIFOP(fd, 4));
//Look for online character.
fd2 = search_character_online(char_status->account_id, char_status->char_id);
if (fd2 >= 0) { //Character online, send whisper.
- wd = mapif_create_whisper(fd, RFIFOP(fd, 4), RFIFOP(fd,28), RFIFOP(fd,52), RFIFOW(fd,2)-52);
+ wd = mapif_create_whisper(fd, (char*)RFIFOP(fd, 4), (char*)RFIFOP(fd,28), (char*)RFIFOP(fd,52), RFIFOW(fd,2)-52);
if (!wd) return 1;
idb_put(wis_db, wd->id, wd);
mapif_wis_message2(wd, fd2);
return 0;
}
//Not found.
- return mapif_wis_fail(fd, RFIFOP(fd, 4));
+ return mapif_wis_fail(fd, (char*)RFIFOP(fd,4));
}
// Wisp/page transmission result
@@ -535,7 +531,7 @@ int mapif_parse_WisReply(int fd) {
RFIFOHEAD(fd);
id = RFIFOL(fd,2);
flag = RFIFOB(fd,6);
- wd = idb_get(wis_db, id);
+ wd = (struct WisData*)idb_get(wis_db, id);
if (wd == NULL)
return 0; // This wisp was probably suppress before, because it was timeout or because of target was found on another map-server
@@ -583,13 +579,13 @@ int mapif_parse_Registry(int fd) {
default: //Error?
return 1;
}
- reg = idb_ensure(accreg_db, RFIFOL(fd,4), create_accreg);
+ reg = (struct accreg*)idb_ensure(accreg_db, RFIFOL(fd,4), create_accreg);
for(j=0,p=13;j<ACCOUNT_REG_NUM && p<RFIFOW(fd,2);j++){
- sscanf(RFIFOP(fd,p), "%31c%n",reg->reg[j].str,&len);
+ sscanf((char*)RFIFOP(fd,p), "%31c%n",reg->reg[j].str,&len);
reg->reg[j].str[len]='\0';
p +=len+1; //+1 to skip the '\0' between strings.
- sscanf(RFIFOP(fd,p), "%255c%n",reg->reg[j].value,&len);
+ sscanf((char*)RFIFOP(fd,p), "%255c%n",reg->reg[j].value,&len);
reg->reg[j].value[len]='\0';
p +=len+1;
}
@@ -636,7 +632,7 @@ int mapif_parse_NameChangeRequest(int fd)
account_id = RFIFOL(fd, 2);
char_id = RFIFOL(fd, 6);
type = RFIFOB(fd, 10);
- name = RFIFOP(fd, 11);
+ name = (char*)RFIFOP(fd, 11);
// Check Authorised letters/symbols in the name
if (char_name_option == 1) { // only letters/symbols in char_name_letters are authorised
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 9112265da..ab243e217 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -232,7 +232,7 @@ void set_char_online(int map_id, int char_id, int account_id)
}
}
- character = idb_ensure(online_char_db, account_id, create_online_char_data);
+ character = (struct online_char_data*)idb_ensure(online_char_db, account_id, create_online_char_data);
if (online_check && character->char_id != -1 && character->server > -1 && character->server != map_id)
{
//char == 99 <- Character logging in, so someone has logged in while one
@@ -257,7 +257,7 @@ void set_char_online(int map_id, int char_id, int account_id)
if (char_id != 99)
{ //Set char online in guild cache. If char is in memory, use the guild id on it, otherwise seek it.
struct mmo_charstatus *cp;
- cp = idb_get(char_db_,char_id);
+ cp = (struct mmo_charstatus*)idb_get(char_db_,char_id);
inter_guild_CharOnline(char_id, cp?cp->guild_id:-1);
}
if (login_fd > 0 && !session[login_fd]->flag.eof)
@@ -281,7 +281,7 @@ void set_char_offline(int char_id, int account_id)
}
else
{
- struct mmo_charstatus* cp = idb_get(char_db_,char_id);
+ struct mmo_charstatus* cp = (struct mmo_charstatus*)idb_get(char_db_,char_id);
inter_guild_CharOffline(char_id, cp?cp->guild_id:-1);
if (cp)
idb_remove(char_db_,char_id);
@@ -290,7 +290,7 @@ void set_char_offline(int char_id, int account_id)
Sql_ShowDebug(sql_handle);
}
- if ((character = idb_get(online_char_db, account_id)) != NULL)
+ if ((character = (struct online_char_data*)idb_get(online_char_db, account_id)) != NULL)
{ //We don't free yet to avoid aCalloc/aFree spamming during char change. [Skotlex]
if( character->server > -1 )
server[character->server].users--;
@@ -442,9 +442,9 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus* p)
if (char_id!=p->char_id) return 0;
#ifndef TXT_SQL_CONVERT
- cp = idb_ensure(char_db_, char_id, create_charstatus);
+ cp = (struct mmo_charstatus*)idb_ensure(char_db_, char_id, create_charstatus);
#else
- cp = aCalloc(1, sizeof(struct mmo_charstatus));
+ cp = (struct mmo_charstatus*)aCalloc(1, sizeof(struct mmo_charstatus));
#endif
StringBuf_Init(&buf);
@@ -1141,7 +1141,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
SqlStmt_Free(stmt);
StringBuf_Destroy(&buf);
- cp = idb_ensure(char_db_, char_id, create_charstatus);
+ cp = (struct mmo_charstatus*)idb_ensure(char_db_, char_id, create_charstatus);
memcpy(cp, p, sizeof(struct mmo_charstatus));
return 1;
}
@@ -1613,7 +1613,7 @@ static void char_auth_ok(int fd, struct char_session_data *sd)
return;
}
- if( online_check && (character = idb_get(online_char_db, sd->account_id)) != NULL )
+ if( online_check && (character = (struct online_char_data*)idb_get(online_char_db, sd->account_id)) != NULL )
{ // check if character is not online already. [Skotlex]
if (character->server > -1)
{ //Character already online. KICK KICK KICK
@@ -1898,7 +1898,7 @@ int parse_fromlogin(int fd)
return 0;
if(!char_gm_read) {
- unsigned char buf[32000];
+ unsigned char buf[32000]; //FIXME: this will crash
if (gm_account != NULL)
aFree(gm_account);
gm_account = (struct gm_account*)aCalloc(sizeof(struct gm_account) * ((RFIFOW(fd,2) - 4) / 5), 1);
@@ -1926,7 +1926,7 @@ int parse_fromlogin(int fd)
{
struct online_char_data* character;
int aid = RFIFOL(fd,2);
- if ((character = idb_get(online_char_db, aid)) != NULL)
+ if ((character = (struct online_char_data*)idb_get(online_char_db, aid)) != NULL)
{ //Kick out this player.
if( character->server > -1 )
{ //Kick it from the map server it is on.
@@ -2118,7 +2118,7 @@ int char_send_fame_list(int fd)
void char_update_fame_list(int type, int index, int fame)
{
- char buf[9];
+ unsigned char buf[8];
WBUFW(buf,0) = 0x2b22;
WBUFB(buf,2) = type;
WBUFB(buf,3) = index;
@@ -2346,7 +2346,7 @@ int parse_frommap(int fd)
for(i = 0; i < server[id].users; i++) {
aid = RFIFOL(fd,6+i*8);
cid = RFIFOL(fd,6+i*8+4);
- character = idb_ensure(online_char_db, aid, create_online_char_data);
+ character = (struct online_char_data*)idb_ensure(online_char_db, aid, create_online_char_data);
if (character->server > -1 && character->server != id)
{
ShowNotice("Set map user: Character (%d:%d) marked on map server %d, but map server %d claims to have (%d:%d) online!\n",
@@ -2375,7 +2375,7 @@ int parse_frommap(int fd)
}
//Check account only if this ain't final save. Final-save goes through because of the char-map reconnect
if (RFIFOB(fd,12) || (
- (character = idb_get(online_char_db, aid)) != NULL &&
+ (character = (struct online_char_data*)idb_get(online_char_db, aid)) != NULL &&
character->char_id == cid))
{
struct mmo_charstatus char_dat;
@@ -2435,7 +2435,7 @@ int parse_frommap(int fd)
if (map_id >= 0)
map_fd = server[map_id].fd;
//Char should just had been saved before this packet, so this should be safe. [Skotlex]
- char_data = uidb_get(char_db_,RFIFOL(fd,14));
+ char_data = (struct mmo_charstatus*)uidb_get(char_db_,RFIFOL(fd,14));
if (char_data == NULL)
{ //Really shouldn't happen.
mmo_char_fromsql(RFIFOL(fd,14), &char_dat, true);
@@ -2460,7 +2460,7 @@ int parse_frommap(int fd)
memcpy(WFIFOP(map_fd,20), char_data, sizeof(struct mmo_charstatus));
WFIFOSET(map_fd, WFIFOW(map_fd,2));
- data = idb_ensure(online_char_db, RFIFOL(fd,2), create_online_char_data);
+ data = (struct online_char_data*)idb_ensure(online_char_db, RFIFOL(fd,2), create_online_char_data);
data->char_id = char_data->char_id;
data->server = map_id; //Update server where char is.
@@ -2683,7 +2683,7 @@ int parse_frommap(int fd)
char esc_motd[sizeof(motd)*2+1];
char esc_server_name[sizeof(server_name)*2+1];
- strncpy(motd, RFIFOP(fd,10), 255); //First copy it to make sure the motd fits.
+ strncpy(motd, (char*)RFIFOP(fd,10), 255); //First copy it to make sure the motd fits.
motd[255] = '\0';
Sql_EscapeString(sql_handle, esc_motd, motd);
Sql_EscapeString(sql_handle, esc_server_name, server_name);
@@ -2851,7 +2851,7 @@ int parse_char(int fd)
{
if (sd != NULL)
{ // already authed client
- struct online_char_data* data = idb_get(online_char_db, sd->account_id);
+ struct online_char_data* data = (struct online_char_data*)idb_get(online_char_db, sd->account_id);
if (!data || data->server == -1) //If it is not in any server, send it offline. [Skotlex]
set_char_offline(99,sd->account_id);
if (data && data->fd == fd)
@@ -3202,8 +3202,8 @@ int parse_char(int fd)
if (RFIFOREST(fd) < 60)
return 0;
{
- char* l_user = RFIFOP(fd,2);
- char* l_pass = RFIFOP(fd,26);
+ char* l_user = (char*)RFIFOP(fd,2);
+ char* l_pass = (char*)RFIFOP(fd,26);
l_user[23] = '\0';
l_pass[23] = '\0';
ARR_FIND( 0, MAX_MAP_SERVERS, i, server[i].fd <= 0 );
@@ -3466,7 +3466,7 @@ int ping_login_server(int tid, unsigned int tick, int id, int data)
static int chardb_waiting_disconnect(int tid, unsigned int tick, int id, int data)
{
struct online_char_data* character;
- if ((character = idb_get(online_char_db, id)) != NULL && character->waiting_disconnect == tid)
+ if ((character = (struct online_char_data*)idb_get(online_char_db, id)) != NULL && character->waiting_disconnect == tid)
{ //Mark it offline due to timeout.
character->waiting_disconnect = -1;
set_char_offline(character->char_id, character->account_id);
diff --git a/src/char_sql/int_auction.c b/src/char_sql/int_auction.c
index 15b316bb8..84f0ff424 100644
--- a/src/char_sql/int_auction.c
+++ b/src/char_sql/int_auction.c
@@ -30,7 +30,7 @@ static int auction_count(int char_id, bool buy)
DBKey key;
iter = auction_db_->iterator(auction_db_);
- for( auction = iter->first(iter,&key); iter->exists(iter); auction = iter->next(iter,&key) )
+ for( auction = (struct auction_data*)iter->first(iter,&key); iter->exists(iter); auction = (struct auction_data*)iter->next(iter,&key) )
{
if( (buy && auction->buyer_id == char_id) || (!buy && auction->seller_id == char_id) )
i++;
@@ -262,7 +262,7 @@ static void mapif_parse_Auction_requestlist(int fd)
memcpy(searchtext, RFIFOP(fd,16), NAME_LENGTH);
iter = auction_db_->iterator(auction_db_);
- for( auction = iter->first(iter,&key); iter->exists(iter); auction = iter->next(iter,&key) )
+ for( auction = (struct auction_data*)iter->first(iter,&key); iter->exists(iter); auction = (struct auction_data*)iter->next(iter,&key) )
{
if( (type == 0 && auction->type != IT_ARMOR && auction->type != IT_PETARMOR) ||
(type == 1 && auction->type != IT_WEAPON) ||
diff --git a/src/char_sql/int_guild.c b/src/char_sql/int_guild.c
index 93b915886..3ff05ddf1 100644
--- a/src/char_sql/int_guild.c
+++ b/src/char_sql/int_guild.c
@@ -59,7 +59,7 @@ static int guild_save_timer(int tid, unsigned int tick, int id, int data)
state = 1;
iter = guild_db_->iterator(guild_db_);
- for( g = iter->first(iter,&key); iter->exists(iter); g = iter->next(iter,&key) )
+ for( g = (struct guild*)iter->first(iter,&key); iter->exists(iter); g = (struct guild*)iter->next(iter,&key) )
{
if( state == 0 && g->guild_id == last_id )
state++; //Save next guild in the list.
@@ -374,7 +374,7 @@ struct guild * inter_guild_fromsql(int guild_id)
if( guild_id <= 0 )
return NULL;
- g = idb_get(guild_db_, guild_id);
+ g = (struct guild*)idb_get(guild_db_, guild_id);
if( g )
return g;
@@ -1852,7 +1852,7 @@ int mapif_parse_GuildCastleDataSave(int fd,int castle_id,int index,int value)
case 1:
if( gc.guild_id!=value ){
int gid=(value)?value:gc.guild_id;
- struct guild *g=idb_get(guild_db_, gid);
+ struct guild *g = (struct guild*)idb_get(guild_db_, gid);
if(log_inter)
inter_log("guild %s (id=%d) %s castle id=%d\n",
(g)?g->name:"??" ,gid, (value)?"occupy":"abandon", castle_id);
diff --git a/src/char_sql/int_homun.c b/src/char_sql/int_homun.c
index 4e596ef28..591ab219d 100644
--- a/src/char_sql/int_homun.c
+++ b/src/char_sql/int_homun.c
@@ -302,7 +302,7 @@ int inter_homunculus_parse_frommap(int fd){
case 0x3091: mapif_load_homunculus(fd); break;
case 0x3092: mapif_save_homunculus(fd, RFIFOW(fd,4), (struct s_homunculus*) RFIFOP(fd, 8)); break;
case 0x3093: mapif_delete_homunculus(fd); break; // doesn't need to be parse, very simple packet...
- case 0x3094: mapif_rename_homun(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), RFIFOP(fd, 10)); break;
+ case 0x3094: mapif_rename_homun(fd, RFIFOL(fd, 2), RFIFOL(fd, 6), (char*)RFIFOP(fd, 10)); break;
default:
return 0;
}
diff --git a/src/char_sql/int_mail.c b/src/char_sql/int_mail.c
index 86a076b0d..963647200 100644
--- a/src/char_sql/int_mail.c
+++ b/src/char_sql/int_mail.c
@@ -53,7 +53,7 @@ static int mail_fromsql(int char_id, struct mail_data* md)
Sql_GetData(sql_handle, 5, &data, NULL); safestrncpy(msg->title, data, MAIL_TITLE_LENGTH);
Sql_GetData(sql_handle, 6, &data, NULL); safestrncpy(msg->body, data, MAIL_BODY_LENGTH);
Sql_GetData(sql_handle, 7, &data, NULL); msg->timestamp = atoi(data);
- Sql_GetData(sql_handle, 8, &data, NULL); msg->status = atoi(data);
+ Sql_GetData(sql_handle, 8, &data, NULL); msg->status = (mail_status)atoi(data);
Sql_GetData(sql_handle, 9, &data, NULL); msg->zeny = atoi(data);
item = &msg->item;
Sql_GetData(sql_handle,10, &data, NULL); item->amount = (short)atoi(data);
@@ -169,7 +169,7 @@ static bool mail_loadmessage(int mail_id, struct mail_message* msg)
Sql_GetData(sql_handle, 5, &data, NULL); safestrncpy(msg->title, data, MAIL_TITLE_LENGTH);
Sql_GetData(sql_handle, 6, &data, NULL); safestrncpy(msg->body, data, MAIL_BODY_LENGTH);
Sql_GetData(sql_handle, 7, &data, NULL); msg->timestamp = atoi(data);
- Sql_GetData(sql_handle, 8, &data, NULL); msg->status = atoi(data);
+ Sql_GetData(sql_handle, 8, &data, NULL); msg->status = (mail_status)atoi(data);
Sql_GetData(sql_handle, 9, &data, NULL); msg->zeny = atoi(data);
Sql_GetData(sql_handle,10, &data, NULL); msg->item.amount = (short)atoi(data);
Sql_GetData(sql_handle,11, &data, NULL); msg->item.nameid = atoi(data);
diff --git a/src/char_sql/int_party.c b/src/char_sql/int_party.c
index a51b8def0..a4769ebd6 100644
--- a/src/char_sql/int_party.c
+++ b/src/char_sql/int_party.c
@@ -211,7 +211,7 @@ struct party_data *inter_party_fromsql(int party_id)
return NULL;
//Load from memory
- p = idb_get(party_db_, party_id);
+ p = (struct party_data*)idb_get(party_db_, party_id);
if( p != NULL )
return p;
@@ -498,7 +498,7 @@ int mapif_parse_CreateParty(int fd, char *name, int item, int item2, struct part
}
}
- p= aCalloc(1, sizeof(struct party_data));
+ p = (struct party_data*)aCalloc(1, sizeof(struct party_data));
memcpy(p->party.name,name,NAME_LENGTH);
p->party.exp=0;
diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c
index 089e93740..4f856211d 100644
--- a/src/char_sql/inter.c
+++ b/src/char_sql/inter.c
@@ -485,8 +485,9 @@ int mapif_wis_message(struct WisData *wd)
return 0;
}
+
// Wis sending result
-int mapif_wis_end(struct WisData *wd,int flag)
+int mapif_wis_end(struct WisData *wd, int flag)
{
unsigned char buf[27];
@@ -497,15 +498,11 @@ int mapif_wis_end(struct WisData *wd,int flag)
return 0;
}
-int mapif_account_reg(int fd,unsigned char *src)
+// Account registry transfer to map-server
+static void mapif_account_reg(int fd, unsigned char *src)
{
-// unsigned char buf[WBUFW(src,2)]; <- Hey, can this really be done? [Skotlex]
- unsigned char *buf = aCalloc(1,WBUFW(src,2)); // [Lance] - Skot... Dynamic allocation is better :D
- memcpy(WBUFP(buf,0),src,WBUFW(src,2));
- WBUFW(buf, 0)=0x3804;
- mapif_sendallwos(fd, buf, WBUFW(buf,2));
- aFree(buf);
- return 0;
+ WBUFW(src,0)=0x3804; //NOTE: writing to RFIFO
+ mapif_sendallwos(fd, src, WBUFW(src,2));
}
// Send the requested account_reg
@@ -524,8 +521,8 @@ int mapif_account_reg_reply(int fd,int account_id,int char_id, int type)
}else{
int i,p;
for (p=13,i = 0; i < reg->reg_num && p < 5000; i++) {
- p+= sprintf(WFIFOP(fd,p), "%s", reg->reg[i].str)+1; //We add 1 to consider the '\0' in place.
- p+= sprintf(WFIFOP(fd,p), "%s", reg->reg[i].value)+1;
+ p+= sprintf((char*)WFIFOP(fd,p), "%s", reg->reg[i].str)+1; //We add 1 to consider the '\0' in place.
+ p+= sprintf((char*)WFIFOP(fd,p), "%s", reg->reg[i].value)+1;
}
WFIFOW(fd,2)=p;
if (p>= 5000)
@@ -605,7 +602,7 @@ int check_ttl_wisdata(void)
wis_delnum = 0;
wis_db->foreach(wis_db, check_ttl_wisdata_sub, tick);
for(i = 0; i < wis_delnum; i++) {
- struct WisData *wd = idb_get(wis_db, wis_dellist[i]);
+ struct WisData *wd = (struct WisData*)idb_get(wis_db, wis_dellist[i]);
ShowWarning("inter: wis data id=%d time out : from %s to %s\n", wd->id, wd->src, wd->dst);
// 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
@@ -710,7 +707,7 @@ int mapif_parse_WisReply(int fd)
id = RFIFOL(fd,2);
flag = RFIFOB(fd,6);
- wd = idb_get(wis_db, id);
+ wd = (struct WisData*)idb_get(wis_db, id);
if (wd == NULL)
return 0; // This wisp was probably suppress before, because it was timeout of because of target was found on another map-server
@@ -755,10 +752,10 @@ int mapif_parse_Registry(int fd)
return 1;
}
for(j=0,p=13;j<max && p<RFIFOW(fd,2);j++){
- sscanf(RFIFOP(fd,p), "%31c%n",reg->reg[j].str,&len);
+ sscanf((char*)RFIFOP(fd,p), "%31c%n",reg->reg[j].str,&len);
reg->reg[j].str[len]='\0';
p +=len+1; //+1 to skip the '\0' between strings.
- sscanf(RFIFOP(fd,p), "%255c%n",reg->reg[j].value,&len);
+ sscanf((char*)RFIFOP(fd,p), "%255c%n",reg->reg[j].value,&len);
reg->reg[j].value[len]='\0';
p +=len+1;
}
@@ -802,7 +799,7 @@ int mapif_parse_NameChangeRequest(int fd)
account_id = RFIFOL(fd,2);
char_id = RFIFOL(fd,6);
type = RFIFOB(fd,10);
- name = RFIFOP(fd,11);
+ name = (char*)RFIFOP(fd,11);
// Check Authorised letters/symbols in the name
if (char_name_option == 1) { // only letters/symbols in char_name_letters are authorised
diff --git a/src/common/db.c b/src/common/db.c
index 77d3b7b2e..07adf73f1 100644
--- a/src/common/db.c
+++ b/src/common/db.c
@@ -107,6 +107,16 @@
#define HASH_SIZE (256+27)
/**
+ * The color of individual nodes.
+ * @private
+ * @see struct dbn
+ */
+typedef enum node_color {
+ RED,
+ BLACK
+} node_color;
+
+/**
* A node in a RED-BLACK tree of the database.
* @param parent Parent node
* @param left Left child node
@@ -127,7 +137,7 @@ typedef struct dbn {
DBKey key;
void *data;
// Other
- enum {RED, BLACK} color;
+ node_color color;
unsigned deleted : 1;
} *DBNode;
@@ -503,7 +513,7 @@ static void db_rebalance_erase(DBNode node, DBNode *root)
y->parent = node->parent;
// switch colors
{
- int tmp = y->color;
+ node_color tmp = y->color;
y->color = node->color;
node->color = tmp;
}
@@ -2112,7 +2122,7 @@ static DBType db_obj_type(DBMap* self)
DBType type;
DB_COUNTSTAT(db_type);
- if (db == NULL) return -1; // nullpo candidate - TODO what should this return?
+ if (db == NULL) return (DBType)-1; // nullpo candidate - TODO what should this return?
db_free_lock(db);
type = db->type;
@@ -2176,7 +2186,7 @@ DBOptions db_fix_options(DBType type, DBOptions options)
switch (type) {
case DB_INT:
case DB_UINT: // Numeric database, do nothing with the keys
- return options&~(DB_OPT_DUP_KEY|DB_OPT_RELEASE_KEY);
+ return (DBOptions)(options&~(DB_OPT_DUP_KEY|DB_OPT_RELEASE_KEY));
default:
ShowError("db_fix_options: Unknown database type %u with options %x\n", type, options);
@@ -2512,10 +2522,11 @@ void db_final(void)
}
// Link DB System - jAthena
-void linkdb_insert( struct linkdb_node** head, void *key, void* data) {
+void linkdb_insert( struct linkdb_node** head, void *key, void* data)
+{
struct linkdb_node *node;
if( head == NULL ) return ;
- node = aMalloc( sizeof(struct linkdb_node) );
+ node = (struct linkdb_node*)aMalloc( sizeof(struct linkdb_node) );
if( *head == NULL ) {
// first node
*head = node;
@@ -2532,7 +2543,8 @@ void linkdb_insert( struct linkdb_node** head, void *key, void* data) {
node->data = data;
}
-void* linkdb_search( struct linkdb_node** head, void *key) {
+void* linkdb_search( struct linkdb_node** head, void *key)
+{
int n = 0;
struct linkdb_node *node;
if( head == NULL ) return NULL;
@@ -2556,7 +2568,8 @@ void* linkdb_search( struct linkdb_node** head, void *key) {
return NULL;
}
-void* linkdb_erase( struct linkdb_node** head, void *key) {
+void* linkdb_erase( struct linkdb_node** head, void *key)
+{
struct linkdb_node *node;
if( head == NULL ) return NULL;
node = *head;
@@ -2577,7 +2590,8 @@ void* linkdb_erase( struct linkdb_node** head, void *key) {
return NULL;
}
-void linkdb_replace( struct linkdb_node** head, void *key, void *data ) {
+void linkdb_replace( struct linkdb_node** head, void *key, void *data )
+{
int n = 0;
struct linkdb_node *node;
if( head == NULL ) return ;
@@ -2603,7 +2617,8 @@ void linkdb_replace( struct linkdb_node** head, void *key, void *data ) {
linkdb_insert( head, key, data );
}
-void linkdb_final( struct linkdb_node** head ) {
+void linkdb_final( struct linkdb_node** head )
+{
struct linkdb_node *node, *node2;
if( head == NULL ) return ;
node = *head;
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 0d3ef44a6..845b73a7b 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -256,11 +256,11 @@ struct mmo_charstatus {
bool show_equip;
};
-enum mail_status {
+typedef enum mail_status {
MAIL_NEW,
MAIL_UNREAD,
MAIL_READ,
-};
+} mail_status;
struct mail_message {
unsigned int id;
@@ -271,7 +271,7 @@ struct mail_message {
char title[MAIL_TITLE_LENGTH];
char body[MAIL_BODY_LENGTH];
- enum mail_status status;
+ mail_status status;
unsigned int timestamp; // marks when the message was sent
int zeny;
diff --git a/src/common/plugin.h b/src/common/plugin.h
index 8aef934d0..fd01be762 100644
--- a/src/common/plugin.h
+++ b/src/common/plugin.h
@@ -80,6 +80,9 @@ typedef void Plugin_Event_Func(void);
#define PLUGIN_INFO struct _Plugin_Info plugin_info
#define PLUGIN_EVENTS_TABLE struct _Plugin_Event_Table plugin_event_table[]
+
+#ifndef _PLUGINS_H_
void** plugin_call_table;
+#endif
#endif /* _PLUGIN_H_ */
diff --git a/src/common/plugins.c b/src/common/plugins.c
index 58ab60b74..01a6194cd 100644
--- a/src/common/plugins.c
+++ b/src/common/plugins.c
@@ -38,6 +38,7 @@ Plugin* plugin_head = NULL;
static Plugin_Info default_info = { "Unknown", PLUGIN_ALL, "0", PLUGIN_VERSION, "Unknown" };
+void** plugin_call_table;
static size_t call_table_size = 0;
static size_t max_call_table = 0;
@@ -196,7 +197,7 @@ Plugin* plugin_open(const char* filename)
// Retrieve plugin information
plugin->state = 0; // initialising
- DLL_SYM(info, plugin->dll, "plugin_info");
+ info = (Plugin_Info*)DLL_SYM(plugin->dll, "plugin_info");
// For high priority plugins (those that are explicitly loaded from the conf file)
// we'll ignore them even (could be a 3rd party dll file)
if( !info )
@@ -225,20 +226,20 @@ Plugin* plugin_open(const char* filename)
plugin->filename = aStrdup(filename);
// Initialise plugin call table (For exporting procedures)
- DLL_SYM(procs, plugin->dll, "plugin_call_table");
+ procs = (void**)DLL_SYM(plugin->dll, "plugin_call_table");
if( procs )
*procs = plugin_call_table;
//else ShowDebug("plugin_open: plugin_call_table not found\n");
// Register plugin events
- DLL_SYM(events, plugin->dll, "plugin_event_table");
+ events = (Plugin_Event_Table*)DLL_SYM(plugin->dll, "plugin_event_table");
if( events ){
int i = 0;
//ShowDebug("plugin_open: parsing plugin_event_table\n");
while( events[i].func_name ){
if( strcmpi(events[i].event_name, EVENT_PLUGIN_TEST) == 0 ){
Plugin_Test_Func* test_func;
- DLL_SYM(test_func, plugin->dll, events[i].func_name);
+ test_func = (Plugin_Test_Func*)DLL_SYM(plugin->dll, events[i].func_name);
//ShowDebug("plugin_open: invoking "EVENT_PLUGIN_TEST" with %s()\n", events[i].func_name);
if( test_func && test_func() == 0 ){
// plugin has failed test, disabling
@@ -247,7 +248,7 @@ Plugin* plugin_open(const char* filename)
}
} else {
Plugin_Event_Func* func;
- DLL_SYM(func, plugin->dll, events[i].func_name);
+ func = (Plugin_Event_Func*)DLL_SYM(plugin->dll, events[i].func_name);
if (func)
register_plugin_event(func, events[i].event_name);
}
@@ -340,27 +341,27 @@ void plugins_init(void)
register_plugin_func(EVENT_ATHENA_FINAL);
// networking
- export_symbol(RFIFOSKIP, SYMBOL_RFIFOSKIP);
- export_symbol(WFIFOSET, SYMBOL_WFIFOSET);
- export_symbol(do_close, SYMBOL_DELETE_SESSION);
- export_symbol(session, SYMBOL_SESSION);
- export_symbol(&fd_max, SYMBOL_FD_MAX);
- export_symbol(addr_, SYMBOL_ADDR);
+ EXPORT_SYMBOL(RFIFOSKIP, SYMBOL_RFIFOSKIP);
+ EXPORT_SYMBOL(WFIFOSET, SYMBOL_WFIFOSET);
+ EXPORT_SYMBOL(do_close, SYMBOL_DELETE_SESSION);
+ EXPORT_SYMBOL(session, SYMBOL_SESSION);
+ EXPORT_SYMBOL(&fd_max, SYMBOL_FD_MAX);
+ EXPORT_SYMBOL(addr_, SYMBOL_ADDR);
// timers
- export_symbol(get_uptime, SYMBOL_GET_UPTIME);
- export_symbol(delete_timer, SYMBOL_DELETE_TIMER);
- export_symbol(add_timer_func_list, SYMBOL_ADD_TIMER_FUNC_LIST);
- export_symbol(add_timer_interval, SYMBOL_ADD_TIMER_INTERVAL);
- export_symbol(add_timer, SYMBOL_ADD_TIMER);
- export_symbol((void*)get_svn_revision, SYMBOL_GET_SVN_REVISION);
- export_symbol(gettick, SYMBOL_GETTICK);
+ EXPORT_SYMBOL(get_uptime, SYMBOL_GET_UPTIME);
+ EXPORT_SYMBOL(delete_timer, SYMBOL_DELETE_TIMER);
+ EXPORT_SYMBOL(add_timer_func_list, SYMBOL_ADD_TIMER_FUNC_LIST);
+ EXPORT_SYMBOL(add_timer_interval, SYMBOL_ADD_TIMER_INTERVAL);
+ EXPORT_SYMBOL(add_timer, SYMBOL_ADD_TIMER);
+ EXPORT_SYMBOL((void*)get_svn_revision, SYMBOL_GET_SVN_REVISION);
+ EXPORT_SYMBOL(gettick, SYMBOL_GETTICK);
// core
- export_symbol(parse_console, SYMBOL_PARSE_CONSOLE);
- export_symbol(&runflag, SYMBOL_RUNFLAG);
- export_symbol(arg_v, SYMBOL_ARG_V);
- export_symbol(&arg_c, SYMBOL_ARG_C);
- export_symbol(SERVER_NAME, SYMBOL_SERVER_NAME);
- export_symbol(&SERVER_TYPE, SYMBOL_SERVER_TYPE);
+ EXPORT_SYMBOL(parse_console, SYMBOL_PARSE_CONSOLE);
+ EXPORT_SYMBOL(&runflag, SYMBOL_RUNFLAG);
+ EXPORT_SYMBOL(arg_v, SYMBOL_ARG_V);
+ EXPORT_SYMBOL(&arg_c, SYMBOL_ARG_C);
+ EXPORT_SYMBOL(SERVER_NAME, SYMBOL_SERVER_NAME);
+ EXPORT_SYMBOL(&SERVER_TYPE, SYMBOL_SERVER_TYPE);
load_priority = 1;
plugins_config_read(PLUGIN_CONF_FILENAME);
diff --git a/src/common/plugins.h b/src/common/plugins.h
index b4235e72d..9d93bcaa6 100644
--- a/src/common/plugins.h
+++ b/src/common/plugins.h
@@ -17,7 +17,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define DLL_OPEN(x) LoadLibrary(x)
- #define DLL_SYM(x,y,z) (FARPROC)(x) = GetProcAddress(y,z)
+ #define DLL_SYM(x,y) GetProcAddress(x,y)
#define DLL_CLOSE(x) FreeLibrary(x)
char *DLL_ERROR(void);
@@ -28,7 +28,7 @@
#include <dlfcn.h>
#define DLL_OPEN(x) dlopen(x,RTLD_NOW)
- #define DLL_SYM(x,y,z) (x) = (void *)dlsym(y,z)
+ #define DLL_SYM(x,y) dlsym(x,y)
#define DLL_CLOSE(x) dlclose(x)
#define DLL_ERROR dlerror
@@ -60,7 +60,8 @@ int register_plugin_event(Plugin_Event_Func* func, char* name);
int plugin_event_trigger(char* name);
int export_symbol(void* var, size_t offset);
-#define EXPORT_SYMBOL(s) export_symbol((s), -1);
+#define EXPORT_SYMBOL(s,o) export_symbol((void*)(s),(o));
+#define EXPORT_SYMBOL2(s) EXPORT_SYMBOL((s), -1);
Plugin* plugin_open(const char* filename);
void plugin_load(const char* filename);
diff --git a/src/common/strlib.c b/src/common/strlib.c
index b65bc0c55..5b53a29da 100644
--- a/src/common/strlib.c
+++ b/src/common/strlib.c
@@ -241,7 +241,7 @@ char* _strtok_r(char *s1, const char *s2, char **lasts)
}
#endif
-#if !(defined(WIN32) && defined(_MSC_VER) && _MSC_VER >= 1400)
+#if !(defined(WIN32) && defined(_MSC_VER) && _MSC_VER >= 1400) && !defined(CYGWIN)
/* Find the length of STRING, but scan at most MAXLEN characters.
If no '\0' terminator is found in that many characters, return MAXLEN. */
size_t strnlen (const char* string, size_t maxlen)
diff --git a/src/common/strlib.h b/src/common/strlib.h
index d1fb20d49..004fe6375 100644
--- a/src/common/strlib.h
+++ b/src/common/strlib.h
@@ -24,7 +24,7 @@ const char *stristr(const char *haystack, const char *needle);
char* _strtok_r(char* s1, const char* s2, char** lasts);
#endif
-#if !(defined(WIN32) && defined(_MSC_VER) && _MSC_VER >= 1400)
+#if !(defined(WIN32) && defined(_MSC_VER) && _MSC_VER >= 1400) && !defined(CYGWIN)
size_t strnlen (const char* string, size_t maxlen);
#endif
@@ -49,7 +49,7 @@ int strline(const char* str, size_t pos);
/// Bitfield determining the behaviour of sv_parse.
-enum e_svopt
+typedef enum e_svopt
{
// default: no escapes and no line terminator
SV_NOESCAPE_NOTERMINATE = 0,
@@ -59,7 +59,7 @@ enum e_svopt
SV_TERMINATE_LF = 2,
SV_TERMINATE_CRLF = 4,
SV_TERMINATE_CR = 8,
-};
+} e_svopt;
/// Other escape sequences supported by the C compiler.
#define SV_ESCAPE_C_SUPPORTED "abtnvfr\?\"'\\"
diff --git a/src/common/timer.h b/src/common/timer.h
index 7eedb689e..9c9d5c2b1 100644
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -51,7 +51,7 @@ int add_timer_func_list(TimerFunc func, char* name);
unsigned long get_uptime(void);
unsigned int calc_times(void);
-int do_timer();
+int do_timer(unsigned int tick);
void timer_init(void);
void timer_final(void);
diff --git a/src/login/login.c b/src/login/login.c
index 2931c87cb..7051ffb5e 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -131,7 +131,7 @@ void add_online_user(int char_server, int account_id)
struct online_login_data* p;
if( !login_config.online_check )
return;
- p = idb_ensure(online_db, account_id, create_online_user);
+ p = (struct online_login_data*)idb_ensure(online_db, account_id, create_online_user);
p->char_server = char_server;
if( p->waiting_disconnect != -1 )
{
@@ -154,7 +154,7 @@ void remove_online_user(int account_id)
static int waiting_disconnect_timer(int tid, unsigned int tick, int id, int data)
{
- struct online_login_data* p = idb_get(online_db, id);
+ struct online_login_data* p = (struct online_login_data*)idb_get(online_db, id);
if( p != NULL && p->waiting_disconnect == id )
{
p->waiting_disconnect = -1;
@@ -1122,7 +1122,7 @@ int mmo_auth(struct mmo_account* account, int fd)
else
safestrncpy(user_password, account->passwd, NAME_LENGTH);
- if( !check_password(session[fd]->session_data, account->passwdenc, user_password, auth_dat[i].pass) )
+ if( !check_password((struct login_session_data*)session[fd]->session_data, account->passwdenc, user_password, auth_dat[i].pass) )
{
ShowNotice("Invalid password (account: %s, pass: %s, received pass: %s, ip: %s)\n", account->userid, auth_dat[i].pass, (account->passwdenc) ? "[MD5]" : account->passwd, ip);
return 1; // 1 = Incorrect Password
@@ -1150,7 +1150,7 @@ int mmo_auth(struct mmo_account* account, int fd)
if( login_config.online_check )
{
- struct online_login_data* data = idb_get(online_db,auth_dat[i].account_id);
+ struct online_login_data* data = (struct online_login_data*)idb_get(online_db,auth_dat[i].account_id);
if( data )
{// account is already marked as online!
if( data->char_server > -1 )
@@ -1456,8 +1456,8 @@ int parse_fromchar(int fd)
char actual_email[40];
char new_email[40];
int account_id = RFIFOL(fd,2);
- safestrncpy(actual_email, RFIFOP(fd,6), 40); remove_control_chars(actual_email);
- safestrncpy(new_email, RFIFOP(fd,46), 40); remove_control_chars(new_email);
+ safestrncpy(actual_email, (char*)RFIFOP(fd,6), 40); remove_control_chars(actual_email);
+ safestrncpy(new_email, (char*)RFIFOP(fd,46), 40); remove_control_chars(new_email);
RFIFOSKIP(fd, 86);
if( e_mail_check(actual_email) == 0 )
@@ -1696,7 +1696,7 @@ int parse_fromchar(int fd)
users = RFIFOW(fd,4);
for (i = 0; i < users; i++) {
aid = RFIFOL(fd,6+i*4);
- p = idb_ensure(online_db, aid, create_online_user);
+ p = (struct online_login_data*)idb_ensure(online_db, aid, create_online_user);
p->char_server = id;
if (p->waiting_disconnect != -1)
{
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index fddb4b248..57ec484cb 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -104,7 +104,7 @@ void add_online_user(int char_server, int account_id)
struct online_login_data* p;
if( !login_config.online_check )
return;
- p = idb_ensure(online_db, account_id, create_online_user);
+ p = (struct online_login_data*)idb_ensure(online_db, account_id, create_online_user);
p->char_server = char_server;
if( p->waiting_disconnect != -1 )
{
@@ -127,7 +127,7 @@ void remove_online_user(int account_id)
static int waiting_disconnect_timer(int tid, unsigned int tick, int id, int data)
{
- struct online_login_data* p = idb_get(online_db, id);
+ struct online_login_data* p = (struct online_login_data*)idb_get(online_db, id);
if( p != NULL && p->waiting_disconnect == id )
{
p->waiting_disconnect = -1;
@@ -531,7 +531,7 @@ int mmo_auth(struct mmo_account* account, int fd)
else
safestrncpy(user_password, account->passwd, NAME_LENGTH);
- if( !check_password(session[fd]->session_data, account->passwdenc, user_password, password) )
+ if( !check_password((struct login_session_data*)session[fd]->session_data, account->passwdenc, user_password, password) )
{
ShowInfo("Invalid password (account: '%s', pass: '%s', received pass: '%s', ip: %s)\n",
esc_userid, password, (account->passwdenc) ? "[MD5]" : user_password, ip);
@@ -552,7 +552,7 @@ int mmo_auth(struct mmo_account* account, int fd)
if( login_config.online_check )
{
- struct online_login_data* data = idb_get(online_db, account->account_id);
+ struct online_login_data* data = (struct online_login_data*)idb_get(online_db, account->account_id);
if( data )
{// account is already marked as online!
if( data->char_server > -1 )
@@ -817,8 +817,8 @@ int parse_fromchar(int fd)
char actual_email[40];
char new_email[40];
int account_id = RFIFOL(fd,2);
- safestrncpy(actual_email, RFIFOP(fd,6), 40);
- safestrncpy(new_email, RFIFOP(fd,46), 40);
+ safestrncpy(actual_email, (char*)RFIFOP(fd,6), 40);
+ safestrncpy(new_email, (char*)RFIFOP(fd,46), 40);
RFIFOSKIP(fd, 86);
if( e_mail_check(actual_email) == 0 )
@@ -997,17 +997,17 @@ int parse_fromchar(int fd)
SqlStmt_ShowDebug(stmt);
for( i = 0, off = 13; i < ACCOUNT_REG2_NUM && off < RFIFOW(fd,2); ++i )
{
- uint8* p;
+ char* p;
size_t len;
// str
- p = (uint8*)RFIFOP(fd,off);
+ p = (char*)RFIFOP(fd,off);
len = strlen(p);
SqlStmt_BindParam(stmt, 0, SQLDT_STRING, p, len);
off += len + 1;
// value
- p = (uint8*)RFIFOP(fd,off);
+ p = (char*)RFIFOP(fd,off);
len = strlen(p);
SqlStmt_BindParam(stmt, 1, SQLDT_STRING, p, len);
off += len + 1;
@@ -1067,7 +1067,7 @@ int parse_fromchar(int fd)
users = RFIFOW(fd,4);
for (i = 0; i < users; i++) {
aid = RFIFOL(fd,6+i*4);
- p = idb_ensure(online_db, aid, create_online_user);
+ p = (struct online_login_data*)idb_ensure(online_db, aid, create_online_user);
p->char_server = id;
if (p->waiting_disconnect != -1)
{
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 233376655..38de48e57 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2394,7 +2394,7 @@ int atcommand_monster(const int fd, struct map_session_data* sd, const char* com
ShowInfo("%s monster='%s' name='%s' id=%d count=%d (%d,%d)\n", command, monster, name, mob_id, number, sd->bl.x, sd->bl.y);
count = 0;
- range = (int)sqrt(number) +2; // calculation of an odd number (+ 4 area around)
+ range = (int)sqrt((float)number) +2; // calculation of an odd number (+ 4 area around)
for (i = 0; i < number; i++) {
map_search_freecell(&sd->bl, 0, &mx, &my, range, range, 0);
k = mob_once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, "");
@@ -5365,7 +5365,7 @@ int atcommand_effect(const int fd, struct map_session_data* sd, const char* comm
return -1;
}
- clif_specialeffect(&sd->bl, type, flag);
+ clif_specialeffect(&sd->bl, type, (send_target)flag);
clif_displaymessage(fd, msg_txt(229)); // Your effect has changed.
return 0;
}
@@ -6997,9 +6997,8 @@ int atcommand_mobinfo(const int fd, struct map_session_data* sd, const char* com
*------------------------------------------*/
int atshowmobs_timer(int tid, unsigned int tick, int id, int data)
{
- struct map_session_data *sd;
-
- if (!session[id] || (sd = session[id]->session_data) == NULL)
+ struct map_session_data* sd = map_id2sd(id);
+ if( sd == NULL )
return 0;
clif_viewpoint(sd, 1, 2, 0, 0, data, 0xFFFFFF);
diff --git a/src/map/battle.c b/src/map/battle.c
index 6a60ea0a9..ae0c9d4a0 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -2754,11 +2754,11 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
int skillv;
struct Damage wd;
- nullpo_retr(0, src);
- nullpo_retr(0, target);
+ nullpo_retr(ATK_NONE, src);
+ nullpo_retr(ATK_NONE, target);
if (src->prev == NULL || target->prev == NULL)
- return 0;
+ return ATK_NONE;
sd = BL_CAST(BL_PC, src);
tsd = BL_CAST(BL_PC, target);
@@ -2782,7 +2782,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
damage = sd->equip_index[EQI_AMMO];
if (damage<0) {
clif_arrow_fail(sd,0);
- return 0;
+ return ATK_NONE;
}
//Ammo check by Ishizu-chan
if (sd->inventory_data[damage])
@@ -2790,7 +2790,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
case W_BOW:
if (sd->inventory_data[damage]->look != A_ARROW) {
clif_arrow_fail(sd,0);
- return 0;
+ return ATK_NONE;
}
break;
case W_REVOLVER:
@@ -2799,13 +2799,13 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
case W_SHOTGUN:
if (sd->inventory_data[damage]->look != A_BULLET) {
clif_arrow_fail(sd,0);
- return 0;
+ return ATK_NONE;
}
break;
case W_GRENADE:
if (sd->inventory_data[damage]->look != A_GRENADE) {
clif_arrow_fail(sd,0);
- return 0;
+ return ATK_NONE;
}
break;
}
@@ -2831,7 +2831,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
clif_damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
status_change_end(target,SC_AUTOCOUNTER,-1);
skill_attack(BF_WEAPON,target,target,src,KN_AUTOCOUNTER,skilllv,tick,0);
- return 0;
+ return ATK_NONE;
}
}
if (tsc->data[SC_BLADESTOP_WAIT] && !is_boss(src)) {
@@ -2843,7 +2843,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
clif_damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
clif_bladestop(target,src,1);
sc_start4(target, SC_BLADESTOP, 100, skilllv, 0, 0,(int)src, duration);
- return 0;
+ return ATK_NONE;
}
}
}
@@ -2857,15 +2857,18 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
status_change_end(src,SC_SKILLRATE_UP,-1);
}
if (rand()%100 < triple_rate)
- return skill_attack(BF_WEAPON,src,src,target,MO_TRIPLEATTACK,skillv,tick,0);
+ //FIXME: invalid return type!
+ return (damage_lv)skill_attack(BF_WEAPON,src,src,target,MO_TRIPLEATTACK,skillv,tick,0);
}
if (sc)
{
if (sc->data[SC_SACRIFICE])
- return skill_attack(BF_WEAPON,src,src,target,PA_SACRIFICE,sc->data[SC_SACRIFICE]->val1,tick,0);
+ //FIXME: invalid return type!
+ return (damage_lv)skill_attack(BF_WEAPON,src,src,target,PA_SACRIFICE,sc->data[SC_SACRIFICE]->val1,tick,0);
if (sc->data[SC_MAGICALATTACK])
- return skill_attack(BF_MAGIC,src,src,target,NPC_MAGICALATTACK,sc->data[SC_MAGICALATTACK]->val1,tick,0);
+ //FIXME: invalid return type!
+ return (damage_lv)skill_attack(BF_MAGIC,src,src,target,NPC_MAGICALATTACK,sc->data[SC_MAGICALATTACK]->val1,tick,0);
}
wd = battle_calc_weapon_attack(src, target, 0, 0, flag);
diff --git a/src/map/battle.h b/src/map/battle.h
index 287b4ed61..c6c2eb2e9 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -5,11 +5,12 @@
#define _BATTLE_H_
// state of a single attack attempt; used in flee/def penalty calculations when mobbed
-enum damage_lv {
- ATK_LUCKY=1, // attack was lucky-dodged
+typedef enum damage_lv {
+ ATK_NONE, // not an attack
+ ATK_LUCKY, // attack was lucky-dodged
ATK_FLEE, // attack was dodged
ATK_DEF // attack connected
-};
+} damage_lv;
// ダメージ
struct Damage {
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 7194819cf..7ef032f16 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -106,8 +106,9 @@ int other_mapserver_count=0; //Holds count of how many other map servers are onl
//This define should spare writing the check in every function. [Skotlex]
#define chrif_check(a) { if(!chrif_isconnected()) return a; }
-struct auth_node* chrif_search(int account_id) {
- return idb_get(auth_db, account_id);
+struct auth_node* chrif_search(int account_id)
+{
+ return (struct auth_node*)idb_get(auth_db, account_id);
}
struct auth_node* chrif_auth_check(int account_id, int char_id, enum sd_state state) {
@@ -1234,7 +1235,7 @@ int chrif_load_scdata(int fd)
for (i = 0; i < count; i++)
{
data = (struct status_change_data*)RFIFOP(fd,14 + i*sizeof(struct status_change_data));
- status_change_start(&sd->bl, data->type, 10000, data->val1, data->val2, data->val3, data->val4, data->tick, 15);
+ status_change_start(&sd->bl, (sc_type)data->type, 10000, data->val1, data->val2, data->val3, data->val4, data->tick, 15);
}
#endif
return 0;
diff --git a/src/map/clif.c b/src/map/clif.c
index a91c8d9ca..532d42ff1 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -678,7 +678,7 @@ static int clif_clearunit_delayed_sub(int tid, unsigned int tick, int id, int da
int clif_clearunit_delayed(struct block_list* bl, unsigned int tick)
{
struct block_list *tbl;
- tbl = aMalloc(sizeof (struct block_list));
+ tbl = (struct block_list*)aMalloc(sizeof (struct block_list));
memcpy (tbl, bl, sizeof (struct block_list));
add_timer(tick, clif_clearunit_delayed_sub, (int)tbl, 0);
return 0;
@@ -1009,21 +1009,18 @@ static void clif_weather_check(struct map_session_data *sd)
}
}
-int clif_weather(int m)
+void clif_weather(int m)
{
- int i;
-
+ struct s_mapiterator* iter;
struct map_session_data *sd=NULL;
- for(i = 0; i < fd_max; i++) {
- if (session[i] && session[i]->func_parse == clif_parse &&
- (sd = session[i]->session_data) != NULL &&
- sd->state.active && sd->bl.m == m) {
+ iter = mapit_getallusers();
+ for( sd = (struct map_session_data*)mapit_first(iter); mapit_exists(iter); sd = (struct map_session_data*)mapit_next(iter) )
+ {
+ if( sd->bl.m == m )
clif_weather_check(sd);
- }
}
-
- return 0;
+ mapit_free(iter);
}
int clif_spawn(struct block_list *bl)
@@ -2488,9 +2485,8 @@ void clif_changetraplook(struct block_list *bl,int val)
}
-//For the stupid cloth-dye bug. Resends the given view data
-//to the area specified by bl.
-void clif_refreshlook(struct block_list *bl,int id,int type,int val,int area)
+//For the stupid cloth-dye bug. Resends the given view data to the area specified by bl.
+void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target)
{
unsigned char buf[32];
#if PACKETVER < 4
@@ -2498,14 +2494,14 @@ void clif_refreshlook(struct block_list *bl,int id,int type,int val,int area)
WBUFL(buf,2)=id;
WBUFB(buf,6)=type;
WBUFB(buf,7)=val;
- clif_send(buf,packet_len(0xc3),bl,area);
+ clif_send(buf,packet_len(0xc3),bl,target);
#else
WBUFW(buf,0)=0x1d7;
WBUFL(buf,2)=id;
WBUFB(buf,6)=type;
WBUFW(buf,7)=val;
WBUFW(buf,9)=0;
- clif_send(buf,packet_len(0x1d7),bl,area);
+ clif_send(buf,packet_len(0x1d7),bl,target);
#endif
return;
}
@@ -6485,9 +6481,9 @@ int clif_guild_expulsion(struct map_session_data *sd,const char *name,const char
nullpo_retr(0, sd);
WBUFW(buf, 0)=0x15c;
- safestrncpy(WBUFP(buf, 2),name,NAME_LENGTH);
- safestrncpy(WBUFP(buf,26),mes,40);
- safestrncpy(WBUFP(buf,66),"",NAME_LENGTH); // account name (not used for security reasons)
+ safestrncpy((char*)WBUFP(buf, 2),name,NAME_LENGTH);
+ safestrncpy((char*)WBUFP(buf,26),mes,40);
+ safestrncpy((char*)WBUFP(buf,66),"",NAME_LENGTH); // account name (not used for security reasons)
clif_send(buf,packet_len(0x15c),&sd->bl,GUILD);
return 0;
}
@@ -6512,9 +6508,9 @@ int clif_guild_expulsionlist(struct map_session_data *sd)
for(i=c=0;i<MAX_GUILDEXPULSION;i++){
struct guild_expulsion *e=&g->expulsion[i];
if(e->account_id>0){
- safestrncpy(WFIFOP(fd,4 + c*88),e->name,NAME_LENGTH);
- safestrncpy(WFIFOP(fd,4 + c*88+24),"",24); // account name (not used for security reasons)
- safestrncpy(WFIFOP(fd,4 + c*88+48),e->mes,40);
+ safestrncpy((char*)WFIFOP(fd,4 + c*88),e->name,NAME_LENGTH);
+ safestrncpy((char*)WFIFOP(fd,4 + c*88+24),"",24); // account name (not used for security reasons)
+ safestrncpy((char*)WFIFOP(fd,4 + c*88+48),e->mes,40);
c++;
}
}
@@ -8263,7 +8259,7 @@ void clif_parse_MapMove(int fd, struct map_session_data *sd)
/*==========================================
*
*------------------------------------------*/
-void clif_changed_dir(struct block_list *bl, int type)
+void clif_changed_dir(struct block_list *bl, enum send_target target)
{
unsigned char buf[64];
@@ -8272,7 +8268,8 @@ void clif_changed_dir(struct block_list *bl, int type)
WBUFW(buf,6) = bl->type==BL_PC?((TBL_PC*)bl)->head_dir:0;
WBUFB(buf,8) = unit_getdir(bl);
- clif_send(buf, packet_len(0x9c), bl, type);
+ clif_send(buf, packet_len(0x9c), bl, target);
+
if (disguised(bl)) {
WBUFL(buf,2) = -bl->id;
WBUFW(buf,6) = 0;
@@ -9005,10 +9002,13 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd)
return;
}
- if(battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 1){
- trade_traderequest(sd,t_sd);
- } else
+ if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 1)
+ {
clif_skill_fail(sd,1,0,0);
+ return;
+ }
+
+ trade_traderequest(sd,t_sd);
}
/*==========================================
@@ -9712,19 +9712,24 @@ void clif_parse_StoragePassword(int fd, struct map_session_data *sd)
/*==========================================
- * パーティを作る
+ * Party creation request
+ * S 00f9 <party name>.24S
+ * S 01e8 <party name>.24S <item1>.B <item2>.B
*------------------------------------------*/
void clif_parse_CreateParty(int fd, struct map_session_data *sd)
{
if(map[sd->bl.m].flag.partylock)
- { //Guild locked.
+ {// Party locked.
clif_displaymessage(fd, msg_txt(227));
return;
}
- if (battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 7) {
- party_create(sd,(char*)RFIFOP(fd,2),0,0);
- } else
+ if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 7 )
+ {
clif_skill_fail(sd,1,0,4);
+ return;
+ }
+
+ party_create(sd,(char*)RFIFOP(fd,2),0,0);
}
/*==========================================
@@ -9733,33 +9738,38 @@ void clif_parse_CreateParty(int fd, struct map_session_data *sd)
void clif_parse_CreateParty2(int fd, struct map_session_data *sd)
{
if(map[sd->bl.m].flag.partylock)
- { //Guild locked.
+ {// Party locked.
clif_displaymessage(fd, msg_txt(227));
return;
}
- if (battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 7)
- party_create(sd,(char*)RFIFOP(fd,2),RFIFOB(fd,26),RFIFOB(fd,27));
- else
+ if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 7 )
+ {
clif_skill_fail(sd,1,0,4);
+ return;
+ }
+
+ party_create(sd,(char*)RFIFOP(fd,2),RFIFOB(fd,26),RFIFOB(fd,27));
}
/*==========================================
- * パーティに勧誘
+ * Party invitation request
+ * S 00fc <account ID>.L
+ * S 02c4 <char name>.24S
*------------------------------------------*/
void clif_parse_PartyInvite(int fd, struct map_session_data *sd)
{
struct map_session_data *t_sd;
if(map[sd->bl.m].flag.partylock)
- { //Guild locked.
+ {// Party locked.
clif_displaymessage(fd, msg_txt(227));
return;
}
t_sd = map_id2sd(RFIFOL(fd,2));
- // @noask [LuzZza]
- if(t_sd && t_sd->state.noask) {
+ if(t_sd && t_sd->state.noask)
+ {// @noask [LuzZza]
clif_noask_sub(sd, t_sd, 1);
return;
}
@@ -9771,18 +9781,18 @@ void clif_parse_PartyInvite2(int fd, struct map_session_data *sd)
{
struct map_session_data *t_sd;
char *name = (char*)RFIFOP(fd,2);
- name[NAME_LENGTH]='\0';
+ name[NAME_LENGTH-1] = '\0';
if(map[sd->bl.m].flag.partylock)
- { //Guild locked.
+ {// Party locked.
clif_displaymessage(fd, msg_txt(227));
return;
}
t_sd = map_nick2sd(name);
- // @noask [LuzZza]
- if(t_sd && t_sd->state.noask) {
+ if(t_sd && t_sd->state.noask)
+ {// @noask [LuzZza]
clif_noask_sub(sd, t_sd, 1);
return;
}
@@ -11710,7 +11720,7 @@ void clif_Auction_openwindow(struct map_session_data *sd)
WFIFOSET(fd,12);
}
-void clif_Auction_results(struct map_session_data *sd, short count, short pages, unsigned char *buf)
+void clif_Auction_results(struct map_session_data *sd, short count, short pages, uint8 *buf)
{
int i, fd = sd->fd, len = sizeof(struct auction_data);
struct auction_data auction;
@@ -11729,7 +11739,7 @@ void clif_Auction_results(struct map_session_data *sd, short count, short pages,
k = 12 + (i * 83);
WFIFOL(fd,k) = auction.auction_id;
- safestrncpy(WFIFOP(fd,4+k), auction.seller_name, NAME_LENGTH);
+ safestrncpy((char*)WFIFOP(fd,4+k), auction.seller_name, NAME_LENGTH);
if( (item = itemdb_search(auction.item.nameid)) != NULL && item->view_id > 0 )
WFIFOW(fd,28+k) = item->view_id;
@@ -11748,7 +11758,7 @@ void clif_Auction_results(struct map_session_data *sd, short count, short pages,
WFIFOW(fd,45+k) = auction.item.card[3];
WFIFOL(fd,47+k) = auction.price;
WFIFOL(fd,51+k) = auction.buynow;
- safestrncpy(WFIFOP(fd,55+k), auction.buyer_name, NAME_LENGTH);
+ safestrncpy((char*)WFIFOP(fd,55+k), auction.buyer_name, NAME_LENGTH);
WFIFOL(fd,79+k) = auction.timestamp;
}
WFIFOSET(fd, 12 + (count * 83));
diff --git a/src/map/clif.h b/src/map/clif.h
index 8c48b7277..d0a4fe4b4 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -56,7 +56,7 @@ struct s_packet_db {
extern struct s_packet_db packet_db[MAX_PACKET_VER+1][MAX_PACKET_DB+1];
// local define
-enum send_target {
+typedef enum send_target {
ALL_CLIENT,
ALL_SAMEMAP,
AREA, // area
@@ -82,7 +82,7 @@ enum send_target {
DUEL_WOS,
CHAT_MAINCHAT, // everyone on main chat
SELF,
-};
+} send_target;
int clif_setip(const char* ip);
void clif_setbindip(const char* ip);
@@ -132,7 +132,7 @@ void clif_sitting(struct block_list* bl);
void clif_standing(struct block_list* bl);
void clif_changelook(struct block_list *bl,int type,int val); // area
void clif_changetraplook(struct block_list *bl,int val); // area
-void clif_refreshlook(struct block_list *bl,int id,int type,int val,int area); //area specified in 'area'
+void clif_refreshlook(struct block_list *bl,int id,int type,int val,enum send_target target); //area specified in 'target'
int clif_arrowequip(struct map_session_data *sd,int val); //self
int clif_arrow_fail(struct map_session_data *sd,int type); //self
int clif_arrow_create_list(struct map_session_data *sd); //self
@@ -262,7 +262,7 @@ int clif_item_skill(struct map_session_data *sd,int skillid,int skilllv);
int clif_mvp_effect(struct map_session_data *sd);
int clif_mvp_item(struct map_session_data *sd,int nameid);
int clif_mvp_exp(struct map_session_data *sd, unsigned int exp);
-void clif_changed_dir(struct block_list *bl, int area);
+void clif_changed_dir(struct block_list *bl, enum send_target target);
// vending
void clif_openvendingreq(struct map_session_data* sd, int num);
@@ -355,7 +355,7 @@ void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_dat
// [Valaris]
int clif_mob_hp(struct mob_data *md);
-int clif_weather(int m); // [Valaris]
+void clif_weather(int m); // [Valaris]
int clif_specialeffect(struct block_list* bl, int type, enum send_target target); // special effects [Valaris]
void clif_specialeffect_single(struct block_list* bl, int type, int fd);
int clif_message(struct block_list *bl, const char* msg); // messages (from mobs/npcs) [Valaris]
@@ -409,7 +409,7 @@ void clif_Mail_refreshinbox(struct map_session_data *sd);
void clif_Mail_getattachment(int fd, uint8 flag);
// AUCTION SYSTEM
void clif_Auction_openwindow(struct map_session_data *sd);
-void clif_Auction_results(struct map_session_data *sd, short count, short pages, unsigned char *buf);
+void clif_Auction_results(struct map_session_data *sd, short count, short pages, uint8 *buf);
void clif_Auction_message(int fd, unsigned char flag);
void clif_Auction_close(int fd, unsigned char flag);
void clif_parse_Auction_cancelreg(int fd, struct map_session_data *sd);
diff --git a/src/map/guild.c b/src/map/guild.c
index ed35aaccb..8413c5c37 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -223,7 +223,7 @@ static int guild_read_castledb(void)
/// lookup: guild id -> guild*
struct guild* guild_search(int guild_id)
{
- return idb_get(guild_db,guild_id);
+ return (struct guild*)idb_get(guild_db,guild_id);
}
/// lookup: guild name -> guild*
@@ -232,7 +232,7 @@ struct guild* guild_searchname(char* str)
struct guild* g;
DBIterator* iter = guild_db->iterator(guild_db);
- for( g = iter->first(iter,NULL); iter->exists(iter); g = iter->next(iter,NULL) )
+ for( g = (struct guild*)iter->first(iter,NULL); iter->exists(iter); g = (struct guild*)iter->next(iter,NULL) )
{
if( strcmpi(g->name, str) == 0 )
break;
@@ -245,7 +245,7 @@ struct guild* guild_searchname(char* str)
/// lookup: castle id -> castle*
struct guild_castle* guild_castle_search(int gcid)
{
- return idb_get(castle_db,gcid);
+ return (struct guild_castle*)idb_get(castle_db,gcid);
}
/// lookup: map index -> castle*
@@ -254,7 +254,7 @@ struct guild_castle* guild_mapindex2gc(short mapindex)
struct guild_castle* gc;
DBIterator* iter = castle_db->iterator(castle_db);
- for( gc = iter->first(iter,NULL); iter->exists(iter); gc = iter->next(iter,NULL) )
+ for( gc = (struct guild_castle*)iter->first(iter,NULL); iter->exists(iter); gc = (struct guild_castle*)iter->next(iter,NULL) )
{
if( gc->mapindex == mapindex )
break;
@@ -460,7 +460,7 @@ int guild_npc_request_info(int guild_id,const char *event)
ev=(struct eventlist *)aCalloc(sizeof(struct eventlist),1);
memcpy(ev->name,event,strlen(event));
//The one in the db becomes the next event from this.
- ev->next=idb_put(guild_infoevent_db,guild_id,ev);
+ ev->next = (struct eventlist*)idb_put(guild_infoevent_db,guild_id,ev);
}
return guild_request_info(guild_id);
@@ -521,7 +521,8 @@ int guild_recv_info(struct guild *sg)
nullpo_retr(0, sg);
- if((g=idb_get(guild_db,sg->guild_id))==NULL){
+ if((g = (struct guild*)idb_get(guild_db,sg->guild_id))==NULL)
+ {
guild_new = true;
g=(struct guild *)aCalloc(1,sizeof(struct guild));
idb_put(guild_db,sg->guild_id,g);
@@ -588,7 +589,8 @@ int guild_recv_info(struct guild *sg)
}
// イベントの発生
- if( (ev=idb_remove(guild_infoevent_db,sg->guild_id))!=NULL ){
+ if( (ev = (struct eventlist*)idb_remove(guild_infoevent_db,sg->guild_id))!=NULL )
+ {
while(ev){
npc_event_do(ev->name);
ev2=ev->next;
@@ -1141,7 +1143,7 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp)
exp = (unsigned int) exp * per / 100;
//Otherwise tax everything.
- c = guild_expcache_db->ensure(guild_expcache_db, i2key(sd->status.char_id), create_expcache, sd);
+ c = (struct guild_expcache*)guild_expcache_db->ensure(guild_expcache_db, i2key(sd->status.char_id), create_expcache, sd);
if (c->exp > UINT_MAX - exp)
c->exp = UINT_MAX;
@@ -1161,7 +1163,7 @@ int guild_getexp(struct map_session_data *sd,int exp)
if (sd->status.guild_id == 0 || (g = guild_search(sd->status.guild_id)) == NULL)
return 0;
- c = guild_expcache_db->ensure(guild_expcache_db, i2key(sd->status.char_id), create_expcache, sd);
+ c = (struct guild_expcache*)guild_expcache_db->ensure(guild_expcache_db, i2key(sd->status.char_id), create_expcache, sd);
if (c->exp > UINT_MAX - exp)
c->exp = UINT_MAX;
else
@@ -1676,10 +1678,10 @@ int guild_addcastleinfoevent(int castle_id,int index,const char *name)
if( name==NULL || *name==0 )
return 0;
- ev=(struct eventlist *)aMalloc(sizeof(struct eventlist));
+ ev = (struct eventlist *)aMalloc(sizeof(struct eventlist));
memcpy(ev->name,name,sizeof(ev->name));
//The next event becomes whatever was currently stored.
- ev->next= idb_put(guild_castleinfoevent_db,code,ev);
+ ev->next = (struct eventlist *)idb_put(guild_castleinfoevent_db,code,ev);
return 0;
}
@@ -1720,7 +1722,9 @@ int guild_castledataloadack(int castle_id,int index,int value)
ShowError("guild_castledataloadack ERROR!! (Not found index=%d)\n", index);
return 0;
}
- if( (ev=idb_remove(guild_castleinfoevent_db,code))!=NULL ){
+
+ if( (ev = (struct eventlist *)idb_remove(guild_castleinfoevent_db,code))!=NULL )
+ {
while(ev){
npc_event_do(ev->name);
ev2=ev->next;
diff --git a/src/map/intif.c b/src/map/intif.c
index 51bbd740b..b0013aa52 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -585,7 +585,7 @@ int intif_guild_leave(int guild_id,int account_id,int char_id,int flag,const cha
WFIFOL(inter_fd, 6) = account_id;
WFIFOL(inter_fd,10) = char_id;
WFIFOB(inter_fd,14) = flag;
- safestrncpy(WFIFOP(inter_fd,15),mes,40);
+ safestrncpy((char*)WFIFOP(inter_fd,15),mes,40);
WFIFOSET(inter_fd,55);
return 0;
}
@@ -1702,12 +1702,14 @@ int intif_Auction_requestlist(int char_id, short type, int price, const char* se
static void intif_parse_Auction_results(int fd)
{
struct map_session_data *sd = map_charid2sd(RFIFOL(fd,4));
- short count = RFIFOW(fd,8), pages = RFIFOW(fd,10);
+ short count = RFIFOW(fd,8);
+ short pages = RFIFOW(fd,10);
+ uint8* data = RFIFOP(fd,12);
if( sd == NULL )
return;
- clif_Auction_results(sd, count, pages, (char *)RFIFOP(fd,12));
+ clif_Auction_results(sd, count, pages, data);
}
int intif_Auction_register(struct auction_data *auction)
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 7d2623fce..d8c767dc8 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -176,7 +176,7 @@ struct item_data* itemdb_exists(int nameid)
if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb_array) )
return itemdb_array[nameid];
- item = idb_get(itemdb_other,nameid);
+ item = (struct item_data*)idb_get(itemdb_other,nameid);
if( item == &dummy_item )
return NULL;// dummy data, doesn't exist
return item;
@@ -279,16 +279,16 @@ struct item_data* itemdb_load(int nameid)
if( id == NULL )
{
key.i = nameid;
- id = itemdb_array[nameid] = create_item_data(key, NULL);
+ id = itemdb_array[nameid] = (struct item_data*)create_item_data(key, NULL);
}
return id;
}
- id = idb_ensure(itemdb_other, nameid, create_item_data);
+ id = (struct item_data*)idb_ensure(itemdb_other, nameid, create_item_data);
if( id == &dummy_item )
{// Remove dummy_item, replace by real data.
key.i = nameid;
- id = create_item_data(key, NULL);
+ id = (struct item_data*)create_item_data(key, NULL);
idb_put(itemdb_other, nameid, id);
}
return id;
@@ -314,7 +314,7 @@ struct item_data* itemdb_search(int nameid)
key.i = nameid;
return (struct item_data*)return_dummy_data(key, NULL);
}
- return idb_ensure(itemdb_other,nameid,return_dummy_data);
+ return (struct item_data*)idb_ensure(itemdb_other,nameid,return_dummy_data);
}
/*==========================================
diff --git a/src/map/log.c b/src/map/log.c
index 0483b6387..5cafcf719 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -426,9 +426,9 @@ int log_config_read(char *cfgName)
if(sscanf(line, "%[^:]: %[^\r\n]", w1, w2) == 2)
{
if(strcmpi(w1,"enable_logs") == 0) {
- log_config.enable_logs = (atoi(w2));
+ log_config.enable_logs = (log_what)atoi(w2);
if (log_config.enable_logs&1) //Log everything.
- log_config.enable_logs=0xFFFFFFFF;
+ log_config.enable_logs = LOG_ALL;
} else if(strcmpi(w1,"sql_logs") == 0) {
log_config.sql_logs = (bool)atoi(w2);
//start of common filter settings
diff --git a/src/map/log.h b/src/map/log.h
index 758bebd71..9745ce1f0 100644
--- a/src/map/log.h
+++ b/src/map/log.h
@@ -24,7 +24,7 @@ int log_mvpdrop(struct map_session_data *sd, int monster_id, int *log_mvp);
int log_config_read(char *cfgName);
-enum log_what {
+typedef enum log_what {
LOG_ALL = 0xFFF,
LOG_TRADES = 0x002,
LOG_VENDING = 0x004,
@@ -36,7 +36,7 @@ enum log_what {
LOG_USED_ITEMS = 0x100, // used by player
LOG_MVP_PRIZE = 0x200,
LOG_COMMAND_ITEMS = 0x400 // created/deleted through @/# commands
-};
+} log_what;
extern struct Log_Config {
enum log_what enable_logs;
diff --git a/src/map/map.c b/src/map/map.c
index 83f6b855e..33a5343c4 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -951,7 +951,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y
if (length)
{ //Adjust final position to fit in the given area.
//TODO: Find an alternate method which does not requires a square root calculation.
- k = (int)sqrt(magnitude2);
+ k = (int)sqrt((float)magnitude2);
mx1 = x0 + (x1 - x0)*length/k;
my1 = y0 + (y1 - y0)*length/k;
len_limit = MAGNITUDE2(x0,y0, mx1,my1);
@@ -1449,7 +1449,7 @@ void map_addnickdb(int charid, const char* nick)
if( map_charid2sd(charid) )
return;// already online
- p = idb_ensure(nick_db, charid, create_charid2nick);
+ p = (struct charid2nick*)idb_ensure(nick_db, charid, create_charid2nick);
safestrncpy(p->nick, nick, sizeof(p->nick));
while( p->requests )
@@ -1471,7 +1471,7 @@ void map_delnickdb(int charid, const char* name)
struct charid_request* req;
struct map_session_data* sd;
- p = idb_remove(nick_db, charid);
+ p = (struct charid2nick*)idb_remove(nick_db, charid);
if( p == NULL )
return;
@@ -1734,7 +1734,7 @@ struct block_list * map_id2bl(int id)
if(id >= 0 && id < ARRAYLENGTH(objects))
bl = objects[id];
else
- bl = idb_get(id_db,id);
+ bl = (struct block_list*)idb_get(id_db,id);
return bl;
}
@@ -2149,7 +2149,7 @@ int map_random_dir(struct block_list *bl, short *x, short *y)
short yi = *y-bl->y;
short i=0, j;
int dist2 = xi*xi + yi*yi;
- short dist = (short)sqrt(dist2);
+ short dist = (short)sqrt((float)dist2);
short segment;
if (dist < 1) dist =1;
@@ -2158,7 +2158,7 @@ int map_random_dir(struct block_list *bl, short *x, short *y)
j = rand()%8; //Pick a random direction
segment = 1+(rand()%dist); //Pick a random interval from the whole vector in that direction
xi = bl->x + segment*dirx[j];
- segment = (short)sqrt(dist2 - segment*segment); //The complement of the previously picked segment
+ segment = (short)sqrt((float)(dist2 - segment*segment)); //The complement of the previously picked segment
yi = bl->y + segment*diry[j];
} while (
(map_getcell(bl->m,xi,yi,CELL_CHKNOPASS) || !path_search(NULL,bl->m,bl->x,bl->y,xi,yi,1,CELL_CHKNOREACH))
@@ -2385,7 +2385,7 @@ int map_eraseipport(unsigned short mapindex, uint32 ip, uint16 port)
{
struct map_data_other_server *mdos;
- mdos = uidb_get(map_db,(unsigned int)mapindex);
+ mdos = (struct map_data_other_server*)uidb_get(map_db,(unsigned int)mapindex);
if(!mdos || mdos->cell) //Map either does not exists or is a local map.
return 0;
@@ -2432,8 +2432,8 @@ int map_readfromcache(struct map_data *m, FILE *fp)
m->ys = info.ys;
size = info.xs*info.ys;
- buf = aMalloc(info.len); // temp buffer to read the zipped map
- buf2 = aMalloc(size); // temp buffer to unpack the data
+ buf = (unsigned char*)aMalloc(info.len); // temp buffer to read the zipped map
+ buf2 = (unsigned char*)aMalloc(size); // temp buffer to unpack the data
CREATE(m->cell, struct mapcell, size);
fread(buf, info.len, 1, fp);
diff --git a/src/map/map.h b/src/map/map.h
index bf168b20c..1dbc4581a 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -176,11 +176,12 @@ enum bl_type {
BL_SKILL = 0x020,
BL_NPC = 0x040,
BL_CHAT = 0x080,
+
+ BL_ALL = 0xFFF,
};
//For common mapforeach calls. Since pets cannot be affected, they aren't included here yet.
#define BL_CHAR (BL_PC|BL_MOB|BL_HOM)
-#define BL_ALL 0xfff
enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP };
@@ -228,6 +229,7 @@ struct block_list {
enum bl_type type;
};
+
// Mob List Held in memory for Dynamic Mobs [Wizputer]
// Expanded to specify all mob-related spawn data by [Skotlex]
struct spawn_data {
@@ -248,6 +250,7 @@ struct spawn_data {
+
struct flooritem_data {
struct block_list bl;
unsigned char subx,suby;
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 039a7f446..66658a1d9 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -606,7 +606,7 @@ int merc_hom_alloc(struct map_session_data *sd, struct s_homunculus *hom)
intif_homunculus_requestdelete(hom->hom_id);
return 1;
}
- sd->hd = hd = aCalloc(1,sizeof(struct homun_data));
+ sd->hd = hd = (struct homun_data*)aCalloc(1,sizeof(struct homun_data));
hd->bl.type = BL_HOM;
hd->bl.id = npc_get_new_npc_id();
diff --git a/src/map/mercenary.h b/src/map/mercenary.h
index 2e90786cd..88692b4d1 100644
--- a/src/map/mercenary.h
+++ b/src/map/mercenary.h
@@ -7,18 +7,21 @@
#include "status.h" // struct status_data, struct status_change
#include "unit.h" // struct unit_data
+struct h_stats {
+ unsigned int HP, SP;
+ unsigned short str, agi, vit, int_, dex, luk;
+};
+
struct s_homunculus_db {
int base_class, evo_class;
char name[NAME_LENGTH];
- struct h_stats {
- unsigned int HP, SP;
- unsigned short str, agi, vit, int_, dex, luk;
- } base, gmin, gmax, emin, emax;
+ struct h_stats base, gmin, gmax, emin, emax;
int foodID ;
int baseASPD ;
long hungryDelay ;
unsigned char element, race, base_size, evo_size;
};
+
extern struct s_homunculus_db homuncumlus_db[MAX_HOMUNCULUS_CLASS];
enum { HOMUNCULUS_CLASS, HOMUNCULUS_FOOD };
enum {
diff --git a/src/map/mob.c b/src/map/mob.c
index bd9ed5d43..6463c2103 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -209,7 +209,7 @@ int mob_parse_dataset(struct spawn_data *data)
*------------------------------------------*/
struct mob_data* mob_spawn_dataset(struct spawn_data *data)
{
- struct mob_data *md = aCalloc(1, sizeof(struct mob_data));
+ struct mob_data *md = (struct mob_data*)aCalloc(1, sizeof(struct mob_data));
md->bl.id= npc_get_new_npc_id();
md->bl.type = BL_MOB;
md->bl.m = data->m;
@@ -419,7 +419,7 @@ int mob_once_spawn(struct map_session_data* sd, int m, short x, short y, const c
struct guild_castle* gc = guild_mapindex2gc(map[m].index);
struct guild* g = gc?guild_search(gc->guild_id):NULL;
if(gc) {
- md->guardian_data = aCalloc(1, sizeof(struct guardian_data));
+ md->guardian_data = (struct guardian_data*)aCalloc(1, sizeof(struct guardian_data));
md->guardian_data->castle = gc;
md->guardian_data->number = MAX_GUARDIANS;
md->guardian_data->guild_id = gc->guild_id;
@@ -586,7 +586,7 @@ void mob_barricade_get(struct map_session_data *sd)
return;
iter = barricade_db->iterator(barricade_db);
- for( barricade = iter->first(iter,&key); iter->exists(iter); barricade = iter->next(iter,&key) )
+ for( barricade = (struct barricade_data *)iter->first(iter,&key); iter->exists(iter); barricade = (struct barricade_data *)iter->next(iter,&key) )
{
if( sd->bl.m != barricade->m )
continue;
@@ -655,7 +655,7 @@ void mod_barricade_clearall(void)
int i;
iter = barricade_db->iterator(barricade_db);
- for( barricade = iter->first(iter,&key); iter->exists(iter); barricade = iter->next(iter,&key) )
+ for( barricade = (struct barricade_data *)iter->first(iter,&key); iter->exists(iter); barricade = (struct barricade_data *)iter->next(iter,&key) )
{
for( i = 0; i < barricade->count; i++ )
{
@@ -789,8 +789,8 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
}
}
- md= mob_spawn_dataset(&data);
- md->guardian_data = aCalloc(1, sizeof(struct guardian_data));
+ md = mob_spawn_dataset(&data);
+ md->guardian_data = (struct guardian_data*)aCalloc(1, sizeof(struct guardian_data));
md->guardian_data->number = guardian;
md->guardian_data->guild_id = gc->guild_id;
md->guardian_data->castle = gc;
@@ -3539,7 +3539,7 @@ static bool mob_parse_dbrow(char** str)
}
if (mob_db_data[class_] == NULL)
- mob_db_data[class_] = aCalloc(1, sizeof (struct mob_db));
+ mob_db_data[class_] = (struct mob_db*)aCalloc(1, sizeof (struct mob_db));
db = mob_db_data[class_];
status = &db->status;
@@ -4379,7 +4379,7 @@ void mob_clear_spawninfo()
int do_init_mob(void)
{ //Initialize the mob database
memset(mob_db_data,0,sizeof(mob_db_data)); //Clear the array
- mob_db_data[0] = aCalloc(1, sizeof (struct mob_db)); //This mob is used for random spawns
+ mob_db_data[0] = (struct mob_db*)aCalloc(1, sizeof (struct mob_db)); //This mob is used for random spawns
mob_makedummymobdb(0); //The first time this is invoked, it creates the dummy mob
item_drop_ers = ers_new(sizeof(struct item_drop));
item_drop_list_ers = ers_new(sizeof(struct item_drop_list));
diff --git a/src/map/npc.c b/src/map/npc.c
index 09f101983..51c95cee0 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -113,7 +113,7 @@ int npc_enable_sub(struct block_list *bl, va_list ap)
int npc_enable(const char* name, int flag)
{
- struct npc_data* nd = strdb_get(npcname_db, name);
+ struct npc_data* nd = (struct npc_data*)strdb_get(npcname_db, name);
if (nd==NULL)
return 0;
@@ -559,7 +559,7 @@ void npc_timerevent_quit(struct map_session_data* sd)
char buf[NAME_LENGTH*2+3];
struct event_data *ev;
snprintf(buf, ARRAYLENGTH(buf), "%s::OnTimerQuit", nd->exname);
- ev = strdb_get(ev_db, buf);
+ ev = (struct event_data*)strdb_get(ev_db, buf);
if(ev && ev->nd != nd) {
ShowWarning("npc_timerevent_quit: Unable to execute \"OnTimerQuit\", two NPCs have the same event name [%s]!\n",buf);
ev = NULL;
@@ -659,7 +659,7 @@ int npc_event_sub(struct map_session_data* sd, struct event_data* ev, const char
*------------------------------------------*/
int npc_event(struct map_session_data* sd, const char* eventname, int mob_kill)
{
- struct event_data* ev = strdb_get(ev_db, eventname);
+ struct event_data* ev = (struct event_data*)strdb_get(ev_db, eventname);
struct npc_data *nd;
int xs,ys;
char mobevent[100];
@@ -676,7 +676,7 @@ int npc_event(struct map_session_data* sd, const char* eventname, int mob_kill)
if (mob_kill) {
strcpy( mobevent, eventname);
strcat( mobevent, "::OnMyMobDead");
- ev = strdb_get(ev_db, mobevent);
+ ev = (struct event_data*)strdb_get(ev_db, mobevent);
if (ev == NULL || (nd = ev->nd) == NULL) {
ShowError("npc_event: (mob_kill) event not found [%s]\n", mobevent);
return 0;
@@ -2331,7 +2331,7 @@ static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const c
//Now that all has been validated. We allocate the actual memory
//that the re-spawn data will use.
- data = aMalloc(sizeof(struct spawn_data));
+ data = (struct spawn_data*)aMalloc(sizeof(struct spawn_data));
memcpy(data, &mob, sizeof(struct spawn_data));
if( !battle_config.dynamic_mobs ) {
@@ -2632,7 +2632,7 @@ void npc_parsesrcfile(const char* filepath)
lines++;
// w1<TAB>w2<TAB>w3<TAB>w4
- count = sv_parse(p, len+buffer-p, 0, '\t', pos, ARRAYLENGTH(pos), SV_TERMINATE_LF|SV_TERMINATE_CRLF);
+ count = sv_parse(p, len+buffer-p, 0, '\t', pos, ARRAYLENGTH(pos), (e_svopt)(SV_TERMINATE_LF|SV_TERMINATE_CRLF));
if( count < 0 )
{
ShowError("npc_parsesrcfile: Parse error in file '%s', line '%d'. Stopping...\n", filepath, strline(buffer,p-buffer));
@@ -2810,7 +2810,7 @@ int npc_reload(void)
//Remove all npcs/mobs. [Skotlex]
iter = mapit_geteachiddb();
- for( bl = mapit_first(iter); mapit_exists(iter); bl = mapit_next(iter) )
+ for( bl = (struct block_list*)mapit_first(iter); mapit_exists(iter); bl = (struct block_list*)mapit_next(iter) )
{
switch(bl->type) {
case BL_NPC:
@@ -2954,7 +2954,7 @@ int do_init_npc(void)
for( i = 1; i < MAX_NPC_CLASS; i++ )
npc_viewdb[i].class_ = i;
- ev_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA,2*NAME_LENGTH+2+1);
+ ev_db = strdb_alloc((DBOptions)(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA),2*NAME_LENGTH+2+1);
npcname_db = strdb_alloc(DB_OPT_BASE,NAME_LENGTH);
timer_event_ers = ers_new(sizeof(struct timer_event_data));
diff --git a/src/map/party.c b/src/map/party.c
index 8e97d1f05..2d81e155c 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -86,7 +86,7 @@ struct party_data* party_search(int party_id)
{
if(!party_id)
return NULL;
- return idb_get(party_db,party_id);
+ return (struct party_data*)idb_get(party_db,party_id);
}
/// Party data lookup using party name.
@@ -95,7 +95,7 @@ struct party_data* party_searchname(const char* str)
struct party_data* p;
DBIterator* iter = party_db->iterator(party_db);
- for( p = iter->first(iter,NULL); iter->exists(iter); p = iter->next(iter,NULL) )
+ for( p = (struct party_data*)iter->first(iter,NULL); iter->exists(iter); p = (struct party_data*)iter->next(iter,NULL) )
{
if( strncmpi(p->party.name,str,NAME_LENGTH) == 0 )
break;
@@ -235,7 +235,7 @@ int party_recv_info(struct party *sp)
nullpo_retr(0, sp);
- p= idb_ensure(party_db, sp->party_id, create_party);
+ p = (struct party_data*)idb_ensure(party_db, sp->party_id, create_party);
if (!p->party.party_id) //party just received.
{
party_new = true;
@@ -726,7 +726,7 @@ int party_send_xy_timer(int tid,unsigned int tick,int id,int data)
DBIterator* iter = party_db->iterator(party_db);
// for each existing party,
- for( p = iter->first(iter,NULL); iter->exists(iter); p = iter->next(iter,NULL) )
+ for( p = (struct party_data*)iter->first(iter,NULL); iter->exists(iter); p = (struct party_data*)iter->next(iter,NULL) )
{
int i;
// for each member of this party,
diff --git a/src/map/pc.c b/src/map/pc.c
index 86d9f186d..838de158d 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1339,7 +1339,7 @@ void pc_autoscript_clear(struct s_autoscript *scripts, int max)
memset(scripts, 0, i*sizeof(struct s_autoscript));
}
-static int pc_bonus_autospell_del(struct s_autospell *spell, int max, short id, short lv, short rate, short card_id)
+static int pc_bonus_autospell_del(struct s_autospell* spell, int max, short id, short lv, short rate, short card_id)
{
int i, j;
for(i=max-1; i>=0 && !spell[i].id; i--);
@@ -1405,7 +1405,7 @@ static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, shor
return 1;
}
-static int pc_bonus_addeff(struct s_addeffect* effect, int max, short id, short rate, short arrow_rate, unsigned char flag)
+static int pc_bonus_addeff(struct s_addeffect* effect, int max, enum sc_type id, short rate, short arrow_rate, unsigned char flag)
{
int i;
if (!(flag&(ATF_SHORT|ATF_LONG)))
@@ -2081,7 +2081,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
ShowWarning("pc_bonus2 (Add Effect): %d is not supported.\n", type2);
break;
}
- pc_bonus_addeff(sd->addeff, ARRAYLENGTH(sd->addeff), type2,
+ pc_bonus_addeff(sd->addeff, ARRAYLENGTH(sd->addeff), (sc_type)type2,
sd->state.lr_flag!=2?val:0, sd->state.lr_flag==2?val:0, 0);
break;
case SP_ADDEFF2:
@@ -2089,7 +2089,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
ShowWarning("pc_bonus2 (Add Effect2): %d is not supported.\n", type2);
break;
}
- pc_bonus_addeff(sd->addeff, ARRAYLENGTH(sd->addeff), type2,
+ pc_bonus_addeff(sd->addeff, ARRAYLENGTH(sd->addeff), (sc_type)type2,
sd->state.lr_flag!=2?val:0, sd->state.lr_flag==2?val:0, ATF_SELF);
break;
case SP_RESEFF:
@@ -2304,7 +2304,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
break;
}
if(sd->state.lr_flag != 2)
- pc_bonus_addeff(sd->addeff2, ARRAYLENGTH(sd->addeff2), type2, val, 0, 0);
+ pc_bonus_addeff(sd->addeff2, ARRAYLENGTH(sd->addeff2), (sc_type)type2, val, 0, 0);
break;
case SP_SKILL_ATK:
if(sd->state.lr_flag == 2)
@@ -2548,7 +2548,7 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
ShowWarning("pc_bonus3 (Add Effect): %d is not supported.\n", type2);
break;
}
- pc_bonus_addeff(sd->addeff, ARRAYLENGTH(sd->addeff), type2,
+ pc_bonus_addeff(sd->addeff, ARRAYLENGTH(sd->addeff), (sc_type)type2,
sd->state.lr_flag!=2?type3:0, sd->state.lr_flag==2?type3:0, val);
break;
@@ -2558,7 +2558,7 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
break;
}
if(sd->state.lr_flag != 2)
- pc_bonus_addeff(sd->addeff2, ARRAYLENGTH(sd->addeff2), type2, type3, 0, val);
+ pc_bonus_addeff(sd->addeff2, ARRAYLENGTH(sd->addeff2), (sc_type)type2, type3, 0, val);
break;
default:
@@ -3757,7 +3757,7 @@ int pc_checkskill(struct map_session_data *sd,int skill_id)
*------------------------------------------*/
int pc_checkallowskill(struct map_session_data *sd)
{
- const int scw_list[] = {
+ const enum sc_type scw_list[] = {
SC_TWOHANDQUICKEN,
SC_ONEHAND,
SC_AURABLADE,
@@ -3767,7 +3767,7 @@ int pc_checkallowskill(struct map_session_data *sd)
SC_ADRENALINE2,
SC_GATLINGFEVER
};
- const int scs_list[] = {
+ const enum sc_type scs_list[] = {
SC_AUTOGUARD,
SC_DEFENDER,
SC_REFLECTSHIELD
@@ -5624,12 +5624,12 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
if ((b_class&&MAPID_UPPERMASK) != (sd->class_&MAPID_UPPERMASK))
{ //Things to remove when changing class tree.
const int class_ = pc_class2idx(sd->status.class_);
- int id;
+ short id;
for(i = 0; i < MAX_SKILL_TREE && (id = skill_tree[class_][i].id) > 0; i++) {
//Remove status specific to your current tree skills.
- id = status_skill2sc(id);
- if (id > SC_COMMON_MAX && sd->sc.data[id])
- status_change_end(&sd->bl, id, -1);
+ enum sc_type sc = status_skill2sc(id);
+ if (sc > SC_COMMON_MAX && sd->sc.data[sc])
+ status_change_end(&sd->bl, sc, -1);
}
}
diff --git a/src/map/pc.h b/src/map/pc.h
index a7d30d1ce..245ecd686 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -45,6 +45,26 @@ struct weapon_data {
} add_dmg[MAX_PC_BONUS];
};
+struct s_autospell {
+ short id, lv, rate, card_id, flag;
+};
+
+struct s_addeffect {
+ enum sc_type id;
+ short rate, arrow_rate;
+ unsigned char flag;
+};
+
+struct s_add_drop {
+ short id, group;
+ int race, rate;
+};
+
+struct s_autoscript {
+ unsigned short rate, flag;
+ struct script_code *script;
+};
+
struct map_session_data {
struct block_list bl;
struct unit_data ud;
@@ -185,13 +205,8 @@ struct map_session_data {
short sp_gain_race[RC_MAX];
// zeroed arrays end here.
// zeroed structures start here
- struct s_autospell{
- short id, lv, rate, card_id, flag;
- } autospell[15], autospell2[15];
- struct s_addeffect{
- short id, rate, arrow_rate;
- unsigned char flag;
- } addeff[MAX_PC_BONUS], addeff2[MAX_PC_BONUS];
+ struct s_autospell autospell[15], autospell2[15];
+ struct s_addeffect addeff[MAX_PC_BONUS], addeff2[MAX_PC_BONUS];
struct { //skillatk raises bonus dmg% of skills, skillheal increases heal%, skillblown increases bonus blewcount for some skills.
unsigned short id;
short val;
@@ -203,22 +218,15 @@ struct map_session_data {
} hp_loss, sp_loss, hp_regen, sp_regen;
struct {
short class_, rate;
- } add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS],
- add_mdmg[MAX_PC_BONUS];
- struct s_add_drop {
- short id, group;
- int race, rate;
- } add_drop[MAX_PC_BONUS];
+ } add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS], add_mdmg[MAX_PC_BONUS];
+ struct s_add_drop add_drop[MAX_PC_BONUS];
struct {
int nameid;
int rate;
} itemhealrate[MAX_PC_BONUS];
// zeroed structures end here
// manually zeroed structures start here.
- struct s_autoscript {
- unsigned short rate, flag;
- struct script_code *script;
- } autoscript[10], autoscript2[10]; //Auto script on attack, when attacked
+ struct s_autoscript autoscript[10], autoscript2[10]; //Auto script on attack, when attacked
// manually zeroed structures end here.
// zeroed vars start here.
int arrow_atk,arrow_ele,arrow_cri,arrow_hit;
@@ -382,15 +390,15 @@ enum weapon_type {
W_DOUBLE_SA, // sword + axe
};
-enum {
+enum ammo_type {
A_ARROW = 1,
- A_DAGGER, //2
+ A_DAGGER, //2
A_BULLET, //3
A_SHELL, //4
A_GRENADE, //5
A_SHURIKEN, //6
A_KUNAI //7
-} ammo_type;
+};
//Equip position constants
enum equip_pos {
@@ -415,7 +423,7 @@ enum equip_pos {
//Equip indexes constants. (eg: sd->equip_index[EQI_AMMO] returns the index
//where the arrows are equipped)
-enum {
+enum equip_index {
EQI_ACC_L = 0,
EQI_ACC_R,
EQI_SHOES,
@@ -428,7 +436,7 @@ enum {
EQI_HAND_R,
EQI_AMMO,
EQI_MAX
-} equip_index_enum;
+};
struct duel {
int members_count;
diff --git a/src/map/pet.h b/src/map/pet.h
index eeb48f018..86b9080eb 100644
--- a/src/map/pet.h
+++ b/src/map/pet.h
@@ -33,6 +33,43 @@ extern struct s_pet_db pet_db[MAX_PET_DB];
enum { PET_CLASS,PET_CATCH,PET_EGG,PET_EQUIP,PET_FOOD };
+struct pet_recovery { //Stat recovery
+ enum sc_type type; //Status Change id
+ unsigned short delay; //How long before curing (secs).
+ int timer;
+};
+
+struct pet_bonus {
+ unsigned short type; //bStr, bVit?
+ unsigned short val; //Qty
+ unsigned short duration; //in secs
+ unsigned short delay; //Time before recasting (secs)
+ int timer;
+};
+
+struct pet_skill_attack { //Attack Skill
+ unsigned short id;
+ unsigned short lv;
+ unsigned short div_; //0 = Normal skill. >0 = Fixed damage (lv), fixed div_.
+ unsigned short rate; //Base chance of skill ocurrance (10 = 10% of attacks)
+ unsigned short bonusrate; //How being 100% loyal affects cast rate (10 = At 1000 intimacy->rate+10%
+};
+
+struct pet_skill_support { //Support Skill
+ unsigned short id;
+ unsigned short lv;
+ unsigned short hp; //Max HP% for skill to trigger (50 -> 50% for Magnificat)
+ unsigned short sp; //Max SP% for skill to trigger (100 = no check)
+ unsigned short delay; //Time (secs) between being able to recast.
+ int timer;
+};
+
+struct pet_loot {
+ struct item *item;
+ unsigned short count;
+ unsigned short weight;
+ unsigned short max;
+};
struct pet_data {
struct block_list bl;
@@ -51,43 +88,11 @@ struct pet_data {
unsigned int next_walktime,last_thinktime;
short rate_fix; //Support rate as modified by intimacy (1000 = 100%) [Skotlex]
- struct pet_recovery { //Stat recovery
- unsigned short type; //Status Change id
- unsigned short delay; //How long before curing (secs).
- int timer;
- } *recovery; //[Valaris] / Reimplemented by [Skotlex]
-
- struct pet_bonus {
- unsigned short type; //bStr, bVit?
- unsigned short val; //Qty
- unsigned short duration; //in secs
- unsigned short delay; //Time before recasting (secs)
- int timer;
- } *bonus; //[Valaris] / Reimplemented by [Skotlex]
-
- struct pet_skill_attack { //Attack Skill
- unsigned short id;
- unsigned short lv;
- unsigned short div_; //0 = Normal skill. >0 = Fixed damage (lv), fixed div_.
- unsigned short rate; //Base chance of skill ocurrance (10 = 10% of attacks)
- unsigned short bonusrate; //How being 100% loyal affects cast rate (10 = At 1000 intimacy->rate+10%
- } *a_skill; //[Skotlex]
-
- struct pet_skill_support { //Support Skill
- unsigned short id;
- unsigned short lv;
- unsigned short hp; //Max HP% for skill to trigger (50 -> 50% for Magnificat)
- unsigned short sp; //Max SP% for skill to trigger (100 = no check)
- unsigned short delay; //Time (secs) between being able to recast.
- int timer;
- } *s_skill; //[Skotlex]
-
- struct pet_loot {
- struct item *item;
- unsigned short count;
- unsigned short weight;
- unsigned short max;
- } *loot; //[Valaris] / Rewritten by [Skotlex]
+ struct pet_recovery* recovery;
+ struct pet_bonus* bonus;
+ struct pet_skill_attack* a_skill;
+ struct pet_skill_support* s_skill;
+ struct pet_loot* loot;
struct map_session_data *msd;
};
diff --git a/src/map/script.c b/src/map/script.c
index 9aa292e63..339afb495 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -30,6 +30,7 @@
#include "mercenary.h" //[orn]
#include "intif.h"
#include "skill.h"
+#include "status.h"
#include "chat.h"
#include "battle.h"
#include "party.h"
@@ -251,14 +252,16 @@ char mapregsql_db_index[32] = "index";
char mapregsql_db_value[32] = "value";
#endif
-int get_com(unsigned char *script,int *pos);
+c_op get_com(unsigned char *script,int *pos);
int get_num(unsigned char *script,int *pos);
-struct script_function {
+typedef struct script_function {
int (*func)(struct script_state *st);
const char *name;
const char *arg;
-} buildin_func[];
+} script_function;
+
+extern script_function buildin_func[];
static struct linkdb_node *sleep_db;
#define not_server_variable(prefix) ( (prefix) != '$' && (prefix) != '.')
@@ -1851,7 +1854,7 @@ void script_error(const char *src,const char *file,int start_line, const char *e
const char *linestart[5] = { NULL, NULL, NULL, NULL, NULL };
for(p=src;p && *p;line++){
- char *lineend=strchr(p,'\n');
+ const char *lineend=strchr(p,'\n');
if(lineend==NULL || error_pos<lineend){
break;
}
@@ -2167,7 +2170,7 @@ void get_val(struct script_state* st, struct script_data* data)
data->ref ? data->ref:
name[1] == '@' ? st->stack->var_function:// instance/scope variable
&st->script->script_vars;// npc variable
- data->u.str = linkdb_search(n, (void*)reference_getuid(data));
+ data->u.str = (char*)linkdb_search(n, (void*)reference_getuid(data));
}
break;
default:
@@ -2234,7 +2237,7 @@ void get_val(struct script_state* st, struct script_data* data)
return;
}
-void push_val2(struct script_stack* stack, int type, int val, struct linkdb_node** ref);
+void push_val2(struct script_stack* stack, enum c_op type, int val, struct linkdb_node** ref);
/// Retrieves the value of a reference identified by uid (variable, constant, param)
/// The value is left in the top of the stack and needs to be removed manually.
@@ -2271,7 +2274,7 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, char* name, con
char* p;
struct linkdb_node** n;
n = (ref) ? ref : (name[1] == '@') ? st->stack->var_function : &st->script->script_vars;
- p = linkdb_erase(n, (void*)num);
+ p = (char*)linkdb_erase(n, (void*)num);
if (p) aFree(p);
if (str[0]) linkdb_insert(n, (void*)num, aStrdup(str));
}
@@ -2423,7 +2426,7 @@ void stack_expand(struct script_stack* stack)
#define push_val(stack,type,val) push_val2(stack, type, val, NULL)
/// Pushes a value into the stack (with reference)
-void push_val2(struct script_stack* stack, int type, int val, struct linkdb_node** ref)
+void push_val2(struct script_stack* stack, enum c_op type, int val, struct linkdb_node** ref)
{
if( stack->sp >= stack->sp_max )
stack_expand(stack);
@@ -2434,7 +2437,7 @@ void push_val2(struct script_stack* stack, int type, int val, struct linkdb_node
}
/// Pushes a string into the stack
-void push_str(struct script_stack* stack, int type, char* str)
+void push_str(struct script_stack* stack, enum c_op type, char* str)
{
if( stack->sp >= stack->sp_max )
stack_expand(stack);
@@ -2549,35 +2552,18 @@ void script_free_code(struct script_code* code)
/*==========================================
* コマンドの読み取り
*------------------------------------------*/
-static int unget_com_data=-1;
-int get_com(unsigned char *script,int *pos)
+c_op get_com(unsigned char *script,int *pos)
{
- int i,j;
- if(unget_com_data>=0){
- i=unget_com_data;
- unget_com_data=-1;
- return i;
- }
+ int i = 0, j = 0;
+
if(script[*pos]>=0x80){
return C_INT;
}
- i=0; j=0;
while(script[*pos]>=0x40){
i=script[(*pos)++]<<j;
j+=6;
}
- return i+(script[(*pos)++]<<j);
-}
-
-/*==========================================
- * コマンドのプッシュバック
- *------------------------------------------*/
-void unget_com(int c)
-{
- if(unget_com_data!=-1)
- ShowError("unget_com can back only 1 data\n");
-
- unget_com_data=c;
+ return (c_op)(i+(script[(*pos)++]<<j));
}
/*==========================================
@@ -2970,14 +2956,14 @@ void run_script(struct script_code *rootscript,int pos,int rid,int oid)
//Resume script.
st = sd->st;
} else {
- st = aCalloc(sizeof(struct script_state), 1);
+ st = (struct script_state*)aCalloc(sizeof(struct script_state), 1);
// the script is different, make new script_state and stack
- st->stack = aMalloc (sizeof(struct script_stack));
+ st->stack = (struct script_stack*)aMalloc (sizeof(struct script_stack));
st->stack->sp=0;
st->stack->sp_max=64;
st->stack->stack_data = (struct script_data *)aCalloc(st->stack->sp_max,sizeof(st->stack->stack_data[0]));
st->stack->defsp = st->stack->sp;
- st->stack->var_function = aCalloc(1, sizeof(struct linkdb_node*));
+ st->stack->var_function = (struct linkdb_node**)aCalloc(1, sizeof(struct linkdb_node*));
st->state = RUN;
st->script = rootscript;
}
@@ -3056,7 +3042,6 @@ int run_script_timer(int tid, unsigned int tick, int id, int data)
*------------------------------------------*/
void run_script_main(struct script_state *st)
{
- int c;
int cmdcount=script_config.check_cmdcount;
int gotocount=script_config.check_gotocount;
TBL_PC *sd;
@@ -3084,8 +3069,9 @@ void run_script_main(struct script_state *st)
} else if(st->state != END)
st->state = RUN;
- while(st->state == RUN){
- c= get_com(st->script->script_buf,&st->pos);
+ while(st->state == RUN)
+ {
+ enum c_op c = get_com(st->script->script_buf,&st->pos);
switch(c){
case C_EOL:
if( stack->sp != stack->defsp )
@@ -3623,7 +3609,7 @@ int do_init_script()
mapreg_db= idb_alloc(DB_OPT_BASE);
mapregstr_db=idb_alloc(DB_OPT_RELEASE_DATA);
userfunc_db=strdb_alloc(DB_OPT_DUP_KEY,0);
- scriptlabel_db=strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_ALLOW_NULL_DATA,50);
+ scriptlabel_db=strdb_alloc((DBOptions)(DB_OPT_DUP_KEY|DB_OPT_ALLOW_NULL_DATA),50);
script_load_mapreg();
@@ -4039,7 +4025,7 @@ BUILDIN_FUNC(callfunc)
struct script_code *scr, *oldscr;
const char* str = script_getstr(st,2);
- scr = strdb_get(userfunc_db, str);
+ scr = (struct script_code*)strdb_get(userfunc_db, str);
if( !scr )
{
ShowError("script:callfunc: function not found! [%s]\n", str);
@@ -8097,12 +8083,12 @@ BUILDIN_FUNC(hideonnpc)
BUILDIN_FUNC(sc_start)
{
struct block_list* bl;
- int type;
+ enum sc_type type;
int tick;
int val1;
int val4 = 0;
- type = script_getnum(st,2);
+ type = (sc_type)script_getnum(st,2);
tick = script_getnum(st,3);
val1 = script_getnum(st,4);
if( script_hasdata(st,5) )
@@ -8110,7 +8096,7 @@ BUILDIN_FUNC(sc_start)
else
bl = map_id2bl(st->rid);
- if( tick == 0 && val1 > 0 && type >= 0 && type < SC_MAX && status_sc2skill(type) != 0 )
+ if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status_sc2skill(type) != 0 )
{// When there isn't a duration specified, try to get it from the skill_db
tick = skill_get_time(status_sc2skill(type), val1);
}
@@ -8124,6 +8110,7 @@ BUILDIN_FUNC(sc_start)
if( bl )
status_change_start(bl, type, 10000, val1, 0, 0, val4, tick, 2);
+
return 0;
}
@@ -8133,13 +8120,13 @@ BUILDIN_FUNC(sc_start)
BUILDIN_FUNC(sc_start2)
{
struct block_list* bl;
- int type;
+ enum sc_type type;
int tick;
int val1;
int val4 = 0;
int rate;
- type = script_getnum(st,2);
+ type = (sc_type)script_getnum(st,2);
tick = script_getnum(st,3);
val1 = script_getnum(st,4);
rate = script_getnum(st,5);
@@ -8148,7 +8135,7 @@ BUILDIN_FUNC(sc_start2)
else
bl = map_id2bl(st->rid);
- if( tick == 0 && val1 > 0 && type >= 0 && type < SC_MAX && status_sc2skill(type) != 0 )
+ if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status_sc2skill(type) != 0 )
{// When there isn't a duration specified, try to get it from the skill_db
tick = skill_get_time(status_sc2skill(type), val1);
}
@@ -8172,14 +8159,14 @@ BUILDIN_FUNC(sc_start2)
BUILDIN_FUNC(sc_start4)
{
struct block_list* bl;
- int type;
+ enum sc_type type;
int tick;
int val1;
int val2;
int val3;
int val4;
- type = script_getnum(st,2);
+ type = (sc_type)script_getnum(st,2);
tick = script_getnum(st,3);
val1 = script_getnum(st,4);
val2 = script_getnum(st,5);
@@ -8190,7 +8177,7 @@ BUILDIN_FUNC(sc_start4)
else
bl = map_id2bl(st->rid);
- if( tick == 0 && val1 > 0 && type >= 0 && type < SC_MAX && status_sc2skill(type) != 0 )
+ if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status_sc2skill(type) != 0 )
{// When there isn't a duration specified, try to get it from the skill_db
tick = skill_get_time(status_sc2skill(type), val1);
}
@@ -8235,7 +8222,7 @@ BUILDIN_FUNC(sc_end)
if (!sce) return 0;
//This should help status_change_end force disabling the SC in case it has no limit.
sce->val1 = sce->val2 = sce->val3 = sce->val4 = 0;
- status_change_end(bl, type, INVALID_TIMER);
+ status_change_end(bl, (sc_type)type, INVALID_TIMER);
} else
status_change_clear(bl, 2);// remove all effects
return 0;
@@ -8257,7 +8244,7 @@ BUILDIN_FUNC(getscrate)
bl = map_id2bl(st->rid);
if (bl)
- rate = status_get_sc_def(bl,type, 10000, 10000, 0);
+ rate = status_get_sc_def(bl, (sc_type)type, 10000, 10000, 0);
script_pushint(st,rate);
return 0;
@@ -9193,7 +9180,7 @@ BUILDIN_FUNC(getcastlename)
{
const char* mapname = mapindex_getmapname(script_getstr(st,2),NULL);
struct guild_castle* gc = guild_mapname2gc(mapname);
- char* name = (gc) ? gc->castle_name : "";
+ const char* name = (gc) ? gc->castle_name : "";
script_pushstrcopy(st,name);
return 0;
}
@@ -10309,9 +10296,8 @@ BUILDIN_FUNC(petrecovery)
} else //Init
pd->recovery = (struct pet_recovery *)aMalloc(sizeof(struct pet_recovery));
- pd->recovery->type=script_getnum(st,2);
+ pd->recovery->type=(sc_type)script_getnum(st,2);
pd->recovery->delay=script_getnum(st,3);
-
pd->recovery->timer=-1;
return 0;
@@ -10484,11 +10470,13 @@ BUILDIN_FUNC(npcskilleffect)
BUILDIN_FUNC(specialeffect)
{
struct block_list *bl=map_id2bl(st->oid);
+ int type = script_getnum(st,2);
+ enum send_target target = script_hasdata(st,3) ? (send_target)script_getnum(st,3) : AREA;
if(bl==NULL)
return 0;
- clif_specialeffect(bl,script_getnum(st,2), (script_hasdata(st,3)?script_getnum(st,3):AREA));
+ clif_specialeffect(bl, type, target);
return 0;
}
@@ -10496,11 +10484,13 @@ BUILDIN_FUNC(specialeffect)
BUILDIN_FUNC(specialeffect2)
{
TBL_PC *sd=script_rid2sd(st);
+ int type = script_getnum(st,2);
+ enum send_target target = script_hasdata(st,3) ? (send_target)script_getnum(st,3) : AREA;
if(sd==NULL)
return 0;
- clif_specialeffect(&sd->bl,script_getnum(st,2), (script_hasdata(st,3)?script_getnum(st,3):AREA));
+ clif_specialeffect(&sd->bl, type, target);
return 0;
}
@@ -11651,7 +11641,7 @@ BUILDIN_FUNC(checkcell)
const char *map = script_getstr(st, 2);
m = mapindex_name2id(map);
if(m){
- script_pushint(st,map_getcell(m, script_getnum(st,3), script_getnum(st,4),script_getnum(st,5)));
+ script_pushint(st,map_getcell(m, script_getnum(st,3), script_getnum(st,4),(cell_chk)script_getnum(st,5)));
} else {
script_pushint(st,0);
}
@@ -11831,7 +11821,7 @@ BUILDIN_FUNC(escape_sql)
str = script_getstr(st,2);
len = strlen(str);
- esc_str = aMallocA(len*2+1);
+ esc_str = (char*)aMallocA(len*2+1);
#if defined(TXT_ONLY)
jstrescapecpy(esc_str, str);
#else
diff --git a/src/map/script.h b/src/map/script.h
index b9e5fdb01..943ce3a4d 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -25,7 +25,7 @@ extern struct Script_Config {
const char *joblvup_event_name;
} script_config;
-enum c_op {
+typedef enum c_op {
C_NOP, // end of script/no value (nil)
C_POS,
C_INT, // number
@@ -63,7 +63,7 @@ enum c_op {
C_NOT, // ~ a
C_R_SHIFT, // a >> b
C_L_SHIFT // a << b
-};
+} c_op;
struct script_data {
enum c_op type;
diff --git a/src/map/skill.c b/src/map/skill.c
index 3095874f4..df5c8deff 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -408,6 +408,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
struct status_data *sstatus, *tstatus;
struct status_change *sc, *tsc;
+ enum sc_type status;
int skill;
int rate;
@@ -523,9 +524,9 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
break;
case AS_GRIMTOOTH:
- skill = dstsd?SC_SLOWDOWN:SC_STOP;
- if (!tsc->data[skill])
- sc_start(bl,skill,100,skilllv,skill_get_time2(skillid, skilllv));
+ status = dstsd?SC_SLOWDOWN:SC_STOP;
+ if (!tsc->data[status])
+ sc_start(bl,status,100,skilllv,skill_get_time2(skillid, skilllv));
break;
case WZ_FIREPILLAR:
@@ -705,9 +706,9 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
break;
case LK_JOINTBEAT:
- skill = status_skill2sc(skillid);
+ status = status_skill2sc(skillid);
if (tsc->jb_flag) {
- sc_start2(bl,skill,(5*skilllv+5),skilllv,tsc->jb_flag&BREAK_FLAGS,skill_get_time2(skillid,skilllv));
+ sc_start2(bl,status,(5*skilllv+5),skilllv,tsc->jb_flag&BREAK_FLAGS,skill_get_time2(skillid,skilllv));
tsc->jb_flag = 0;
}
break;
@@ -807,7 +808,8 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
skillid != CR_REFLECTSHIELD &&
skillid != ASC_BREAKER
){ //Trigger status effects
- int i, type;
+ enum sc_type type;
+ int i;
for(i=0; i < ARRAYLENGTH(sd->addeff) && sd->addeff[i].flag; i++)
{
rate = sd->addeff[i].rate;
@@ -998,7 +1000,8 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
if(dstsd && attack_type&BF_WEAPON)
{ //Counter effects.
- int i, type, time;
+ enum sc_type type;
+ int i, time;
for(i=0; i < ARRAYLENGTH(dstsd->addeff2) && dstsd->addeff2[i].flag; i++)
{
rate = dstsd->addeff2[i].rate;
@@ -1104,9 +1107,9 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
--------------------------------------------------------------------------*/
int skill_break_equip (struct block_list *bl, unsigned short where, int rate, int flag)
{
- const int where_list[4] = {EQP_WEAPON, EQP_ARMOR, EQP_SHIELD, EQP_HELM};
- const int scatk[4] = {SC_STRIPWEAPON, SC_STRIPARMOR, SC_STRIPSHIELD, SC_STRIPHELM};
- const int scdef[4] = {SC_CP_WEAPON, SC_CP_ARMOR, SC_CP_SHIELD, SC_CP_HELM};
+ const int where_list[4] = {EQP_WEAPON, EQP_ARMOR, EQP_SHIELD, EQP_HELM};
+ const enum sc_type scatk[4] = {SC_STRIPWEAPON, SC_STRIPARMOR, SC_STRIPSHIELD, SC_STRIPHELM};
+ const enum sc_type scdef[4] = {SC_CP_WEAPON, SC_CP_ARMOR, SC_CP_SHIELD, SC_CP_HELM};
struct status_change *sc = status_get_sc(bl);
int i,j;
TBL_PC *sd;
@@ -1188,9 +1191,9 @@ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, in
int skill_strip_equip(struct block_list *bl, unsigned short where, int rate, int lv, int time)
{
struct status_change *sc;
- const int pos[4] = {EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HELM};
- const int sc_atk[4] = {SC_STRIPWEAPON, SC_STRIPSHIELD, SC_STRIPARMOR, SC_STRIPHELM};
- const int sc_def[4] = {SC_CP_WEAPON, SC_CP_SHIELD, SC_CP_ARMOR, SC_CP_HELM};
+ const int pos[4] = {EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HELM};
+ const enum sc_type sc_atk[4] = {SC_STRIPWEAPON, SC_STRIPSHIELD, SC_STRIPARMOR, SC_STRIPHELM};
+ const enum sc_type sc_def[4] = {SC_CP_WEAPON, SC_CP_SHIELD, SC_CP_ARMOR, SC_CP_HELM};
int i;
if (rand()%100 >= rate)
@@ -2810,7 +2813,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
struct status_change_entry *tsce;
struct mob_data *md;
struct mob_data *dstmd;
- int i,type;
+ int i;
+ enum sc_type type;
if(skillid > 0 && skilllv <= 0) return 0; // celest
@@ -3109,9 +3113,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
mob_class_change(dstmd,class_);
if( tsc && dstmd->status.mode&MD_BOSS )
{
- const int scs[] = { SC_QUAGMIRE, SC_PROVOKE, SC_ROKISWEIL, SC_GRAVITATION, SC_SUITON, SC_STRIPWEAPON, SC_STRIPSHIELD, SC_STRIPARMOR, SC_STRIPHELM, SC_BLADESTOP };
+ const enum sc_type scs[] = { SC_QUAGMIRE, SC_PROVOKE, SC_ROKISWEIL, SC_GRAVITATION, SC_SUITON, SC_STRIPWEAPON, SC_STRIPSHIELD, SC_STRIPARMOR, SC_STRIPHELM, SC_BLADESTOP };
for (i = SC_COMMON_MIN; i <= SC_COMMON_MAX; i++)
- if (tsc->data[i]) status_change_end(bl, i, -1);
+ if (tsc->data[i]) status_change_end(bl, (sc_type)i, -1);
for (i = 0; i < ARRAYLENGTH(scs); i++)
if (tsc->data[scs[i]]) status_change_end(bl, scs[i], -1);
}
@@ -3153,7 +3157,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case CG_MARIONETTE:
{
struct status_change *sc= status_get_sc(src);
- int type2 = SC_MARIONETTE2;
+ enum sc_type type2 = SC_MARIONETTE2;
if(sc && tsc){
if (!sc->data[type] && !tsc->data[type2]) {
@@ -4020,32 +4024,36 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case RG_STRIPARMOR:
case RG_STRIPHELM:
case ST_FULLSTRIP:
+ {
+ unsigned short location = 0;
i = 5+2*skilllv;
if (sstatus->dex > tstatus->dex)
i += (sstatus->dex - tstatus->dex)/5;
+
switch (skillid) {
case RG_STRIPWEAPON:
- type = EQP_WEAPON;
+ location = EQP_WEAPON;
break;
case RG_STRIPSHIELD:
- type = EQP_SHIELD;
+ location = EQP_SHIELD;
break;
case RG_STRIPARMOR:
- type = EQP_ARMOR;
+ location = EQP_ARMOR;
break;
case RG_STRIPHELM:
- type = EQP_HELM;
+ location = EQP_HELM;
break;
case ST_FULLSTRIP:
- type = EQP_WEAPON|EQP_SHIELD|EQP_ARMOR|EQP_HELM;
+ location = EQP_WEAPON|EQP_SHIELD|EQP_ARMOR|EQP_HELM;
break;
}
//Note that Full Strip autospell doesn't use a duration
if (!clif_skill_nodamage(src,bl,skillid,skilllv,
- skill_strip_equip(bl, type, i, skilllv,
+ skill_strip_equip(bl, location, i, skilllv,
sd&&skillid==ST_FULLSTRIP&&!pc_checkskill(sd, skillid)?0:skill_get_time(skillid,skilllv)))
&& sd)
clif_skill_fail(sd,skillid,0,0); //Nothing stripped.
+ }
break;
case AM_BERSERKPITCHER:
@@ -4139,7 +4147,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case AM_CP_ARMOR:
case AM_CP_HELM:
{
- int scid = SC_STRIPWEAPON + (skillid - AM_CP_WEAPON);
+ enum sc_type scid = (sc_type)(SC_STRIPWEAPON + (skillid - AM_CP_WEAPON));
if(tsc && tsc->data[scid])
status_change_end(bl, scid, -1 );
clif_skill_nodamage(src,bl,skillid,skilllv,
@@ -4192,7 +4200,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
}
if(status_isimmune(bl) || !tsc || !tsc->count)
break;
- for(i=0;i<SC_MAX;i++){
+ for(i=0;i<SC_MAX;i++)
+ {
if (!tsc->data[i])
continue;
switch (i) {
@@ -4217,7 +4226,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
continue;
}
if(i==SC_BERSERK) tsc->data[i]->val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0.
- status_change_end(bl,i,-1);
+ status_change_end(bl,(sc_type)i,-1);
}
break;
}
@@ -4446,7 +4455,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
if (i > SC_ASPDPOTION3)
i = SC_ASPDPOTION3;
clif_skill_nodamage(src,bl,skillid,skilllv,
- sc_start(bl,i,100,skilllv,skilllv * 60000));
+ sc_start(bl,(sc_type)i,100,skilllv,skilllv * 60000));
}
break;
@@ -4764,8 +4773,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
}
for (i=0; i<4; i++) {
if(tsc->data[SC_STRIPWEAPON + i])
- status_change_end(bl, SC_STRIPWEAPON + i, -1 );
- sc_start(bl,SC_CP_WEAPON + i,100,skilllv,skilltime);
+ status_change_end(bl, (sc_type)(SC_STRIPWEAPON + i), -1 );
+ sc_start(bl,(sc_type)(SC_CP_WEAPON + i),100,skilllv,skilltime);
}
clif_skill_nodamage(src,bl,skillid,skilllv,1);
}
@@ -4831,7 +4840,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
case 7: // stop freeze or stoned
{
- int sc[] = { SC_STOP, SC_FREEZE, SC_STONE };
+ enum sc_type sc[] = { SC_STOP, SC_FREEZE, SC_STONE };
sc_start(bl,sc[rand()%3],100,skilllv,skill_get_time2(skillid,skilllv));
}
break;
@@ -5120,7 +5129,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case NPC_DRAGONFEAR:
if (flag&1) {
- const int sc[] = { SC_STUN, SC_CURSE, SC_SILENCE, SC_BLEEDING };
+ const enum sc_type sc[] = { SC_STUN, SC_CURSE, SC_SILENCE, SC_BLEEDING };
i = rand()%ARRAYLENGTH(sc);
sc_start(bl,sc[i],100,skilllv,skill_get_time2(skillid,i+1));
} else {
@@ -5528,7 +5537,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk
struct status_change* sc;
struct status_change_entry *sce;
struct skill_unit_group* sg;
- int i,type;
+ enum sc_type type;
+ int i;
//if(skilllv <= 0) return 0;
if(skillid > 0 && skilllv <= 0) return 0; // celest
@@ -6491,7 +6501,8 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un
struct block_list *ss;
struct status_change *sc;
struct status_change_entry *sce;
- int type,skillid;
+ enum sc_type type;
+ int skillid;
nullpo_retr(0, src);
nullpo_retr(0, bl);
@@ -6651,7 +6662,8 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
struct status_data *tstatus, *sstatus;
struct status_change *tsc, *sc;
struct skill_unit_group_tickset *ts;
- int type, skillid;
+ enum sc_type type;
+ int skillid;
int diff=0;
nullpo_retr(0, src);
@@ -6926,60 +6938,61 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
break;
if (battle_check_target(ss,bl,BCT_PARTY)>0)
{ // Support Effect only on party, not guild
+ int heal;
int i = rand()%13; // Positive buff count
- type = skill_get_time2(sg->skill_id, sg->skill_lv); //Duration
+ int time = skill_get_time2(sg->skill_id, sg->skill_lv); //Duration
switch (i)
{
case 0: // Heal 1~9999 HP
- type = rand() %9999+1;
- clif_skill_nodamage(ss,bl,AL_HEAL,type,1);
- status_heal(bl,type,0,0);
+ heal = rand() %9999+1;
+ clif_skill_nodamage(ss,bl,AL_HEAL,heal,1);
+ status_heal(bl,heal,0,0);
break;
case 1: // End all negative status
status_change_clear_buffs(bl,2);
if (tsd) clif_gospel_info(tsd, 0x15);
break;
case 2: // Immunity to all status
- sc_start(bl,SC_SCRESIST,100,100,type);
+ sc_start(bl,SC_SCRESIST,100,100,time);
if (tsd) clif_gospel_info(tsd, 0x16);
break;
case 3: // MaxHP +100%
- sc_start(bl,SC_INCMHPRATE,100,100,type);
+ sc_start(bl,SC_INCMHPRATE,100,100,time);
if (tsd) clif_gospel_info(tsd, 0x17);
break;
case 4: // MaxSP +100%
- sc_start(bl,SC_INCMSPRATE,100,100,type);
+ sc_start(bl,SC_INCMSPRATE,100,100,time);
if (tsd) clif_gospel_info(tsd, 0x18);
break;
case 5: // All stats +20
- sc_start(bl,SC_INCALLSTATUS,100,20,type);
+ sc_start(bl,SC_INCALLSTATUS,100,20,time);
if (tsd) clif_gospel_info(tsd, 0x19);
break;
case 6: // Level 10 Blessing
- sc_start(bl,SC_BLESSING,100,10,type);
+ sc_start(bl,SC_BLESSING,100,10,time);
break;
case 7: // Level 10 Increase AGI
- sc_start(bl,SC_INCREASEAGI,100,10,type);
+ sc_start(bl,SC_INCREASEAGI,100,10,time);
break;
case 8: // Enchant weapon with Holy element
- sc_start(bl,SC_ASPERSIO,100,1,type);
+ sc_start(bl,SC_ASPERSIO,100,1,time);
if (tsd) clif_gospel_info(tsd, 0x1c);
break;
case 9: // Enchant armor with Holy element
- sc_start(bl,SC_BENEDICTIO,100,1,type);
+ sc_start(bl,SC_BENEDICTIO,100,1,time);
if (tsd) clif_gospel_info(tsd, 0x1d);
break;
case 10: // DEF +25%
- sc_start(bl,SC_INCDEFRATE,100,25,type);
+ sc_start(bl,SC_INCDEFRATE,100,25,time);
if (tsd) clif_gospel_info(tsd, 0x1e);
break;
case 11: // ATK +100%
- sc_start(bl,SC_INCATKRATE,100,100,type);
+ sc_start(bl,SC_INCATKRATE,100,100,time);
if (tsd) clif_gospel_info(tsd, 0x1f);
break;
case 12: // HIT/Flee +50
- sc_start(bl,SC_INCHIT,100,50,type);
- sc_start(bl,SC_INCFLEE,100,50,type);
+ sc_start(bl,SC_INCHIT,100,50,time);
+ sc_start(bl,SC_INCFLEE,100,50,time);
if (tsd) clif_gospel_info(tsd, 0x20);
break;
}
@@ -6987,35 +7000,35 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
else if (battle_check_target(&src->bl,bl,BCT_ENEMY)>0)
{ // Offensive Effect
int i = rand()%9; // Negative buff count
- type = skill_get_time2(sg->skill_id, sg->skill_lv);
+ int time = skill_get_time2(sg->skill_id, sg->skill_lv);
switch (i)
{
case 0: // Deal 1~9999 damage
skill_attack(BF_MISC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
break;
case 1: // Curse
- sc_start(bl,SC_CURSE,100,1,type);
+ sc_start(bl,SC_CURSE,100,1,time);
break;
case 2: // Blind
- sc_start(bl,SC_BLIND,100,1,type);
+ sc_start(bl,SC_BLIND,100,1,time);
break;
case 3: // Poison
- sc_start(bl,SC_POISON,100,1,type);
+ sc_start(bl,SC_POISON,100,1,time);
break;
case 4: // Level 10 Provoke
- sc_start(bl,SC_PROVOKE,100,10,type);
+ sc_start(bl,SC_PROVOKE,100,10,time);
break;
case 5: // DEF -100%
- sc_start(bl,SC_INCDEFRATE,100,-100,type);
+ sc_start(bl,SC_INCDEFRATE,100,-100,time);
break;
case 6: // ATK -100%
- sc_start(bl,SC_INCATKRATE,100,-100,type);
+ sc_start(bl,SC_INCATKRATE,100,-100,time);
break;
case 7: // Flee -100%
- sc_start(bl,SC_INCFLEERATE,100,-100,type);
+ sc_start(bl,SC_INCFLEERATE,100,-100,time);
break;
case 8: // Speed/ASPD -25%
- sc_start4(bl,SC_GOSPEL,100,1,0,0,BCT_ENEMY,type);
+ sc_start4(bl,SC_GOSPEL,100,1,0,0,BCT_ENEMY,time);
break;
}
}
@@ -7063,7 +7076,7 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in
struct skill_unit_group *sg;
struct status_change *sc;
struct status_change_entry *sce;
- int type;
+ enum sc_type type;
nullpo_retr(0, src);
nullpo_retr(0, bl);
@@ -7110,7 +7123,7 @@ static int skill_unit_onleft (int skill_id, struct block_list *bl, unsigned int
{
struct status_change *sc;
struct status_change_entry *sce;
- int type;
+ enum sc_type type;
sc = status_get_sc(bl);
if (sc && !sc->count)
diff --git a/src/map/status.c b/src/map/status.c
index a87e2cbc4..47d2617b6 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -60,22 +60,22 @@ int current_equip_card_id; //To prevent card-stacking (from jA) [Skotlex]
//we need it for new cards 15 Feb 2005, to check if the combo cards are insrerted into the CURRENT weapon only
//to avoid cards exploits
-static int SkillStatusChangeTable[MAX_SKILL]; // skill -> status
-static int StatusIconChangeTable[SC_MAX]; // status -> icon
-unsigned long StatusChangeFlagTable[SC_MAX]; // status -> flags
-static int StatusSkillChangeTable[SC_MAX]; // status -> skill
+static sc_type SkillStatusChangeTable[MAX_SKILL]; // skill -> status
+static int StatusIconChangeTable[SC_MAX]; // status -> icon
+unsigned long StatusChangeFlagTable[SC_MAX]; // status -> flags
+static int StatusSkillChangeTable[SC_MAX]; // status -> skill
-int status_skill2sc(int skill)
+sc_type status_skill2sc(int skill)
{
int sk = skill_get_index(skill);
if( sk == 0 ) {
ShowError("status_skill2sc: Unsupported skill id %d\n", skill);
- return -1;
+ return SC_NONE;
}
return SkillStatusChangeTable[sk];
}
-int status_sc2skill(int sc)
+int status_sc2skill(sc_type sc)
{
if( sc < 0 || sc >= SC_MAX ) {
ShowError("status_skill2sc: Unsupported status change id %d\n", sc);
@@ -87,7 +87,7 @@ int status_sc2skill(int sc)
#define add_sc(skill,sc) set_sc(skill,sc,SI_BLANK,SCB_NONE)
-static void set_sc(int skill, int sc, int icon, unsigned int flag)
+static void set_sc(int skill, sc_type sc, int icon, unsigned int flag)
{
int sk = skill_get_index(skill);
if( sk == 0 ) {
@@ -105,7 +105,7 @@ static void set_sc(int skill, int sc, int icon, unsigned int flag)
StatusIconChangeTable[sc] = icon;
StatusChangeFlagTable[sc] |= flag;
- if( SkillStatusChangeTable[sk] == -1 )
+ if( SkillStatusChangeTable[sk] == SC_NONE )
SkillStatusChangeTable[sk] = sc;
}
@@ -115,7 +115,7 @@ void initChangeTables(void)
for (i = 0; i < SC_MAX; i++)
StatusIconChangeTable[i] = SI_BLANK;
for (i = 0; i < MAX_SKILL; i++)
- SkillStatusChangeTable[i] = -1;
+ SkillStatusChangeTable[i] = SC_NONE;
memset(StatusSkillChangeTable, 0, sizeof(StatusSkillChangeTable));
memset(StatusChangeFlagTable, 0, sizeof(StatusChangeFlagTable));
@@ -407,21 +407,21 @@ void initChangeTables(void)
set_sc( GD_REGENERATION , SC_REGENERATION , SI_BLANK , SCB_REGEN );
// Storing the target job rather than simply SC_SPIRIT simplifies code later on.
- SkillStatusChangeTable[SL_ALCHEMIST] = MAPID_ALCHEMIST,
- SkillStatusChangeTable[SL_MONK] = MAPID_MONK,
- SkillStatusChangeTable[SL_STAR] = MAPID_STAR_GLADIATOR,
- SkillStatusChangeTable[SL_SAGE] = MAPID_SAGE,
- SkillStatusChangeTable[SL_CRUSADER] = MAPID_CRUSADER,
- SkillStatusChangeTable[SL_SUPERNOVICE] = MAPID_SUPER_NOVICE,
- SkillStatusChangeTable[SL_KNIGHT] = MAPID_KNIGHT,
- SkillStatusChangeTable[SL_WIZARD] = MAPID_WIZARD,
- SkillStatusChangeTable[SL_PRIEST] = MAPID_PRIEST,
- SkillStatusChangeTable[SL_BARDDANCER] = MAPID_BARDDANCER,
- SkillStatusChangeTable[SL_ROGUE] = MAPID_ROGUE,
- SkillStatusChangeTable[SL_ASSASIN] = MAPID_ASSASSIN,
- SkillStatusChangeTable[SL_BLACKSMITH] = MAPID_BLACKSMITH,
- SkillStatusChangeTable[SL_HUNTER] = MAPID_HUNTER,
- SkillStatusChangeTable[SL_SOULLINKER] = MAPID_SOUL_LINKER,
+ SkillStatusChangeTable[SL_ALCHEMIST] = (sc_type)MAPID_ALCHEMIST,
+ SkillStatusChangeTable[SL_MONK] = (sc_type)MAPID_MONK,
+ SkillStatusChangeTable[SL_STAR] = (sc_type)MAPID_STAR_GLADIATOR,
+ SkillStatusChangeTable[SL_SAGE] = (sc_type)MAPID_SAGE,
+ SkillStatusChangeTable[SL_CRUSADER] = (sc_type)MAPID_CRUSADER,
+ SkillStatusChangeTable[SL_SUPERNOVICE] = (sc_type)MAPID_SUPER_NOVICE,
+ SkillStatusChangeTable[SL_KNIGHT] = (sc_type)MAPID_KNIGHT,
+ SkillStatusChangeTable[SL_WIZARD] = (sc_type)MAPID_WIZARD,
+ SkillStatusChangeTable[SL_PRIEST] = (sc_type)MAPID_PRIEST,
+ SkillStatusChangeTable[SL_BARDDANCER] = (sc_type)MAPID_BARDDANCER,
+ SkillStatusChangeTable[SL_ROGUE] = (sc_type)MAPID_ROGUE,
+ SkillStatusChangeTable[SL_ASSASIN] = (sc_type)MAPID_ASSASSIN,
+ SkillStatusChangeTable[SL_BLACKSMITH] = (sc_type)MAPID_BLACKSMITH,
+ SkillStatusChangeTable[SL_HUNTER] = (sc_type)MAPID_HUNTER,
+ SkillStatusChangeTable[SL_SOULLINKER] = (sc_type)MAPID_SOUL_LINKER,
//Status that don't have a skill associated.
StatusIconChangeTable[SC_WEIGHT50] = SI_WEIGHT50;
@@ -1350,7 +1350,7 @@ int status_calc_mob(struct mob_data* md, int first)
return 0;
}
if (!md->base_status)
- md->base_status = aCalloc(1, sizeof(struct status_data));
+ md->base_status = (struct status_data*)aCalloc(1, sizeof(struct status_data));
status = md->base_status;
memcpy(status, &md->db->status, sizeof(struct status_data));
@@ -4603,7 +4603,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
sc = status_get_sc(bl);
status = status_get_status_data(bl);
- if( type < 0 || type >= SC_MAX )
+ if( type <= SC_NONE || type >= SC_MAX )
{
ShowError("status_change_start: invalid status change (%d)!\n", type);
return 0;
@@ -5581,8 +5581,8 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
{ //Try to inherit the status from the Crusader [Skotlex]
//Ideally, we should calculate the remaining time and use that, but we'll trust that
//once the Crusader's status changes, it will reflect on the others.
- const int types[] = { SC_AUTOGUARD, SC_DEFENDER, SC_REFLECTSHIELD, SC_ENDURE };
- int type2;
+ const enum sc_type types[] = { SC_AUTOGUARD, SC_DEFENDER, SC_REFLECTSHIELD, SC_ENDURE };
+ enum sc_type type2;
int i = map_flag_gvg(bl->m)?2:3;
while (i >= 0) {
type2 = types[i];
@@ -6166,7 +6166,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
int status_change_clear(struct block_list* bl, int type)
{
struct status_change* sc;
- enum sc_type i;
+ int i;
sc = status_get_sc(bl);
@@ -6200,7 +6200,7 @@ int status_change_clear(struct block_list* bl, int type)
continue;
}
- status_change_end(bl, i, INVALID_TIMER);
+ status_change_end(bl, (sc_type)i, INVALID_TIMER);
if( type == 1 && sc->data[i] )
{ //If for some reason status_change_end decides to still keep the status when quitting. [Skotlex]
@@ -6442,7 +6442,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
case SC_MARIONETTE2: /// Marionette target
if (sce->val1)
{ // check for partner and end their marionette status as well
- int type2 = (type == SC_MARIONETTE) ? SC_MARIONETTE2 : SC_MARIONETTE;
+ enum sc_type type2 = (type == SC_MARIONETTE) ? SC_MARIONETTE2 : SC_MARIONETTE;
struct block_list *pbl = map_id2bl(sce->val1);
struct status_change* sc2 = pbl?status_get_sc(pbl):NULL;
@@ -6728,7 +6728,7 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, int data)
*------------------------------------------*/
int status_change_timer(int tid, unsigned int tick, int id, int data)
{
- enum sc_type type = data;
+ enum sc_type type = (sc_type)data;
struct block_list *bl;
struct map_session_data *sd;
struct status_data *status;
@@ -7074,7 +7074,7 @@ int status_change_timer_sub(struct block_list* bl, va_list ap)
struct block_list* src = va_arg(ap,struct block_list*);
struct status_change_entry* sce = va_arg(ap,struct status_change_entry*);
- enum sc_type type = va_arg(ap,enum sc_type);
+ enum sc_type type = (sc_type)va_arg(ap,int); //gcc: enum args get promoted to int
unsigned int tick = va_arg(ap,unsigned int);
if (status_isdead(bl))
@@ -7129,7 +7129,7 @@ int status_change_timer_sub(struct block_list* bl, va_list ap)
*------------------------------------------*/
int status_change_clear_buffs (struct block_list* bl, int type)
{
- enum sc_type i;
+ int i;
struct status_change *sc= status_get_sc(bl);
if (!sc || !sc->count)
@@ -7139,7 +7139,7 @@ int status_change_clear_buffs (struct block_list* bl, int type)
for( i = SC_COMMON_MIN; i <= SC_COMMON_MAX; i++ )
{
if(sc->data[i])
- status_change_end(bl,i,-1);
+ status_change_end(bl,(sc_type)i,-1);
}
for( i = SC_COMMON_MAX+1; i < SC_MAX; i++ )
@@ -7206,7 +7206,7 @@ int status_change_clear_buffs (struct block_list* bl, int type)
continue;
break;
}
- status_change_end(bl,i,-1);
+ status_change_end(bl,(sc_type)i,-1);
}
return 0;
}
diff --git a/src/map/status.h b/src/map/status.h
index 52274b66f..5011eada5 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -18,7 +18,9 @@ extern unsigned long StatusChangeFlagTable[];
// Status changes listing. These code are for use by the server.
-enum sc_type {
+typedef enum sc_type {
+ SC_NONE = -1,
+
//First we enumerate common status ailments which are often used around.
SC_STONE = 0,
SC_COMMON_MIN = 0, // begin
@@ -290,7 +292,7 @@ enum sc_type {
SC_SPCOST_RATE,
SC_COMMONSC_RESIST,
SC_MAX, //Automatically updated max, used in for's to check we are within bounds.
-};
+} sc_type;
//Numerates the Number for the status changes (client-dependent), imported from jA
enum si_type {
@@ -683,8 +685,8 @@ struct status_change {
};
// for looking up associated data
-int status_skill2sc(int skill);
-int status_sc2skill(int sc);
+sc_type status_skill2sc(int skill);
+int status_sc2skill(sc_type sc);
int status_damage(struct block_list *src,struct block_list *target,int hp,int sp, int walkdelay, int flag);
//Define for standard HP damage attacks.
diff --git a/src/map/storage.c b/src/map/storage.c
index 06c052d74..c2e4bf5f7 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -106,13 +106,13 @@ static void* create_storage(DBKey key, va_list args)
}
struct storage *account2storage(int account_id)
{
- return idb_ensure(storage_db,account_id,create_storage);
+ return (struct storage*)idb_ensure(storage_db,account_id,create_storage);
}
// Just to ask storage, without creation
struct storage *account2storage2(int account_id)
{
- return idb_get(storage_db, account_id);
+ return (struct storage*)idb_get(storage_db, account_id);
}
int storage_delete(int account_id)
@@ -141,7 +141,7 @@ int storage_storageopen(struct map_session_data *sd)
return 1;
}
- if((stor = idb_get(storage_db,sd->status.account_id)) == NULL)
+ if((stor = (struct storage*)idb_get(storage_db,sd->status.account_id)) == NULL)
{ //Request storage.
intif_request_storage(sd->status.account_id);
return 2;
@@ -478,7 +478,7 @@ struct guild_storage *guild2storage(int guild_id)
struct guild_storage *guild2storage2(int guild_id)
{ //For just locating a storage without creating one. [Skotlex]
- return idb_get(guild_storage_db,guild_id);
+ return (struct guild_storage*)idb_get(guild_storage_db,guild_id);
}
int guild_storage_delete(int guild_id)
diff --git a/src/tool/Makefile.in b/src/tool/Makefile.in
index f1d688a7d..efe3383ac 100644
--- a/src/tool/Makefile.in
+++ b/src/tool/Makefile.in
@@ -2,27 +2,23 @@
@SET_MAKE@
#####################################################################
-.PHONY : all adduser convert mapcache clean help
+.PHONY : all adduser mapcache clean help
-all: adduser convert mapcache
+all: adduser mapcache
adduser:
@CC@ -o ../../tools/adduser@EXEEXT@ adduser.c
-convert:
- @CC@ -o ../../tools/convert@EXEEXT@ convert.c
-
mapcache: obj_mapcache
@CC@ -c -o obj_mapcache/grfio.o grfio.c
@CC@ -o ../../mapcache@EXEEXT@ mapcache.c obj_mapcache/grfio.o -lz
clean:
- rm -rf *.o obj_mapcache ../../tools/adduser@EXEEXT@ ../../tools/convert@EXEEXT@ ../../mapcache@EXEEXT@
+ rm -rf *.o obj_mapcache ../../tools/adduser@EXEEXT@ ../../mapcache@EXEEXT@
help:
- @echo "possible targets are 'adduser' 'convert' 'mapcache' 'all' 'clean' 'help'"
+ @echo "possible targets are 'adduser' 'mapcache' 'all' 'clean' 'help'"
@echo "'adduser' - ???"
- @echo "'convert' - ???"
@echo "'mapcache' - mapcache generator"
@echo "'all' - builds all above targets"
@echo "'clean' - cleans builds and objects"
diff --git a/src/tool/adduser.c b/src/tool/adduser.c
index 8e7c5f0c2..2c7461930 100644
--- a/src/tool/adduser.c
+++ b/src/tool/adduser.c
@@ -9,19 +9,20 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
char *account_txt = "../save/account.txt";
//-----------------------------------------------------
// 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;
for(i = 0; str[i]; i++) {
- if (str[i] < 32) {
+ if (iscntrl((unsigned char)(str[i]))) {
str[i] = '_';
change = 1;
}
@@ -64,7 +65,7 @@ int main(int argc, char *argv[])
}
}
}
- close(FPaccin);
+ fclose(FPaccin);
printf("File exists.\n");
printf("Don't create an account if the login-server is online!!!\n");
@@ -96,7 +97,7 @@ int main(int argc, char *argv[])
FPaccout = fopen(account_txt, "r+");
fseek(FPaccout, 0, SEEK_END);
fprintf(FPaccout, "%i %s %s - %s -\r\n", next_id, username, password, sex);
- close(FPaccout);
+ fclose(FPaccout);
printf("Account added.\n");
}
diff --git a/src/tool/convert.c b/src/tool/convert.c
deleted file mode 100644
index 671a49fb7..000000000
--- a/src/tool/convert.c
+++ /dev/null
@@ -1,300 +0,0 @@
-// (c) eAthena Dev Team - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define MAX_INVENTORY 100
-#define MAX_CART 100
-#define MAX_SKILL 350
-#define GLOBAL_REG_NUM 16
-
-struct item {
- int id;
- short nameid;
- short amount;
- short equip;
- char identify;
- char refine;
- char attribute;
- short card[4];
-};
-struct point{
- char map[16];
- short x,y;
-};
-struct skill {
- unsigned short id,lv,flag;
-};
-struct global_reg {
- char str[16];
- int value;
-};
-
-struct mmo_charstatus {
- int char_id;
- int account_id;
- int base_exp,job_exp,zeny;
-
- short class;
- short status_point,skill_point;
- short hp,max_hp,sp,max_sp;
- short option,karma,manner;
- short hair,hair_color,clothes_color;
- int party_id,guild_id,pet_id;
-
- short weapon,shield;
- short head_top,head_mid,head_bottom;
-
- char name[24];
- unsigned char base_level,job_level;
- unsigned char str,agi,vit,int_,dex,luk,slot,sex;
-
- struct point last_point,save_point,memo_point[3];
- struct item inventory[MAX_INVENTORY],cart[MAX_CART];
- struct skill skill[MAX_SKILL];
- int global_reg_num;
- struct global_reg global_reg[GLOBAL_REG_NUM];
-};
-
-int mmo_char_tostr(char *str,struct mmo_charstatus *p)
-{
- int i;
- sprintf(str,"%d\t%d,%d\t%s\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d"
- "\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d,%d"
- "\t%s,%d,%d\t%s,%d,%d",
- p->char_id,p->account_id,p->slot,p->name, //
- p->class,p->base_level,p->job_level,
- p->base_exp,p->job_exp,p->zeny,
- p->hp,p->max_hp,p->sp,p->max_sp,
- p->str,p->agi,p->vit,p->int_,p->dex,p->luk,
- p->status_point,p->skill_point,
- p->option,p->karma,p->manner, //
- p->party_id,p->guild_id,p->pet_id,
- p->hair,p->hair_color,p->clothes_color,
- p->weapon,p->shield,p->head_top,p->head_mid,p->head_bottom,
- p->last_point.map,p->last_point.x,p->last_point.y, //
- p->save_point.map,p->save_point.x,p->save_point.y
- );
- strcat(str,"\t");
- for(i=0;i<3;i++)
- if(p->memo_point[i].map[0]){
- sprintf(str+strlen(str),"%s,%d,%d",p->memo_point[i].map,p->memo_point[i].x,p->memo_point[i].y);
- }
- strcat(str,"\t");
- for(i=0;i<MAX_INVENTORY;i++)
- if(p->inventory[i].nameid){
- sprintf(str+strlen(str),"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d ",
- p->inventory[i].id,p->inventory[i].nameid,p->inventory[i].amount,p->inventory[i].equip,
- p->inventory[i].identify,p->inventory[i].refine,p->inventory[i].attribute,
- p->inventory[i].card[0],p->inventory[i].card[1],p->inventory[i].card[2],p->inventory[i].card[3]);
- }
- strcat(str,"\t");
- for(i=0;i<MAX_CART;i++)
- if(p->cart[i].nameid){
- sprintf(str+strlen(str),"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d ",
- p->cart[i].id,p->cart[i].nameid,p->cart[i].amount,p->cart[i].equip,
- p->cart[i].identify,p->cart[i].refine,p->cart[i].attribute,
- p->cart[i].card[0],p->cart[i].card[1],p->cart[i].card[2],p->cart[i].card[3]);
- }
- strcat(str,"\t");
- for(i=0;i<MAX_SKILL;i++)
- if(p->skill[i].id){
- sprintf(str+strlen(str),"%d,%d ",p->skill[i].id,p->skill[i].lv);
- }
- strcat(str,"\t");
- for(i=0;i<p->global_reg_num;i++)
- sprintf(str+strlen(str),"%s,%d ",p->global_reg[i].str,p->global_reg[i].value);
- strcat(str,"\t");
- return 0;
-}
-
-int mmo_char_fromstr(char *str,struct mmo_charstatus *p)
-{
- int tmp_int[256];
- int set,next,len,i;
-
- set=sscanf(str,"%d\t%d,%d\t%[^\t]\t%d,%d,%d\t%d,%d,%d\t%d,%d,%d,%d\t%d,%d,%d,%d,%d,%d\t%d,%d"
- "\t%d,%d,%d\t%d,%d\t%d,%d,%d\t%d,%d,%d,%d,%d"
- "\t%[^,],%d,%d\t%[^,],%d,%d%n",
- &tmp_int[0],&tmp_int[1],&tmp_int[2],p->name, //
- &tmp_int[3],&tmp_int[4],&tmp_int[5],
- &tmp_int[6],&tmp_int[7],&tmp_int[8],
- &tmp_int[9],&tmp_int[10],&tmp_int[11],&tmp_int[12],
- &tmp_int[13],&tmp_int[14],&tmp_int[15],&tmp_int[16],&tmp_int[17],&tmp_int[18],
- &tmp_int[19],&tmp_int[20],
- &tmp_int[21],&tmp_int[22],&tmp_int[23], //
- &tmp_int[24],&tmp_int[25],
- &tmp_int[26],&tmp_int[27],&tmp_int[28],
- &tmp_int[29],&tmp_int[30],&tmp_int[31],&tmp_int[32],&tmp_int[33],
- p->last_point.map,&tmp_int[34],&tmp_int[35], //
- p->save_point.map,&tmp_int[36],&tmp_int[37],&next
- );
- p->char_id=tmp_int[0];
- p->account_id=tmp_int[1];
- p->slot=tmp_int[2];
- p->class=tmp_int[3];
- p->base_level=tmp_int[4];
- p->job_level=tmp_int[5];
- p->base_exp=tmp_int[6];
- p->job_exp=tmp_int[7];
- p->zeny=tmp_int[8];
- p->hp=tmp_int[9];
- p->max_hp=tmp_int[10];
- p->sp=tmp_int[11];
- p->max_sp=tmp_int[12];
- p->str=tmp_int[13];
- p->agi=tmp_int[14];
- p->vit=tmp_int[15];
- p->int_=tmp_int[16];
- p->dex=tmp_int[17];
- p->luk=tmp_int[18];
- p->status_point=tmp_int[19];
- p->skill_point=tmp_int[20];
- p->option=tmp_int[21];
- p->karma=tmp_int[22];
- p->manner=tmp_int[23];
- p->party_id=tmp_int[24];
- p->guild_id=tmp_int[25];
- p->pet_id=0;
- p->hair=tmp_int[26];
- p->hair_color=tmp_int[27];
- p->clothes_color=tmp_int[28];
- p->weapon=tmp_int[29];
- p->shield=tmp_int[30];
- p->head_top=tmp_int[31];
- p->head_mid=tmp_int[32];
- p->head_bottom=tmp_int[33];
- p->last_point.x=tmp_int[34];
- p->last_point.y=tmp_int[35];
- p->save_point.x=tmp_int[36];
- p->save_point.y=tmp_int[37];
- if(set!=41)
- return 0;
- if(str[next]=='\n' || str[next]=='\r')
- return 1; // 新規データ
- next++;
- for(i=0;str[next] && str[next]!='\t';i++){
- set=sscanf(str+next,"%[^,],%d,%d%n",p->memo_point[i].map,&tmp_int[0],&tmp_int[1],&len);
- if(set!=3)
- return 0;
- p->memo_point[i].x=tmp_int[0];
- p->memo_point[i].y=tmp_int[1];
- next+=len;
- if(str[next]==' ')
- next++;
- }
- next++;
- for(i=0;str[next] && str[next]!='\t';i++){
- set=sscanf(str+next,"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%n",
- &tmp_int[0],&tmp_int[1],&tmp_int[2],&tmp_int[3],
- &tmp_int[4],&tmp_int[5],&tmp_int[6],
- &tmp_int[7],&tmp_int[8],&tmp_int[9],&tmp_int[10],&len);
- if(set!=11)
- return 0;
- p->inventory[i].id=tmp_int[0];
- p->inventory[i].nameid=tmp_int[1];
- p->inventory[i].amount=tmp_int[2];
- p->inventory[i].equip=tmp_int[3];
- p->inventory[i].identify=tmp_int[4];
- p->inventory[i].refine=tmp_int[5];
- p->inventory[i].attribute=tmp_int[6];
- p->inventory[i].card[0]=tmp_int[7];
- p->inventory[i].card[1]=tmp_int[8];
- p->inventory[i].card[2]=tmp_int[9];
- p->inventory[i].card[3]=tmp_int[10];
- next+=len;
- if(str[next]==' ')
- next++;
- }
- next++;
- for(i=0;str[next] && str[next]!='\t';i++){
- set=sscanf(str+next,"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%n",
- &tmp_int[0],&tmp_int[1],&tmp_int[2],&tmp_int[3],
- &tmp_int[4],&tmp_int[5],&tmp_int[6],
- &tmp_int[7],&tmp_int[8],&tmp_int[9],&tmp_int[10],&len);
- if(set!=11)
- return 0;
- p->cart[i].id=tmp_int[0];
- p->cart[i].nameid=tmp_int[1];
- p->cart[i].amount=tmp_int[2];
- p->cart[i].equip=tmp_int[3];
- p->cart[i].identify=tmp_int[4];
- p->cart[i].refine=tmp_int[5];
- p->cart[i].attribute=tmp_int[6];
- p->cart[i].card[0]=tmp_int[7];
- p->cart[i].card[1]=tmp_int[8];
- p->cart[i].card[2]=tmp_int[9];
- p->cart[i].card[3]=tmp_int[10];
- next+=len;
- if(str[next]==' ')
- next++;
- }
- next++;
- for(i=0;str[next] && str[next]!='\t';i++){
- set=sscanf(str+next,"%d,%d%n",
- &tmp_int[0],&tmp_int[1],&len);
- if(set!=2)
- return 0;
- p->skill[tmp_int[0]].id=tmp_int[0];
- p->skill[tmp_int[0]].lv=tmp_int[1];
- next+=len;
- if(str[next]==' ')
- next++;
- }
- next++;
- for(i=0;str[next] && str[next]!='\t' && str[next]!='\n' && str[next]!='\r';i++){ //global_reg実装以前のathena.txt互換のため一応'\n'チェック
- set=sscanf(str+next,"%[^,],%d%n",
- p->global_reg[i].str,&p->global_reg[i].value,&len);
- if(set!=2)
- return 0;
- next+=len;
- if(str[next]==' ')
- next++;
- }
- p->global_reg_num=i;
- return 1;
-}
-
-int mmo_char_convert(char *fname1,char *fname2)
-{
- char line[65536];
- int ret;
- struct mmo_charstatus char_dat;
- FILE *ifp,*ofp;
-
- ifp=fopen(fname1,"r");
- ofp=fopen(fname2,"w");
- if(ifp==NULL) {
- printf("file not found %s\n",fname1);
- return 0;
- }
- if(ofp==NULL) {
- printf("file open error %s\n",fname2);
- return 0;
- }
- while(fgets(line, sizeof(line), ifp))
- {
- memset(&char_dat,0,sizeof(struct mmo_charstatus));
- ret=mmo_char_fromstr(line,&char_dat);
- if(ret){
- mmo_char_tostr(line,&char_dat);
- fprintf(ofp,"%s\n",line);
- }
- }
- fclose(ifp);
- fclose(ofp);
- return 0;
-}
-
-int main(int argc,char *argv[])
-{
- if(argc < 3) {
- printf("Usage: convert <input filename> <output filename>\n");
- exit(EXIT_SUCCESS);
- }
- mmo_char_convert(argv[1],argv[2]);
-
- return 0;
-}
diff --git a/src/txt-converter/login-converter.c b/src/txt-converter/login-converter.c
index 6936ca782..b216ff8d2 100644
--- a/src/txt-converter/login-converter.c
+++ b/src/txt-converter/login-converter.c
@@ -34,11 +34,8 @@ char db_server_logindb[32] = "ragnarok";
int isGM(int account_id)
{
- struct gm_account *p;
- p = idb_get(gm_account_db,account_id);
- if( p == NULL)
- return 0;
- return p->level;
+ struct gm_account* p = (struct gm_account*)idb_get(gm_account_db,account_id);
+ return( p != NULL ) ? p->level : 0;
}
int read_gm_account()
@@ -74,7 +71,7 @@ int read_gm_account()
else {
if(p->level > 99)
p->level = 99;
- p = idb_put(gm_account_db,p->account_id,p);
+ p = (struct gm_account*)idb_put(gm_account_db,p->account_id,p);
if( p )
aFree(p);// old entry replaced
gm_counter++;
diff --git a/vcproj-9/char-server_sql.vcproj b/vcproj-9/char-server_sql.vcproj
index bf882d8ae..b4d46301d 100644
--- a/vcproj-9/char-server_sql.vcproj
+++ b/vcproj-9/char-server_sql.vcproj
@@ -41,6 +41,7 @@
/>
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4800"
Optimization="0"
AdditionalIncludeDirectories="..\src\common;..\src\zlib;..\src\mysql"
PreprocessorDefinitions="WIN32;_WIN32;__WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;FD_SETSIZE=4096;DB_MANUAL_CAST_TO_UNION"
@@ -53,9 +54,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -129,6 +129,7 @@
/>
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4800"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
@@ -143,9 +144,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -169,7 +169,6 @@
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
diff --git a/vcproj-9/char-server_txt.vcproj b/vcproj-9/char-server_txt.vcproj
index 8e7ec7c65..ef6806380 100644
--- a/vcproj-9/char-server_txt.vcproj
+++ b/vcproj-9/char-server_txt.vcproj
@@ -41,6 +41,7 @@
/>
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4800"
Optimization="0"
AdditionalIncludeDirectories="..\src\common;..\src\zlib"
PreprocessorDefinitions="WIN32;_WIN32;__WIN32;_DEBUG;TXT_ONLY;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;FD_SETSIZE=4096;DB_MANUAL_CAST_TO_UNION"
@@ -53,9 +54,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -128,6 +128,7 @@
/>
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4800"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
@@ -142,9 +143,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -167,7 +167,6 @@
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
diff --git a/vcproj-9/ladmin.vcproj b/vcproj-9/ladmin.vcproj
index 4765619ff..69307a132 100644
--- a/vcproj-9/ladmin.vcproj
+++ b/vcproj-9/ladmin.vcproj
@@ -52,9 +52,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -142,9 +141,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -167,7 +165,6 @@
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
diff --git a/vcproj-9/login-server_sql.vcproj b/vcproj-9/login-server_sql.vcproj
index ce9b4c923..ba9a6027c 100644
--- a/vcproj-9/login-server_sql.vcproj
+++ b/vcproj-9/login-server_sql.vcproj
@@ -41,6 +41,7 @@
/>
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4800"
Optimization="0"
AdditionalIncludeDirectories="..\src\common;..\src\zlib;..\src\mysql"
PreprocessorDefinitions="WIN32;_WIN32;__WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;FD_SETSIZE=4096;DB_MANUAL_CAST_TO_UNION"
@@ -53,9 +54,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -129,6 +129,7 @@
/>
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4800"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
@@ -145,9 +146,8 @@
PrecompiledHeaderThrough=""
PrecompiledHeaderFile=""
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -171,7 +171,6 @@
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
diff --git a/vcproj-9/login-server_txt.vcproj b/vcproj-9/login-server_txt.vcproj
index fbc53a87c..1ef895c32 100644
--- a/vcproj-9/login-server_txt.vcproj
+++ b/vcproj-9/login-server_txt.vcproj
@@ -40,7 +40,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalOptions="/wd4100"
+ AdditionalOptions="/wd4100&#x0D;&#x0A;/wd4800"
Optimization="0"
AdditionalIncludeDirectories="..\src\common;..\src\zlib"
PreprocessorDefinitions="WIN32;_WIN32;__WIN32;_DEBUG;TXT_ONLY;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;FD_SETSIZE=4096;DB_MANUAL_CAST_TO_UNION"
@@ -53,9 +53,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -128,6 +127,7 @@
/>
<Tool
Name="VCCLCompilerTool"
+ AdditionalOptions="/wd4800"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
@@ -142,9 +142,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -167,7 +166,6 @@
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
diff --git a/vcproj-9/map-server_sql.vcproj b/vcproj-9/map-server_sql.vcproj
index fce6df987..df0d9a7c3 100644
--- a/vcproj-9/map-server_sql.vcproj
+++ b/vcproj-9/map-server_sql.vcproj
@@ -40,7 +40,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalOptions="/wd4018&#x0D;&#x0A;/wd4100"
+ AdditionalOptions="/wd4018&#x0D;&#x0A;/wd4100&#x0D;&#x0A;/wd4800"
Optimization="0"
AdditionalIncludeDirectories="..\src\common;..\src\zlib;..\src\mysql"
PreprocessorDefinitions="WIN32;_WIN32;__WIN32;_DEBUG;PCRE_SUPPORT;MAPREGSQL;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;FD_SETSIZE=4096;DB_MANUAL_CAST_TO_UNION"
@@ -53,9 +53,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -129,7 +128,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalOptions="/wd4018&#x0D;&#x0A;/wd4100"
+ AdditionalOptions="/wd4018&#x0D;&#x0A;/wd4100&#x0D;&#x0A;/wd4800"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
@@ -144,9 +143,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -170,7 +168,6 @@
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
diff --git a/vcproj-9/map-server_txt.vcproj b/vcproj-9/map-server_txt.vcproj
index d482b8dc8..567a27ccc 100644
--- a/vcproj-9/map-server_txt.vcproj
+++ b/vcproj-9/map-server_txt.vcproj
@@ -40,7 +40,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalOptions="/wd4018&#x0D;&#x0A;/wd4100"
+ AdditionalOptions="/wd4018&#x0D;&#x0A;/wd4100&#x0D;&#x0A;/wd4800"
Optimization="0"
AdditionalIncludeDirectories="..\src\common;..\src\zlib"
PreprocessorDefinitions="WIN32;_WIN32;__WIN32;_DEBUG;PCRE_SUPPORT;TXT_ONLY;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;FD_SETSIZE=4096;DB_MANUAL_CAST_TO_UNION"
@@ -53,9 +53,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -128,7 +127,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalOptions="/wd4018&#x0D;&#x0A;/wd4100"
+ AdditionalOptions="/wd4018&#x0D;&#x0A;/wd4100&#x0D;&#x0A;/wd4800"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
@@ -144,9 +143,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -169,7 +167,6 @@
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
diff --git a/vcproj-9/mapcache.vcproj b/vcproj-9/mapcache.vcproj
index 351b74377..a67a7fce8 100644
--- a/vcproj-9/mapcache.vcproj
+++ b/vcproj-9/mapcache.vcproj
@@ -52,9 +52,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -142,9 +141,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -167,7 +165,6 @@
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
diff --git a/vcproj-9/txt-converter-char.vcproj b/vcproj-9/txt-converter-char.vcproj
index 4eef64794..ce2ff1762 100644
--- a/vcproj-9/txt-converter-char.vcproj
+++ b/vcproj-9/txt-converter-char.vcproj
@@ -53,9 +53,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -145,9 +144,8 @@
PrecompiledHeaderThrough=""
PrecompiledHeaderFile=""
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -171,7 +169,6 @@
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
diff --git a/vcproj-9/txt-converter-login.vcproj b/vcproj-9/txt-converter-login.vcproj
index 4fde417f7..baf84d9e8 100644
--- a/vcproj-9/txt-converter-login.vcproj
+++ b/vcproj-9/txt-converter-login.vcproj
@@ -53,9 +53,8 @@
DefaultCharIsUnsigned="false"
UsePrecompiledHeader="0"
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -145,9 +144,8 @@
PrecompiledHeaderThrough=""
PrecompiledHeaderFile=""
WarningLevel="3"
- Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
- CompileAs="1"
+ CompileAs="2"
/>
<Tool
Name="VCManagedResourceCompilerTool"
@@ -171,7 +169,6 @@
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
- OptimizeForWindows98="1"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"