summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c50
-rw-r--r--src/char/int_guild.c86
-rw-r--r--src/char/int_guild.h4
-rw-r--r--src/char/int_party.c39
-rw-r--r--src/char/int_party.h4
-rw-r--r--src/char/int_storage.c8
-rw-r--r--src/char/int_storage.h8
-rw-r--r--src/char/inter.c16
-rw-r--r--src/char/inter.h2
-rw-r--r--src/common/db.c2
-rw-r--r--src/common/md5calc.c4
-rw-r--r--src/common/md5calc.h2
-rw-r--r--src/common/mmo.h4
-rw-r--r--src/common/nullpo.c2
-rw-r--r--src/common/socket.c22
-rw-r--r--src/common/socket.h2
-rw-r--r--src/common/timer.c8
-rw-r--r--src/common/timer.h5
-rw-r--r--src/ladmin/ladmin.c16
-rw-r--r--src/login/login.c20
-rw-r--r--src/login/login.h2
-rw-r--r--src/map/atcommand.c232
-rw-r--r--src/map/battle.c48
-rw-r--r--src/map/chat.c4
-rw-r--r--src/map/chrif.c10
-rw-r--r--src/map/chrif.h2
-rw-r--r--src/map/clif.c189
-rw-r--r--src/map/clif.h4
-rw-r--r--src/map/guild.c44
-rw-r--r--src/map/guild.h2
-rw-r--r--src/map/intif.c6
-rw-r--r--src/map/intif.h2
-rw-r--r--src/map/itemdb.c18
-rw-r--r--src/map/magic-expr.c14
-rw-r--r--src/map/magic-expr.h2
-rw-r--r--src/map/magic-interpreter-parser.y49
-rw-r--r--src/map/magic-interpreter.h2
-rw-r--r--src/map/magic-stmt.c21
-rw-r--r--src/map/magic.c2
-rw-r--r--src/map/magic.h2
-rw-r--r--src/map/map.c85
-rw-r--r--src/map/map.h10
-rw-r--r--src/map/mob.c600
-rw-r--r--src/map/mob.h6
-rw-r--r--src/map/npc.c103
-rw-r--r--src/map/npc.h2
-rw-r--r--src/map/party.c10
-rw-r--r--src/map/pc.c156
-rw-r--r--src/map/script.c92
-rw-r--r--src/map/script.h8
-rw-r--r--src/map/skill.c73
-rw-r--r--src/map/skill.h4
-rw-r--r--src/tool/eathena-monitor.c2
53 files changed, 986 insertions, 1124 deletions
diff --git a/src/char/char.c b/src/char/char.c
index dc77c31..eac88e6 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -246,7 +246,7 @@ int mmo_char_tostr (char *str, struct mmo_charstatus *p)
}
str_p += sprintf (str_p, "%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,%d\t", p->char_id, p->account_id, p->char_num, 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->pc_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, 0, 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,
p->partner_id);
@@ -364,7 +364,7 @@ int mmo_char_fromstr (char *str, struct mmo_charstatus *p)
p->char_id = tmp_int[0];
p->account_id = tmp_int[1];
p->char_num = tmp_int[2];
- p->class = tmp_int[3];
+ p->pc_class = tmp_int[3];
p->base_level = tmp_int[4];
p->job_level = tmp_int[5];
p->base_exp = tmp_int[6];
@@ -857,9 +857,7 @@ static void remove_prefix_blanks (char *name)
int make_new_char (int fd, unsigned char *dat)
{
int i, j;
- struct char_session_data *sd;
-
- sd = session[fd]->session_data;
+ struct char_session_data *sd = (struct char_session_data *)session[fd]->session_data;
// remove control characters from the name
dat[23] = '\0';
@@ -1003,7 +1001,7 @@ int make_new_char (int fd, unsigned char *dat)
char_dat[i].account_id = sd->account_id;
char_dat[i].char_num = dat[30];
strcpy (char_dat[i].name, dat);
- char_dat[i].class = 0;
+ char_dat[i].pc_class = 0;
char_dat[i].base_level = 1;
char_dat[i].job_level = 1;
char_dat[i].base_exp = 0;
@@ -1054,9 +1052,9 @@ int make_new_char (int fd, unsigned char *dat)
//----------------------------------------------------
// This function return the name of the job (by [Yor])
//----------------------------------------------------
-char *job_name (int class)
+char *job_name (int pc_class)
{
- switch (class)
+ switch (pc_class)
{
case 0:
return "Novice";
@@ -1278,13 +1276,13 @@ void create_online_files (void)
break;
case 4: // by job (and job level)
for (j = 0; j < players; j++)
- if (char_dat[i].class < char_dat[id[j]].class ||
+ if (char_dat[i].pc_class < char_dat[id[j]].pc_class ||
// if same job, we sort by job level.
- (char_dat[i].class == char_dat[id[j]].class &&
+ (char_dat[i].pc_class == char_dat[id[j]].pc_class &&
char_dat[i].job_level <
char_dat[id[j]].job_level) ||
// if same job and job level, we sort by job exp.
- (char_dat[i].class == char_dat[id[j]].class &&
+ (char_dat[i].pc_class == char_dat[id[j]].pc_class &&
char_dat[i].job_level ==
char_dat[id[j]].job_level
&& char_dat[i].job_exp <
@@ -1459,7 +1457,7 @@ void create_online_files (void)
// displaying of the job
if (online_display_option & 6)
{
- char *jobname = job_name (char_dat[j].class);
+ char *jobname = job_name (char_dat[j].pc_class);
if ((online_display_option & 6) == 6)
{
fprintf (fp2, " <td>%s %d/%d</td>\n",
@@ -1638,7 +1636,7 @@ int mmo_char_send006b (int fd, struct char_session_data *sd)
WFIFOW (fd, j + 46) = (p->sp > 0x7fff) ? 0x7fff : p->sp;
WFIFOW (fd, j + 48) = (p->max_sp > 0x7fff) ? 0x7fff : p->max_sp;
WFIFOW (fd, j + 50) = DEFAULT_WALK_SPEED; // p->speed;
- WFIFOW (fd, j + 52) = p->class;
+ WFIFOW (fd, j + 52) = p->pc_class;
WFIFOW (fd, j + 54) = p->hair;
// WFIFOW(fd,j+56) = p->weapon; // dont send weapon since TMW does not support it
WFIFOW (fd, j + 56) = 0;
@@ -1790,7 +1788,7 @@ int disconnect_player (int accound_id)
// disconnect player if online on char-server
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data))
+ if (session[i] && (sd = (struct char_session_data*)session[i]->session_data))
{
if (sd->account_id == accound_id)
{
@@ -1849,7 +1847,7 @@ void parse_tologin (int fd)
return;
}
- sd = session[fd]->session_data;
+ sd = (struct char_session_data*)session[fd]->session_data;
while (RFIFOREST (fd) >= 2)
{
@@ -1892,7 +1890,7 @@ void parse_tologin (int fd)
// printf("parse_tologin 2713 : %d\n", RFIFOB(fd,6));
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data)
+ if (session[i] && (sd = (struct char_session_data*)session[i]->session_data)
&& sd->account_id == RFIFOL (fd, 2))
{
if (RFIFOB (fd, 6) != 0)
@@ -1935,7 +1933,7 @@ void parse_tologin (int fd)
return;
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data))
+ if (session[i] && (sd = (struct char_session_data*)session[i]->session_data))
{
if (sd->account_id == RFIFOL (fd, 2))
{
@@ -1979,7 +1977,7 @@ void parse_tologin (int fd)
{
if (char_dat[i].account_id == acc)
{
- int jobclass = char_dat[i].class;
+ int jobclass = char_dat[i].pc_class;
char_dat[i].sex = sex;
// auth_fifo[i].sex = sex;
if (jobclass == 19 || jobclass == 20 ||
@@ -1989,18 +1987,18 @@ void parse_tologin (int fd)
// job modification
if (jobclass == 19 || jobclass == 20)
{
- char_dat[i].class = (sex) ? 19 : 20;
+ char_dat[i].pc_class = (sex) ? 19 : 20;
}
else if (jobclass == 4020
|| jobclass == 4021)
{
- char_dat[i].class =
+ char_dat[i].pc_class =
(sex) ? 4020 : 4021;
}
else if (jobclass == 4042
|| jobclass == 4043)
{
- char_dat[i].class =
+ char_dat[i].pc_class =
(sex) ? 4042 : 4043;
}
}
@@ -2216,7 +2214,7 @@ void parse_tologin (int fd)
for (j = 0; j < fd_max; j++)
{
if (session[j]
- && (sd2 = session[j]->session_data)
+ && (sd2 = (struct char_session_data*)session[j]->session_data)
&& sd2->account_id ==
char_dat[char_num - 1].account_id)
{
@@ -2311,7 +2309,7 @@ void parse_tologin (int fd)
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data))
+ if (session[i] && (sd = (struct char_session_data*)session[i]->session_data))
{
if (sd->account_id == acc)
{
@@ -2963,7 +2961,7 @@ void parse_char (int fd)
return;
}
- sd = session[fd]->session_data;
+ sd = (struct char_session_data*)session[fd]->session_data;
while (RFIFOREST (fd) >= 2)
{
@@ -3290,7 +3288,7 @@ void parse_char (int fd)
(char_dat[i].max_sp >
0x7fff) ? 0x7fff : char_dat[i].max_sp;
WFIFOW (fd, 2 + 50) = DEFAULT_WALK_SPEED; // char_dat[i].speed;
- WFIFOW (fd, 2 + 52) = char_dat[i].class;
+ WFIFOW (fd, 2 + 52) = char_dat[i].pc_class;
WFIFOW (fd, 2 + 54) = char_dat[i].hair;
WFIFOW (fd, 2 + 58) = char_dat[i].base_level;
@@ -3412,7 +3410,7 @@ void parse_char (int fd)
for (j = 0; j < fd_max; j++)
{
if (session[j]
- && (sd2 =
+ && (sd2 = (struct char_session_data*)
session[j]->session_data)
&& sd2->account_id ==
char_dat[char_num - 1].account_id)
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index 9715700..b0c3ccf 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -49,7 +49,7 @@ int inter_guild_tostr (char *str, struct guild *g)
len += sprintf (str + len, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\t%s\t",
m->account_id, m->char_id,
m->hair, m->hair_color, m->gender,
- m->class, m->lv, m->exp, m->exp_payper, m->position,
+ m->pc_class, m->lv, m->exp, m->exp_payper, m->position,
((m->account_id > 0) ? m->name : "-"));
}
// 役職
@@ -154,7 +154,7 @@ int inter_guild_fromstr (char *str, struct guild *g)
m->hair = tmp_int[2];
m->hair_color = tmp_int[3];
m->gender = tmp_int[4];
- m->class = tmp_int[5];
+ m->pc_class = tmp_int[5];
m->lv = tmp_int[6];
m->exp = tmp_int[7];
m->exp_payper = tmp_int[8];
@@ -398,7 +398,7 @@ int inter_guildcastle_fromstr (char *str, struct guild_castle *gc)
}
// ギルド関連データベース読み込み
-int inter_guild_readdb ()
+int inter_guild_readdb (void)
{
int i;
FILE *fp;
@@ -424,7 +424,7 @@ int inter_guild_readdb ()
}
// ギルドデータの読み込み
-int inter_guild_init ()
+int inter_guild_init (void)
{
char line[16384];
struct guild *g;
@@ -535,9 +535,7 @@ int inter_guild_init ()
struct guild *inter_guild_search (int guild_id)
{
- struct guild *g;
-
- g = numdb_search (guild_db, guild_id);
+ struct guild *g = (struct guild *)numdb_search (guild_db, guild_id);
return g;
}
@@ -565,7 +563,7 @@ void inter_castle_save_sub (db_key_t key, db_val_t data, va_list ap)
}
// ギルドデータのセーブ
-int inter_guild_save ()
+int inter_guild_save (void)
{
FILE *fp;
int lock;
@@ -839,7 +837,7 @@ int mapif_guild_memberinfoshort (struct guild *g, int idx)
WBUFL (buf, 10) = 0 /*g->member[idx].char_id*/;
WBUFB (buf, 14) = g->member[idx].online;
WBUFW (buf, 15) = g->member[idx].lv;
- WBUFW (buf, 17) = g->member[idx].class;
+ WBUFW (buf, 17) = g->member[idx].pc_class;
mapif_sendall (buf, 19);
return 0;
}
@@ -1091,9 +1089,7 @@ int mapif_parse_CreateGuild (int fd, int account_id, char *name,
// ギルド情報要求
int mapif_parse_GuildInfo (int fd, int guild_id)
{
- struct guild *g;
-
- g = numdb_search (guild_db, guild_id);
+ struct guild *g = (struct guild *)numdb_search (guild_db, guild_id);
if (g != NULL)
{
guild_calcinfo (g);
@@ -1108,17 +1104,14 @@ int mapif_parse_GuildInfo (int fd, int guild_id)
// ギルドメンバ追加要求
int mapif_parse_GuildAddMember (int fd, int guild_id, struct guild_member *m)
{
- struct guild *g;
- int i;
-
- g = numdb_search (guild_db, guild_id);
+ struct guild *g = (struct guild *)numdb_search (guild_db, guild_id);
if (g == NULL)
{
mapif_guild_memberadded (fd, guild_id, m->account_id, 0 /*char_id*/, 1);
return 0;
}
- for (i = 0; i < g->max_member; i++)
+ for (int i = 0; i < g->max_member; i++)
{
if (g->member[i].account_id == 0)
{
@@ -1140,13 +1133,10 @@ int mapif_parse_GuildAddMember (int fd, int guild_id, struct guild_member *m)
int mapif_parse_GuildLeave (int fd, int guild_id, int account_id, int char_id,
int flag, const char *mes)
{
- struct guild *g = NULL;
- int i, j;
-
- g = numdb_search (guild_db, guild_id);
+ struct guild *g = (struct guild *)numdb_search (guild_db, guild_id);
if (g != NULL)
{
- for (i = 0; i < MAX_GUILD; i++)
+ for (int i = 0; i < MAX_GUILD; i++)
{
if (g->member[i].account_id == account_id)
{
@@ -1154,7 +1144,9 @@ int mapif_parse_GuildLeave (int fd, int guild_id, int account_id, int char_id,
// printf("%d %s\n", i, g->member[i].name);
if (flag)
- { // 追放の場合追放リストに入れる
+ {
+ int j;
+ // 追放の場合追放リストに入れる
for (j = 0; j < MAX_GUILDEXPLUSION; j++)
{
if (g->explusion[j].account_id == 0)
@@ -1191,26 +1183,23 @@ int mapif_parse_GuildLeave (int fd, int guild_id, int account_id, int char_id,
// オンライン/Lv更新
int mapif_parse_GuildChangeMemberInfoShort (int fd, int guild_id,
int account_id, int char_id,
- int online, int lv, int class)
+ int online, int lv, int pc_class)
{
- struct guild *g;
- int i, alv, c;
-
- g = numdb_search (guild_db, guild_id);
+ struct guild *g = (struct guild *)numdb_search (guild_db, guild_id);
if (g == NULL)
return 0;
g->connect_member = 0;
- alv = 0;
- c = 0;
- for (i = 0; i < MAX_GUILD; i++)
+ int alv = 0;
+ int c = 0;
+ for (int i = 0; i < MAX_GUILD; i++)
{
if (g->member[i].account_id == account_id)
{
g->member[i].online = online;
g->member[i].lv = lv;
- g->member[i].class = class;
+ g->member[i].pc_class = pc_class;
mapif_guild_memberinfoshort (g, i);
}
if (g->member[i].account_id > 0)
@@ -1244,9 +1233,7 @@ void guild_break_sub (db_key_t key, db_val_t data, va_list ap)
// ギルド解散要求
int mapif_parse_BreakGuild (int fd, int guild_id)
{
- struct guild *g;
-
- g = numdb_search (guild_db, guild_id);
+ struct guild *g = (struct guild *)numdb_search (guild_db, guild_id);
if (g == NULL)
return 0;
@@ -1272,10 +1259,9 @@ int mapif_parse_GuildMessage (int fd, int guild_id, int account_id, char *mes,
int mapif_parse_GuildBasicInfoChange (int fd, int guild_id, int type,
const char *data, int len)
{
- struct guild *g;
short dw = *((short *) data);
- g = numdb_search (guild_db, guild_id);
+ struct guild *g = (struct guild *)numdb_search (guild_db, guild_id);
if (g == NULL)
return 0;
@@ -1307,9 +1293,7 @@ int mapif_parse_GuildMemberInfoChange (int fd, int guild_id, int account_id,
const char *data, int len)
{
int i;
- struct guild *g;
-
- g = numdb_search (guild_db, guild_id);
+ struct guild *g = (struct guild *)numdb_search (guild_db, guild_id);
if (g == NULL)
return 0;
@@ -1351,7 +1335,7 @@ int mapif_parse_GuildMemberInfoChange (int fd, int guild_id, int account_id,
int mapif_parse_GuildPosition (int fd, int guild_id, int idx,
struct guild_position *p)
{
- struct guild *g = numdb_search (guild_db, guild_id);
+ struct guild *g = (struct guild *)numdb_search (guild_db, guild_id);
if (g == NULL || idx < 0 || idx >= MAX_GUILDPOSITION)
{
@@ -1368,7 +1352,7 @@ int mapif_parse_GuildPosition (int fd, int guild_id, int idx,
int mapif_parse_GuildSkillUp (int fd, int guild_id, int skill_num,
int account_id)
{
- struct guild *g = numdb_search (guild_db, guild_id);
+ struct guild *g = (struct guild *)numdb_search (guild_db, guild_id);
int idx = skill_num - 10000;
if (g == NULL || skill_num < 10000)
@@ -1394,8 +1378,8 @@ int mapif_parse_GuildAlliance (int fd, int guild_id1, int guild_id2,
struct guild *g[2];
int j, i;
- g[0] = numdb_search (guild_db, guild_id1);
- g[1] = numdb_search (guild_db, guild_id2);
+ g[0] = (struct guild *)numdb_search (guild_db, guild_id1);
+ g[1] = (struct guild *)numdb_search (guild_db, guild_id2);
if (g[0] == NULL || g[1] == NULL)
return 0;
@@ -1436,9 +1420,7 @@ int mapif_parse_GuildAlliance (int fd, int guild_id1, int guild_id2,
int mapif_parse_GuildNotice (int fd, int guild_id, const char *mes1,
const char *mes2)
{
- struct guild *g;
-
- g = numdb_search (guild_db, guild_id);
+ struct guild *g = (struct guild *)numdb_search (guild_db, guild_id);
if (g == NULL)
return 0;
memcpy (g->mes1, mes1, 60);
@@ -1451,9 +1433,7 @@ int mapif_parse_GuildNotice (int fd, int guild_id, const char *mes1,
int mapif_parse_GuildEmblem (int fd, int len, int guild_id, int dummy,
const char *data)
{
- struct guild *g;
-
- g = numdb_search (guild_db, guild_id);
+ struct guild *g = (struct guild *)numdb_search (guild_db, guild_id);
if (g == NULL)
return 0;
memcpy (g->emblem_data, data, len);
@@ -1465,7 +1445,7 @@ int mapif_parse_GuildEmblem (int fd, int len, int guild_id, int dummy,
int mapif_parse_GuildCastleDataLoad (int fd, int castle_id, int index)
{
- struct guild_castle *gc = numdb_search (castle_db, castle_id);
+ struct guild_castle *gc = (struct guild_castle *)numdb_search (castle_db, castle_id);
if (gc == NULL)
{
@@ -1560,7 +1540,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 = numdb_search (castle_db, castle_id);
+ struct guild_castle *gc = (struct guild_castle *)numdb_search (castle_db, castle_id);
if (gc == NULL)
{
@@ -1572,7 +1552,7 @@ int mapif_parse_GuildCastleDataSave (int fd, int castle_id, int index,
if (gc->guild_id != value)
{
int gid = (value) ? value : gc->guild_id;
- struct guild *g = numdb_search (guild_db, gid);
+ struct guild *g = (struct guild *)numdb_search (guild_db, gid);
inter_log ("guild %s (id=%d) %s castle id=%d" RETCODE,
(g) ? g->name : "??", gid,
(value) ? "occupy" : "abandon", index);
diff --git a/src/char/int_guild.h b/src/char/int_guild.h
index 954addf..5ac9a51 100644
--- a/src/char/int_guild.h
+++ b/src/char/int_guild.h
@@ -2,8 +2,8 @@
#ifndef _INT_GUILD_H_
#define _INT_GUILD_H_
-int inter_guild_init ();
-int inter_guild_save ();
+int inter_guild_init (void);
+int inter_guild_save (void);
int inter_guild_parse_frommap (int fd);
struct guild *inter_guild_search (int guild_id);
int inter_guild_mapif_init (int fd);
diff --git a/src/char/int_party.c b/src/char/int_party.c
index b728b1e..af79373 100644
--- a/src/char/int_party.c
+++ b/src/char/int_party.c
@@ -87,7 +87,7 @@ int inter_party_fromstr (char *str, struct party *p)
}
// パーティデータのロード
-int inter_party_init ()
+int inter_party_init (void)
{
char line[8192];
struct party *p;
@@ -144,7 +144,7 @@ void inter_party_save_sub (db_key_t key, db_val_t data, va_list ap)
}
// パーティーデータのセーブ
-int inter_party_save ()
+int inter_party_save (void)
{
FILE *fp;
int lock;
@@ -460,9 +460,7 @@ int mapif_parse_CreateParty (int fd, int account_id, char *name, char *nick,
// パーティ情報要求
int mapif_parse_PartyInfo (int fd, int party_id)
{
- struct party *p;
-
- p = numdb_search (party_db, party_id);
+ struct party *p = (struct party *)numdb_search (party_db, party_id);
if (p != NULL)
mapif_party_info (fd, p);
else
@@ -475,17 +473,14 @@ int mapif_parse_PartyInfo (int fd, int party_id)
int mapif_parse_PartyAddMember (int fd, int party_id, int account_id,
char *nick, char *map, int lv)
{
- struct party *p;
- int i;
-
- p = numdb_search (party_db, party_id);
+ struct party *p = (struct party *)numdb_search (party_db, party_id);
if (p == NULL)
{
mapif_party_memberadded (fd, party_id, account_id, 1);
return 0;
}
- for (i = 0; i < MAX_PARTY; i++)
+ for (int i = 0; i < MAX_PARTY; i++)
{
if (p->member[i].account_id == 0)
{
@@ -519,14 +514,12 @@ int mapif_parse_PartyAddMember (int fd, int party_id, int account_id,
int mapif_parse_PartyChangeOption (int fd, int party_id, int account_id,
int exp, int item)
{
- struct party *p;
- int flag = 0;
-
- p = numdb_search (party_db, party_id);
+ struct party *p = (struct party *)numdb_search (party_db, party_id);
if (p == NULL)
return 0;
p->exp = exp;
+ int flag = 0;
if (exp > 0 && !party_check_exp_share (p))
{
flag |= 0x01;
@@ -542,13 +535,10 @@ int mapif_parse_PartyChangeOption (int fd, int party_id, int account_id,
// パーティ脱退要求
int mapif_parse_PartyLeave (int fd, int party_id, int account_id)
{
- struct party *p;
- int i;
-
- p = numdb_search (party_db, party_id);
+ struct party *p = (struct party *)numdb_search (party_db, party_id);
if (p != NULL)
{
- for (i = 0; i < MAX_PARTY; i++)
+ for (int i = 0; i < MAX_PARTY; i++)
{
if (p->member[i].account_id == account_id)
{
@@ -569,14 +559,11 @@ int mapif_parse_PartyLeave (int fd, int party_id, int account_id)
int mapif_parse_PartyChangeMap (int fd, int party_id, int account_id,
char *map, int online, int lv)
{
- struct party *p;
- int i;
-
- p = numdb_search (party_db, party_id);
+ struct party *p = (struct party *)numdb_search (party_db, party_id);
if (p == NULL)
return 0;
- for (i = 0; i < MAX_PARTY; i++)
+ for (int i = 0; i < MAX_PARTY; i++)
{
if (p->member[i].account_id == account_id)
{
@@ -604,9 +591,7 @@ int mapif_parse_PartyChangeMap (int fd, int party_id, int account_id,
// パーティ解散要求
int mapif_parse_BreakParty (int fd, int party_id)
{
- struct party *p;
-
- p = numdb_search (party_db, party_id);
+ struct party *p = (struct party *)numdb_search (party_db, party_id);
if (p == NULL)
return 0;
diff --git a/src/char/int_party.h b/src/char/int_party.h
index 738b624..2007ed5 100644
--- a/src/char/int_party.h
+++ b/src/char/int_party.h
@@ -2,8 +2,8 @@
#ifndef _INT_PARTY_H_
#define _INT_PARTY_H_
-int inter_party_init ();
-int inter_party_save ();
+int inter_party_init (void);
+int inter_party_save (void);
int inter_party_parse_frommap (int fd);
diff --git a/src/char/int_storage.c b/src/char/int_storage.c
index 99af725..b3ec4da 100644
--- a/src/char/int_storage.c
+++ b/src/char/int_storage.c
@@ -248,7 +248,7 @@ struct guild_storage *guild2storage (int guild_id)
//---------------------------------------------------------
// 倉庫データを読み込む
-int inter_storage_init ()
+int inter_storage_init (void)
{
char line[65536];
int c = 0, tmp_int;
@@ -328,7 +328,7 @@ void guild_storage_db_final (db_key_t k, db_val_t data, va_list ap)
free (p);
}
-void inter_storage_final ()
+void inter_storage_final (void)
{
numdb_final (storage_db, storage_db_final);
numdb_final (guild_storage_db, guild_storage_db_final);
@@ -347,7 +347,7 @@ void inter_storage_save_sub (db_key_t key, db_val_t data, va_list ap)
//---------------------------------------------------------
// 倉庫データを書き込む
-int inter_storage_save ()
+int inter_storage_save (void)
{
FILE *fp;
int lock;
@@ -384,7 +384,7 @@ void inter_guild_storage_save_sub (db_key_t key, db_val_t data, va_list ap)
//---------------------------------------------------------
// 倉庫データを書き込む
-int inter_guild_storage_save ()
+int inter_guild_storage_save (void)
{
FILE *fp;
int lock;
diff --git a/src/char/int_storage.h b/src/char/int_storage.h
index 5036600..f1859c6 100644
--- a/src/char/int_storage.h
+++ b/src/char/int_storage.h
@@ -2,10 +2,10 @@
#ifndef _INT_STORAGE_H_
#define _INT_STORAGE_H_
-int inter_storage_init ();
-void inter_storage_final ();
-int inter_storage_save ();
-int inter_guild_storage_save ();
+int inter_storage_init (void);
+void inter_storage_final (void);
+int inter_storage_save (void);
+int inter_guild_storage_save (void);
int inter_storage_delete (int account_id);
int inter_guild_storage_delete (int guild_id);
struct storage *account2storage (int account_id);
diff --git a/src/char/inter.c b/src/char/inter.c
index f563931..a1a5664 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -106,7 +106,7 @@ int inter_accreg_fromstr (const char *str, struct accreg *reg)
}
// アカウント変数の読み込み
-int inter_accreg_init ()
+int inter_accreg_init (void)
{
char line[8192];
FILE *fp;
@@ -155,7 +155,7 @@ void inter_accreg_save_sub (db_key_t key, db_val_t data, va_list ap)
}
// アカウント変数のセーブ
-int inter_accreg_save ()
+int inter_accreg_save (void)
{
FILE *fp;
int lock;
@@ -262,7 +262,7 @@ int inter_log (char *fmt, ...)
}
// セーブ
-int inter_save ()
+int inter_save (void)
{
inter_party_save ();
inter_guild_save ();
@@ -358,7 +358,7 @@ int mapif_account_reg (int fd, unsigned char *src)
// アカウント変数要求返信
int mapif_account_reg_reply (int fd, int account_id)
{
- struct accreg *reg = numdb_search (accreg_db, account_id);
+ struct accreg *reg = (struct accreg *)numdb_search (accreg_db, account_id);
WFIFOW (fd, 0) = 0x3804;
WFIFOL (fd, 4) = account_id;
@@ -395,7 +395,7 @@ void check_ttl_wisdata_sub (db_key_t key, db_val_t data, va_list ap)
wis_dellist[wis_delnum++] = wd->id;
}
-int check_ttl_wisdata ()
+int check_ttl_wisdata (void)
{
unsigned long tick = gettick ();
int i;
@@ -406,7 +406,7 @@ int check_ttl_wisdata ()
numdb_foreach (wis_db, check_ttl_wisdata_sub, tick);
for (i = 0; i < wis_delnum; i++)
{
- struct WisData *wd = numdb_search (wis_db, wis_dellist[i]);
+ struct WisData *wd = (struct WisData *)numdb_search (wis_db, wis_dellist[i]);
printf ("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
@@ -499,7 +499,7 @@ int mapif_parse_WisRequest (int fd)
int mapif_parse_WisReply (int fd)
{
int id = RFIFOL (fd, 2), flag = RFIFOB (fd, 6);
- struct WisData *wd = numdb_search (wis_db, id);
+ struct WisData *wd = (struct WisData *)numdb_search (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
@@ -530,7 +530,7 @@ int mapif_parse_WisToGM (int fd)
int mapif_parse_AccReg (int fd)
{
int j, p;
- struct accreg *reg = numdb_search (accreg_db, (numdb_key_t)RFIFOL (fd, 4));
+ struct accreg *reg = (struct accreg*)numdb_search (accreg_db, (numdb_key_t)RFIFOL (fd, 4));
if (reg == NULL)
{
diff --git a/src/char/inter.h b/src/char/inter.h
index 7ad7d08..219f195 100644
--- a/src/char/inter.h
+++ b/src/char/inter.h
@@ -3,7 +3,7 @@
#define _INTER_H_
int inter_init (const char *file);
-int inter_save ();
+int inter_save (void);
int inter_parse_frommap (int fd);
int inter_mapif_init (int fd);
diff --git a/src/common/db.c b/src/common/db.c
index cee17df..f56a511 100644
--- a/src/common/db.c
+++ b/src/common/db.c
@@ -229,7 +229,7 @@ static void db_rebalance_erase (struct dbn *z, struct dbn **root)
z->parent->right = y;
y->parent = z->parent;
{
- int tmp = y->color;
+ dbn_color tmp = y->color;
y->color = z->color;
z->color = tmp;
}
diff --git a/src/common/md5calc.c b/src/common/md5calc.c
index 3f2e009..ba8f6af 100644
--- a/src/common/md5calc.c
+++ b/src/common/md5calc.c
@@ -165,7 +165,7 @@ void MD5_to_bin(MD5_state state, uint8_t out[0x10])
out[i] = state.val[i/4] >> 8*(i%4);
}
-static const char hex[0x10] = "0123456789abcdef";
+static const char hex[] = "0123456789abcdef";
void MD5_to_str(MD5_state state, char out[0x21])
{
@@ -291,7 +291,7 @@ const char *MD5_saltcrypt(const char *key, const char *salt)
return obuf;
}
-const char *make_salt() {
+const char *make_salt(void) {
static char salt[6];
for (int i=0; i<5; i++)
salt[i] = MPRAND(48, 78);
diff --git a/src/common/md5calc.h b/src/common/md5calc.h
index cf1425f..b864791 100644
--- a/src/common/md5calc.h
+++ b/src/common/md5calc.h
@@ -53,7 +53,7 @@ const char *MD5_saltcrypt(const char *key, const char *salt);
/// return some random characters (statically allocated)
// Currently, returns a 5-char string
-const char *make_salt();
+const char *make_salt(void);
/// check plaintext password against saved saltcrypt
bool pass_ok(const char *password, const char *crypted);
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 906f5c1..2bd8705 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -101,7 +101,7 @@ struct mmo_charstatus
int base_exp, job_exp, zeny;
- short class;
+ short pc_class;
short status_point, skill_point;
int hp, max_hp, sp, max_sp;
short option, karma, manner;
@@ -176,7 +176,7 @@ struct party
struct guild_member
{
int account_id, char_id;
- short hair, hair_color, gender, class, lv;
+ short hair, hair_color, gender, pc_class, lv;
int exp, exp_payper;
short online, position;
int rsv1, rsv2;
diff --git a/src/common/nullpo.c b/src/common/nullpo.c
index de10517..8c7c405 100644
--- a/src/common/nullpo.c
+++ b/src/common/nullpo.c
@@ -47,6 +47,8 @@ void nullpo_info (const char *file, int line, const char *func)
/// Actual output function
static void nullpo_info_core (const char *file, int line, const char *func,
+ const char *fmt, va_list ap) __attribute__((format(printf, 4, 0)));
+static void nullpo_info_core (const char *file, int line, const char *func,
const char *fmt, va_list ap)
{
if (!file)
diff --git a/src/common/socket.c b/src/common/socket.c
index 7c86b1a..67a5102 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -23,8 +23,8 @@ fd_set readfds;
int fd_max;
int currentuse;
-const uint32_t rfifo_size = 65536;
-const uint32_t wfifo_size = 65536;
+const uint32_t RFIFO_SIZE = 65536;
+const uint32_t WFIFO_SIZE = 65536;
struct socket_data *session[FD_SETSIZE];
@@ -126,11 +126,11 @@ static void connect_client (int listen_fd)
fcntl (fd, F_SETFL, O_NONBLOCK);
CREATE (session[fd], struct socket_data, 1);
- CREATE (session[fd]->rdata, uint8_t, rfifo_size);
- CREATE (session[fd]->wdata, uint8_t, wfifo_size);
+ CREATE (session[fd]->rdata, uint8_t, RFIFO_SIZE);
+ CREATE (session[fd]->wdata, uint8_t, WFIFO_SIZE);
- session[fd]->max_rdata = rfifo_size;
- session[fd]->max_wdata = wfifo_size;
+ session[fd]->max_rdata = RFIFO_SIZE;
+ session[fd]->max_wdata = WFIFO_SIZE;
session[fd]->func_recv = recv_to_fifo;
session[fd]->func_send = send_from_fifo;
session[fd]->func_parse = default_func_parse;
@@ -231,11 +231,11 @@ int make_connection (uint32_t ip, uint16_t port)
FD_SET (fd, &readfds);
CREATE (session[fd], struct socket_data, 1);
- CREATE (session[fd]->rdata, uint8_t, rfifo_size);
- CREATE (session[fd]->wdata, uint8_t, wfifo_size);
+ CREATE (session[fd]->rdata, uint8_t, RFIFO_SIZE);
+ CREATE (session[fd]->wdata, uint8_t, WFIFO_SIZE);
- session[fd]->max_rdata = rfifo_size;
- session[fd]->max_wdata = wfifo_size;
+ session[fd]->max_rdata = RFIFO_SIZE;
+ session[fd]->max_wdata = WFIFO_SIZE;
session[fd]->func_recv = recv_to_fifo;
session[fd]->func_send = send_from_fifo;
session[fd]->func_parse = default_func_parse;
@@ -399,7 +399,7 @@ FILE *fopen_ (const char *path, const char *mode)
return f;
}
-bool free_fds ()
+bool free_fds (void)
{
return currentuse < SOFT_LIMIT;
}
diff --git a/src/common/socket.h b/src/common/socket.h
index 0e15f5b..b886df0 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -130,6 +130,6 @@ void set_defaultparse (void (*defaultparse) (int));
/// Wrappers to track number of free FDs
void fclose_ (FILE * fp);
FILE *fopen_ (const char *path, const char *mode);
-bool free_fds ();
+bool free_fds (void);
#endif // SOCKET_H
diff --git a/src/common/timer.c b/src/common/timer.c
index f4be19b..6795824 100644
--- a/src/common/timer.c
+++ b/src/common/timer.c
@@ -51,7 +51,7 @@ static void push_timer_heap (timer_id index)
if (timer_heap == NULL || timer_heap[0] + 1 >= timer_heap_max)
{
timer_heap_max += 256;
- RECREATE (timer_heap, int, timer_heap_max);
+ RECREATE (timer_heap, timer_id, timer_heap_max);
memset (timer_heap + (timer_heap_max - 256), 0, sizeof (timer_id) * 256);
}
// timer_heap[0] is the greatest index into the heap, which increases
@@ -71,14 +71,14 @@ static void push_timer_heap (timer_id index)
timer_heap[h + 1] = index;
}
-static timer_id top_timer_heap ()
+static timer_id top_timer_heap (void)
{
if (!timer_heap || !timer_heap[0])
return -1;
return timer_heap[1];
}
-static timer_id pop_timer_heap ()
+static timer_id pop_timer_heap (void)
{
if (!timer_heap || !timer_heap[0])
return -1;
@@ -227,7 +227,7 @@ interval_t do_timer (tick_t tick)
switch (timer_data[i].type)
{
case TIMER_ONCE_AUTODEL:
- timer_data[i].type = 0;
+ timer_data[i].type = TIMER_NONE;
if (free_timer_list_pos >= free_timer_list_max)
{
free_timer_list_max += 256;
diff --git a/src/common/timer.h b/src/common/timer.h
index e363a56..e6a292c 100644
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -5,8 +5,9 @@
enum TIMER_TYPE
{
- TIMER_ONCE_AUTODEL = 1,
- TIMER_INTERVAL = 2,
+ TIMER_NONE,
+ TIMER_ONCE_AUTODEL,
+ TIMER_INTERVAL,
};
/// This is needed to produce a signed result when 2 ticks are subtracted
# define DIFF_TICK(a,b) ((int32_t)((a)-(b)))
diff --git a/src/ladmin/ladmin.c b/src/ladmin/ladmin.c
index 49f52ca..ebe5a75 100644
--- a/src/ladmin/ladmin.c
+++ b/src/ladmin/ladmin.c
@@ -255,7 +255,7 @@ int already_exit_function = 0; // sometimes, the exit function is called twice.
//------------------------------
// Writing function of logs file
//------------------------------
-int ladmin_log (char *fmt, ...)
+int ladmin_log (const char *fmt, ...)
{
FILE *logfp;
va_list ap;
@@ -307,7 +307,7 @@ int remove_control_chars (unsigned char *str)
//---------------------------------------------
// Function to return ordonal text of a number.
//---------------------------------------------
-char *makeordinal (int number)
+const char *makeordinal (int number)
{
if (defaultlanguage == 'F')
{
@@ -2784,7 +2784,7 @@ int changeemail (char *param)
//-----------------------------------------------------
// Sub-function: Asking of the number of online players
//-----------------------------------------------------
-int getlogincount ()
+int getlogincount (void)
{
if (defaultlanguage == 'F')
{
@@ -3399,7 +3399,7 @@ int changepasswd (char *param)
// Sub-function: Request to login-server to reload GM configuration file
// this function have no answer
//----------------------------------------------------------------------
-int reloadGM ()
+int reloadGM (void)
{
WFIFOW (login_fd, 0) = 0x7955;
WFIFOSET (login_fd, 2);
@@ -4387,7 +4387,7 @@ int whoaccount (char *param)
//--------------------------------------------------------
// Sub-function: Asking of the version of the login-server
//--------------------------------------------------------
-int checkloginversion ()
+int checkloginversion (void)
{
if (defaultlanguage == 'F')
ladmin_log
@@ -4408,7 +4408,7 @@ int checkloginversion ()
// this function wait until user type a command
// and analyse the command.
//---------------------------------------------
-int prompt ()
+int prompt (void)
{
int i, j;
char buf[1024];
@@ -4767,7 +4767,7 @@ void parse_fromlogin (int fd)
}
// printf("parse_fromlogin : %d %d %d\n", fd, RFIFOREST(fd), RFIFOW(fd,0));
- sd = session[fd]->session_data;
+ sd = (struct char_session_data *)session[fd]->session_data;
while (RFIFOREST (fd) >= 2)
{
@@ -6339,7 +6339,7 @@ void parse_fromlogin (int fd)
//------------------------------------
// Function to connect to login-server
//------------------------------------
-int Connect_login_server ()
+int Connect_login_server (void)
{
if (defaultlanguage == 'F')
{
diff --git a/src/login/login.c b/src/login/login.c
index 6788371..fd6ead7 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -170,9 +170,7 @@ int login_log (char *fmt, ...)
//----------------------------------------------------------------------
int isGM (int account_id)
{
- struct gm_account *p;
-
- p = numdb_search (gm_account_db, account_id);
+ struct gm_account *p = (struct gm_account*) numdb_search (gm_account_db, account_id);
if (p == NULL)
return 0;
return p->level;
@@ -181,7 +179,7 @@ int isGM (int account_id)
//-------------------------------------------------------
// Reading function of GM accounts file (and their level)
//-------------------------------------------------------
-int read_gm_account ()
+int read_gm_account (void)
{
char line[512];
struct gm_account *p;
@@ -1101,7 +1099,7 @@ int charif_sendallwos (int sfd, unsigned char *buf, unsigned int len)
//-----------------------------------------------------
// Send GM accounts to all char-server
//-----------------------------------------------------
-void send_GM_accounts ()
+void send_GM_accounts (void)
{
int i;
char buf[32000];
@@ -1277,7 +1275,7 @@ int mmo_auth (struct mmo_account *account, int fd)
RETCODE, account->userid, account->userid[len + 1], ip);
return 9; // 9 = Account already exists
}
- ld = session[fd]->session_data;
+ ld = (struct login_session_data*) session[fd]->session_data;
#ifdef PASSWORDENC
if (account->passwdenc > 0)
{
@@ -2576,7 +2574,7 @@ void parse_admin (int fd)
server[i].users;
WFIFOW (fd, 4 + server_num * 32 + 28) =
server[i].maintenance;
- WFIFOW (fd, 4 + server_num * 32 + 30) = server[i].new;
+ WFIFOW (fd, 4 + server_num * 32 + 30) = server[i].is_new;
server_num++;
}
}
@@ -3744,7 +3742,7 @@ void parse_login (int fd)
WFIFOW (fd, 47 + server_num * 32 + 28) =
server[i].maintenance;
WFIFOW (fd, 47 + server_num * 32 + 30) =
- server[i].new;
+ server[i].is_new;
server_num++;
}
}
@@ -3769,7 +3767,7 @@ void parse_login (int fd)
WFIFOW (fd, 47 + server_num * 32 + 28) =
server[i].maintenance;
WFIFOW (fd, 47 + server_num * 32 + 30) =
- server[i].new;
+ server[i].is_new;
server_num++;
}
}
@@ -3953,7 +3951,7 @@ void parse_login (int fd)
server[account.account_id].users = 0;
server[account.account_id].maintenance =
RFIFOW (fd, 82);
- server[account.account_id].new = RFIFOW (fd, 84);
+ server[account.account_id].is_new = RFIFOW (fd, 84);
server_fd[account.account_id] = fd;
if (anti_freeze_enable)
server_freezeflag[account.account_id] = 5; // Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed
@@ -4026,7 +4024,7 @@ void parse_login (int fd)
}
else
{
- struct login_session_data *ld = session[fd]->session_data;
+ struct login_session_data *ld = (struct login_session_data *)session[fd]->session_data;
if (RFIFOW (fd, 2) == 0)
{ // non encrypted password
unsigned char *password;
diff --git a/src/login/login.h b/src/login/login.h
index 98025f8..a1f8fef 100644
--- a/src/login/login.h
+++ b/src/login/login.h
@@ -35,7 +35,7 @@ struct mmo_char_server
short port;
int users;
int maintenance;
- int new;
+ int is_new;
};
#endif
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 6a09970..3c54d5e 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -418,9 +418,9 @@ static AtCommandInfo atcommand_info[] = {
* This function return the name of the job (by [Yor])
*----------------------------------------------------
*/
-char *job_name (int class)
+const char *job_name (int pc_class)
{
- switch (class)
+ switch (pc_class)
{
case 0:
return "Novice";
@@ -681,7 +681,7 @@ void gm_log (const char *fmt, ...)
if (logfile_nr != last_logfile_nr)
{
- char *fullname = malloc (strlen (gm_logfile_name) + 10);
+ char *fullname = (char *)malloc (strlen (gm_logfile_name) + 10);
sprintf (fullname, "%s.%04d-%02d", gm_logfile_name, year, month);
if (gm_logfile)
@@ -1301,7 +1301,7 @@ int atcommand_who (const int fd, struct map_session_data *sd,
GM_level = pc_isGM (sd);
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
pl_GM_level = pc_isGM (pl_sd);
@@ -1377,7 +1377,7 @@ int atcommand_whogroup (const int fd, struct map_session_data *sd,
GM_level = pc_isGM (sd);
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
pl_GM_level = pc_isGM (pl_sd);
@@ -1462,7 +1462,7 @@ int atcommand_whomap (const int fd, struct map_session_data *sd,
GM_level = pc_isGM (sd);
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
pl_GM_level = pc_isGM (pl_sd);
@@ -1540,7 +1540,7 @@ int atcommand_whomapgroup (const int fd, struct map_session_data *sd,
GM_level = pc_isGM (sd);
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
pl_GM_level = pc_isGM (pl_sd);
@@ -1623,7 +1623,7 @@ int atcommand_whogm (const int fd, struct map_session_data *sd,
GM_level = pc_isGM (sd);
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
pl_GM_level = pc_isGM (pl_sd);
@@ -1647,7 +1647,7 @@ int atcommand_whogm (const int fd, struct map_session_data *sd,
sprintf (output,
" BLvl: %d | Job: %s (Lvl: %d)",
pl_sd->status.base_level,
- job_name (pl_sd->status.class),
+ job_name (pl_sd->status.pc_class),
pl_sd->status.job_level);
clif_displaymessage (fd, output);
g = guild_search (pl_sd->status.guild_id);
@@ -1865,19 +1865,19 @@ int atcommand_option (const int fd, struct map_session_data *sd,
}
sd->status.option = param3;
// fix pecopeco display
- if (sd->status.class == 13 || sd->status.class == 21
- || sd->status.class == 4014 || sd->status.class == 4022)
+ if (sd->status.pc_class == 13 || sd->status.pc_class == 21
+ || sd->status.pc_class == 4014 || sd->status.pc_class == 4022)
{
if (!pc_isriding (sd))
{ // sd have the new value...
- if (sd->status.class == 13)
- sd->status.class = sd->view_class = 7;
- else if (sd->status.class == 21)
- sd->status.class = sd->view_class = 14;
- else if (sd->status.class == 4014)
- sd->status.class = sd->view_class = 4008;
- else if (sd->status.class == 4022)
- sd->status.class = sd->view_class = 4015;
+ if (sd->status.pc_class == 13)
+ sd->status.pc_class = sd->view_class = 7;
+ else if (sd->status.pc_class == 21)
+ sd->status.pc_class = sd->view_class = 14;
+ else if (sd->status.pc_class == 4014)
+ sd->status.pc_class = sd->view_class = 4008;
+ else if (sd->status.pc_class == 4022)
+ sd->status.pc_class = sd->view_class = 4015;
}
}
else
@@ -1890,14 +1890,14 @@ int atcommand_option (const int fd, struct map_session_data *sd,
}
else
{
- if (sd->status.class == 7)
- sd->status.class = sd->view_class = 13;
- else if (sd->status.class == 14)
- sd->status.class = sd->view_class = 21;
- else if (sd->status.class == 4008)
- sd->status.class = sd->view_class = 4014;
- else if (sd->status.class == 4015)
- sd->status.class = sd->view_class = 4022;
+ if (sd->status.pc_class == 7)
+ sd->status.pc_class = sd->view_class = 13;
+ else if (sd->status.pc_class == 14)
+ sd->status.pc_class = sd->view_class = 21;
+ else if (sd->status.pc_class == 4008)
+ sd->status.pc_class = sd->view_class = 4014;
+ else if (sd->status.pc_class == 4015)
+ sd->status.pc_class = sd->view_class = 4022;
else
sd->status.option &= ~0x0020;
}
@@ -2255,10 +2255,10 @@ int atcommand_joblevelup (const int fd, struct map_session_data *sd,
return -1;
}
- if (sd->status.class == 0 || sd->status.class == 4001)
+ if (sd->status.pc_class == 0 || sd->status.pc_class == 4001)
up_level -= 40;
- else if ((sd->status.class > 4007 && sd->status.class < 4024)
- || sd->status.class == 23)
+ else if ((sd->status.pc_class > 4007 && sd->status.pc_class < 4024)
+ || sd->status.pc_class == 23)
up_level += 20;
if (level > 0)
@@ -2402,7 +2402,7 @@ int atcommand_pvpoff (const int fd, struct map_session_data *sd,
clif_send0199 (sd->bl.m, 0);
for (i = 0; i < fd_max; i++)
{ //人数分ループ
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
if (sd->bl.m == pl_sd->bl.m)
@@ -2450,7 +2450,7 @@ int atcommand_pvpon (const int fd, struct map_session_data *sd,
clif_send0199 (sd->bl.m, 1);
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
if (sd->bl.m == pl_sd->bl.m && pl_sd->pvp_timer == -1)
@@ -2549,7 +2549,7 @@ int atcommand_model (const int fd, struct map_session_data *sd,
{
//服の色変更
if (cloth_color != 0 && sd->status.sex == 1
- && (sd->status.class == 12 || sd->status.class == 17))
+ && (sd->status.pc_class == 12 || sd->status.pc_class == 17))
{
//服の色未実装職の判定
clif_displaymessage (fd, msg_table[35]); // You can't use this command with this class.
@@ -2596,7 +2596,7 @@ int atcommand_dye (const int fd, struct map_session_data *sd,
if (cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR)
{
if (cloth_color != 0 && sd->status.sex == 1
- && (sd->status.class == 12 || sd->status.class == 17))
+ && (sd->status.pc_class == 12 || sd->status.pc_class == 17))
{
clif_displaymessage (fd, msg_table[35]); // You can't use this command with this class.
return -1;
@@ -2651,7 +2651,7 @@ int atcommand_hair_style (const int fd, struct map_session_data *sd,
if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE)
{
if (hair_style != 0 && sd->status.sex == 1
- && (sd->status.class == 12 || sd->status.class == 17))
+ && (sd->status.pc_class == 12 || sd->status.pc_class == 17))
{
clif_displaymessage (fd, msg_table[35]); // You can't use this command with this class.
return -1;
@@ -2706,7 +2706,7 @@ int atcommand_hair_color (const int fd, struct map_session_data *sd,
if (hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR)
{
if (hair_color != 0 && sd->status.sex == 1
- && (sd->status.class == 12 || sd->status.class == 17))
+ && (sd->status.pc_class == 12 || sd->status.pc_class == 17))
{
clif_displaymessage (fd, msg_table[35]); // You can't use this command with this class.
return -1;
@@ -3810,7 +3810,7 @@ int atcommand_character_stats (const int fd, struct map_session_data *sd,
{
NULL, 0}
};
- sprintf (job_jobname, "Job - %s %s", job_name (pl_sd->status.class),
+ sprintf (job_jobname, "Job - %s %s", job_name (pl_sd->status.pc_class),
"(level %d)");
sprintf (output, msg_table[53], pl_sd->status.name); // '%s' stats:
clif_displaymessage (fd, output);
@@ -3848,7 +3848,7 @@ int atcommand_character_stats_all (const int fd, struct map_session_data *sd,
count = 0;
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
@@ -3860,7 +3860,7 @@ int atcommand_character_stats_all (const int fd, struct map_session_data *sd,
sprintf (output,
"Name: %s | BLvl: %d | Job: %s (Lvl: %d) | HP: %d/%d | SP: %d/%d",
pl_sd->status.name, pl_sd->status.base_level,
- job_name (pl_sd->status.class), pl_sd->status.job_level,
+ job_name (pl_sd->status.pc_class), pl_sd->status.job_level,
pl_sd->status.hp, pl_sd->status.max_hp, pl_sd->status.sp,
pl_sd->status.max_sp);
clif_displaymessage (fd, output);
@@ -3918,19 +3918,19 @@ int atcommand_character_option (const int fd, struct map_session_data *sd,
pl_sd->opt2 = opt2;
pl_sd->status.option = opt3;
// fix pecopeco display
- if (pl_sd->status.class == 13 || pl_sd->status.class == 21
- || pl_sd->status.class == 4014 || pl_sd->status.class == 4022)
+ if (pl_sd->status.pc_class == 13 || pl_sd->status.pc_class == 21
+ || pl_sd->status.pc_class == 4014 || pl_sd->status.pc_class == 4022)
{
if (!pc_isriding (pl_sd))
{ // pl_sd have the new value...
- if (pl_sd->status.class == 13)
- pl_sd->status.class = pl_sd->view_class = 7;
- else if (pl_sd->status.class == 21)
- pl_sd->status.class = pl_sd->view_class = 14;
- else if (pl_sd->status.class == 4014)
- pl_sd->status.class = pl_sd->view_class = 4008;
- else if (pl_sd->status.class == 4022)
- pl_sd->status.class = pl_sd->view_class = 4015;
+ if (pl_sd->status.pc_class == 13)
+ pl_sd->status.pc_class = pl_sd->view_class = 7;
+ else if (pl_sd->status.pc_class == 21)
+ pl_sd->status.pc_class = pl_sd->view_class = 14;
+ else if (pl_sd->status.pc_class == 4014)
+ pl_sd->status.pc_class = pl_sd->view_class = 4008;
+ else if (pl_sd->status.pc_class == 4022)
+ pl_sd->status.pc_class = pl_sd->view_class = 4015;
}
}
else
@@ -3943,14 +3943,14 @@ int atcommand_character_option (const int fd, struct map_session_data *sd,
}
else
{
- if (pl_sd->status.class == 7)
- pl_sd->status.class = pl_sd->view_class = 13;
- else if (pl_sd->status.class == 14)
- pl_sd->status.class = pl_sd->view_class = 21;
- else if (pl_sd->status.class == 4008)
- pl_sd->status.class = pl_sd->view_class = 4014;
- else if (pl_sd->status.class == 4015)
- pl_sd->status.class = pl_sd->view_class = 4022;
+ if (pl_sd->status.pc_class == 7)
+ pl_sd->status.pc_class = pl_sd->view_class = 13;
+ else if (pl_sd->status.pc_class == 14)
+ pl_sd->status.pc_class = pl_sd->view_class = 21;
+ else if (pl_sd->status.pc_class == 4008)
+ pl_sd->status.pc_class = pl_sd->view_class = 4014;
+ else if (pl_sd->status.pc_class == 4015)
+ pl_sd->status.pc_class = pl_sd->view_class = 4022;
else
pl_sd->status.option &= ~0x0020;
}
@@ -4324,7 +4324,7 @@ int atcommand_night (const int fd, struct map_session_data *sd,
night_flag = 1; // 0=day, 1=night [Yor]
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
pl_sd->opt2 |= STATE_BLIND;
@@ -4357,7 +4357,7 @@ int atcommand_day (const int fd, struct map_session_data *sd,
night_flag = 0; // 0=day, 1=night [Yor]
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
pl_sd->opt2 &= ~STATE_BLIND;
@@ -4387,7 +4387,7 @@ int atcommand_doom (const int fd, struct map_session_data *sd,
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth && i != fd
&& pc_isGM (sd) >= pc_isGM (pl_sd))
{ // you can doom only lower or same gm level
@@ -4412,7 +4412,7 @@ int atcommand_doommap (const int fd, struct map_session_data *sd,
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth && i != fd && sd->bl.m == pl_sd->bl.m
&& pc_isGM (sd) >= pc_isGM (pl_sd))
{ // you can doom only lower or same gm level
@@ -4455,7 +4455,7 @@ int atcommand_raise (const int fd, struct map_session_data *sd,
for (i = 0; i < fd_max; i++)
{
if (session[i])
- atcommand_raise_sub (session[i]->session_data);
+ atcommand_raise_sub ((struct map_session_data *)session[i]->session_data);
}
clif_displaymessage (fd, msg_table[64]); // Mercy has been granted.
@@ -4474,7 +4474,7 @@ int atcommand_raisemap (const int fd, struct map_session_data *sd,
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth && sd->bl.m == pl_sd->bl.m)
atcommand_raise_sub (pl_sd);
}
@@ -4603,7 +4603,7 @@ int atcommand_character_joblevel (const int fd, struct map_session_data *sd,
if ((pl_sd = map_nick2sd (character)) != NULL)
{
- pl_s_class = pc_calc_base_job (pl_sd->status.class);
+ pl_s_class = pc_calc_base_job (pl_sd->status.pc_class);
if (pc_isGM (sd) >= pc_isGM (pl_sd))
{ // you can change job level only lower or same gm level
if (pl_s_class.job == 0)
@@ -4717,7 +4717,7 @@ int atcommand_kickall (const int fd, struct map_session_data *sd,
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth && pc_isGM (sd) >= pc_isGM (pl_sd))
{ // you can kick only lower or same gm level
if (sd->status.account_id != pl_sd->status.account_id)
@@ -5063,7 +5063,7 @@ int atcommand_mapexit (const int fd, struct map_session_data *sd,
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
if (sd->status.account_id != pl_sd->status.account_id)
@@ -5380,7 +5380,7 @@ int atcommand_charmodel (const int fd, struct map_session_data *sd,
if (cloth_color != 0 &&
pl_sd->status.sex == 1 &&
- (pl_sd->status.class == 12 || pl_sd->status.class == 17))
+ (pl_sd->status.pc_class == 12 || pl_sd->status.pc_class == 17))
{
clif_displaymessage (fd, msg_table[35]); // You can't use this command with this class.
return -1;
@@ -5593,7 +5593,7 @@ int atcommand_recallall (const int fd, struct map_session_data *sd,
count = 0;
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth
&& sd->status.account_id != pl_sd->status.account_id
&& pc_isGM (sd) >= pc_isGM (pl_sd))
@@ -5656,7 +5656,7 @@ int atcommand_guildrecall (const int fd, struct map_session_data *sd,
count = 0;
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth
&& sd->status.account_id != pl_sd->status.account_id
&& pl_sd->status.guild_id == g->guild_id)
@@ -5725,7 +5725,7 @@ int atcommand_partyrecall (const int fd, struct map_session_data *sd,
count = 0;
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth
&& sd->status.account_id != pl_sd->status.account_id
&& pl_sd->status.party_id == p->party_id)
@@ -5880,7 +5880,7 @@ int atcommand_mapinfo (const int fd, struct map_session_data *sd,
chat_num = 0;
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth
&& (cd = (struct chat_data *) map_id2bl (pl_sd->chatID)))
{
@@ -5933,7 +5933,7 @@ int atcommand_mapinfo (const int fd, struct map_session_data *sd,
clif_displaymessage (fd, "----- Players in Map -----");
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth
&& strcmp (pl_sd->mapname, map_name) == 0)
{
@@ -5984,7 +5984,7 @@ int atcommand_mapinfo (const int fd, struct map_session_data *sd,
}
sprintf (output,
"NPC %d: %s | Direction: %s | Sprite: %d | Location: %d %d",
- ++i, nd->name, direction, nd->class, nd->bl.x,
+ ++i, nd->name, direction, nd->npc_class, nd->bl.x,
nd->bl.y);
clif_displaymessage (fd, output);
}
@@ -5993,7 +5993,7 @@ int atcommand_mapinfo (const int fd, struct map_session_data *sd,
clif_displaymessage (fd, "----- Chats in Map -----");
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth
&& (cd = (struct chat_data *) map_id2bl (pl_sd->chatID))
&& strcmp (pl_sd->mapname, map_name) == 0
@@ -6037,17 +6037,17 @@ int atcommand_mount_peco (const int fd, struct map_session_data *sd,
if (!pc_isriding (sd))
{ // if actually no peco
- if (sd->status.class == 7 || sd->status.class == 14
- || sd->status.class == 4008 || sd->status.class == 4015)
- {
- if (sd->status.class == 7)
- sd->status.class = sd->view_class = 13;
- else if (sd->status.class == 14)
- sd->status.class = sd->view_class = 21;
- else if (sd->status.class == 4008)
- sd->status.class = sd->view_class = 4014;
- else if (sd->status.class == 4015)
- sd->status.class = sd->view_class = 4022;
+ if (sd->status.pc_class == 7 || sd->status.pc_class == 14
+ || sd->status.pc_class == 4008 || sd->status.pc_class == 4015)
+ {
+ if (sd->status.pc_class == 7)
+ sd->status.pc_class = sd->view_class = 13;
+ else if (sd->status.pc_class == 14)
+ sd->status.pc_class = sd->view_class = 21;
+ else if (sd->status.pc_class == 4008)
+ sd->status.pc_class = sd->view_class = 4014;
+ else if (sd->status.pc_class == 4015)
+ sd->status.pc_class = sd->view_class = 4022;
pc_setoption (sd, sd->status.option | 0x0020);
clif_displaymessage (fd, msg_table[102]); // Mounted Peco.
}
@@ -6059,14 +6059,14 @@ int atcommand_mount_peco (const int fd, struct map_session_data *sd,
}
else
{
- if (sd->status.class == 13)
- sd->status.class = sd->view_class = 7;
- else if (sd->status.class == 21)
- sd->status.class = sd->view_class = 14;
- else if (sd->status.class == 4014)
- sd->status.class = sd->view_class = 4008;
- else if (sd->status.class == 4022)
- sd->status.class = sd->view_class = 4015;
+ if (sd->status.pc_class == 13)
+ sd->status.pc_class = sd->view_class = 7;
+ else if (sd->status.pc_class == 21)
+ sd->status.pc_class = sd->view_class = 14;
+ else if (sd->status.pc_class == 4014)
+ sd->status.pc_class = sd->view_class = 4008;
+ else if (sd->status.pc_class == 4022)
+ sd->status.pc_class = sd->view_class = 4015;
pc_setoption (sd, sd->status.option & ~0x0020);
clif_displaymessage (fd, msg_table[214]); // Unmounted Peco.
}
@@ -6103,17 +6103,17 @@ int atcommand_char_mount_peco (const int fd, struct map_session_data *sd,
if (!pc_isriding (pl_sd))
{ // if actually no peco
- if (pl_sd->status.class == 7 || pl_sd->status.class == 14
- || pl_sd->status.class == 4008 || pl_sd->status.class == 4015)
+ if (pl_sd->status.pc_class == 7 || pl_sd->status.pc_class == 14
+ || pl_sd->status.pc_class == 4008 || pl_sd->status.pc_class == 4015)
{
- if (pl_sd->status.class == 7)
- pl_sd->status.class = pl_sd->view_class = 13;
- else if (pl_sd->status.class == 14)
- pl_sd->status.class = pl_sd->view_class = 21;
- else if (pl_sd->status.class == 4008)
- pl_sd->status.class = pl_sd->view_class = 4014;
- else if (pl_sd->status.class == 4015)
- pl_sd->status.class = pl_sd->view_class = 4022;
+ if (pl_sd->status.pc_class == 7)
+ pl_sd->status.pc_class = pl_sd->view_class = 13;
+ else if (pl_sd->status.pc_class == 14)
+ pl_sd->status.pc_class = pl_sd->view_class = 21;
+ else if (pl_sd->status.pc_class == 4008)
+ pl_sd->status.pc_class = pl_sd->view_class = 4014;
+ else if (pl_sd->status.pc_class == 4015)
+ pl_sd->status.pc_class = pl_sd->view_class = 4022;
pc_setoption (pl_sd, pl_sd->status.option | 0x0020);
clif_displaymessage (fd, msg_table[216]); // Now, this player mounts a peco.
}
@@ -6125,14 +6125,14 @@ int atcommand_char_mount_peco (const int fd, struct map_session_data *sd,
}
else
{
- if (pl_sd->status.class == 13)
- pl_sd->status.class = pl_sd->view_class = 7;
- else if (pl_sd->status.class == 21)
- pl_sd->status.class = pl_sd->view_class = 14;
- else if (pl_sd->status.class == 4014)
- pl_sd->status.class = pl_sd->view_class = 4008;
- else if (pl_sd->status.class == 4022)
- pl_sd->status.class = pl_sd->view_class = 4015;
+ if (pl_sd->status.pc_class == 13)
+ pl_sd->status.pc_class = pl_sd->view_class = 7;
+ else if (pl_sd->status.pc_class == 21)
+ pl_sd->status.pc_class = pl_sd->view_class = 14;
+ else if (pl_sd->status.pc_class == 4014)
+ pl_sd->status.pc_class = pl_sd->view_class = 4008;
+ else if (pl_sd->status.pc_class == 4022)
+ pl_sd->status.pc_class = pl_sd->view_class = 4015;
pc_setoption (pl_sd, pl_sd->status.option & ~0x0020);
clif_displaymessage (fd, msg_table[218]); // Now, this player has not more peco.
}
@@ -7176,7 +7176,7 @@ int atcommand_effect (const int fd, struct map_session_data *sd,
{
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
clif_specialeffect (&pl_sd->bl, type, flag);
@@ -8151,7 +8151,7 @@ int atcommand_summon (const int fd, struct map_session_data *sd,
{
md->master_id = sd->bl.id;
md->state.special_mob_ai = 1;
- md->mode = mob_db[md->class].mode | 0x04;
+ md->mode = mob_db[md->mob_class].mode | 0x04;
md->deletetimer = add_timer (tick + 60000, mob_timer_delete, id, 0);
clif_misceffect (&md->bl, 344);
}
@@ -8400,7 +8400,7 @@ int
atcommand_tee (const int fd, struct map_session_data *sd,
const char *command, const char *message)
{
- char *data = malloc (strlen (message) + 28);
+ char *data = (char *)malloc (strlen (message) + 28);
strcpy (data, sd->status.name);
strcat (data, " : ");
strcat (data, message);
@@ -8426,7 +8426,7 @@ atcommand_visible (const int fd, struct map_session_data *sd,
int atcommand_jump_iterate (const int fd, struct map_session_data *sd,
const char *command, const char *message,
- struct map_session_data *(*get_start) (),
+ struct map_session_data *(*get_start) (void),
struct map_session_data *(*get_next) (struct
map_session_data
* current))
@@ -8679,7 +8679,7 @@ int atcommand_ipcheck (const int fd, struct map_session_data *sd,
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
if (getpeername (pl_sd->fd, (struct sockaddr *)&sai, &sa_len))
diff --git a/src/map/battle.c b/src/map/battle.c
index a6a803a..6edf996 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -67,9 +67,9 @@ int battle_get_class (struct block_list *bl)
{
nullpo_retr (0, bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
- return ((struct mob_data *) bl)->class;
+ return ((struct mob_data *) bl)->mob_class;
else if (bl->type == BL_PC && (struct map_session_data *) bl)
- return ((struct map_session_data *) bl)->status.class;
+ return ((struct map_session_data *) bl)->status.pc_class;
else
return 0;
}
@@ -115,7 +115,7 @@ int battle_get_range (struct block_list *bl)
{
nullpo_retr (0, bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
- return mob_db[((struct mob_data *) bl)->class].range;
+ return mob_db[((struct mob_data *) bl)->mob_class].range;
else if (bl->type == BL_PC && (struct map_session_data *) bl)
return ((struct map_session_data *) bl)->attackrange;
else
@@ -155,7 +155,7 @@ int battle_get_max_hp (struct block_list *bl)
if (bl->type == BL_MOB && ((struct mob_data *) bl))
{
max_hp = ((struct mob_data *) bl)->stats[MOB_MAX_HP];
- if (mob_db[((struct mob_data *) bl)->class].mexp > 0)
+ if (mob_db[((struct mob_data *) bl)->mob_class].mexp > 0)
{
if (battle_config.mvp_hp_rate != 100)
max_hp = (max_hp * battle_config.mvp_hp_rate) / 100;
@@ -1076,7 +1076,7 @@ int battle_get_amotion (struct block_list *bl)
struct status_change *sc_data = battle_get_sc_data (bl);
int amotion = 2000, aspd_rate = 100, i;
if (bl->type == BL_MOB && (struct mob_data *) bl)
- amotion = mob_db[((struct mob_data *) bl)->class].amotion;
+ amotion = mob_db[((struct mob_data *) bl)->mob_class].amotion;
if (sc_data)
{
@@ -1138,7 +1138,7 @@ int battle_get_dmotion (struct block_list *bl)
sc_data = battle_get_sc_data (bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
{
- ret = mob_db[((struct mob_data *) bl)->class].dmotion;
+ ret = mob_db[((struct mob_data *) bl)->mob_class].dmotion;
if (battle_config.monster_damage_delay_rate != 100)
ret = ret * battle_config.monster_damage_delay_rate / 400;
}
@@ -1267,7 +1267,7 @@ int battle_get_guild_id (struct block_list *bl)
if (bl->type == BL_PC && (struct map_session_data *) bl)
return ((struct map_session_data *) bl)->status.guild_id;
else if (bl->type == BL_MOB && (struct mob_data *) bl)
- return ((struct mob_data *) bl)->class;
+ return ((struct mob_data *) bl)->mob_class;
else if (bl->type == BL_SKILL && (struct skill_unit *) bl)
return ((struct skill_unit *) bl)->group->guild_id;
else
@@ -1278,7 +1278,7 @@ int battle_get_race (struct block_list *bl)
{
nullpo_retr (0, bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
- return mob_db[((struct mob_data *) bl)->class].race;
+ return mob_db[((struct mob_data *) bl)->mob_class].race;
else if (bl->type == BL_PC && (struct map_session_data *) bl)
return 7;
else
@@ -1289,7 +1289,7 @@ int battle_get_size (struct block_list *bl)
{
nullpo_retr (1, bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
- return mob_db[((struct mob_data *) bl)->class].size;
+ return mob_db[((struct mob_data *) bl)->mob_class].size;
else if (bl->type == BL_PC && (struct map_session_data *) bl)
return 1;
else
@@ -1300,7 +1300,7 @@ int battle_get_mode (struct block_list *bl)
{
nullpo_retr (0x01, bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
- return mob_db[((struct mob_data *) bl)->class].mode;
+ return mob_db[((struct mob_data *) bl)->mob_class].mode;
else
return 0x01; // とりあえず動くということで1
}
@@ -1312,7 +1312,7 @@ int battle_get_mexp (struct block_list *bl)
{
const struct mob_data *mob = (struct mob_data *) bl;
const int retval =
- (mob_db[mob->class].mexp *
+ (mob_db[mob->mob_class].mexp *
(int) (mob->stats[MOB_XP_BONUS])) >> MOB_XP_BONUS_SHIFT;
fprintf (stderr, "Modifier of %x: -> %d\n", mob->stats[MOB_XP_BONUS],
retval);
@@ -1614,11 +1614,11 @@ int battle_calc_damage (struct block_list *src, struct block_list *bl,
struct mob_data *md = NULL;
struct status_change *sc_data, *sc;
short *sc_count;
- int class;
+ int class_;
nullpo_retr (0, bl);
- class = battle_get_class (bl);
+ class_ = battle_get_class (bl);
if (bl->type == BL_MOB)
md = (struct mob_data *) bl;
else
@@ -1785,10 +1785,10 @@ int battle_calc_damage (struct block_list *src, struct block_list *bl,
}
}
- if (class == 1288 || class == 1287 || class == 1286 || class == 1285)
+ if (class_ == 1288 || class_ == 1287 || class_ == 1286 || class_ == 1285)
{
// if(class == 1288) {
- if (class == 1288 && flag & BF_SKILL)
+ if (class_ == 1288 && flag & BF_SKILL)
damage = 0;
if (src->type == BL_PC)
{
@@ -1798,7 +1798,7 @@ int battle_calc_damage (struct block_list *src, struct block_list *bl,
struct guild_castle *gc = guild_mapname2gc (map[bl->m].name);
if (!((struct map_session_data *) src)->status.guild_id)
damage = 0;
- if (gc && agit_flag == 0 && class != 1288) // guardians cannot be damaged during non-woe [Valaris]
+ if (gc && agit_flag == 0 && class_ != 1288) // guardians cannot be damaged during non-woe [Valaris]
damage = 0; // end woe check [Valaris]
if (g == NULL)
damage = 0; //ギルド未加入ならダメージ無し
@@ -2136,7 +2136,7 @@ static struct Damage battle_calc_mob_weapon_attack (struct block_list *src,
atkmin = battle_get_atk (src);
atkmax = battle_get_atk2 (src);
}
- if (mob_db[md->class].range > 3)
+ if (mob_db[md->mob_class].range > 3)
flag = (flag & ~BF_RANGEMASK) | BF_LONG;
if (atkmin > atkmax)
@@ -2536,13 +2536,13 @@ static struct Damage battle_calc_mob_weapon_attack (struct block_list *src,
int cardfix = 100, i;
cardfix = cardfix * (100 - tsd->subele[s_ele]) / 100; // 属 性によるダメージ耐性
cardfix = cardfix * (100 - tsd->subrace[s_race]) / 100; // 種族によるダメージ耐性
- if (mob_db[md->class].mode & 0x20)
+ if (mob_db[md->mob_class].mode & 0x20)
cardfix = cardfix * (100 - tsd->subrace[10]) / 100;
else
cardfix = cardfix * (100 - tsd->subrace[11]) / 100;
for (i = 0; i < tsd->add_def_class_count; i++)
{
- if (tsd->add_def_classid[i] == md->class)
+ if (tsd->add_def_classid[i] == md->mob_class)
{
cardfix = cardfix * (100 - tsd->add_def_classrate[i]) / 100;
break;
@@ -3868,7 +3868,7 @@ static struct Damage battle_calc_pc_weapon_attack (struct block_list *src,
//特定Class用補正処理左手(少女の日記→ボンゴン用?)
for (i = 0; i < tsd->add_def_class_count; i++)
{
- if (tsd->add_def_classid[i] == sd->status.class)
+ if (tsd->add_def_classid[i] == sd->status.pc_class)
{
cardfix = cardfix * (100 - tsd->add_def_classrate[i]) / 100;
break;
@@ -4875,7 +4875,7 @@ int battle_weapon_attack (struct block_list *src, struct block_list *target,
BL_PC) ? ((struct map_session_data *) target)->
status.char_id : target->id,
(target->type ==
- BL_PC) ? 0 : ((struct mob_data *) target)->class,
+ BL_PC) ? 0 : ((struct mob_data *) target)->mob_class,
wd.damage + wd.damage2, weapon);
}
@@ -4889,7 +4889,7 @@ int battle_weapon_attack (struct block_list *src, struct block_list *target,
BL_PC) ? ((struct map_session_data *) src)->
status.char_id : src->id,
(src->type ==
- BL_PC) ? 0 : ((struct mob_data *) src)->class,
+ BL_PC) ? 0 : ((struct mob_data *) src)->mob_class,
wd.damage + wd.damage2);
}
@@ -5332,9 +5332,9 @@ int battle_check_target (struct block_list *src, struct block_list *target,
if (su && su->group->target_flag == BCT_NOENEMY)
return 1;
else if (battle_config.pk_mode
- && (((struct map_session_data *) ss)->status.class == 0
+ && (((struct map_session_data *) ss)->status.pc_class == 0
|| ((struct map_session_data *) target)->
- status.class == 0))
+ status.pc_class == 0))
return 1; // prevent novice engagement in pk_mode [Valaris]
else if (map[ss->m].flag.pvp_noparty && s_p > 0 && t_p > 0
&& s_p == t_p)
diff --git a/src/map/chat.c b/src/map/chat.c
index 00aadea..ccb75df 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -28,7 +28,7 @@ int chat_createchat (struct map_session_data *sd, int limit, int pub,
nullpo_retr (0, sd);
- cd = calloc (1, sizeof (struct chat_data));
+ CREATE(cd, struct chat_data, 1);
cd->limit = limit;
cd->pub = pub;
@@ -279,7 +279,7 @@ int chat_createnpcchat (struct npc_data *nd, int limit, int pub, int trigger,
nullpo_retr (1, nd);
- cd = calloc (1, sizeof (struct chat_data));
+ CREATE (cd, struct chat_data, 1);
cd->limit = cd->trigger = limit;
if (trigger > 0)
diff --git a/src/map/chrif.c b/src/map/chrif.c
index b80b4fd..5e2cd4c 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -65,7 +65,7 @@ void chrif_setpasswd (char *pwd)
passwd[sizeof(passwd)-1] = '\0';
}
-char *chrif_getpasswd ()
+char *chrif_getpasswd (void)
{
return passwd;
}
@@ -651,7 +651,7 @@ int chrif_changedsex (int fd)
{
if (sd != NULL && sd->status.sex != sex)
{
- s_class = pc_calc_base_job (sd->status.class);
+ s_class = pc_calc_base_job (sd->status.pc_class);
if (sd->status.sex == 0)
{
sd->status.sex = 1;
@@ -679,10 +679,10 @@ int chrif_changedsex (int fd)
// change job if necessary
if (s_class.job == 20 || s_class.job == 4021
|| s_class.job == 4043)
- sd->status.class -= 1;
+ sd->status.pc_class -= 1;
else if (s_class.job == 19 || s_class.job == 4020
|| s_class.job == 4042)
- sd->status.class += 1;
+ sd->status.pc_class += 1;
}
// save character
chrif_save (sd);
@@ -1257,7 +1257,7 @@ void send_users_tochar (timer_id tid, tick_t tick, custom_id_t id, custom_data_t
WFIFOW (char_fd, 0) = 0x2aff;
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data) && sd->state.auth &&
+ if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->state.auth &&
!((battle_config.hide_GM_session
|| sd->state.shroud_active
|| (sd->status.option & OPTION_HIDE)) && pc_isGM (sd)))
diff --git a/src/map/chrif.h b/src/map/chrif.h
index 3515463..e891be7 100644
--- a/src/map/chrif.h
+++ b/src/map/chrif.h
@@ -4,7 +4,7 @@
void chrif_setuserid (char *);
void chrif_setpasswd (char *);
-char *chrif_getpasswd ();
+char *chrif_getpasswd (void);
void chrif_setip (char *);
void chrif_setport (int);
diff --git a/src/map/clif.c b/src/map/clif.c
index 8bbf112..551147b 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -185,7 +185,7 @@ int clif_countusers (void)
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data) && sd
+ if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd
&& sd->state.auth && !(battle_config.hide_GM_session
&& pc_isGM (sd)))
users++;
@@ -206,7 +206,7 @@ int clif_foreachclient (int (*func) (struct map_session_data *, va_list), ...)
va_start (ap, func);
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data) && sd
+ if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd
&& sd->state.auth)
func (sd, ap);
}
@@ -348,7 +348,7 @@ int clif_send (unsigned char *buf, int len, struct block_list *bl, int type)
case ALL_CLIENT: // 全クライアントに送信
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data) != NULL
+ if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) != NULL
&& sd->state.auth)
{
if (packet_len_table[RBUFW (buf, 0)])
@@ -362,7 +362,7 @@ int clif_send (unsigned char *buf, int len, struct block_list *bl, int type)
case ALL_SAMEMAP: // 同じマップの全クライアントに送信
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data) != NULL
+ if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) != NULL
&& sd->state.auth && sd->bl.m == bl->m)
{
if (packet_len_table[RBUFW (buf, 0)])
@@ -462,7 +462,7 @@ int clif_send (unsigned char *buf, int len, struct block_list *bl, int type)
}
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data) != NULL
+ if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) != NULL
&& sd->state.auth)
{
if (sd->partyspy == p->party_id)
@@ -526,7 +526,7 @@ int clif_send (unsigned char *buf, int len, struct block_list *bl, int type)
}
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data) != NULL
+ if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) != NULL
&& sd->state.auth)
{
if (sd->guildspy == g->guild_id)
@@ -766,12 +766,9 @@ static void clif_clearchar_delay_sub (timer_id tid, tick_t tick, custom_id_t id,
int clif_clearchar_delay (unsigned int tick, struct block_list *bl, int type)
{
- struct block_list *tmpbl = calloc (sizeof (struct block_list), 1);
- if (tmpbl == NULL)
- {
- printf ("clif_clearchar_delay: out of memory !\n");
- exit (1);
- }
+ struct block_list *tmpbl;
+ CREATE (tmpbl, struct block_list, 1);
+
memcpy (tmpbl, bl, sizeof (struct block_list));
add_timer (tick, clif_clearchar_delay_sub, (custom_id_t) tmpbl, type);
@@ -982,18 +979,18 @@ static int clif_set007b (struct map_session_data *sd, unsigned char *buf)
* クラスチェンジ typeはMobの場合は1で他は0?
*------------------------------------------
*/
-int clif_class_change (struct block_list *bl, int class, int type)
+int clif_npc_class_change (struct block_list *bl, int npc_class, int type)
{
char buf[16];
nullpo_retr (0, bl);
- if (class >= MAX_PC_CLASS)
+ if (npc_class >= MAX_PC_CLASS)
{
WBUFW (buf, 0) = 0x1b0;
WBUFL (buf, 2) = bl->id;
WBUFB (buf, 6) = type;
- WBUFL (buf, 7) = class;
+ WBUFL (buf, 7) = npc_class;
clif_send (buf, packet_len_table[0x1b0], bl, AREA);
}
@@ -1004,10 +1001,10 @@ int clif_class_change (struct block_list *bl, int class, int type)
*
*------------------------------------------
*/
-int clif_mob_class_change (struct mob_data *md, int class)
+int clif_mob_class_change (struct mob_data *md, int class_)
{
char buf[16];
- int view = mob_get_viewclass (class);
+ int view = mob_get_viewclass (class_);
nullpo_retr (0, md);
@@ -1061,24 +1058,24 @@ static int clif_mob0078 (struct mob_data *md, unsigned char *buf)
WBUFW (buf, 8) = md->opt1;
WBUFW (buf, 10) = md->opt2;
WBUFW (buf, 12) = md->option;
- WBUFW (buf, 14) = mob_get_viewclass (md->class);
- if ((mob_get_viewclass (md->class) <= 23)
- || (mob_get_viewclass (md->class) == 812)
- || (mob_get_viewclass (md->class) >= 4001))
- {
- WBUFW (buf, 12) |= mob_db[md->class].option;
- WBUFW (buf, 16) = mob_get_hair (md->class);
- WBUFW (buf, 18) = mob_get_weapon (md->class);
- WBUFW (buf, 20) = mob_get_head_buttom (md->class);
- WBUFW (buf, 22) = mob_get_shield (md->class);
- WBUFW (buf, 24) = mob_get_head_top (md->class);
- WBUFW (buf, 26) = mob_get_head_mid (md->class);
- WBUFW (buf, 28) = mob_get_hair_color (md->class);
- WBUFW (buf, 30) = mob_get_clothes_color (md->class); //Add for player monster dye - Valaris
- WBUFB (buf, 45) = mob_get_sex (md->class);
- }
-
- if (md->class >= 1285 && md->class <= 1287)
+ WBUFW (buf, 14) = mob_get_viewclass (md->mob_class);
+ if ((mob_get_viewclass (md->mob_class) <= 23)
+ || (mob_get_viewclass (md->mob_class) == 812)
+ || (mob_get_viewclass (md->mob_class) >= 4001))
+ {
+ WBUFW (buf, 12) |= mob_db[md->mob_class].option;
+ WBUFW (buf, 16) = mob_get_hair (md->mob_class);
+ WBUFW (buf, 18) = mob_get_weapon (md->mob_class);
+ WBUFW (buf, 20) = mob_get_head_buttom (md->mob_class);
+ WBUFW (buf, 22) = mob_get_shield (md->mob_class);
+ WBUFW (buf, 24) = mob_get_head_top (md->mob_class);
+ WBUFW (buf, 26) = mob_get_head_mid (md->mob_class);
+ WBUFW (buf, 28) = mob_get_hair_color (md->mob_class);
+ WBUFW (buf, 30) = mob_get_clothes_color (md->mob_class); //Add for player monster dye - Valaris
+ WBUFB (buf, 45) = mob_get_sex (md->mob_class);
+ }
+
+ if (md->mob_class >= 1285 && md->mob_class <= 1287)
{ // Added guardian emblems [Valaris]
struct guild *g;
struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name);
@@ -1123,26 +1120,26 @@ static int clif_mob007b (struct mob_data *md, unsigned char *buf)
WBUFW (buf, 8) = md->opt1;
WBUFW (buf, 10) = md->opt2;
WBUFW (buf, 12) = md->option;
- WBUFW (buf, 14) = mob_get_viewclass (md->class);
- if ((mob_get_viewclass (md->class) < 24)
- || (mob_get_viewclass (md->class) > 4000))
- {
- WBUFW (buf, 12) |= mob_db[md->class].option;
- WBUFW (buf, 16) = mob_get_hair (md->class);
- WBUFW (buf, 18) = mob_get_weapon (md->class);
- WBUFW (buf, 20) = mob_get_head_buttom (md->class);
+ WBUFW (buf, 14) = mob_get_viewclass (md->mob_class);
+ if ((mob_get_viewclass (md->mob_class) < 24)
+ || (mob_get_viewclass (md->mob_class) > 4000))
+ {
+ WBUFW (buf, 12) |= mob_db[md->mob_class].option;
+ WBUFW (buf, 16) = mob_get_hair (md->mob_class);
+ WBUFW (buf, 18) = mob_get_weapon (md->mob_class);
+ WBUFW (buf, 20) = mob_get_head_buttom (md->mob_class);
WBUFL (buf, 22) = gettick ();
- WBUFW (buf, 26) = mob_get_shield (md->class);
- WBUFW (buf, 28) = mob_get_head_top (md->class);
- WBUFW (buf, 30) = mob_get_head_mid (md->class);
- WBUFW (buf, 32) = mob_get_hair_color (md->class);
- WBUFW (buf, 34) = mob_get_clothes_color (md->class); //Add for player monster dye - Valaris
- WBUFB (buf, 49) = mob_get_sex (md->class);
+ WBUFW (buf, 26) = mob_get_shield (md->mob_class);
+ WBUFW (buf, 28) = mob_get_head_top (md->mob_class);
+ WBUFW (buf, 30) = mob_get_head_mid (md->mob_class);
+ WBUFW (buf, 32) = mob_get_hair_color (md->mob_class);
+ WBUFW (buf, 34) = mob_get_clothes_color (md->mob_class); //Add for player monster dye - Valaris
+ WBUFB (buf, 49) = mob_get_sex (md->mob_class);
}
else
WBUFL (buf, 22) = gettick ();
- if (md->class >= 1285 && md->class <= 1287)
+ if (md->mob_class >= 1285 && md->mob_class <= 1287)
{ // Added guardian emblems [Valaris]
struct guild *g;
struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name);
@@ -1183,8 +1180,8 @@ static int clif_npc0078 (struct npc_data *nd, unsigned char *buf)
WBUFW (buf, 0) = 0x78;
WBUFL (buf, 2) = nd->bl.id;
WBUFW (buf, 6) = nd->speed;
- WBUFW (buf, 14) = nd->class;
- if ((nd->class == 722) && (nd->u.scr.guild_id > 0)
+ WBUFW (buf, 14) = nd->npc_class;
+ if ((nd->npc_class == 722) && (nd->u.scr.guild_id > 0)
&& ((g = guild_search (nd->u.scr.guild_id)) != NULL))
{
WBUFL (buf, 22) = g->emblem_id;
@@ -1301,13 +1298,13 @@ int clif_spawnpc (struct map_session_data *sd)
clif_guild_emblem (sd, g);
} // end addition [Valaris]
- if (sd->status.class == 13 || sd->status.class == 21
- || sd->status.class == 4014 || sd->status.class == 4022)
+ if (sd->status.pc_class == 13 || sd->status.pc_class == 21
+ || sd->status.pc_class == 4014 || sd->status.pc_class == 4022)
pc_setoption (sd, sd->status.option | 0x0020); // [Valaris]
if ((pc_isriding (sd) && pc_checkskill (sd, KN_RIDING) > 0)
- && (sd->status.class == 7 || sd->status.class == 14
- || sd->status.class == 4008 || sd->status.class == 4015))
+ && (sd->status.pc_class == 7 || sd->status.pc_class == 14
+ || sd->status.pc_class == 4008 || sd->status.pc_class == 4015))
pc_setriding (sd); // update peco riders for people upgrading athena [Valaris]
if (map[sd->bl.m].flag.snow)
@@ -1337,7 +1334,7 @@ int clif_spawnnpc (struct npc_data *nd)
nullpo_retr (0, nd);
- if (nd->class < 0 || nd->flag & 1 || nd->class == INVISIBLE_CLASS)
+ if (nd->npc_class < 0 || nd->flag & 1 || nd->npc_class == INVISIBLE_CLASS)
return 0;
memset (buf, 0, packet_len_table[0x7c]);
@@ -1345,7 +1342,7 @@ int clif_spawnnpc (struct npc_data *nd)
WBUFW (buf, 0) = 0x7c;
WBUFL (buf, 2) = nd->bl.id;
WBUFW (buf, 6) = nd->speed;
- WBUFW (buf, 20) = nd->class;
+ WBUFW (buf, 20) = nd->npc_class;
WBUFPOS (buf, 36, nd->bl.x, nd->bl.y);
clif_send (buf, packet_len_table[0x7c], &nd->bl, AREA);
@@ -1405,7 +1402,7 @@ int clif_spawnmob (struct mob_data *md)
nullpo_retr (0, md);
- if (mob_get_viewclass (md->class) > 23)
+ if (mob_get_viewclass (md->mob_class) > 23)
{
memset (buf, 0, packet_len_table[0x7c]);
@@ -1415,7 +1412,7 @@ int clif_spawnmob (struct mob_data *md)
WBUFW (buf, 8) = md->opt1;
WBUFW (buf, 10) = md->opt2;
WBUFW (buf, 12) = md->option;
- WBUFW (buf, 20) = mob_get_viewclass (md->class);
+ WBUFW (buf, 20) = mob_get_viewclass (md->mob_class);
WBUFPOS (buf, 36, md->bl.x, md->bl.y);
clif_send (buf, packet_len_table[0x7c], &md->bl, AREA);
}
@@ -1423,8 +1420,8 @@ int clif_spawnmob (struct mob_data *md)
len = clif_mob0078 (md, buf);
clif_send (buf, len, &md->bl, AREA);
- if (mob_get_equip (md->class) > 0) // mob equipment [Valaris]
- clif_mob_equip (md, mob_get_equip (md->class));
+ if (mob_get_equip (md->mob_class) > 0) // mob equipment [Valaris]
+ clif_mob_equip (md, mob_get_equip (md->mob_class));
return 0;
}
@@ -3634,7 +3631,7 @@ void clif_getareachar_npc (struct map_session_data *sd, struct npc_data *nd)
nullpo_retv (sd);
nullpo_retv (nd);
- if (nd->class < 0 || nd->flag & 1 || nd->class == INVISIBLE_CLASS)
+ if (nd->npc_class < 0 || nd->flag & 1 || nd->npc_class == INVISIBLE_CLASS)
return;
len = clif_npc0078 (nd, WFIFOP (sd->fd, 0));
@@ -3661,8 +3658,8 @@ int clif_movemob (struct mob_data *md)
len = clif_mob007b (md, buf);
clif_send (buf, len, &md->bl, AREA);
- if (mob_get_equip (md->class) > 0) // mob equipment [Valaris]
- clif_mob_equip (md, mob_get_equip (md->class));
+ if (mob_get_equip (md->mob_class) > 0) // mob equipment [Valaris]
+ clif_mob_equip (md, mob_get_equip (md->mob_class));
return 0;
}
@@ -3790,8 +3787,8 @@ void clif_getareachar_mob (struct map_session_data *sd, struct mob_data *md)
WFIFOSET (sd->fd, len);
}
- if (mob_get_equip (md->class) > 0) // mob equipment [Valaris]
- clif_mob_equip (md, mob_get_equip (md->class));
+ if (mob_get_equip (md->mob_class) > 0) // mob equipment [Valaris]
+ clif_mob_equip (md, mob_get_equip (md->mob_class));
}
/*==========================================
@@ -3989,7 +3986,7 @@ int clif_pcoutsight (struct block_list *bl, va_list ap)
}
break;
case BL_NPC:
- if (((struct npc_data *) bl)->class != INVISIBLE_CLASS)
+ if (((struct npc_data *) bl)->npc_class != INVISIBLE_CLASS)
clif_clearchar_id (bl->id, 0, sd->fd);
break;
case BL_MOB:
@@ -4546,14 +4543,14 @@ int clif_skill_estimation (struct map_session_data *sd,
return 0;
WBUFW (buf, 0) = 0x18c;
- WBUFW (buf, 2) = mob_get_viewclass (md->class);
- WBUFW (buf, 4) = mob_db[md->class].lv;
- WBUFW (buf, 6) = mob_db[md->class].size;
+ WBUFW (buf, 2) = mob_get_viewclass (md->mob_class);
+ WBUFW (buf, 4) = mob_db[md->mob_class].lv;
+ WBUFW (buf, 6) = mob_db[md->mob_class].size;
WBUFL (buf, 8) = md->hp;
WBUFW (buf, 12) = battle_get_def2 (&md->bl);
- WBUFW (buf, 14) = mob_db[md->class].race;
+ WBUFW (buf, 14) = mob_db[md->mob_class].race;
WBUFW (buf, 16) =
- battle_get_mdef2 (&md->bl) - (mob_db[md->class].vit >> 1);
+ battle_get_mdef2 (&md->bl) - (mob_db[md->mob_class].vit >> 1);
WBUFW (buf, 18) = battle_get_elem_type (&md->bl);
for (i = 0; i < 9; i++)
WBUFB (buf, 20 + i) = battle_attr_fix (100, i + 1, md->def_ele);
@@ -4613,7 +4610,7 @@ int clif_GMmessage (struct block_list *bl, char *mes, int len, int flag)
{
unsigned char lbuf[255];
unsigned char *buf =
- ((len + 16) >= sizeof (lbuf)) ? malloc (len + 16) : lbuf;
+ ((len + 16) >= sizeof (lbuf)) ? (unsigned char*)malloc (len + 16) : lbuf;
int lp = (flag & 0x10) ? 8 : 4;
WBUFW (buf, 0) = 0x9a;
@@ -6000,7 +5997,7 @@ int clif_guild_memberlist (struct map_session_data *sd)
WFIFOW (fd, c * 104 + 12) = m->hair;
WFIFOW (fd, c * 104 + 14) = m->hair_color;
WFIFOW (fd, c * 104 + 16) = m->gender;
- WFIFOW (fd, c * 104 + 18) = m->class;
+ WFIFOW (fd, c * 104 + 18) = m->pc_class;
WFIFOW (fd, c * 104 + 20) = m->lv;
WFIFOL (fd, c * 104 + 22) = m->exp;
WFIFOL (fd, c * 104 + 26) = m->online;
@@ -6315,7 +6312,7 @@ int clif_guild_message (struct guild *g, int account_id, const char *mes,
unsigned char lbuf[255];
unsigned char *buf = lbuf;
if (len + 32 >= sizeof (lbuf))
- buf = malloc (len + 32);
+ buf = (unsigned char *)malloc (len + 32);
WBUFW (buf, 0) = 0x17f;
WBUFW (buf, 2) = len + 4;
memcpy (WBUFP (buf, 4), mes, len);
@@ -6570,7 +6567,7 @@ int clif_disp_onlyself (struct map_session_data *sd, char *mes, int len)
{
unsigned char lbuf[255];
unsigned char *buf =
- (len + 32 >= sizeof (lbuf)) ? malloc (len + 32) : lbuf;
+ (len + 32 >= sizeof (lbuf)) ? (unsigned char *)malloc (len + 32) : lbuf;
nullpo_retr (0, sd);
@@ -6699,7 +6696,7 @@ int clif_specialeffect (struct block_list *bl, int type, int flag)
int i;
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data) != NULL
+ if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) != NULL
&& sd->state.auth && sd->bl.m == bl->m)
clif_specialeffect (&sd->bl, type, 1);
}
@@ -6755,12 +6752,8 @@ void clif_parse_WantToConnection (int fd, struct map_session_data *sd)
}
else
{
- sd = session[fd]->session_data = calloc (sizeof (*sd), 1);
- if (sd == NULL)
- {
- printf ("out of memory : clif_parse_WantToConnection\n");
- exit (1);
- }
+ CREATE (sd, struct map_session_data, 1);
+ session[fd]->session_data = sd;
sd->fd = fd;
pc_setnewpc (sd, account_id, RFIFOL (fd, 6), RFIFOL (fd, 10),
@@ -6864,7 +6857,7 @@ void clif_parse_LoadEndAck (int fd, struct map_session_data *sd)
if (sd->state.connect_new)
{
sd->state.connect_new = 0;
- if (sd->status.class != sd->view_class)
+ if (sd->status.pc_class != sd->view_class)
clif_changelook (&sd->bl, LOOK_BASE, sd->view_class);
/* Stop players from spawning inside castles [Valaris] */
@@ -7957,17 +7950,17 @@ void clif_parse_RemoveOption (int fd, struct map_session_data *sd)
{
if (pc_isriding (sd))
{ // jobchange when removing peco [Valaris]
- if (sd->status.class == 13)
- sd->status.class = sd->view_class = 7;
+ if (sd->status.pc_class == 13)
+ sd->status.pc_class = sd->view_class = 7;
- if (sd->status.class == 21)
- sd->status.class = sd->view_class = 14;
+ if (sd->status.pc_class == 21)
+ sd->status.pc_class = sd->view_class = 14;
- if (sd->status.class == 4014)
- sd->status.class = sd->view_class = 4008;
+ if (sd->status.pc_class == 4014)
+ sd->status.pc_class = sd->view_class = 4008;
- if (sd->status.class == 4022)
- sd->status.class = sd->view_class = 4015;
+ if (sd->status.pc_class == 4022)
+ sd->status.pc_class = sd->view_class = 4015;
}
pc_setoption (sd, 0);
@@ -9316,7 +9309,7 @@ void clif_parse_sn_explosionspirits (int fd, struct map_session_data *sd)
if (sd)
{
int nextbaseexp = pc_nextbaseexp (sd);
- struct pc_base_job s_class = pc_calc_base_job (sd->status.class);
+ struct pc_base_job s_class = pc_calc_base_job (sd->status.pc_class);
if (battle_config.etc_log)
{
if (nextbaseexp != 0)
@@ -9349,7 +9342,7 @@ void clif_parse_sn_explosionspirits (int fd, struct map_session_data *sd)
// rate -1 is unlimited
typedef struct func_table
{
- void (*func)();
+ void (*func)(int fd, struct map_session_data *sd);
int rate;
} func_table;
// *INDENT-OFF*
@@ -9905,7 +9898,7 @@ func_table clif_parse_func_table[0x220] =
// Checks for packet flooding
int clif_check_packet_flood(int fd, int cmd)
{
- struct map_session_data *sd = session[fd]->session_data;
+ struct map_session_data *sd = (struct map_session_data *)session[fd]->session_data;
unsigned int rate, tick = gettick();
// sd will not be set if the client hasn't requested
@@ -10117,9 +10110,7 @@ static char *clif_validate_chat (struct map_session_data *sd, int type,
static void clif_parse (int fd)
{
int packet_len = 0, cmd = 0;
- struct map_session_data *sd = NULL;
-
- sd = session[fd]->session_data;
+ struct map_session_data *sd = (struct map_session_data *)session[fd]->session_data;
if (!sd || (sd && !sd->state.auth))
{
diff --git a/src/map/clif.h b/src/map/clif.h
index d947f95..a1914e3 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -131,8 +131,8 @@ int clif_pcoutsight (struct block_list *, va_list); // map_forallinmovearea
int clif_mobinsight (struct block_list *, va_list); // map_forallinmovearea callback
int clif_moboutsight (struct block_list *, va_list); // map_forallinmovearea callback
-int clif_class_change (struct block_list *bl, int class, int type);
-int clif_mob_class_change (struct mob_data *md, int class);
+int clif_npc_class_change (struct block_list *bl, int npc_class, int type);
+int clif_mob_class_change (struct mob_data *md, int mob_class);
int clif_mob_equip (struct mob_data *md, int nameid); // [Valaris]
int clif_skillinfo (struct map_session_data *sd, int skillid, int type,
diff --git a/src/map/guild.c b/src/map/guild.c
index 6017b8e..e4e0ca8 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -162,7 +162,7 @@ void do_init_guild (void)
// 検索
struct guild *guild_search (int guild_id)
{
- return numdb_search (guild_db, guild_id);
+ return (struct guild *)numdb_search (guild_db, guild_id);
}
void guild_searchname_sub (db_key_t key, db_val_t data, va_list ap)
@@ -185,7 +185,7 @@ struct guild *guild_searchname (char *str)
struct guild_castle *guild_castle_search (int gcid)
{
- return numdb_search (castle_db, gcid);
+ return (struct guild_castle *)numdb_search (castle_db, gcid);
}
// mapnameに対応したアジトのgcを返す
@@ -255,7 +255,7 @@ void guild_makemember (struct guild_member *m, struct map_session_data *sd)
m->hair = sd->status.hair;
m->hair_color = sd->status.hair_color;
m->gender = sd->sex;
- m->class = sd->status.class;
+ m->pc_class = sd->status.pc_class;
m->lv = sd->status.base_level;
m->exp = 0;
m->exp_payper = 0;
@@ -372,7 +372,7 @@ int guild_created (int account_id, int guild_id)
sd->status.guild_id = guild_id;
sd->guild_sended = 0;
- if ((g = numdb_search (guild_db, guild_id)) != NULL)
+ if ((g = (struct guild *)numdb_search (guild_db, guild_id)) != NULL)
{
printf ("guild_created(): ID already exists!\n");
exit (1);
@@ -434,7 +434,7 @@ int guild_check_member (const struct guild *g)
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data) && sd->state.auth)
+ if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->state.auth)
{
if (sd->status.guild_id == g->guild_id)
{
@@ -466,7 +466,7 @@ int guild_recv_noinfo (int guild_id)
struct map_session_data *sd;
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data) && sd->state.auth)
+ if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->state.auth)
{
if (sd->status.guild_id == guild_id)
sd->status.guild_id = 0;
@@ -484,7 +484,7 @@ int guild_recv_info (struct guild *sg)
nullpo_retr (0, sg);
- if ((g = numdb_search (guild_db, sg->guild_id)) == NULL)
+ if ((g = (struct guild *)numdb_search (guild_db, sg->guild_id)) == NULL)
{
CREATE (g, struct guild, 1);
numdb_insert (guild_db, sg->guild_id, g);
@@ -544,7 +544,7 @@ int guild_recv_info (struct guild *sg)
}
// イベントの発生
- if ((ev = numdb_search (guild_infoevent_db, sg->guild_id)) != NULL)
+ if ((ev = (struct eventlist *)numdb_search (guild_infoevent_db, sg->guild_id)) != NULL)
{
numdb_erase (guild_infoevent_db, sg->guild_id);
for (; ev; ev2 = ev->next, free (ev), ev = ev2)
@@ -820,7 +820,7 @@ int guild_send_memberinfoshort (struct map_session_data *sd, int online)
intif_guild_memberinfoshort (g->guild_id,
sd->status.account_id, 0 /*char_id*/,
online, sd->status.base_level,
- sd->status.class);
+ sd->status.pc_class);
if (!online)
{ // ログアウトするならsdをクリアして終了
@@ -854,7 +854,7 @@ int guild_send_memberinfoshort (struct map_session_data *sd, int online)
// ギルドメンバのオンライン状態/Lv更新通知
int guild_recv_memberinfoshort (int guild_id, int account_id, int char_id,
- int online, int lv, int class)
+ int online, int lv, int pc_class)
{
int i, alv, c, idx = 0, om = 0, oldonline = -1;
struct guild *g = guild_search (guild_id);
@@ -868,7 +868,7 @@ int guild_recv_memberinfoshort (int guild_id, int account_id, int char_id,
oldonline = m->online;
m->online = online;
m->lv = lv;
- m->class = class;
+ m->pc_class = pc_class;
idx = i;
}
if (m->account_id > 0)
@@ -1084,7 +1084,7 @@ int guild_payexp (struct map_session_data *sd, int exp)
if ((exp2 = exp * per / 100) <= 0)
return 0;
- if ((c = numdb_search (guild_expcache_db, sd->status.account_id /*char_id*/)) == NULL)
+ if ((c = (struct guild_expcache *)numdb_search (guild_expcache_db, sd->status.account_id /*char_id*/)) == NULL)
{
CREATE (c, struct guild_expcache, 1);
c->guild_id = sd->status.guild_id;
@@ -1539,7 +1539,7 @@ int guild_addcastleinfoevent (int castle_id, int index, const char *name)
CREATE (ev, struct eventlist, 1);
memcpy (ev->name, name, sizeof (ev->name));
- ev->next = numdb_search (guild_castleinfoevent_db, code);
+ ev->next = (struct eventlist *)numdb_search (guild_castleinfoevent_db, code);
numdb_insert (guild_castleinfoevent_db, code, ev);
return 0;
}
@@ -1637,7 +1637,7 @@ int guild_castledataloadack (int castle_id, int index, int value)
index);
return 0;
}
- if ((ev = numdb_search (guild_castleinfoevent_db, code)) != NULL)
+ if ((ev = (struct eventlist *)numdb_search (guild_castleinfoevent_db, code)) != NULL)
{
numdb_erase (guild_castleinfoevent_db, code);
for (; ev; ev2 = ev->next, free (ev), ev = ev2)
@@ -1882,30 +1882,22 @@ int guild_isallied (struct guild *g, struct guild_castle *gc)
static void guild_db_final (db_key_t key, db_val_t data, va_list ap)
{
- struct guild *g = data;
-
- free (g);
+ free (data);
}
static void castle_db_final (db_key_t key, db_val_t data, va_list ap)
{
- struct guild_castle *gc = data;
-
- free (gc);
+ free (data);
}
static void guild_expcache_db_final (db_key_t key, db_val_t data, va_list ap)
{
- struct guild_expcache *c = data;
-
- free (c);
+ free (data);
}
static void guild_infoevent_db_final (db_key_t key, db_val_t data, va_list ap)
{
- struct eventlist *ev = data;
-
- free (ev);
+ free (data);
}
void do_final_guild (void)
diff --git a/src/map/guild.h b/src/map/guild.h
index 6ac13f9..8e7c32e 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -59,7 +59,7 @@ int guild_opposition (struct map_session_data *sd, int char_id);
int guild_send_memberinfoshort (struct map_session_data *sd, int online);
int guild_recv_memberinfoshort (int guild_id, int account_id, int char_id,
- int online, int lv, int class);
+ int online, int lv, int class_);
int guild_change_memberposition (int guild_id, int account_id, int char_id,
int idx);
int guild_memberposition_changed (struct guild *g, int idx, int pos);
diff --git a/src/map/intif.c b/src/map/intif.c
index 629eade..7069e3a 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -366,7 +366,7 @@ int intif_guild_leave (int guild_id, int account_id, int char_id, int flag,
// ギルドメンバのオンライン状況/Lv更新要求
int intif_guild_memberinfoshort (int guild_id,
int account_id, int char_id, int online,
- int lv, int class)
+ int lv, int class_)
{
WFIFOW (inter_fd, 0) = 0x3035;
WFIFOL (inter_fd, 2) = guild_id;
@@ -374,7 +374,7 @@ int intif_guild_memberinfoshort (int guild_id,
WFIFOL (inter_fd, 10) = char_id;
WFIFOB (inter_fd, 14) = online;
WFIFOW (inter_fd, 15) = lv;
- WFIFOW (inter_fd, 17) = class;
+ WFIFOW (inter_fd, 17) = class_;
WFIFOSET (inter_fd, 19);
return 0;
}
@@ -603,7 +603,7 @@ int mapif_parse_WisToGM (int fd)
message[len - 1] = '\0';
// information is sended to all online GM
for (i = 0; i < fd_max; i++)
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
if (pc_isGM (pl_sd) >= min_gm_level)
clif_wis_message (i, Wisp_name, message,
diff --git a/src/map/intif.h b/src/map/intif.h
index b6abd78..374c95a 100644
--- a/src/map/intif.h
+++ b/src/map/intif.h
@@ -36,7 +36,7 @@ int intif_guild_addmember (int guild_id, struct guild_member *m);
int intif_guild_leave (int guild_id, int account_id, int char_id, int flag,
const char *mes);
int intif_guild_memberinfoshort (int guild_id, int account_id, int char_id,
- int online, int lv, int class);
+ int online, int lv, int class_);
int intif_guild_break (int guild_id);
int intif_guild_message (int guild_id, int account_id, char *mes, int len);
int intif_guild_checkconflict (int guild_id, int account_id, int char_id);
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 6557d43..f89446b 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -38,7 +38,7 @@ static int blue_box_default = 0, violet_box_default = 0, card_album_default =
static void itemdb_read (void);
static int itemdb_readdb (void);
-static int itemdb_read_randomitem ();
+static int itemdb_read_randomitem (void);
static int itemdb_read_itemavail (void);
static int itemdb_read_itemnametable (void);
static int itemdb_read_noequip (void);
@@ -143,7 +143,7 @@ int itemdb_searchrandomid (int flags)
*/
struct item_data *itemdb_exists (int nameid)
{
- return numdb_search (item_db, nameid);
+ return (struct item_data *)numdb_search (item_db, nameid);
}
/*==========================================
@@ -152,9 +152,7 @@ struct item_data *itemdb_exists (int nameid)
*/
struct item_data *itemdb_search (int nameid)
{
- struct item_data *id;
-
- id = numdb_search (item_db, nameid);
+ struct item_data *id = (struct item_data *)numdb_search (item_db, nameid);
if (id)
return id;
@@ -263,7 +261,7 @@ static int itemdb_read_itemslottable (void)
char *buf, *p;
int s;
- buf = grfio_reads ("data\\itemslottable.txt", &s);
+ buf = (char *)grfio_reads ("data\\itemslottable.txt", &s);
if (buf == NULL)
return -1;
buf[s] = 0;
@@ -397,7 +395,7 @@ static int itemdb_readdb (void)
* ランダムアイテム出現データの読み込み
*------------------------------------------
*/
-static int itemdb_read_randomitem ()
+static int itemdb_read_randomitem (void)
{
FILE *fp;
char line[1024];
@@ -546,7 +544,7 @@ static int itemdb_read_itemnametable (void)
char *buf, *p;
int s;
- buf = grfio_reads ("data\\idnum2itemdisplaynametable.txt", &s);
+ buf = (char *)grfio_reads ("data\\idnum2itemdisplaynametable.txt", &s);
if (buf == NULL)
return -1;
@@ -592,7 +590,7 @@ static int itemdb_read_cardillustnametable (void)
char *buf, *p;
int s;
- buf = grfio_reads ("data\\num2cardillustnametable.txt", &s);
+ buf = (char *)grfio_reads ("data\\num2cardillustnametable.txt", &s);
if (buf == NULL)
return -1;
@@ -676,7 +674,7 @@ static void itemdb_final (db_key_t key, db_val_t data, va_list ap)
{
struct item_data *id;
- nullpo_retv (id = data);
+ nullpo_retv (id = (struct item_data *)data);
if (id->use_script)
free (id->use_script);
diff --git a/src/map/magic-expr.c b/src/map/magic-expr.c
index c3846e2..a0a4935 100644
--- a/src/map/magic-expr.c
+++ b/src/map/magic-expr.c
@@ -34,7 +34,7 @@ static void free_area (area_t * area)
static area_t *dup_area (area_t * area)
{
- area_t *retval = malloc (sizeof (area_t));
+ area_t *retval = (area_t *)malloc (sizeof (area_t));
*retval = *area;
switch (area->ty)
@@ -122,7 +122,7 @@ static void stringify (val_t * v, int within_op)
break;
case TY_INT:
- buf = malloc (32);
+ buf = (char *)malloc (32);
sprintf (buf, "%i", v->v.v_int);
break;
@@ -138,7 +138,7 @@ static void stringify (val_t * v, int within_op)
break;
case TY_LOCATION:
- buf = malloc (128);
+ buf = (char *) malloc (128);
sprintf (buf, "<\"%s\", %d, %d>", map[v->v.v_location.m].name,
v->v.v_location.x, v->v.v_location.y);
break;
@@ -204,7 +204,7 @@ static void make_area (val_t * v)
{
if (v->ty == TY_LOCATION)
{
- area_t *a = malloc (sizeof (area_t));
+ area_t *a = (char *)malloc (sizeof (area_t));
v->ty = TY_AREA;
a->ty = AREA_LOCATION;
a->a.a_loc = v->v.v_location;
@@ -617,7 +617,7 @@ static int
fun_mob_id (env_t * env, int args_nr, val_t * result, val_t * args)
{
if (ETY (0) != BL_MOB) return 1;
- RESULTINT = ((struct mob_data *) (ARGENTITY(0)))->class;
+ RESULTINT = ((struct mob_data *) (ARGENTITY(0)))->mob_class;
return 0;
}
@@ -1243,7 +1243,7 @@ int compare_fun (const void *lhs, const void *rhs)
return strcmp (((fun_t *) lhs)->name, ((fun_t *) rhs)->name);
}
-fun_t *magic_get_fun (char *name, int *index)
+fun_t *magic_get_fun (const char *name, int *index)
{
static int functions_nr;
fun_t *result;
@@ -1302,7 +1302,7 @@ eval_location (env_t * env, location_t * dest, e_location_t * expr)
static area_t *eval_area (env_t * env, e_area_t * expr)
{
- area_t *area = malloc (sizeof (area_t));
+ area_t *area = (area_t *)malloc (sizeof (area_t));
area->ty = expr->ty;
switch (expr->ty)
diff --git a/src/map/magic-expr.h b/src/map/magic-expr.h
index 657dcb7..e912d14 100644
--- a/src/map/magic-expr.h
+++ b/src/map/magic-expr.h
@@ -47,7 +47,7 @@ typedef struct op
* @param name The name to look up
* @return A function of that name, or NULL, and a function index
*/
-fun_t *magic_get_fun (char *name, int *index);
+fun_t *magic_get_fun (const char *name, int *index);
/**
* Retrieves an operation by name
diff --git a/src/map/magic-interpreter-parser.y b/src/map/magic-interpreter-parser.y
index c5ee41d..9df0f3e 100644
--- a/src/map/magic-interpreter-parser.y
+++ b/src/map/magic-interpreter-parser.y
@@ -6,11 +6,11 @@
magic_conf_t magic_conf;
static int
-intern_id(char *id_name);
+intern_id(const char *id_name);
static expr_t *
-fun_expr(char *name, int args_nr, expr_t **args, int line, int column);
+fun_expr(const char *name, int args_nr, expr_t **args, int line, int column);
static expr_t *
dot_expr(expr_t *lhs, int id);
@@ -23,7 +23,7 @@ static void
magic_frontend_error(const char *msg);
static void
-fail(int line, int column, char *fmt, ...);
+fail(int line, int column, const char *fmt, ...);
static spell_t *
new_spell(spellguard_t *guard);
@@ -50,7 +50,7 @@ static effect_t *
op_effect(char *name, int args_nr, expr_t **args, int line, int column);
int
-magic_frontend_lex();
+magic_frontend_lex(void);
static void
install_proc(proc_t *proc);
@@ -232,12 +232,12 @@ proc_formals_list : /* empty */
proc_formals_list_ne : ID
{ CREATE ($$, proc_t, 1);
$$->args_nr = 1;
- $$->args = malloc(sizeof(int));
+ $$->args = (int*)malloc(sizeof(int));
$$->args[0] = intern_id($1);
}
| proc_formals_list_ne ',' ID
{ $$ = $1;
- $$->args = realloc($$->args, sizeof(int) * (1 + $$->args_nr));
+ $$->args = (int*)realloc($$->args, sizeof(int) * (1 + $$->args_nr));
$$->args[$$->args_nr++] = intern_id($3);
}
;
@@ -261,7 +261,8 @@ spellconf_option : ID '=' expr
}
| TELEPORT_ANCHOR ID ':' expr '=' expr
{
- teleport_anchor_t *anchor = calloc(sizeof(teleport_anchor_t), 1);
+ teleport_anchor_t *anchor;
+ CREATE (anchor, teleport_anchor_t, 1);
anchor->name = $2;
anchor->invocation = magic_eval_str(&magic_default_env, $4);
anchor->location = $6;
@@ -419,7 +420,7 @@ arg_list_ne : expr
$$.args[0] = $1;
}
| arg_list_ne ',' expr
- { $$.args = realloc($$.args, (1 + $$.args_nr) * sizeof(expr_t *));
+ { RECREATE($$.args, expr_t *, 1 + $$.args_nr);
$$.args[$$.args_nr++] = $3;
}
;
@@ -462,12 +463,12 @@ spelldef : spellbody_list
defs : semicolons
{ $$.letdefs_nr = 0;
- $$.letdefs = (letdef_t *) malloc(1);
+ CREATE($$.letdefs, letdef_t, 1);
}
| defs def semicolons
{ $$ = $1;
$$.letdefs_nr++;
- $$.letdefs = realloc($$.letdefs, sizeof(letdef_t) * $$.letdefs_nr);
+ RECREATE ($$.letdefs, letdef_t, $$.letdefs_nr);
$$.letdefs[$1.letdefs_nr] = $2;
}
;
@@ -701,21 +702,21 @@ effect_list : /* empty */
* during startup for a relatively manageable set of configs, it should be fine. */
static int
-intern_id(char *id_name)
+intern_id(const char *id_name)
{
int i;
for (i = 0; i < magic_conf.vars_nr; i++)
if (!strcmp(id_name, magic_conf.var_name[i])) {
- free(id_name);
+ free((char*)id_name);
return i;
}
/* Must add new */
i = magic_conf.vars_nr++;
- magic_conf.var_name = realloc(magic_conf.var_name, magic_conf.vars_nr * sizeof(char *));
+ RECREATE(magic_conf.var_name, const char *, magic_conf.vars_nr);
magic_conf.var_name[i] = id_name;
- magic_conf.vars = realloc(magic_conf.vars, magic_conf.vars_nr * sizeof(val_t));
+ RECREATE(magic_conf.vars, val_t, magic_conf.vars_nr);
magic_conf.vars[i].ty = TY_UNDEF;
return i;
@@ -740,7 +741,7 @@ add_spell(spell_t *spell, int line_nr)
}
magic_conf.spells_nr++;
- magic_conf.spells = realloc(magic_conf.spells, magic_conf.spells_nr * sizeof (spell_t*));
+ RECREATE(magic_conf.spells, spell_t *, magic_conf.spells_nr);
magic_conf.spells[index] = spell;
@@ -765,13 +766,13 @@ add_teleport_anchor(teleport_anchor_t *anchor, int line_nr)
}
magic_conf.anchors_nr++;
- magic_conf.anchors = realloc(magic_conf.anchors, magic_conf.anchors_nr * sizeof (teleport_anchor_t*));
+ RECREATE(magic_conf.anchors, teleport_anchor_t *, magic_conf.anchors_nr);
magic_conf.anchors[index] = anchor;
}
static void
-fail(int line, int column, char *fmt, ...)
+fail(int line, int column, const char *fmt, ...)
{
va_list ap;
fprintf(stderr, "[magic-init] L%d:%d: ", line, column);
@@ -791,7 +792,7 @@ dot_expr(expr_t *expr, int id)
}
static expr_t *
-fun_expr(char *name, int args_nr, expr_t **args, int line, int column)
+fun_expr(const char *name, int args_nr, expr_t **args, int line, int column)
{
int id;
expr_t *expr;
@@ -828,7 +829,7 @@ new_spell(spellguard_t *guard)
{
static int spell_counter = 0;
- spell_t *retval = calloc(1, sizeof(spell_t));
+ spell_t *retval = (spell_t*)calloc(1, sizeof(spell_t));
retval->index = ++spell_counter;
retval->spellguard = guard;
return retval;
@@ -837,7 +838,7 @@ new_spell(spellguard_t *guard)
static spellguard_t *
new_spellguard(int ty)
{
- spellguard_t *retval = calloc(1, sizeof(spellguard_t));
+ spellguard_t *retval = (spellguard_t *)calloc(1, sizeof(spellguard_t));
retval->ty = ty;
return retval;
}
@@ -938,7 +939,7 @@ op_effect(char *name, int args_nr, expr_t **args, int line, int column)
proc_t *procs = NULL;
int procs_nr = 0;
-
+// I think this is a memory leak, or undefined behavior
static void
install_proc(proc_t *proc)
{
@@ -946,7 +947,7 @@ install_proc(proc_t *proc)
procs = proc;
procs_nr = 1;
} else {
- procs = realloc(procs, sizeof(proc_t) * (1 + procs_nr));
+ RECREATE (procs, proc_t, 1 + procs_nr);
procs[procs_nr++] = *proc;
}
}
@@ -1042,10 +1043,10 @@ magic_init(char *conffile) // must be called after itemdb initialisation
magic_conf.min_casttime = 100;
magic_conf.spells_nr = 0;
- magic_conf.spells = (spell_t **)malloc(1);
+ CREATE(magic_conf.spells, spell_t *, 1);
magic_conf.anchors_nr = 0;
- magic_conf.anchors = (teleport_anchor_t **)malloc(1);
+ CREATE(magic_conf.anchors, teleport_anchor_t *, 1);
INTERN_ASSERT("min_casttime", VAR_MIN_CASTTIME);
INTERN_ASSERT("obscure_chance", VAR_OBSCURE_CHANCE);
diff --git a/src/map/magic-interpreter.h b/src/map/magic-interpreter.h
index e9232bd..0b4b73c 100644
--- a/src/map/magic-interpreter.h
+++ b/src/map/magic-interpreter.h
@@ -335,7 +335,7 @@ typedef struct teleport_anchor
typedef struct
{
int vars_nr;
- char **var_name;
+ const char **var_name;
val_t *vars; /* Initial assignments, if any, or NULL */
int obscure_chance;
diff --git a/src/map/magic-stmt.c b/src/map/magic-stmt.c
index 4ae7e5d..5569217 100644
--- a/src/map/magic-stmt.c
+++ b/src/map/magic-stmt.c
@@ -473,14 +473,7 @@ record_status_change (invocation_t * invocation, int bl_id, int sc_id)
int index = invocation->status_change_refs_nr++;
status_change_ref_t *cr;
- if (invocation->status_change_refs)
- invocation->status_change_refs =
- realloc (invocation->status_change_refs,
- sizeof (status_change_ref_t) *
- invocation->status_change_refs_nr);
- else
- invocation->status_change_refs =
- malloc (sizeof (status_change_ref_t));
+ RECREATE (invocation->status_change_refs, status_change_ref_t, invocation->status_change_refs_nr);
cr = &invocation->status_change_refs[index];
@@ -739,7 +732,7 @@ static int op_injure (env_t * env, int args_nr, val_t * args)
struct mob_data *mob = (struct mob_data *) target;
MAP_LOG_PC (caster_pc, "SPELLDMG MOB%d %d FOR %d BY %s",
- mob->bl.id, mob->class, damage_caused,
+ mob->bl.id, mob->mob_class, damage_caused,
get_invocation_name (env));
}
}
@@ -884,7 +877,7 @@ op_t *magic_get_op (char *name, int *index)
}
key.name = name;
- op_t *op = bsearch (&key, operations, operation_count, sizeof (op_t),
+ op_t *op = (op_t *)bsearch (&key, operations, operation_count, sizeof (op_t),
compare_operations);
if (op && index)
@@ -1048,7 +1041,7 @@ static int find_entities_in_area_c (entity_t * target, va_list va)
if (*entities_nr_p == *entities_allocd_p) { \
/* Need more space */ \
(*entities_allocd_p) += 32; \
- *entities_p = realloc(*entities_p, sizeof(int) * (*entities_allocd_p)); \
+ RECREATE (*entities_p, int, *entities_allocd_p); \
} \
(*entities_p)[(*entities_nr_p)++] = e;
@@ -1169,14 +1162,14 @@ static effect_t *run_foreach (invocation_t * invocation, effect_t * foreach,
if (!ar)
return return_location;
- entities_collect = malloc (entities_allocd * sizeof (int));
+ CREATE (entities_collect, int, entities_allocd);
find_entities_in_area (area.v.v_area, &entities_allocd, &entities_nr,
&entities_collect, filter);
/* Now shuffle */
- shuffle_board = malloc ((sizeof (int) * (1 + entities_nr))); // +1: to avoid spurious warnings in memory profilers
- entities = malloc ((sizeof (int) * (1 + entities_nr))); // +1: to avoid spurious warnings in memory profilers
+ CREATE (shuffle_board, int, entities_nr);
+ CREATE (entities, int, entities_nr);
for (i = 0; i < entities_nr; i++)
shuffle_board[i] = i;
diff --git a/src/map/magic.c b/src/map/magic.c
index b67aaca..797dc16 100644
--- a/src/map/magic.c
+++ b/src/map/magic.c
@@ -124,7 +124,7 @@ int magic_message (character_t * caster, char *spell_, size_t spell_len)
int magic_init (char *conffile); // must be called after itemdb initialisation
-void do_init_magic ()
+void do_init_magic (void)
{
magic_init (MAGIC_CONFIG_FILE);
}
diff --git a/src/map/magic.h b/src/map/magic.h
index 99ae647..1979914 100644
--- a/src/map/magic.h
+++ b/src/map/magic.h
@@ -46,7 +46,7 @@ spell_effect_report_termination (int invocation, int bl_id, int sc_id,
/**
* Initialise all spells, read config data
*/
-void do_init_magic ();
+void do_init_magic (void);
/**
* Identifies the invocation used to trigger a spell
diff --git a/src/map/map.c b/src/map/map.c
index 7730b94..fdc97e7 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1021,10 +1021,7 @@ int map_addflooritem (struct item *item_data, int amount, int m, int x, int y,
*/
void map_addchariddb (int charid, char *name)
{
- struct charid2nick *p = NULL;
- int req = 0;
-
- p = numdb_search (charid_db, charid);
+ struct charid2nick *p = (struct charid2nick *)numdb_search (charid_db, charid);
if (p == NULL)
{ // データベースにない
CREATE (p, struct charid2nick, 1);
@@ -1033,7 +1030,7 @@ void map_addchariddb (int charid, char *name)
else
numdb_erase (charid_db, charid);
- req = p->req_id;
+ int req = p->req_id;
memcpy (p->nick, name, 24);
p->req_id = 0;
numdb_insert (charid_db, charid, p);
@@ -1051,11 +1048,9 @@ void map_addchariddb (int charid, char *name)
*/
int map_reqchariddb (struct map_session_data *sd, int charid)
{
- struct charid2nick *p = NULL;
-
nullpo_retr (0, sd);
- p = numdb_search (charid_db, charid);
+ struct charid2nick *p = (struct charid2nick *)numdb_search (charid_db, charid);
if (p != NULL) // データベースにすでにある
return 0;
CREATE (p, struct charid2nick, 1);
@@ -1195,7 +1190,7 @@ struct map_session_data *map_id2sd (int id)
struct map_session_data *sd = NULL;
for (i = 0; i < fd_max; i++)
- if (session[i] && (sd = session[i]->session_data) && sd->bl.id == id)
+ if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->bl.id == id)
return sd;
return NULL;
@@ -1207,7 +1202,7 @@ struct map_session_data *map_id2sd (int id)
*/
char *map_charid2nick (int id)
{
- struct charid2nick *p = numdb_search (charid_db, id);
+ struct charid2nick *p = (struct charid2nick *)numdb_search (charid_db, id);
if (p == NULL)
return NULL;
@@ -1224,7 +1219,7 @@ static struct map_session_data *map_get_session (int i)
struct map_session_data *d;
if (i >= 0 && i < fd_max
- && session[i] && (d = session[i]->session_data) && d->state.auth)
+ && session[i] && (d = (struct map_session_data *)session[i]->session_data) && d->state.auth)
return d;
return NULL;
@@ -1256,7 +1251,7 @@ static struct map_session_data *map_get_session_backward (int start)
return NULL;
}
-struct map_session_data *map_get_first_session ()
+struct map_session_data *map_get_first_session (void)
{
return map_get_session_forward (0);
}
@@ -1266,7 +1261,7 @@ struct map_session_data *map_get_next_session (struct map_session_data *d)
return map_get_session_forward (d->fd + 1);
}
-struct map_session_data *map_get_last_session ()
+struct map_session_data *map_get_last_session (void)
{
return map_get_session_backward (fd_max);
}
@@ -1295,7 +1290,7 @@ struct map_session_data *map_nick2sd (char *nick)
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
// Without case sensitive check (increase the number of similar character names found)
@@ -1329,7 +1324,7 @@ struct block_list *map_id2bl (int id)
if (id < sizeof (object) / sizeof (object[0]))
bl = object[id];
else
- bl = numdb_search (id_db, id);
+ bl = (struct block_list *)numdb_search (id_db, id);
return bl;
}
@@ -1413,9 +1408,7 @@ void map_removenpc (void)
*/
int map_mapname2mapid (char *name)
{
- struct map_data *md = NULL;
-
- md = strdb_search (map_db, name);
+ struct map_data *md = (struct map_data *)strdb_search (map_db, name);
if (md == NULL || md->gat == NULL)
return -1;
return md->m;
@@ -1427,9 +1420,7 @@ int map_mapname2mapid (char *name)
*/
int map_mapname2ipport (char *name, int *ip, int *port)
{
- struct map_data_other_server *mdos = NULL;
-
- mdos = strdb_search (map_db, name);
+ struct map_data_other_server *mdos = (struct map_data_other_server *)strdb_search (map_db, name);
if (mdos == NULL || mdos->gat)
return -1;
*ip = mdos->ip;
@@ -1564,10 +1555,9 @@ int map_setcell (int m, int x, int y, int t)
*/
int map_setipport (char *name, unsigned long ip, int port)
{
- struct map_data *md = NULL;
struct map_data_other_server *mdos = NULL;
- md = strdb_search (map_db, name);
+ struct map_data *md = (struct map_data *)strdb_search (map_db, name);
if (md == NULL)
{ // not exist -> add new data
CREATE (mdos, struct map_data_other_server, 1);
@@ -1664,7 +1654,6 @@ static void map_readwater (char *watertxt)
*/
static int map_readmap (int m, char *fn, char *alias)
{
- unsigned char *gat = "";
int s;
int x, y, xs, ys;
struct gat_1cell
@@ -1675,7 +1664,7 @@ static int map_readmap (int m, char *fn, char *alias)
size_t size;
// read & convert fn
- gat = grfio_read (fn);
+ uint8_t gat = (uint8_t *)grfio_read (fn);
if (gat == NULL)
return -1;
@@ -1686,7 +1675,7 @@ static int map_readmap (int m, char *fn, char *alias)
xs = map[m].xs = *(short *) (gat);
ys = map[m].ys = *(short *) (gat + 2);
printf ("\n%i %i\n", xs, ys);
- map[m].gat = calloc (s = map[m].xs * map[m].ys, 1);
+ map[m].gat = (uint8_t *)calloc (s = map[m].xs * map[m].ys, 1);
if (map[m].gat == NULL)
{
printf ("out of memory : map_readmap gat\n");
@@ -1717,39 +1706,15 @@ static int map_readmap (int m, char *fn, char *alias)
map[m].bxs = (xs + BLOCK_SIZE - 1) / BLOCK_SIZE;
map[m].bys = (ys + BLOCK_SIZE - 1) / BLOCK_SIZE;
- size = map[m].bxs * map[m].bys * sizeof (struct block_list *);
-
- map[m].block = calloc (size, 1);
- if (map[m].block == NULL)
- {
- printf ("out of memory : map_readmap block\n");
- exit (1);
- }
+ size = map[m].bxs * map[m].bys;
- map[m].block_mob = calloc (size, 1);
- if (map[m].block_mob == NULL)
- {
- printf ("out of memory : map_readmap block_mob\n");
- exit (1);
- }
+ CREATE (map[m].block, struct block_list *, size);
- size = map[m].bxs * map[m].bys * sizeof (int);
+ CREATE (map[m].block_mob, struct block_list *, size);
- map[m].block_count = calloc (size, 1);
- if (map[m].block_count == NULL)
- {
- printf ("out of memory : map_readmap block\n");
- exit (1);
- }
- memset (map[m].block_count, 0, size);
+ CREATE (map[m].block_count, int, size);
- map[m].block_mob_count = calloc (size, 1);
- if (map[m].block_mob_count == NULL)
- {
- printf ("out of memory : map_readmap block_mob\n");
- exit (1);
- }
- memset (map[m].block_mob_count, 0, size);
+ CREATE (map[m].block_mob_count, int, size);
strdb_insert (map_db, map[m].name, &map[m]);
@@ -1873,11 +1838,11 @@ FILE *map_logfile = NULL;
char *map_logfile_name = NULL;
static long map_logfile_index;
-static void map_close_logfile ()
+static void map_close_logfile (void)
{
if (map_logfile)
{
- char *filenameop_buf = malloc (strlen (map_logfile_name) + 50);
+ char *filenameop_buf = (char*)malloc (strlen (map_logfile_name) + 50);
sprintf (filenameop_buf, "gzip -f %s.%ld", map_logfile_name,
map_logfile_index);
@@ -1892,7 +1857,7 @@ static void map_close_logfile ()
static void map_start_logfile (long suffix)
{
- char *filename_buf = malloc (strlen (map_logfile_name) + 50);
+ char *filename_buf = (char*)malloc (strlen (map_logfile_name) + 50);
map_logfile_index = suffix >> LOGFILE_SECONDS_PER_CHUNK_SHIFT;
sprintf (filename_buf, "%s.%ld", map_logfile_name, map_logfile_index);
@@ -2138,7 +2103,9 @@ void do_final (void)
do_final_guild ();
}
-void map_helpscreen ()
+/// --help was passed
+// FIXME this should produce output
+void map_helpscreen (void)
{
exit (1);
}
diff --git a/src/map/map.h b/src/map/map.h
index 5955418..a480cd0 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -424,7 +424,7 @@ struct npc_data
{
struct block_list bl;
short n;
- short class, dir;
+ short npc_class, dir;
short speed;
char name[24];
char exname[24];
@@ -487,7 +487,7 @@ struct mob_data
{
struct block_list bl;
short n;
- short base_class, class, dir, mode;
+ short base_class, mob_class, dir, mode;
short m, x0, y0, xs, ys;
char name[24];
int spawndelay1, spawndelay2;
@@ -795,8 +795,8 @@ int map_scriptcont (struct map_session_data *sd, int id); /* Continues a scrip
struct map_session_data *map_nick2sd (char *);
int compare_item (struct item *a, struct item *b);
-struct map_session_data *map_get_first_session ();
-struct map_session_data *map_get_last_session ();
+struct map_session_data *map_get_first_session (void);
+struct map_session_data *map_get_last_session (void);
struct map_session_data *map_get_next_session (struct map_session_data
*current);
struct map_session_data *map_get_prev_session (struct map_session_data
@@ -816,7 +816,7 @@ int path_blownpos (int m, int x0, int y0, int dx, int dy, int count);
int map_who (int fd);
-void map_helpscreen (); // [Valaris]
+void map_helpscreen (void); // [Valaris]
int map_delmap (char *mapname);
#endif
diff --git a/src/map/mob.c b/src/map/mob.c
index 3e3297d..2402245 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -46,7 +46,7 @@ static int mob_makedummymobdb (int);
static void mob_timer (timer_id, tick_t, custom_id_t, custom_data_t);
int mobskill_use (struct mob_data *md, unsigned int tick, int event);
int mobskill_deltimer (struct mob_data *md);
-int mob_skillid2skillidx (int class, int skillid);
+int mob_skillid2skillidx (int mob_class, int skillid);
int mobskill_use_id (struct mob_data *md, struct block_list *target,
int skill_idx);
static int mob_unlocktarget (struct mob_data *md, int tick);
@@ -90,21 +90,21 @@ static void mob_init (struct mob_data *md);
* The minimum data set for MOB spawning
*------------------------------------------
*/
-int mob_spawn_dataset (struct mob_data *md, const char *mobname, int class)
+int mob_spawn_dataset (struct mob_data *md, const char *mobname, int mob_class)
{
nullpo_retr (0, md);
if (strcmp (mobname, "--en--") == 0)
- memcpy (md->name, mob_db[class].name, 24);
+ memcpy (md->name, mob_db[mob_class].name, 24);
else if (strcmp (mobname, "--ja--") == 0)
- memcpy (md->name, mob_db[class].jname, 24);
+ memcpy (md->name, mob_db[mob_class].jname, 24);
else
memcpy (md->name, mobname, 24);
md->bl.prev = NULL;
md->bl.next = NULL;
md->n = 0;
- md->base_class = md->class = class;
+ md->base_class = md->mob_class = mob_class;
md->bl.id = npc_get_new_npc_id ();
memset (&md->state, 0, sizeof (md->state));
@@ -292,24 +292,24 @@ int mob_gen_exp (struct mob_db *mob)
static void mob_init (struct mob_data *md)
{
int i;
- const int class = md->class;
- const int mutations_nr = mob_db[class].mutations_nr;
- const int mutation_power = mob_db[class].mutation_power;
-
- md->stats[MOB_LV] = mob_db[class].lv;
- md->stats[MOB_MAX_HP] = mob_db[class].max_hp;
- md->stats[MOB_STR] = mob_db[class].str;
- md->stats[MOB_AGI] = mob_db[class].agi;
- md->stats[MOB_VIT] = mob_db[class].vit;
- md->stats[MOB_INT] = mob_db[class].int_;
- md->stats[MOB_DEX] = mob_db[class].dex;
- md->stats[MOB_LUK] = mob_db[class].luk;
- md->stats[MOB_ATK1] = mob_db[class].atk1;
- md->stats[MOB_ATK2] = mob_db[class].atk2;
- md->stats[MOB_ADELAY] = mob_db[class].adelay;
- md->stats[MOB_DEF] = mob_db[class].def;
- md->stats[MOB_MDEF] = mob_db[class].mdef;
- md->stats[MOB_SPEED] = mob_db[class].speed;
+ const int mob_class = md->mob_class;
+ const int mutations_nr = mob_db[mob_class].mutations_nr;
+ const int mutation_power = mob_db[mob_class].mutation_power;
+
+ md->stats[MOB_LV] = mob_db[mob_class].lv;
+ md->stats[MOB_MAX_HP] = mob_db[mob_class].max_hp;
+ md->stats[MOB_STR] = mob_db[mob_class].str;
+ md->stats[MOB_AGI] = mob_db[mob_class].agi;
+ md->stats[MOB_VIT] = mob_db[mob_class].vit;
+ md->stats[MOB_INT] = mob_db[mob_class].int_;
+ md->stats[MOB_DEX] = mob_db[mob_class].dex;
+ md->stats[MOB_LUK] = mob_db[mob_class].luk;
+ md->stats[MOB_ATK1] = mob_db[mob_class].atk1;
+ md->stats[MOB_ATK2] = mob_db[mob_class].atk2;
+ md->stats[MOB_ADELAY] = mob_db[mob_class].adelay;
+ md->stats[MOB_DEF] = mob_db[mob_class].def;
+ md->stats[MOB_MDEF] = mob_db[mob_class].mdef;
+ md->stats[MOB_SPEED] = mob_db[mob_class].speed;
md->stats[MOB_XP_BONUS] = MOB_XP_BONUS_BASE;
for (i = 0; i < mutations_nr; i++)
@@ -339,11 +339,11 @@ static void mob_init (struct mob_data *md)
*------------------------------------------
*/
int mob_once_spawn (struct map_session_data *sd, char *mapname,
- int x, int y, const char *mobname, int class, int amount,
+ int x, int y, const char *mobname, int mob_class, int amount,
const char *event)
{
struct mob_data *md = NULL;
- int m, count, lv = 255, r = class;
+ int m, count, lv = 255, r = mob_class;
if (sd)
lv = sd->status.base_level;
@@ -353,29 +353,29 @@ int mob_once_spawn (struct map_session_data *sd, char *mapname,
else
m = map_mapname2mapid (mapname);
- if (m < 0 || amount <= 0 || (class >= 0 && class <= 1000) || class > 2000) // 値が異常なら召喚を止める
+ if (m < 0 || amount <= 0 || (mob_class >= 0 && mob_class <= 1000) || mob_class > 2000) // 値が異常なら召喚を止める
return 0;
- if (class < 0)
+ if (mob_class < 0)
{ // ランダムに召喚
int i = 0;
- int j = -class - 1;
+ int j = -mob_class - 1;
int k;
if (j >= 0 && j < MAX_RANDOMMONSTER)
{
do
{
- class = MPRAND (1001, 1000);
+ mob_class = MPRAND (1001, 1000);
k = MRAND (1000000);
}
- while ((mob_db[class].max_hp <= 0
- || mob_db[class].summonper[j] <= k
- || (lv < mob_db[class].lv
+ while ((mob_db[mob_class].max_hp <= 0
+ || mob_db[mob_class].summonper[j] <= k
+ || (lv < mob_db[mob_class].lv
&& battle_config.random_monster_checklv == 1))
&& (i++) < 2000);
if (i >= 2000)
{
- class = mob_db[0].summonper[j];
+ mob_class = mob_db[0].summonper[j];
}
}
else
@@ -383,7 +383,7 @@ int mob_once_spawn (struct map_session_data *sd, char *mapname,
return 0;
}
// if(battle_config.etc_log==1)
-// printf("mobclass=%d try=%d\n",class,i);
+// printf("mobmob_class=%d try=%d\n",mob_class,i);
}
if (sd)
{
@@ -400,13 +400,13 @@ int mob_once_spawn (struct map_session_data *sd, char *mapname,
for (count = 0; count < amount; count++)
{
md = (struct mob_data *) calloc (1, sizeof (struct mob_data));
- if (mob_db[class].mode & 0x02)
+ if (mob_db[mob_class].mode & 0x02)
md->lootitem =
(struct item *) calloc (LOOTITEM_SIZE, sizeof (struct item));
else
md->lootitem = NULL;
- mob_spawn_dataset (md, mobname, class);
+ mob_spawn_dataset (md, mobname, mob_class);
md->bl.m = m;
md->bl.x = x;
md->bl.y = y;
@@ -426,13 +426,13 @@ int mob_once_spawn (struct map_session_data *sd, char *mapname,
map_addiddb (&md->bl);
mob_spawn (md->bl.id);
- if (class == 1288)
+ if (mob_class == 1288)
{ // emperium hp based on defense level [Valaris]
struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name);
if (gc)
{
- mob_db[class].max_hp += 2000 * gc->defense;
- md->hp = mob_db[class].max_hp;
+ mob_db[mob_class].max_hp += 2000 * gc->defense;
+ md->hp = mob_db[mob_class].max_hp;
}
} // end addition [Valaris]
@@ -446,7 +446,7 @@ int mob_once_spawn (struct map_session_data *sd, char *mapname,
*/
int mob_once_spawn_area (struct map_session_data *sd, char *mapname,
int x0, int y0, int x1, int y1,
- const char *mobname, int class, int amount,
+ const char *mobname, int mob_class, int amount,
const char *event)
{
int x, y, i, c, max, lx = -1, ly = -1, id = 0;
@@ -461,7 +461,7 @@ int mob_once_spawn_area (struct map_session_data *sd, char *mapname,
if (max > 1000)
max = 1000;
- if (m < 0 || amount <= 0 || (class >= 0 && class <= 1000) || class > 2000) // A summon is stopped if a value is unusual
+ if (m < 0 || amount <= 0 || (mob_class >= 0 && mob_class <= 1000) || mob_class > 2000) // A summon is stopped if a value is unusual
return 0;
for (i = 0; i < amount; i++)
@@ -483,7 +483,7 @@ int mob_once_spawn_area (struct map_session_data *sd, char *mapname,
else
return 0; // Since reference of the place which boils first went wrong, it stops.
}
- id = mob_once_spawn (sd, mapname, x, y, mobname, class, 1, event);
+ id = mob_once_spawn (sd, mapname, x, y, mobname, mob_class, 1, event);
lx = x;
ly = y;
}
@@ -495,7 +495,7 @@ int mob_once_spawn_area (struct map_session_data *sd, char *mapname,
*------------------------------------------
*/
int mob_spawn_guardian (struct map_session_data *sd, char *mapname,
- int x, int y, const char *mobname, int class,
+ int x, int y, const char *mobname, int mob_class,
int amount, const char *event, int guardian)
{
struct mob_data *md = NULL;
@@ -509,10 +509,10 @@ int mob_spawn_guardian (struct map_session_data *sd, char *mapname,
else
m = map_mapname2mapid (mapname);
- if (m < 0 || amount <= 0 || (class >= 0 && class <= 1000) || class > 2000) // 値が異常なら召喚を止める
+ if (m < 0 || amount <= 0 || (mob_class >= 0 && mob_class <= 1000) || mob_class > 2000) // 値が異常なら召喚を止める
return 0;
- if (class < 0)
+ if (mob_class < 0)
return 0;
if (sd)
@@ -529,15 +529,9 @@ int mob_spawn_guardian (struct map_session_data *sd, char *mapname,
for (count = 0; count < amount; count++)
{
struct guild_castle *gc;
- md = calloc (sizeof (struct mob_data), 1);
- if (md == NULL)
- {
- printf ("mob_spawn_guardian: out of memory !\n");
- exit (1);
- }
- memset (md, '\0', sizeof *md);
+ CREATE (md, struct mob_data, 1);
- mob_spawn_dataset (md, mobname, class);
+ mob_spawn_dataset (md, mobname, mob_class);
md->bl.m = m;
md->bl.x = x;
md->bl.y = y;
@@ -558,7 +552,7 @@ int mob_spawn_guardian (struct map_session_data *sd, char *mapname,
gc = guild_mapname2gc (map[md->bl.m].name);
if (gc)
{
- mob_db[class].max_hp += 2000 * gc->defense;
+ mob_db[mob_class].max_hp += 2000 * gc->defense;
if (guardian == 0)
{
md->hp = gc->Ghp0;
@@ -610,59 +604,59 @@ int mob_spawn_guardian (struct map_session_data *sd, char *mapname,
* Appearance income of mob
*------------------------------------------
*/
-int mob_get_viewclass (int class)
+int mob_get_viewclass (int mob_class)
{
- return mob_db[class].view_class;
+ return mob_db[mob_class].view_class;
}
-int mob_get_sex (int class)
+int mob_get_sex (int mob_class)
{
- return mob_db[class].sex;
+ return mob_db[mob_class].sex;
}
-short mob_get_hair (int class)
+short mob_get_hair (int mob_class)
{
- return mob_db[class].hair;
+ return mob_db[mob_class].hair;
}
-short mob_get_hair_color (int class)
+short mob_get_hair_color (int mob_class)
{
- return mob_db[class].hair_color;
+ return mob_db[mob_class].hair_color;
}
-short mob_get_weapon (int class)
+short mob_get_weapon (int mob_class)
{
- return mob_db[class].weapon;
+ return mob_db[mob_class].weapon;
}
-short mob_get_shield (int class)
+short mob_get_shield (int mob_class)
{
- return mob_db[class].shield;
+ return mob_db[mob_class].shield;
}
-short mob_get_head_top (int class)
+short mob_get_head_top (int mob_class)
{
- return mob_db[class].head_top;
+ return mob_db[mob_class].head_top;
}
-short mob_get_head_mid (int class)
+short mob_get_head_mid (int mob_class)
{
- return mob_db[class].head_mid;
+ return mob_db[mob_class].head_mid;
}
-short mob_get_head_buttom (int class)
+short mob_get_head_buttom (int mob_class)
{
- return mob_db[class].head_buttom;
+ return mob_db[mob_class].head_buttom;
}
-short mob_get_clothes_color (int class) // Add for player monster dye - Valaris
+short mob_get_clothes_color (int mob_class) // Add for player monster dye - Valaris
{
- return mob_db[class].clothes_color; // End
+ return mob_db[mob_class].clothes_color; // End
}
-int mob_get_equip (int class) // mob equip [Valaris]
+int mob_get_equip (int mob_class) // mob equip [Valaris]
{
- return mob_db[class].equip;
+ return mob_db[mob_class].equip;
}
/*==========================================
@@ -869,11 +863,11 @@ static int mob_check_attack (struct mob_data *md)
}
if (!md->mode)
- mode = mob_db[md->class].mode;
+ mode = mob_db[md->mob_class].mode;
else
mode = md->mode;
- race = mob_db[md->class].race;
+ race = mob_db[md->mob_class].race;
if (!(mode & 0x80))
{
md->target_id = 0;
@@ -890,7 +884,7 @@ static int mob_check_attack (struct mob_data *md)
return 0;
}
- range = mob_db[md->class].range;
+ range = mob_db[md->mob_class].range;
if (mode & 1)
range++;
if (distance (md->bl.x, md->bl.y, tbl->x, tbl->y) > range)
@@ -1229,7 +1223,7 @@ int mob_spawn (int id)
map_delblock (&md->bl);
}
else
- md->class = md->base_class;
+ md->mob_class = md->base_class;
md->bl.m = md->m;
do
@@ -1269,8 +1263,8 @@ int mob_spawn (int id)
mob_init (md);
if (!md->stats[MOB_SPEED])
- md->stats[MOB_SPEED] = mob_db[md->class].speed;
- md->def_ele = mob_db[md->class].element;
+ md->stats[MOB_SPEED] = mob_db[md->mob_class].speed;
+ md->def_ele = mob_db[md->mob_class].element;
md->master_id = 0;
md->master_dist = 0;
@@ -1314,7 +1308,7 @@ int mob_spawn (int id)
md->hp = battle_get_max_hp (&md->bl);
if (md->hp <= 0)
{
- mob_makedummymobdb (md->class);
+ mob_makedummymobdb (md->mob_class);
md->hp = battle_get_max_hp (&md->bl);
}
@@ -1414,7 +1408,7 @@ int mob_can_reach (struct mob_data *md, struct block_list *bl, int range)
//=========== guildcastle guardian no search start===========
//when players are the guild castle member not attack them !
- if (md->class == 1285 || md->class == 1286 || md->class == 1287)
+ if (md->mob_class == 1285 || md->mob_class == 1286 || md->mob_class == 1287)
{
struct map_session_data *sd;
struct guild *g = NULL;
@@ -1503,11 +1497,11 @@ int mob_target (struct mob_data *md, struct block_list *bl, int dist)
sc_data = battle_get_sc_data (bl);
option = battle_get_option (bl);
- race = mob_db[md->class].race;
+ race = mob_db[md->mob_class].race;
if (!md->mode)
{
- mode = mob_db[md->class].mode;
+ mode = mob_db[md->mob_class].mode;
}
else
{
@@ -1576,14 +1570,14 @@ static int mob_ai_sub_hard_activesearch (struct block_list *bl, va_list ap)
return 0;
if (!smd->mode)
- mode = mob_db[smd->class].mode;
+ mode = mob_db[smd->mob_class].mode;
else
mode = smd->mode;
// アクティブでターゲット射程内にいるなら、ロックする
if (mode & 0x04)
{
- race = mob_db[smd->class].race;
+ race = mob_db[smd->mob_class].race;
//対象がPCの場合
if (tsd &&
!pc_isdead (tsd) &&
@@ -1641,7 +1635,7 @@ static int mob_ai_sub_hard_lootsearch (struct block_list *bl, va_list ap)
if (!md->mode)
{
- mode = mob_db[md->class].mode;
+ mode = mob_db[md->mob_class].mode;
}
else
{
@@ -1686,8 +1680,8 @@ static int mob_ai_sub_hard_linksearch (struct block_list *bl, va_list ap)
nullpo_retr (0, target = va_arg (ap, struct block_list *));
// same family free in a range at a link monster -- it will be made to lock if MOB is
-/* if( (md->target_id > 0 && md->state.targettype == ATTACKABLE) && mob_db[md->class].mode&0x08){
- if( tmd->class==md->class && (!tmd->target_id || md->state.targettype == NONE_ATTACKABLE) && tmd->bl.m == md->bl.m){
+/* if( (md->target_id > 0 && md->state.targettype == ATTACKABLE) && mob_db[md->mob_class].mode&0x08){
+ if( tmd->mob_class==md->mob_class && (!tmd->target_id || md->state.targettype == NONE_ATTACKABLE) && tmd->bl.m == md->bl.m){
if( mob_can_reach(tmd,target,12) ){ // Reachability judging
tmd->target_id=md->target_id;
tmd->state.targettype = ATTACKABLE;
@@ -1695,9 +1689,9 @@ static int mob_ai_sub_hard_linksearch (struct block_list *bl, va_list ap)
}
}
}*/
- if (md->attacked_id > 0 && mob_db[md->class].mode & 0x08)
+ if (md->attacked_id > 0 && mob_db[md->mob_class].mode & 0x08)
{
- if (tmd->class == md->class && tmd->bl.m == md->bl.m
+ if (tmd->mob_class == md->mob_class && tmd->bl.m == md->bl.m
&& (!tmd->target_id || md->state.targettype == NONE_ATTACKABLE))
{
if (mob_can_reach (tmd, target, 12))
@@ -1727,7 +1721,7 @@ static int mob_ai_sub_hard_slavemob (struct mob_data *md, unsigned int tick)
if ((bl = map_id2bl (md->master_id)) != NULL)
mmd = (struct mob_data *) bl;
- mode = mob_db[md->class].mode;
+ mode = mob_db[md->mob_class].mode;
// It is not main monster/leader.
if (!mmd || mmd->bl.type != BL_MOB || mmd->bl.id != md->master_id)
@@ -1821,7 +1815,7 @@ static int mob_ai_sub_hard_slavemob (struct mob_data *md, unsigned int tick)
&& !pc_isinvisible (sd))
{
- race = mob_db[md->class].race;
+ race = mob_db[md->mob_class].race;
if (mode & 0x20 ||
(sd->sc_data[SC_TRICKDEAD].timer == -1 &&
((!pc_ishiding (sd) && !sd->state.gangsterparadise)
@@ -1842,7 +1836,7 @@ static int mob_ai_sub_hard_slavemob (struct mob_data *md, unsigned int tick)
struct map_session_data *sd=map_id2sd(md->target_id);
if(sd!=NULL && !pc_isdead(sd) && sd->invincible_timer == -1 && !pc_isinvisible(sd)){
- race=mob_db[mmd->class].race;
+ race=mob_db[mmd->mob_class].race;
if(mode&0x20 ||
(sd->sc_data[SC_TRICKDEAD].timer == -1 &&
(!(sd->status.option&0x06) || race==4 || race==6)
@@ -1908,8 +1902,8 @@ static int mob_randomwalk (struct mob_data *md, int tick)
{
if (battle_config.error_log == 1)
printf
- ("MOB cant move. random spawn %d, class = %d\n",
- md->bl.id, md->class);
+ ("MOB cant move. random spawn %d, mob_class = %d\n",
+ md->bl.id, md->mob_class);
md->move_fail_count = 0;
mob_spawn (md->bl.id);
}
@@ -1962,11 +1956,11 @@ static int mob_ai_sub_hard (struct block_list *bl, va_list ap)
}
if (!md->mode)
- mode = mob_db[md->class].mode;
+ mode = mob_db[md->mob_class].mode;
else
mode = md->mode;
- race = mob_db[md->class].race;
+ race = mob_db[md->mob_class].race;
// Abnormalities
if ((md->opt1 > 0 && md->opt1 != 6) || md->state.state == MS_DELAY
@@ -2084,7 +2078,7 @@ static int mob_ai_sub_hard (struct block_list *bl, va_list ap)
&& race != 6)))
mob_unlocktarget (md, tick); // スキルなどによる策敵妨害
else if (!battle_check_range
- (&md->bl, tbl, mob_db[md->class].range))
+ (&md->bl, tbl, mob_db[md->mob_class].range))
{
// 攻撃範囲外なので移動
if (!(mode & 1))
@@ -2320,7 +2314,7 @@ static void mob_ai_hard (timer_id tid, tick_t tick, custom_id_t id, custom_data_
*/
static void mob_ai_sub_lazy (db_key_t key, db_val_t data, va_list app)
{
- struct mob_data *md = data;
+ struct mob_data *md = (struct mob_data *)data;
unsigned int tick;
va_list ap;
@@ -2348,7 +2342,7 @@ static void mob_ai_sub_lazy (db_key_t key, db_val_t data, va_list app)
}
if (DIFF_TICK (md->next_walktime, tick) < 0 &&
- (mob_db[md->class].mode & 1) && mob_can_move (md))
+ (mob_db[md->mob_class].mode & 1) && mob_can_move (md))
{
if (map[md->bl.m].users > 0)
@@ -2361,8 +2355,8 @@ static void mob_ai_sub_lazy (db_key_t key, db_val_t data, va_list app)
// MOB which is not not the summons MOB but BOSS, either sometimes reboils.
else if (MRAND (1000) < MOB_LAZYWARPPERC && md->x0 <= 0
- && md->master_id != 0 && mob_db[md->class].mexp <= 0
- && !(mob_db[md->class].mode & 0x20))
+ && md->master_id != 0 && mob_db[md->mob_class].mexp <= 0
+ && !(mob_db[md->mob_class].mode & 0x20))
mob_spawn (md->bl.id);
}
@@ -2372,8 +2366,8 @@ static void mob_ai_sub_lazy (db_key_t key, db_val_t data, va_list app)
// MOB which is not BOSS which is not Summons MOB, either -- a case -- sometimes -- leaping
if (MRAND (1000) < MOB_LAZYWARPPERC && md->x0 <= 0
- && md->master_id != 0 && mob_db[md->class].mexp <= 0
- && !(mob_db[md->class].mode & 0x20))
+ && md->master_id != 0 && mob_db[md->mob_class].mexp <= 0
+ && !(mob_db[md->mob_class].mode & 0x20))
mob_warp (md, -1, -1, -1, -1);
}
@@ -2495,7 +2489,7 @@ int mob_delete (struct mob_data *md)
mob_changestate (md, MS_DEAD, 0);
clif_clearchar_area (&md->bl, 1);
map_delblock (&md->bl);
- if (mob_get_viewclass (md->class) <= 1000)
+ if (mob_get_viewclass (md->mob_class) <= 1000)
clif_clearchar_delay (gettick () + 3000, &md->bl, 0);
mob_deleteslave (md);
mob_setdelayspawn (md->bl.id);
@@ -2683,7 +2677,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage,
{
MAP_LOG_PC (((struct map_session_data *) master_bl),
"MOB-TO-MOB-DMG FROM MOB%d %d TO MOB%d %d FOR %d",
- md2->bl.id, md2->class, md->bl.id, md->class,
+ md2->bl.id, md2->mob_class, md->bl.id, md->mob_class,
damage);
}
@@ -2720,7 +2714,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage,
md->hp -= damage;
- if (md->class >= 1285 && md->class <= 1287)
+ if (md->mob_class >= 1285 && md->mob_class <= 1287)
{ // guardian hp update [Valaris]
struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name);
if (gc)
@@ -2812,7 +2806,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage,
int skillidx = 0;
if ((skillidx =
- mob_skillid2skillidx (md->class, NPC_SELFDESTRUCTION2)) >= 0)
+ mob_skillid2skillidx (md->mob_class, NPC_SELFDESTRUCTION2)) >= 0)
{
md->mode |= 0x1;
md->next_walktime = tick;
@@ -2898,13 +2892,13 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage,
continue;
/* jAthena's exp formula
per = ((double)md->dmglog[i].dmg)*(9.+(double)((count > 6)? 6:count))/10./((double)max_hp) * dmg_rate;
- temp = ((double)mob_db[md->class].base_exp * (double)battle_config.base_exp_rate / 100. * per);
+ temp = ((double)mob_db[md->mob_class].base_exp * (double)battle_config.base_exp_rate / 100. * per);
base_exp = (temp > 2147483647.)? 0x7fffffff:(int)temp;
- if(mob_db[md->class].base_exp > 0 && base_exp < 1) base_exp = 1;
+ if(mob_db[md->mob_class].base_exp > 0 && base_exp < 1) base_exp = 1;
if(base_exp < 0) base_exp = 0;
- temp = ((double)mob_db[md->class].job_exp * (double)battle_config.job_exp_rate / 100. * per);
+ temp = ((double)mob_db[md->mob_class].job_exp * (double)battle_config.job_exp_rate / 100. * per);
job_exp = (temp > 2147483647.)? 0x7fffffff:(int)temp;
- if(mob_db[md->class].job_exp > 0 && job_exp < 1) job_exp = 1;
+ if(mob_db[md->mob_class].job_exp > 0 && job_exp < 1) job_exp = 1;
if(job_exp < 0) job_exp = 0;
*/
//eAthena's exp formula rather than jAthena's
@@ -2918,23 +2912,23 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage,
per = 1;
base_exp =
- ((mob_db[md->class].base_exp *
+ ((mob_db[md->mob_class].base_exp *
md->stats[MOB_XP_BONUS]) >> MOB_XP_BONUS_SHIFT) * per / 256;
if (base_exp < 1)
base_exp = 1;
if (sd && md && battle_config.pk_mode == 1
- && (mob_db[md->class].lv - sd->status.base_level >= 20))
+ && (mob_db[md->mob_class].lv - sd->status.base_level >= 20))
{
base_exp *= 1.15; // pk_mode additional exp if monster >20 levels [Valaris]
}
if (md->state.special_mob_ai >= 1
&& battle_config.alchemist_summon_reward != 1)
base_exp = 0; // Added [Valaris]
- job_exp = mob_db[md->class].job_exp * per / 256;
+ job_exp = mob_db[md->mob_class].job_exp * per / 256;
if (job_exp < 1)
job_exp = 1;
if (sd && md && battle_config.pk_mode == 1
- && (mob_db[md->class].lv - sd->status.base_level >= 20))
+ && (mob_db[md->mob_class].lv - sd->status.base_level >= 20))
{
job_exp *= 1.15; // pk_mode additional exp if monster >20 levels [Valaris]
}
@@ -2986,22 +2980,22 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage,
if (md->state.special_mob_ai >= 1 && battle_config.alchemist_summon_reward != 1) // Added [Valaris]
break; // End
- if (mob_db[md->class].dropitem[i].nameid <= 0)
+ if (mob_db[md->mob_class].dropitem[i].nameid <= 0)
continue;
- drop_rate = mob_db[md->class].dropitem[i].p;
+ drop_rate = mob_db[md->mob_class].dropitem[i].p;
if (drop_rate <= 0 && battle_config.drop_rate0item == 1)
drop_rate = 1;
if (battle_config.drops_by_luk > 0 && sd && md)
drop_rate += (sd->status.luk * battle_config.drops_by_luk) / 100; // drops affected by luk [Valaris]
if (sd && md && battle_config.pk_mode == 1
- && (mob_db[md->class].lv - sd->status.base_level >= 20))
+ && (mob_db[md->mob_class].lv - sd->status.base_level >= 20))
drop_rate *= 1.25; // pk_mode increase drops if 20 level difference [Valaris]
if (drop_rate <= MRAND (10000))
continue;
ditem = (struct delay_item_drop *)
calloc (1, sizeof (struct delay_item_drop));
- ditem->nameid = mob_db[md->class].dropitem[i].nameid;
+ ditem->nameid = mob_db[md->mob_class].dropitem[i].nameid;
ditem->amount = 1;
ditem->m = md->bl.m;
ditem->x = md->bl.x;
@@ -3020,9 +3014,9 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage,
if (sd->monster_drop_itemid[i] <= 0)
continue;
if (sd->monster_drop_race[i] & (1 << race) ||
- (mob_db[md->class].mode & 0x20
+ (mob_db[md->mob_class].mode & 0x20
&& sd->monster_drop_race[i] & 1 << 10)
- || (!(mob_db[md->class].mode & 0x20)
+ || (!(mob_db[md->mob_class].mode & 0x20)
&& sd->monster_drop_race[i] & 1 << 11))
{
if (sd->monster_drop_itemrate[i] <= MRAND (10000))
@@ -3044,7 +3038,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage,
}
if (sd->get_zeny_num > 0)
pc_getzeny (sd,
- mob_db[md->class].lv * 10 +
+ mob_db[md->mob_class].lv * 10 +
MRAND ((sd->get_zeny_num + 1)));
}
if (md->lootitem)
@@ -3070,7 +3064,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage,
}
// mvp処理
- if (mvp_sd && mob_db[md->class].mexp > 0)
+ if (mvp_sd && mob_db[md->mob_class].mexp > 0)
{
int j;
int mexp = battle_get_mexp (&md->bl);
@@ -3086,9 +3080,9 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage,
for (j = 0; j < 3; j++)
{
i = MRAND (3);
- if (mob_db[md->class].mvpitem[i].nameid <= 0)
+ if (mob_db[md->mob_class].mvpitem[i].nameid <= 0)
continue;
- drop_rate = mob_db[md->class].mvpitem[i].p;
+ drop_rate = mob_db[md->mob_class].mvpitem[i].p;
if (drop_rate <= 0 && battle_config.drop_rate0item == 1)
drop_rate = 1;
if (drop_rate < battle_config.item_drop_mvp_min)
@@ -3098,7 +3092,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage,
if (drop_rate <= MRAND (10000))
continue;
memset (&item, 0, sizeof (item));
- item.nameid = mob_db[md->class].mvpitem[i].nameid;
+ item.nameid = mob_db[md->mob_class].mvpitem[i].nameid;
item.identify = !itemdb_isequip3 (item.nameid);
clif_mvp_item (mvp_sd, item.nameid);
if (mvp_sd->weight * 2 > mvp_sd->max_weight)
@@ -3141,7 +3135,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage,
int i;
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (tmpsd = session[i]->session_data)
+ if (session[i] && (tmpsd = (struct map_session_data *)session[i]->session_data)
&& tmpsd->state.auth)
{
if (md->bl.m == tmpsd->bl.m)
@@ -3159,7 +3153,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage,
clif_clearchar_area (&md->bl, 1);
map_delblock (&md->bl);
- if (mob_get_viewclass (md->class) <= 1000)
+ if (mob_get_viewclass (md->mob_class) <= 1000)
clif_clearchar_delay (tick + 3000, &md->bl, 0);
mob_deleteslave (md);
mob_setdelayspawn (md->bl.id);
@@ -3175,7 +3169,7 @@ int mob_damage (struct block_list *src, struct mob_data *md, int damage,
int mob_class_change (struct mob_data *md, int *value)
{
unsigned int tick = gettick ();
- int i, c, hp_rate, max_hp, class, count = 0;
+ int i, c, hp_rate, max_hp, mob_class, count = 0;
nullpo_retr (0, md);
nullpo_retr (0, value);
@@ -3190,14 +3184,14 @@ int mob_class_change (struct mob_data *md, int *value)
if (count < 1)
return 0;
- class = value[MRAND (count)];
- if (class <= 1000 || class > 2000)
+ mob_class = value[MRAND (count)];
+ if (mob_class <= 1000 || mob_class > 2000)
return 0;
max_hp = battle_get_max_hp (&md->bl);
hp_rate = md->hp * 100 / max_hp;
- clif_mob_class_change (md, class);
- md->class = class;
+ clif_mob_class_change (md, mob_class);
+ md->mob_class = mob_class;
max_hp = battle_get_max_hp (&md->bl);
if (battle_config.monster_class_change_full_recover == 1)
{
@@ -3211,14 +3205,14 @@ int mob_class_change (struct mob_data *md, int *value)
else if (md->hp < 1)
md->hp = 1;
- memcpy (md->name, mob_db[class].jname, 24);
+ memcpy (md->name, mob_db[mob_class].jname, 24);
memset (&md->state, 0, sizeof (md->state));
md->attacked_id = 0;
md->target_id = 0;
md->move_fail_count = 0;
- md->stats[MOB_SPEED] = mob_db[md->class].speed;
- md->def_ele = mob_db[md->class].element;
+ md->stats[MOB_SPEED] = mob_db[md->mob_class].speed;
+ md->def_ele = mob_db[md->mob_class].element;
mob_changestate (md, MS_IDLE, 0);
skill_castcancel (&md->bl, 0);
@@ -3234,7 +3228,7 @@ int mob_class_change (struct mob_data *md, int *value)
md->skillid = 0;
md->skilllv = 0;
- if (md->lootitem == NULL && mob_db[class].mode & 0x02)
+ if (md->lootitem == NULL && mob_db[mob_class].mode & 0x02)
md->lootitem = (struct item *)
calloc (LOOTITEM_SIZE, sizeof (struct item));
@@ -3261,7 +3255,7 @@ int mob_heal (struct mob_data *md, int heal)
if (max_hp < md->hp)
md->hp = max_hp;
- if (md->class >= 1285 && md->class <= 1287)
+ if (md->mob_class >= 1285 && md->mob_class <= 1287)
{ // guardian hp update [Valaris]
struct guild_castle *gc = guild_mapname2gc (map[md->bl.m].name);
if (gc)
@@ -3375,7 +3369,7 @@ int mob_warp (struct mob_data *md, int m, int x, int y, int type)
{
m = md->bl.m;
if (battle_config.error_log == 1)
- printf ("MOB %d warp failed, class = %d\n", md->bl.id, md->class);
+ printf ("MOB %d warp failed, mob_class = %d\n", md->bl.id, md->mob_class);
}
md->target_id = 0; // タゲを解除する
@@ -3387,8 +3381,8 @@ int mob_warp (struct mob_data *md, int m, int x, int y, int type)
if (type > 0 && i == 1000)
{
if (battle_config.battle_log == 1)
- printf ("MOB %d warp to (%d,%d), class = %d\n", md->bl.id, x, y,
- md->class);
+ printf ("MOB %d warp to (%d,%d), mob_class = %d\n", md->bl.id, x, y,
+ md->mob_class);
}
map_addblock (&md->bl);
@@ -3445,7 +3439,7 @@ int mob_countslave (struct mob_data *md)
int mob_summonslave (struct mob_data *md2, int *value, int amount, int flag)
{
struct mob_data *md;
- int bx, by, m, count = 0, class, k, a = amount;
+ int bx, by, m, count = 0, mob_class, k, a = amount;
nullpo_retr (0, md2);
nullpo_retr (0, value);
@@ -3464,14 +3458,14 @@ int mob_summonslave (struct mob_data *md2, int *value, int amount, int flag)
for (k = 0; k < count; k++)
{
amount = a;
- class = value[k];
- if (class <= 1000 || class > 2000)
+ mob_class = value[k];
+ if (mob_class <= 1000 || mob_class > 2000)
continue;
for (; amount > 0; amount--)
{
int x = 0, y = 0, c = 0, i = 0;
md = (struct mob_data *) calloc (1, sizeof (struct mob_data));
- if (mob_db[class].mode & 0x02)
+ if (mob_db[mob_class].mode & 0x02)
md->lootitem = (struct item *)
calloc (LOOTITEM_SIZE, sizeof (struct item));
else
@@ -3489,7 +3483,7 @@ int mob_summonslave (struct mob_data *md2, int *value, int amount, int flag)
y = by;
}
- mob_spawn_dataset (md, "--ja--", class);
+ mob_spawn_dataset (md, "--ja--", mob_class);
md->bl.prev = NULL;
md->bl.next = NULL;
md->bl.m = m;
@@ -3577,15 +3571,15 @@ int mob_counttargeted (struct mob_data *md, struct block_list *src,
*MOBskillから該当skillidのskillidxを返す
*------------------------------------------
*/
-int mob_skillid2skillidx (int class, int skillid)
+int mob_skillid2skillidx (int mob_class, int skillid)
{
int i;
- struct mob_skill *ms = mob_db[class].skill;
+ struct mob_skill *ms = mob_db[mob_class].skill;
if (ms == NULL)
return -1;
- for (i = 0; i < mob_db[class].maxskill; i++)
+ for (i = 0; i < mob_db[mob_class].maxskill; i++)
{
if (ms[i].skill_id == skillid)
return i;
@@ -3677,8 +3671,8 @@ void mobskill_castend_id (timer_id tid, tick_t tick, custom_id_t id, custom_data
md->skilldelay[md->skillidx] = tick;
if (battle_config.mob_skill_log == 1)
- printf ("MOB skill castend skill=%d, class = %d\n", md->skillid,
- md->class);
+ printf ("MOB skill castend skill=%d, mob_class = %d\n", md->skillid,
+ md->mob_class);
mob_stop_walking (md, 0);
switch (skill_get_nk (md->skillid))
@@ -3690,7 +3684,7 @@ void mobskill_castend_id (timer_id tid, tick_t tick, custom_id_t id, custom_data
tick, 0);
break;
case 1: // 支援系
- if (!mob_db[md->class].skill[md->skillidx].val[0] &&
+ if (!mob_db[md->mob_class].skill[md->skillidx].val[0] &&
(md->skillid == AL_HEAL
|| (md->skillid == ALL_RESURRECTION && bl->type != BL_PC))
&& battle_check_undead (battle_get_race (bl),
@@ -3829,8 +3823,8 @@ void mobskill_castend_pos (timer_id tid, tick_t tick, custom_id_t id, custom_dat
md->skilldelay[md->skillidx] = tick;
if (battle_config.mob_skill_log == 1)
- printf ("MOB skill castend skill=%d, class = %d\n", md->skillid,
- md->class);
+ printf ("MOB skill castend skill=%d, mob_class = %d\n", md->skillid,
+ md->mob_class);
mob_stop_walking (md, 0);
skill_castend_pos2 (&md->bl, md->skillx, md->skilly, md->skillid,
@@ -3851,7 +3845,7 @@ int mobskill_use_id (struct mob_data *md, struct block_list *target,
int skill_id, skill_lv, forcecast = 0;
nullpo_retr (0, md);
- nullpo_retr (0, ms = &mob_db[md->class].skill[skill_idx]);
+ nullpo_retr (0, ms = &mob_db[md->mob_class].skill[skill_idx]);
if (target == NULL && (target = map_id2bl (md->target_id)) == NULL)
return 0;
@@ -3928,8 +3922,8 @@ int mobskill_use_id (struct mob_data *md, struct block_list *target,
if (battle_config.mob_skill_log == 1)
printf
- ("MOB skill use target_id=%d skill=%d lv=%d cast=%d, class = %d\n",
- target->id, skill_id, skill_lv, casttime, md->class);
+ ("MOB skill use target_id=%d skill=%d lv=%d cast=%d, mob_class = %d\n",
+ target->id, skill_id, skill_lv, casttime, md->mob_class);
if (casttime > 0 || forcecast)
{ // 詠唱が必要
@@ -3938,7 +3932,7 @@ int mobskill_use_id (struct mob_data *md, struct block_list *target,
md->bl.id, target->id, 0, 0, skill_id, casttime);
// 詠唱反応モンスター
-/* if( target->type==BL_MOB && mob_db[(md2=(struct mob_data *)target)->class].mode&0x10 &&
+/* if( target->type==BL_MOB && mob_db[(md2=(struct mob_data *)target)->mob_class].mode&0x10 &&
md2->state.state!=MS_ATTACK){
md2->target_id=md->bl.id;
md->state.targettype = ATTACKABLE;
@@ -3988,7 +3982,7 @@ int mobskill_use_pos (struct mob_data *md,
int skill_id, skill_lv;
nullpo_retr (0, md);
- nullpo_retr (0, ms = &mob_db[md->class].skill[skill_idx]);
+ nullpo_retr (0, ms = &mob_db[md->mob_class].skill[skill_idx]);
if (md->bl.prev == NULL)
return 0;
@@ -4038,8 +4032,8 @@ int mobskill_use_pos (struct mob_data *md,
if (battle_config.mob_skill_log == 1)
printf
- ("MOB skill use target_pos=(%d,%d) skill=%d lv=%d cast=%d, class = %d\n",
- skill_x, skill_y, skill_id, skill_lv, casttime, md->class);
+ ("MOB skill use target_pos=(%d,%d) skill=%d lv=%d cast=%d, mob_class = %d\n",
+ skill_x, skill_y, skill_id, skill_lv, casttime, md->mob_class);
if (casttime > 0) // A cast time is required.
clif_skillcasting (&md->bl,
@@ -4092,7 +4086,7 @@ int mob_getfriendhpltmaxrate_sub (struct block_list *bl, va_list ap)
return 0;
rate = va_arg (ap, int);
fr = va_arg (ap, struct mob_data **);
- if (md->hp < mob_db[md->class].max_hp * rate / 100)
+ if (md->hp < mob_db[md->mob_class].max_hp * rate / 100)
(*fr) = md;
return 0;
}
@@ -4171,7 +4165,7 @@ int mobskill_use (struct mob_data *md, unsigned int tick, int event)
int i, max_hp;
nullpo_retr (0, md);
- nullpo_retr (0, ms = mob_db[md->class].skill);
+ nullpo_retr (0, ms = mob_db[md->mob_class].skill);
max_hp = battle_get_max_hp (&md->bl);
@@ -4184,7 +4178,7 @@ int mobskill_use (struct mob_data *md, unsigned int tick, int event)
if (md->sc_data[SC_SELFDESTRUCTION].timer != -1) //自爆中はスキルを使わない
return 0;
- for (i = 0; i < mob_db[md->class].maxskill; i++)
+ for (i = 0; i < mob_db[md->mob_class].maxskill; i++)
{
int c2 = ms[i].cond2, flag = 0;
struct mob_data *fmd = NULL;
@@ -4402,20 +4396,20 @@ int mob_gvmobcheck (struct map_session_data *sd, struct block_list *bl)
nullpo_retr (0, bl);
if (bl->type == BL_MOB && (md = (struct mob_data *) bl) &&
- (md->class == 1288 || md->class == 1287 || md->class == 1286
- || md->class == 1285))
+ (md->mob_class == 1288 || md->mob_class == 1287 || md->mob_class == 1286
+ || md->mob_class == 1285))
{
struct guild_castle *gc = guild_mapname2gc (map[sd->bl.m].name);
struct guild *g = guild_search (sd->status.guild_id);
- if (g == NULL && md->class == 1288)
+ if (g == NULL && md->mob_class == 1288)
return 0; //ギルド未加入ならダメージ無し
else if (gc != NULL && !map[sd->bl.m].flag.gvg)
return 0; //砦内でGvじゃないときはダメージなし
else if (g && gc != NULL && g->guild_id == gc->guild_id)
return 0; //自占領ギルドのエンペならダメージ無し
else if (g && guild_checkskill (g, GD_APPROVAL) <= 0
- && md->class == 1288)
+ && md->mob_class == 1288)
return 0; //正規ギルド承認がないとダメージ無し
}
@@ -4449,55 +4443,55 @@ int mobskill_deltimer (struct mob_data *md)
* Since un-setting [ mob ] up was used, it is an initial provisional value setup.
*------------------------------------------
*/
-static int mob_makedummymobdb (int class)
+static int mob_makedummymobdb (int mob_class)
{
int i;
- sprintf (mob_db[class].name, "mob%d", class);
- sprintf (mob_db[class].jname, "mob%d", class);
- mob_db[class].lv = 1;
- mob_db[class].max_hp = 1000;
- mob_db[class].max_sp = 1;
- mob_db[class].base_exp = 2;
- mob_db[class].job_exp = 1;
- mob_db[class].range = 1;
- mob_db[class].atk1 = 7;
- mob_db[class].atk2 = 10;
- mob_db[class].def = 0;
- mob_db[class].mdef = 0;
- mob_db[class].str = 1;
- mob_db[class].agi = 1;
- mob_db[class].vit = 1;
- mob_db[class].int_ = 1;
- mob_db[class].dex = 6;
- mob_db[class].luk = 2;
- mob_db[class].range2 = 10;
- mob_db[class].range3 = 10;
- mob_db[class].size = 0;
- mob_db[class].race = 0;
- mob_db[class].element = 0;
- mob_db[class].mode = 0;
- mob_db[class].speed = 300;
- mob_db[class].adelay = 1000;
- mob_db[class].amotion = 500;
- mob_db[class].dmotion = 500;
- mob_db[class].dropitem[0].nameid = 909; // Jellopy
- mob_db[class].dropitem[0].p = 1000;
+ sprintf (mob_db[mob_class].name, "mob%d", mob_class);
+ sprintf (mob_db[mob_class].jname, "mob%d", mob_class);
+ mob_db[mob_class].lv = 1;
+ mob_db[mob_class].max_hp = 1000;
+ mob_db[mob_class].max_sp = 1;
+ mob_db[mob_class].base_exp = 2;
+ mob_db[mob_class].job_exp = 1;
+ mob_db[mob_class].range = 1;
+ mob_db[mob_class].atk1 = 7;
+ mob_db[mob_class].atk2 = 10;
+ mob_db[mob_class].def = 0;
+ mob_db[mob_class].mdef = 0;
+ mob_db[mob_class].str = 1;
+ mob_db[mob_class].agi = 1;
+ mob_db[mob_class].vit = 1;
+ mob_db[mob_class].int_ = 1;
+ mob_db[mob_class].dex = 6;
+ mob_db[mob_class].luk = 2;
+ mob_db[mob_class].range2 = 10;
+ mob_db[mob_class].range3 = 10;
+ mob_db[mob_class].size = 0;
+ mob_db[mob_class].race = 0;
+ mob_db[mob_class].element = 0;
+ mob_db[mob_class].mode = 0;
+ mob_db[mob_class].speed = 300;
+ mob_db[mob_class].adelay = 1000;
+ mob_db[mob_class].amotion = 500;
+ mob_db[mob_class].dmotion = 500;
+ mob_db[mob_class].dropitem[0].nameid = 909; // Jellopy
+ mob_db[mob_class].dropitem[0].p = 1000;
for (i = 1; i < 8; i++)
{
- mob_db[class].dropitem[i].nameid = 0;
- mob_db[class].dropitem[i].p = 0;
+ mob_db[mob_class].dropitem[i].nameid = 0;
+ mob_db[mob_class].dropitem[i].p = 0;
}
// Item1,Item2
- mob_db[class].mexp = 0;
- mob_db[class].mexpper = 0;
+ mob_db[mob_class].mexp = 0;
+ mob_db[mob_class].mexpper = 0;
for (i = 0; i < 3; i++)
{
- mob_db[class].mvpitem[i].nameid = 0;
- mob_db[class].mvpitem[i].p = 0;
+ mob_db[mob_class].mvpitem[i].nameid = 0;
+ mob_db[mob_class].mvpitem[i].p = 0;
}
for (i = 0; i < MAX_RANDOMMONSTER; i++)
- mob_db[class].summonper[i] = 0;
+ mob_db[mob_class].summonper[i] = 0;
return 0;
}
@@ -4526,7 +4520,7 @@ static int mob_readdb (void)
}
while (fgets (line, 1020, fp))
{
- int class, i;
+ int mob_class, i;
char *str[57], *p, *np;
if (line[0] == '/' && line[1] == '/')
@@ -4546,68 +4540,68 @@ static int mob_readdb (void)
str[i] = p;
}
- class = atoi (str[0]);
- if (class <= 1000 || class > 2000)
+ mob_class = atoi (str[0]);
+ if (mob_class <= 1000 || mob_class > 2000)
continue;
- mob_db[class].view_class = class;
- memcpy (mob_db[class].name, str[1], 24);
- memcpy (mob_db[class].jname, str[2], 24);
- mob_db[class].lv = atoi (str[3]);
- mob_db[class].max_hp = atoi (str[4]);
- mob_db[class].max_sp = atoi (str[5]);
-
- mob_db[class].base_exp = atoi (str[6]);
- if (mob_db[class].base_exp < 0)
- mob_db[class].base_exp = 0;
- else if (mob_db[class].base_exp > 0
- && (mob_db[class].base_exp *
+ mob_db[mob_class].view_class = mob_class;
+ memcpy (mob_db[mob_class].name, str[1], 24);
+ memcpy (mob_db[mob_class].jname, str[2], 24);
+ mob_db[mob_class].lv = atoi (str[3]);
+ mob_db[mob_class].max_hp = atoi (str[4]);
+ mob_db[mob_class].max_sp = atoi (str[5]);
+
+ mob_db[mob_class].base_exp = atoi (str[6]);
+ if (mob_db[mob_class].base_exp < 0)
+ mob_db[mob_class].base_exp = 0;
+ else if (mob_db[mob_class].base_exp > 0
+ && (mob_db[mob_class].base_exp *
battle_config.base_exp_rate / 100 > 1000000000
- || mob_db[class].base_exp *
+ || mob_db[mob_class].base_exp *
battle_config.base_exp_rate / 100 < 0))
- mob_db[class].base_exp = 1000000000;
+ mob_db[mob_class].base_exp = 1000000000;
else
- mob_db[class].base_exp *= battle_config.base_exp_rate / 100;
+ mob_db[mob_class].base_exp *= battle_config.base_exp_rate / 100;
- mob_db[class].job_exp = atoi (str[7]);
- if (mob_db[class].job_exp < 0)
- mob_db[class].job_exp = 0;
- else if (mob_db[class].job_exp > 0
- && (mob_db[class].job_exp * battle_config.job_exp_rate /
+ mob_db[mob_class].job_exp = atoi (str[7]);
+ if (mob_db[mob_class].job_exp < 0)
+ mob_db[mob_class].job_exp = 0;
+ else if (mob_db[mob_class].job_exp > 0
+ && (mob_db[mob_class].job_exp * battle_config.job_exp_rate /
100 > 1000000000
- || mob_db[class].job_exp *
+ || mob_db[mob_class].job_exp *
battle_config.job_exp_rate / 100 < 0))
- mob_db[class].job_exp = 1000000000;
+ mob_db[mob_class].job_exp = 1000000000;
else
- mob_db[class].job_exp *= battle_config.job_exp_rate / 100;
-
- mob_db[class].range = atoi (str[8]);
- mob_db[class].atk1 = atoi (str[9]);
- mob_db[class].atk2 = atoi (str[10]);
- mob_db[class].def = atoi (str[11]);
- mob_db[class].mdef = atoi (str[12]);
- mob_db[class].str = atoi (str[13]);
- mob_db[class].agi = atoi (str[14]);
- mob_db[class].vit = atoi (str[15]);
- mob_db[class].int_ = atoi (str[16]);
- mob_db[class].dex = atoi (str[17]);
- mob_db[class].luk = atoi (str[18]);
- mob_db[class].range2 = atoi (str[19]);
- mob_db[class].range3 = atoi (str[20]);
- mob_db[class].size = atoi (str[21]);
- mob_db[class].race = atoi (str[22]);
- mob_db[class].element = atoi (str[23]);
- mob_db[class].mode = atoi (str[24]);
- mob_db[class].speed = atoi (str[25]);
- mob_db[class].adelay = atoi (str[26]);
- mob_db[class].amotion = atoi (str[27]);
- mob_db[class].dmotion = atoi (str[28]);
+ mob_db[mob_class].job_exp *= battle_config.job_exp_rate / 100;
+
+ mob_db[mob_class].range = atoi (str[8]);
+ mob_db[mob_class].atk1 = atoi (str[9]);
+ mob_db[mob_class].atk2 = atoi (str[10]);
+ mob_db[mob_class].def = atoi (str[11]);
+ mob_db[mob_class].mdef = atoi (str[12]);
+ mob_db[mob_class].str = atoi (str[13]);
+ mob_db[mob_class].agi = atoi (str[14]);
+ mob_db[mob_class].vit = atoi (str[15]);
+ mob_db[mob_class].int_ = atoi (str[16]);
+ mob_db[mob_class].dex = atoi (str[17]);
+ mob_db[mob_class].luk = atoi (str[18]);
+ mob_db[mob_class].range2 = atoi (str[19]);
+ mob_db[mob_class].range3 = atoi (str[20]);
+ mob_db[mob_class].size = atoi (str[21]);
+ mob_db[mob_class].race = atoi (str[22]);
+ mob_db[mob_class].element = atoi (str[23]);
+ mob_db[mob_class].mode = atoi (str[24]);
+ mob_db[mob_class].speed = atoi (str[25]);
+ mob_db[mob_class].adelay = atoi (str[26]);
+ mob_db[mob_class].amotion = atoi (str[27]);
+ mob_db[mob_class].dmotion = atoi (str[28]);
for (i = 0; i < 8; i++)
{
int rate = 0, type, ratemin, ratemax;
- mob_db[class].dropitem[i].nameid = atoi (str[29 + i * 2]);
- type = itemdb_type (mob_db[class].dropitem[i].nameid);
+ mob_db[mob_class].dropitem[i].nameid = atoi (str[29 + i * 2]);
+ type = itemdb_type (mob_db[mob_class].dropitem[i].nameid);
if (type == 0)
{ // Added [Valaris]
rate = battle_config.item_rate_heal;
@@ -4642,38 +4636,38 @@ static int mob_readdb (void)
rate =
(rate < ratemin) ? ratemin : (rate >
ratemax) ? ratemax : rate;
- mob_db[class].dropitem[i].p = rate;
+ mob_db[mob_class].dropitem[i].p = rate;
}
// Item1,Item2
- mob_db[class].mexp =
+ mob_db[mob_class].mexp =
atoi (str[45]) * battle_config.mvp_exp_rate / 100;
- mob_db[class].mexpper = atoi (str[46]);
+ mob_db[mob_class].mexpper = atoi (str[46]);
for (i = 0; i < 3; i++)
{
- mob_db[class].mvpitem[i].nameid = atoi (str[47 + i * 2]);
- mob_db[class].mvpitem[i].p =
+ mob_db[mob_class].mvpitem[i].nameid = atoi (str[47 + i * 2]);
+ mob_db[mob_class].mvpitem[i].p =
atoi (str[48 + i * 2]) * battle_config.mvp_item_rate /
100;
}
- mob_db[class].mutations_nr = atoi (str[55]);
- mob_db[class].mutation_power = atoi (str[56]);
+ mob_db[mob_class].mutations_nr = atoi (str[55]);
+ mob_db[mob_class].mutation_power = atoi (str[56]);
for (i = 0; i < MAX_RANDOMMONSTER; i++)
- mob_db[class].summonper[i] = 0;
- mob_db[class].maxskill = 0;
-
- mob_db[class].sex = 0;
- mob_db[class].hair = 0;
- mob_db[class].hair_color = 0;
- mob_db[class].weapon = 0;
- mob_db[class].shield = 0;
- mob_db[class].head_top = 0;
- mob_db[class].head_mid = 0;
- mob_db[class].head_buttom = 0;
- mob_db[class].clothes_color = 0; //Add for player monster dye - Valaris
-
- if (mob_db[class].base_exp == 0)
- mob_db[class].base_exp = mob_gen_exp (&mob_db[class]);
+ mob_db[mob_class].summonper[i] = 0;
+ mob_db[mob_class].maxskill = 0;
+
+ mob_db[mob_class].sex = 0;
+ mob_db[mob_class].hair = 0;
+ mob_db[mob_class].hair_color = 0;
+ mob_db[mob_class].weapon = 0;
+ mob_db[mob_class].shield = 0;
+ mob_db[mob_class].head_top = 0;
+ mob_db[mob_class].head_mid = 0;
+ mob_db[mob_class].head_buttom = 0;
+ mob_db[mob_class].clothes_color = 0; //Add for player monster dye - Valaris
+
+ if (mob_db[mob_class].base_exp == 0)
+ mob_db[mob_class].base_exp = mob_gen_exp (&mob_db[mob_class]);
}
fclose_ (fp);
printf ("read %s done\n", filename[i]);
@@ -4690,7 +4684,7 @@ static int mob_readdb_mobavail (void)
FILE *fp;
char line[1024];
int ln = 0;
- int class, j, k;
+ int mob_class, j, k;
char *str[20], *p, *np;
if ((fp = fopen_ ("db/mob_avail.txt", "r")) == NULL)
@@ -4720,31 +4714,31 @@ static int mob_readdb_mobavail (void)
if (str[0] == NULL)
continue;
- class = atoi (str[0]);
+ mob_class = atoi (str[0]);
- if (class <= 1000 || class > 2000) // 値が異常なら処理しない。
+ if (mob_class <= 1000 || mob_class > 2000) // 値が異常なら処理しない。
continue;
k = atoi (str[1]);
if (k >= 0)
- mob_db[class].view_class = k;
+ mob_db[mob_class].view_class = k;
- if ((mob_db[class].view_class < 24)
- || (mob_db[class].view_class > 4000))
+ if ((mob_db[mob_class].view_class < 24)
+ || (mob_db[mob_class].view_class > 4000))
{
- mob_db[class].sex = atoi (str[2]);
- mob_db[class].hair = atoi (str[3]);
- mob_db[class].hair_color = atoi (str[4]);
- mob_db[class].weapon = atoi (str[5]);
- mob_db[class].shield = atoi (str[6]);
- mob_db[class].head_top = atoi (str[7]);
- mob_db[class].head_mid = atoi (str[8]);
- mob_db[class].head_buttom = atoi (str[9]);
- mob_db[class].option = atoi (str[10]) & ~0x46;
- mob_db[class].clothes_color = atoi (str[11]); // Monster player dye option - Valaris
+ mob_db[mob_class].sex = atoi (str[2]);
+ mob_db[mob_class].hair = atoi (str[3]);
+ mob_db[mob_class].hair_color = atoi (str[4]);
+ mob_db[mob_class].weapon = atoi (str[5]);
+ mob_db[mob_class].shield = atoi (str[6]);
+ mob_db[mob_class].head_top = atoi (str[7]);
+ mob_db[mob_class].head_mid = atoi (str[8]);
+ mob_db[mob_class].head_buttom = atoi (str[9]);
+ mob_db[mob_class].option = atoi (str[10]) & ~0x46;
+ mob_db[mob_class].clothes_color = atoi (str[11]); // Monster player dye option - Valaris
}
else if (atoi (str[2]) > 0)
- mob_db[class].equip = atoi (str[2]); // mob equipment [Valaris]
+ mob_db[mob_class].equip = atoi (str[2]); // mob equipment [Valaris]
ln++;
}
@@ -4781,7 +4775,7 @@ static int mob_read_randommonster (void)
}
while (fgets (line, 1020, fp))
{
- int class, per;
+ int mob_class, per;
if (line[0] == '/' && line[1] == '/')
continue;
memset (str, 0, sizeof (str));
@@ -4796,10 +4790,10 @@ static int mob_read_randommonster (void)
if (str[0] == NULL || str[2] == NULL)
continue;
- class = atoi (str[0]);
+ mob_class = atoi (str[0]);
per = atoi (str[2]);
- if ((class > 1000 && class <= 2000) || class == 0)
- mob_db[class].summonper[i] = per;
+ if ((mob_class > 1000 && mob_class <= 2000) || mob_class == 0)
+ mob_db[mob_class].summonper[i] = per;
}
fclose_ (fp);
printf ("read %s done\n", mobfile[i]);
diff --git a/src/map/mob.h b/src/map/mob.h
index aff305b..b5d642a 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -96,14 +96,14 @@ enum
int mobdb_searchname (const char *str);
int mobdb_checkid (const int id);
int mob_once_spawn (struct map_session_data *sd, char *mapname,
- int x, int y, const char *mobname, int class, int amount,
+ int x, int y, const char *mobname, int class_, int amount,
const char *event);
int mob_once_spawn_area (struct map_session_data *sd, char *mapname, int x0,
int y0, int x1, int y1, const char *mobname,
- int class, int amount, const char *event);
+ int class_, int amount, const char *event);
int mob_spawn_guardian (struct map_session_data *sd, char *mapname, // Spawning Guardians [Valaris]
- int x, int y, const char *mobname, int class, int amount, const char *event, int guardian); // Spawning Guardians [Valaris]
+ int x, int y, const char *mobname, int class_, int amount, const char *event, int guardian); // Spawning Guardians [Valaris]
int mob_walktoxy (struct mob_data *md, int x, int y, int easy);
diff --git a/src/map/npc.c b/src/map/npc.c
index 85ac6e9..5314916 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -85,7 +85,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_search (npcname_db, name);
+ struct npc_data *nd = (struct npc_data *)strdb_search (npcname_db, name);
if (nd == NULL)
return 0;
@@ -125,7 +125,7 @@ int npc_enable (const char *name, int flag)
*/
struct npc_data *npc_name2id (const char *name)
{
- return strdb_search (npcname_db, name);
+ return (struct npc_data *)strdb_search (npcname_db, name);
}
/*==========================================
@@ -184,7 +184,7 @@ void npc_event_timer (timer_id tid, tick_t tick, custom_id_t id, custom_data_t d
int npc_timer_event (const char *eventname) // Added by RoVeRT
{
- struct event_data *ev = strdb_search (ev_db, eventname);
+ struct event_data *ev = (struct event_data *)strdb_search (ev_db, eventname);
struct npc_data *nd;
// int xs,ys;
@@ -261,14 +261,9 @@ int npc_event_export (void *key, void *data, va_list ap)
char *buf;
char *p = strchr (lname, ':');
// エクスポートされる
- ev = calloc (sizeof (struct event_data), 1);
- buf = calloc (50, 1);
- if (ev == NULL || buf == NULL)
- {
- printf ("npc_event_export: out of memory !\n");
- exit (1);
- }
- else if (p == NULL || (p - lname) > 24)
+ CREATE (ev, struct event_data, 1);
+ CREATE (buf, char, 50);
+ if (p == NULL || (p - lname) > 24)
{
printf ("npc_event_export: label name error !\n");
exit (1);
@@ -428,12 +423,8 @@ int npc_addeventtimer (struct npc_data *nd, int tick, const char *name)
break;
if (i < MAX_EVENTTIMER)
{
- char *evname = malloc (24);
- if (evname == NULL)
- {
- printf ("npc_addeventtimer: out of memory !\n");
- exit (1);
- }
+ char *evname;
+ CREATE (evname, char, 24);
memcpy (evname, name, 24);
nd->eventtimer[i] = add_timer (gettick () + tick,
npc_event_timer, nd->bl.id,
@@ -529,15 +520,7 @@ int npc_timerevent_import (void *key, void *data, va_list ap)
// タイマーイベント
struct npc_timerevent_list *te = nd->u.scr.timer_event;
int j, i = nd->u.scr.timeramount;
- if (te == NULL)
- te = malloc (sizeof (struct npc_timerevent_list));
- else
- te = realloc (te, sizeof (struct npc_timerevent_list) * (i + 1));
- if (te == NULL)
- {
- printf ("npc_timerevent_import: out of memory !\n");
- exit (1);
- }
+ RECREATE (te, struct npc_timerevent_list, i+1);
for (j = 0; j < i; j++)
{
if (te[j].timer > t)
@@ -677,7 +660,7 @@ int npc_settimerevent_tick (struct npc_data *nd, int newtimer)
int npc_event (struct map_session_data *sd, const char *eventname,
int mob_kill)
{
- struct event_data *ev = strdb_search (ev_db, eventname);
+ struct event_data *ev = (struct event_data *)strdb_search (ev_db, eventname);
struct npc_data *nd;
int xs, ys;
char mobevent[100];
@@ -697,7 +680,7 @@ int npc_event (struct map_session_data *sd, const char *eventname,
{
strcpy (mobevent, eventname);
strcat (mobevent, "::OnMyMobDead");
- ev = strdb_search (ev_db, mobevent);
+ ev = (struct event_data *)strdb_search (ev_db, mobevent);
if (ev == NULL || (nd = ev->nd) == NULL)
{
if (strncasecmp (eventname, "GM_MONSTER", 10) != 0)
@@ -847,7 +830,7 @@ int npc_touch_areanpc (struct map_session_data *sd, int m, int x, int y)
case MESSAGE:
case SCRIPT:
{
- char *name = calloc (50, 1);
+ char *name = (char *)malloc (50);
memcpy (name, map[m].npc[i]->name, 50);
if (sd->areanpc_id == map[m].npc[i]->bl.id)
@@ -880,7 +863,7 @@ int npc_checknear (struct map_session_data *sd, int id)
return 1;
}
- if (nd->class < 0) // イベント系は常にOK
+ if (nd->npc_class < 0) // イベント系は常にOK
return 0;
// エリア判定
@@ -1019,7 +1002,7 @@ int npc_buylist (struct map_session_data *sd, int n,
{
struct npc_data *nd;
double z;
- int i, j, w, skill, itemamount = 0, new = 0;
+ int i, j, w, skill, itemamount = 0, new_stacks = 0;
nullpo_retr (3, sd);
nullpo_retr (3, item_list);
@@ -1055,9 +1038,9 @@ int npc_buylist (struct map_session_data *sd, int n,
break;
case ADDITEM_NEW:
if (itemdb_isequip (item_list[i * 2 + 1]))
- new += item_list[i * 2];
+ new_stacks += item_list[i * 2];
else
- new++;
+ new_stacks++;
break;
case ADDITEM_OVERAMOUNT:
return 2;
@@ -1070,7 +1053,7 @@ int npc_buylist (struct map_session_data *sd, int n,
return 1; // zeny不足
if (w + sd->weight > sd->max_weight)
return 2; // 重量超過
- if (pc_inventoryblank (sd) < new)
+ if (pc_inventoryblank (sd) < new_stacks)
return 3; // 種類数超過
if (sd->trade_partner != 0)
return 4; // cant buy while trading
@@ -1201,7 +1184,7 @@ int npc_selllist (struct map_session_data *sd, int n,
* 読み込むnpcファイルのクリア
*------------------------------------------
*/
-void npc_clearsrcfile ()
+void npc_clearsrcfile (void)
{
struct npc_src_list *p = npc_src_first;
@@ -1221,7 +1204,7 @@ void npc_clearsrcfile ()
*/
void npc_addsrcfile (char *name)
{
- struct npc_src_list *new;
+ struct npc_src_list *new_src;
size_t len;
if (strcasecmp (name, "clear") == 0)
@@ -1230,16 +1213,16 @@ void npc_addsrcfile (char *name)
return;
}
- len = sizeof (*new) + strlen (name);
- new = (struct npc_src_list *) calloc (1, len);
- new->next = NULL;
- strncpy (new->name, name, strlen (name) + 1);
+ len = sizeof (*new_src) + strlen (name);
+ new_src = (struct npc_src_list *) calloc (1, len);
+ new_src->next = NULL;
+ strncpy (new_src->name, name, strlen (name) + 1);
if (npc_src_first == NULL)
- npc_src_first = new;
+ npc_src_first = new_src;
if (npc_src_last)
- npc_src_last->next = new;
+ npc_src_last->next = new_src;
- npc_src_last = new;
+ npc_src_last = new_src;
}
/*==========================================
@@ -1306,9 +1289,9 @@ int npc_parse_warp (char *w1, char *w2, char *w3, char *w4)
nd->chat_id = 0;
if (!battle_config.warp_point_debug)
- nd->class = WARP_CLASS;
+ nd->npc_class = WARP_CLASS;
else
- nd->class = WARP_DEBUG_CLASS;
+ nd->npc_class = WARP_DEBUG_CLASS;
nd->speed = 200;
nd->option = 0;
nd->opt1 = 0;
@@ -1421,7 +1404,7 @@ static int npc_parse_shop (char *w1, char *w2, char *w3, char *w4)
nd->dir = dir;
nd->flag = 0;
memcpy (nd->name, w3, 24);
- nd->class = atoi (w4);
+ nd->npc_class = atoi (w4);
nd->speed = 200;
nd->chat_id = 0;
nd->option = 0;
@@ -1488,7 +1471,7 @@ void npc_convertlabel_db (db_key_t key, db_val_t data, va_list ap)
static int npc_parse_script (char *w1, char *w2, char *w3, char *w4,
char *first_line, FILE * fp, int *lines)
{
- int x, y, dir = 0, m, xs = 0, ys = 0, class = 0; // [Valaris] thanks to fov
+ int x, y, dir = 0, m, xs = 0, ys = 0, npc_class = 0; // [Valaris] thanks to fov
char mapname[24];
unsigned char *srcbuf = NULL, *script;
int srcsize = 65536;
@@ -1598,7 +1581,7 @@ static int npc_parse_script (char *w1, char *w2, char *w3, char *w4,
// スクリプトコピー用のダミーNPC
}
- else if (sscanf (w4, "%d,%d,%d", &class, &xs, &ys) == 3)
+ else if (sscanf (w4, "%d,%d,%d", &npc_class, &xs, &ys) == 3)
{
// 接触型NPC
int i, j;
@@ -1608,7 +1591,7 @@ static int npc_parse_script (char *w1, char *w2, char *w3, char *w4,
if (ys >= 0)
ys = ys * 2 + 1;
- if (class >= 0)
+ if (npc_class >= 0)
{
for (i = 0; i < ys; i++)
@@ -1629,12 +1612,12 @@ static int npc_parse_script (char *w1, char *w2, char *w3, char *w4,
}
else
{ // クリック型NPC
- class = atoi (w4);
+ npc_class = atoi (w4);
nd->u.scr.xs = 0;
nd->u.scr.ys = 0;
}
- if (class < 0 && m >= 0)
+ if (npc_class < 0 && m >= 0)
{ // イベント型NPC
evflag = 1;
}
@@ -1663,7 +1646,7 @@ static int npc_parse_script (char *w1, char *w2, char *w3, char *w4,
nd->bl.id = npc_get_new_npc_id ();
nd->dir = dir;
nd->flag = 0;
- nd->class = class;
+ nd->npc_class = npc_class;
nd->speed = 200;
nd->u.scr.script = script;
nd->u.scr.src_id = src_id;
@@ -1873,7 +1856,7 @@ static int npc_parse_function (char *w1, char *w2, char *w3, char *w4,
*/
int npc_parse_mob (char *w1, char *w2, char *w3, char *w4)
{
- int m, x, y, xs, ys, class, num, delay1, delay2;
+ int m, x, y, xs, ys, mob_class, num, delay1, delay2;
int i;
char mapname[24];
char eventname[24] = "";
@@ -1883,7 +1866,7 @@ int npc_parse_mob (char *w1, char *w2, char *w3, char *w4)
delay1 = delay2 = 0;
// 引数の個数チェック
if (sscanf (w1, "%[^,],%d,%d,%d,%d", mapname, &x, &y, &xs, &ys) < 3 ||
- sscanf (w4, "%d,%d,%d,%d,%s", &class, &num, &delay1, &delay2,
+ sscanf (w4, "%d,%d,%d,%d,%s", &mob_class, &num, &delay1, &delay2,
eventname) < 2)
{
printf ("bad monster line : %s\n", w3);
@@ -1908,14 +1891,14 @@ int npc_parse_mob (char *w1, char *w2, char *w3, char *w4)
md->bl.x = x;
md->bl.y = y;
if (strcmp (w3, "--en--") == 0)
- memcpy (md->name, mob_db[class].name, 24);
+ memcpy (md->name, mob_db[mob_class].name, 24);
else if (strcmp (w3, "--ja--") == 0)
- memcpy (md->name, mob_db[class].jname, 24);
+ memcpy (md->name, mob_db[mob_class].jname, 24);
else
memcpy (md->name, w3, 24);
md->n = i;
- md->base_class = md->class = class;
+ md->base_class = md->mob_class = mob_class;
md->bl.id = npc_get_new_npc_id ();
md->m = m;
md->x0 = x;
@@ -1930,7 +1913,7 @@ int npc_parse_mob (char *w1, char *w2, char *w3, char *w4)
md->target_id = 0;
md->attacked_id = 0;
- if (mob_db[class].mode & 0x02)
+ if (mob_db[mob_class].mode & 0x02)
md->lootitem =
(struct item *) calloc (LOOTITEM_SIZE, sizeof (struct item));
else
@@ -2142,7 +2125,7 @@ static void ev_db_final (db_key_t key, db_val_t data, va_list ap)
}
struct npc_data *npc_spawn_text (int m, int x, int y,
- int class, char *name, char *message)
+ int npc_class, char *name, char *message)
{
struct npc_data *retval =
(struct npc_data *) calloc (1, sizeof (struct npc_data));
@@ -2159,7 +2142,7 @@ struct npc_data *npc_spawn_text (int m, int x, int y,
retval->exname[15] = 0;
retval->u.message = message ? strdup (message) : NULL;
- retval->class = class;
+ retval->npc_class = npc_class;
retval->speed = 200;
clif_spawnnpc (retval);
diff --git a/src/map/npc.h b/src/map/npc.h
index 248bad7..757c7ab 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -33,7 +33,7 @@ int npc_get_new_npc_id (void);
*
* \param message The message to speak. If message is NULL, the NPC will not do anything at all.
*/
-struct npc_data *npc_spawn_text (int m, int x, int y, int class, char *name, char *message); // message is strdup'd within
+struct npc_data *npc_spawn_text (int m, int x, int y, int class_, char *name, char *message); // message is strdup'd within
/**
* Uninstalls and frees an NPC
diff --git a/src/map/party.c b/src/map/party.c
index cc35d2a..6c2e627 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -52,7 +52,7 @@ void do_init_party (void)
// 検索
struct party *party_search (int party_id)
{
- return numdb_search (party_db, party_id);
+ return (struct party *)numdb_search (party_db, party_id);
}
void party_searchname_sub (db_key_t key, db_val_t data, va_list ap)
@@ -110,7 +110,7 @@ int party_created (int account_id, int fail, int party_id, char *name)
struct party *p;
sd->status.party_id = party_id;
- if ((p = numdb_search (party_db, party_id)) != NULL)
+ if ((p = (struct party *)numdb_search (party_db, party_id)) != NULL)
{
printf ("party_created(): ID already exists!\n");
exit (1);
@@ -147,7 +147,7 @@ int party_check_member (struct party *p)
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data) && sd->state.auth)
+ if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->state.auth)
{
if (sd->status.party_id == p->party_id)
{
@@ -182,7 +182,7 @@ int party_recv_noinfo (int party_id)
struct map_session_data *sd;
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (sd = session[i]->session_data) && sd->state.auth)
+ if (session[i] && (sd = (struct map_session_data *)session[i]->session_data) && sd->state.auth)
{
if (sd->status.party_id == party_id)
sd->status.party_id = 0;
@@ -199,7 +199,7 @@ int party_recv_info (struct party *sp)
nullpo_retr (0, sp);
- if ((p = numdb_search (party_db, sp->party_id)) == NULL)
+ if ((p = (struct party *)numdb_search (party_db, sp->party_id)) == NULL)
{
CREATE (p, struct party, 1);
numdb_insert (party_db, sp->party_id, p);
diff --git a/src/map/pc.c b/src/map/pc.c
index ac03334..e3594e0 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -149,7 +149,7 @@ int pc_set_gm_level (int account_id, int level)
}
GM_num++;
- gm_account = realloc (gm_account, sizeof (struct gm_account) * GM_num);
+ RECREATE (gm_account, struct gm_account, GM_num);
gm_account[GM_num - 1].account_id = account_id;
gm_account[GM_num - 1].level = level;
return 0;
@@ -317,7 +317,7 @@ int pc_setrestartvalue (struct map_session_data *sd, int type)
nullpo_retr (0, sd);
- s_class = pc_calc_base_job (sd->status.class);
+ s_class = pc_calc_base_job (sd->status.pc_class);
//-----------------------
// 死亡した
@@ -358,7 +358,7 @@ int pc_setrestartvalue (struct map_session_data *sd, int type)
/* removed exp penalty on spawn [Valaris] */
- if (type & 2 && sd->status.class != 0 && battle_config.zeny_penalty > 0
+ if (type & 2 && sd->status.pc_class != 0 && battle_config.zeny_penalty > 0
&& !map[sd->bl.m].flag.nozenypenalty)
{
int zeny =
@@ -511,7 +511,7 @@ int pc_equippoint (struct map_session_data *sd, int n)
if (!sd->inventory_data[n])
return 0;
- s_class = pc_calc_base_job (sd->status.class);
+ s_class = pc_calc_base_job (sd->status.pc_class);
ep = sd->inventory_data[n]->equip;
if ((sd->inventory_data[n]->look == 1 || sd->inventory_data[n]->look == 2
@@ -788,7 +788,7 @@ int pc_authok (int id, int login_id2, time_t connect_until_time,
sd->bl.prev = sd->bl.next = NULL;
sd->weapontype1 = sd->weapontype2 = 0;
- sd->view_class = sd->status.class;
+ sd->view_class = sd->status.pc_class;
sd->speed = DEFAULT_WALK_SPEED;
sd->state.dead_sit = 0;
sd->dir = 0;
@@ -1026,7 +1026,7 @@ int pc_calc_skilltree (struct map_session_data *sd)
nullpo_retr (0, sd);
- s_class = pc_calc_base_job (sd->status.class);
+ s_class = pc_calc_base_job (sd->status.pc_class);
c = s_class.job;
s = (s_class.upper == 1) ? 1 : 0; //ソ転生以外は通常のスキル?
@@ -1257,7 +1257,7 @@ int pc_calcstatus (struct map_session_data *sd, int first)
nullpo_retr (0, sd);
//転生や養子の場合の元の職業を算出する
- s_class = pc_calc_base_job (sd->status.class);
+ s_class = pc_calc_base_job (sd->status.pc_class);
b_speed = sd->speed;
b_max_hp = sd->status.max_hp;
@@ -1284,7 +1284,7 @@ int pc_calcstatus (struct map_session_data *sd, int first)
b_mdef = sd->mdef;
b_mdef2 = sd->mdef2;
b_class = sd->view_class;
- sd->view_class = sd->status.class;
+ sd->view_class = sd->status.pc_class;
b_base_atk = sd->base_atk;
pc_calc_skilltree (sd); // スキルツリーの計算
@@ -2025,15 +2025,15 @@ int pc_calcstatus (struct map_session_data *sd, int first)
//Flee上昇
if ((skill = pc_checkskill (sd, TF_MISS)) > 0)
{ // 回避率増加
- if (sd->status.class == 6 || sd->status.class == 4007
- || sd->status.class == 23)
+ if (sd->status.pc_class == 6 || sd->status.pc_class == 4007
+ || sd->status.pc_class == 23)
{
sd->flee += skill * 3;
}
- if (sd->status.class == 12 || sd->status.class == 17
- || sd->status.class == 4013 || sd->status.class == 4018)
+ if (sd->status.pc_class == 12 || sd->status.pc_class == 17
+ || sd->status.pc_class == 4013 || sd->status.pc_class == 4018)
sd->flee += skill * 4;
- if (sd->status.class == 12 || sd->status.class == 4013)
+ if (sd->status.pc_class == 12 || sd->status.pc_class == 4013)
sd->speed -= sd->speed * (skill * .5) / 100;
}
if ((skill = pc_checkskill (sd, MO_DODGE)) > 0) // 見切り
@@ -3959,24 +3959,26 @@ int pc_steal_item (struct map_session_data *sd, struct block_list *bl)
int i, skill, rate, itemid, flag, count;
struct mob_data *md;
md = (struct mob_data *) bl;
- if (!md->state.steal_flag && mob_db[md->class].mexp <= 0 && !(mob_db[md->class].mode & 0x20) && md->sc_data[SC_STONE].timer == -1 && md->sc_data[SC_FREEZE].timer == -1 && (!(md->class > 1324 && md->class < 1364))) // prevent stealing from treasure boxes [Valaris]
+ if (!md->state.steal_flag && mob_db[md->mob_class].mexp <= 0 &&
+ !(mob_db[md->mob_class].mode & 0x20) &&
+ md->sc_data[SC_STONE].timer == -1 &&
+ md->sc_data[SC_FREEZE].timer == -1 &&
+ (!(md->mob_class > 1324 && md->mob_class < 1364))) // prevent stealing from treasure boxes [Valaris]
{
- skill =
- sd->paramc[4] - mob_db[md->class].dex + pc_checkskill (sd,
- TF_STEAL)
- + 10;
+ skill = sd->paramc[4] - mob_db[md->mob_class].dex
+ + pc_checkskill (sd, TF_STEAL) + 10;
if (0 < skill)
{
for (count = 8; count <= 8 && count != 0; count--)
{
i = rand () % 8;
- itemid = mob_db[md->class].dropitem[i].nameid;
+ itemid = mob_db[md->mob_class].dropitem[i].nameid;
if (itemid > 0 && itemdb_type (itemid) != 6)
{
rate =
- (mob_db[md->class].dropitem[i].p /
+ (mob_db[md->mob_class].dropitem[i].p /
battle_config.item_rate_common * 100 * skill) /
100;
@@ -4032,11 +4034,11 @@ int pc_steal_coin (struct map_session_data *sd, struct block_list *bl)
{
skill = pc_checkskill (sd, RG_STEALCOIN) * 10;
rate =
- skill + (sd->status.base_level - mob_db[md->class].lv) * 3 +
+ skill + (sd->status.base_level - mob_db[md->mob_class].lv) * 3 +
sd->paramc[4] * 2 + sd->paramc[5] * 2;
if (MRAND (1000) < rate)
{
- pc_getzeny (sd, mob_db[md->class].lv * 10 + MRAND (100));
+ pc_getzeny (sd, mob_db[md->mob_class].lv * 10 + MRAND (100));
md->state.steal_coin_flag = 1;
return 1;
}
@@ -5077,7 +5079,7 @@ int pc_checkbaselevelup (struct map_session_data *sd)
if (sd->status.base_exp >= next && next > 0)
{
- struct pc_base_job s_class = pc_calc_base_job (sd->status.class);
+ struct pc_base_job s_class = pc_calc_base_job (sd->status.pc_class);
// base側レベルアップ処理
sd->status.base_exp -= next;
@@ -5305,17 +5307,17 @@ int pc_nextbaseexp (struct map_session_data *sd)
if (sd->status.base_level >= MAX_LEVEL || sd->status.base_level <= 0)
return 0;
- if (sd->status.class == 0)
+ if (sd->status.pc_class == 0)
i = 0;
- else if (sd->status.class <= 6)
+ else if (sd->status.pc_class <= 6)
i = 1;
- else if (sd->status.class <= 22)
+ else if (sd->status.pc_class <= 22)
i = 2;
- else if (sd->status.class == 23)
+ else if (sd->status.pc_class == 23)
i = 3;
- else if (sd->status.class == 4001)
+ else if (sd->status.pc_class == 4001)
i = 4;
- else if (sd->status.class <= 4007)
+ else if (sd->status.pc_class <= 4007)
i = 5;
else
i = 6;
@@ -5350,17 +5352,17 @@ int pc_nextbaseafter (struct map_session_data *sd)
if (sd->status.base_level >= MAX_LEVEL || sd->status.base_level <= 0)
return 0;
- if (sd->status.class == 0)
+ if (sd->status.pc_class == 0)
i = 0;
- else if (sd->status.class <= 6)
+ else if (sd->status.pc_class <= 6)
i = 1;
- else if (sd->status.class <= 22)
+ else if (sd->status.pc_class <= 22)
i = 2;
- else if (sd->status.class == 23)
+ else if (sd->status.pc_class == 23)
i = 3;
- else if (sd->status.class == 4001)
+ else if (sd->status.pc_class == 4001)
i = 4;
- else if (sd->status.class <= 4007)
+ else if (sd->status.pc_class <= 4007)
i = 5;
else
i = 6;
@@ -5381,17 +5383,17 @@ int pc_nextjobafter (struct map_session_data *sd)
if (sd->status.job_level >= MAX_LEVEL || sd->status.job_level <= 0)
return 0;
- if (sd->status.class == 0)
+ if (sd->status.pc_class == 0)
i = 7;
- else if (sd->status.class <= 6)
+ else if (sd->status.pc_class <= 6)
i = 8;
- else if (sd->status.class <= 22)
+ else if (sd->status.pc_class <= 22)
i = 9;
- else if (sd->status.class == 23)
+ else if (sd->status.pc_class == 23)
i = 10;
- else if (sd->status.class == 4001)
+ else if (sd->status.pc_class == 4001)
i = 11;
- else if (sd->status.class <= 4007)
+ else if (sd->status.pc_class <= 4007)
i = 12;
else
i = 13;
@@ -5616,7 +5618,7 @@ int pc_allskillup (struct map_session_data *sd)
nullpo_retr (0, sd);
- s_class = pc_calc_base_job (sd->status.class);
+ s_class = pc_calc_base_job (sd->status.pc_class);
c = s_class.job;
s = (s_class.upper == 1) ? 1 : 0; //転生以外は通常のスキル?
@@ -5678,7 +5680,7 @@ int pc_resetlvl (struct map_session_data *sd, int type)
sd->status.int_ = 1;
sd->status.dex = 1;
sd->status.luk = 1;
- if (sd->status.class == 4001)
+ if (sd->status.pc_class == 4001)
sd->status.status_point = 100;
}
@@ -5831,7 +5833,7 @@ int pc_damage (struct block_list *src, struct map_session_data *sd,
nullpo_retr (0, sd);
//転生や養子の場合の元の職業を算出する
- s_class = pc_calc_base_job (sd->status.class);
+ s_class = pc_calc_base_job (sd->status.pc_class);
// 既に死んでいたら無効
if (pc_isdead (sd))
return 0;
@@ -6116,7 +6118,7 @@ int pc_readparam (struct map_session_data *sd, int type)
int val = 0;
struct pc_base_job s_class;
- s_class = pc_calc_base_job (sd->status.class);
+ s_class = pc_calc_base_job (sd->status.pc_class);
nullpo_retr (0, sd);
@@ -6141,7 +6143,7 @@ int pc_readparam (struct map_session_data *sd, int type)
if (val >= 24 && val < 45)
val += 3978;
else
- val = sd->status.class;
+ val = sd->status.pc_class;
break;
case SP_UPPER:
val = s_class.upper;
@@ -6216,7 +6218,7 @@ int pc_setparam (struct map_session_data *sd, int type, int val)
nullpo_retr (0, sd);
- s_class = pc_calc_base_job (sd->status.class);
+ s_class = pc_calc_base_job (sd->status.pc_class);
switch (type)
{
@@ -6237,10 +6239,10 @@ int pc_setparam (struct map_session_data *sd, int type, int val)
pc_heal (sd, sd->status.max_hp, sd->status.max_sp);
break;
case SP_JOBLEVEL:
- if (sd->status.class == 0)
+ if (sd->status.pc_class == 0)
up_level -= 40;
- if ((sd->status.class == 23)
- || (sd->status.class >= 4001 && sd->status.class <= 4022))
+ if ((sd->status.pc_class == 23)
+ || (sd->status.pc_class >= 4001 && sd->status.pc_class <= 4022))
up_level += 20;
if (val >= sd->status.job_level)
{
@@ -6626,7 +6628,7 @@ int pc_jobchange (struct map_session_data *sd, int job, int upper)
int i;
int b_class = 0;
//転生や養子の場合の元の職業を算出する
- struct pc_base_job s_class = pc_calc_base_job (sd->status.class);
+ struct pc_base_job s_class = pc_calc_base_job (sd->status.pc_class);
nullpo_retr (0, sd);
@@ -6665,10 +6667,10 @@ int pc_jobchange (struct map_session_data *sd, int job, int upper)
if ((sd->status.sex == 0 && job == 19) || (sd->status.sex == 1 && job == 20) ||
(sd->status.sex == 0 && job == 4020) || (sd->status.sex == 1 && job == 4021) ||
- job == 22 || sd->status.class == b_class) //♀はバードになれない、♂はダンサーになれない、結婚衣裳もお断り
+ job == 22 || sd->status.pc_class == b_class) //♀はバードになれない、♂はダンサーになれない、結婚衣裳もお断り
return 1;
- sd->status.class = sd->view_class = b_class;
+ sd->status.pc_class = sd->view_class = b_class;
sd->status.job_level = 1;
sd->status.job_exp = 0;
@@ -6842,17 +6844,17 @@ int pc_setriding (struct map_session_data *sd)
{ // ライディングスキル所持
pc_setoption (sd, sd->status.option | 0x0020);
- if (sd->status.class == 7)
- sd->status.class = sd->view_class = 13;
+ if (sd->status.pc_class == 7)
+ sd->status.pc_class = sd->view_class = 13;
- if (sd->status.class == 14)
- sd->status.class = sd->view_class = 21;
+ if (sd->status.pc_class == 14)
+ sd->status.pc_class = sd->view_class = 21;
- if (sd->status.class == 4008)
- sd->status.class = sd->view_class = 4014;
+ if (sd->status.pc_class == 4008)
+ sd->status.pc_class = sd->view_class = 4014;
- if (sd->status.class == 4015)
- sd->status.class = sd->view_class = 4022;
+ if (sd->status.pc_class == 4015)
+ sd->status.pc_class = sd->view_class = 4022;
}
return 0;
@@ -6894,15 +6896,7 @@ int pc_setreg (struct map_session_data *sd, int reg, int val)
}
}
sd->reg_num++;
- sd->reg = realloc (sd->reg, sizeof (*(sd->reg)) * sd->reg_num);
- if (sd->reg == NULL)
- {
- printf ("out of memory : pc_setreg\n");
- exit (1);
- }
-/* memset(sd->reg + (sd->reg_num - 1) * sizeof(*(sd->reg)), 0,
- sizeof(*(sd->reg)));
-*/
+ RECREATE (sd->reg, struct script_reg, sd->reg_num);
sd->reg[i].index = reg;
sd->reg[i].data = val;
@@ -6949,16 +6943,7 @@ int pc_setregstr (struct map_session_data *sd, int reg, char *str)
return 0;
}
sd->regstr_num++;
- sd->regstr =
- realloc (sd->regstr, sizeof (sd->regstr[0]) * sd->regstr_num);
- if (sd->regstr == NULL)
- {
- printf ("out of memory : pc_setreg\n");
- exit (1);
- }
-/* memset(sd->reg + (sd->reg_num - 1) * sizeof(*(sd->reg)), 0,
- sizeof(*(sd->reg)));
-*/
+ RECREATE (sd->regstr, struct script_regstr, sd->regstr_num);
sd->regstr[i].index = reg;
strcpy (sd->regstr[i].data, str);
@@ -7394,7 +7379,7 @@ int pc_equipitem (struct map_session_data *sd, int n, int pos)
// 二刀流処理
if ((pos == 0x22) // 一応、装備要求箇所が二刀流武器かチェックする
&& (id->equip == 2) // 単 手武器
- && (pc_checkskill (sd, AS_LEFT) > 0 || sd->status.class == 12)) // 左手修錬有
+ && (pc_checkskill (sd, AS_LEFT) > 0 || sd->status.pc_class == 12)) // 左手修錬有
{
int tpos = 0;
if (sd->equip_index[8] >= 0)
@@ -8136,7 +8121,7 @@ static int pc_natural_heal_sp (struct map_session_data *sd)
if (sd->inchealsptick >= battle_config.natural_heal_skill_interval
&& sd->status.sp < sd->status.max_sp)
{
- struct pc_base_job s_class = pc_calc_base_job (sd->status.class);
+ struct pc_base_job s_class = pc_calc_base_job (sd->status.pc_class);
if (sd->doridori_counter && s_class.job == 23)
bonus = sd->nshealsp * 2;
else
@@ -8473,8 +8458,7 @@ int pc_read_gm_account (int fd)
free (gm_account);
GM_num = 0;
- gm_account =
- calloc (sizeof (struct gm_account) * ((RFIFOW (fd, 2) - 4) / 5), 1);
+ CREATE (gm_account, struct gm_account, (RFIFOW (fd, 2) - 4) / 5);
for (i = 4; i < RFIFOW (fd, 2); i = i + 5)
{
gm_account[GM_num].account_id = RFIFOL (fd, i);
@@ -8503,7 +8487,7 @@ void map_day_timer (timer_id tid, tick_t tick, custom_id_t id, custom_data_t dat
night_flag = 0; // 0=day, 1=night [Yor]
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
pl_sd->opt2 &= ~STATE_BLIND;
@@ -8534,7 +8518,7 @@ void map_night_timer (timer_id tid, tick_t tick, custom_id_t id, custom_data_t d
night_flag = 1; // 0=day, 1=night [Yor]
for (i = 0; i < fd_max; i++)
{
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
pl_sd->opt2 |= STATE_BLIND;
diff --git a/src/map/script.c b/src/map/script.c
index fb8b8af..e4dde51 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -51,13 +51,13 @@ static int script_pos, script_size;
char *str_buf;
int str_pos, str_size;
-static struct
+static struct str_data_t
{
int type;
int str;
int backpatch;
int label;
- int (*func) ();
+ int (*func) (struct script_state *);
int val;
int next;
} *str_data;
@@ -73,12 +73,12 @@ char mapreg_txt[256] = "save/mapreg.txt";
static struct dbt *scriptlabel_db = NULL;
static struct dbt *userfunc_db = NULL;
-struct dbt *script_get_label_db ()
+struct dbt *script_get_label_db (void)
{
return scriptlabel_db;
}
-struct dbt *script_get_userfunc_db ()
+struct dbt *script_get_userfunc_db (void)
{
if (!userfunc_db)
userfunc_db = strdb_init (50);
@@ -320,7 +320,7 @@ int mapreg_setregstr (int num, const char *str);
struct
{
- int (*func) ();
+ int (*func) (struct script_state *);
char *name;
char *arg;
} buildin_func[] =
@@ -826,7 +826,7 @@ static int add_str (const unsigned char *p)
if (str_num >= str_data_size)
{
str_data_size += 128;
- str_data = realloc (str_data, sizeof (str_data[0]) * str_data_size);
+ RECREATE (str_data, struct str_data_t, str_data_size);
memset (str_data + (str_data_size - 128), '\0', 128);
}
while (str_pos + strlen (p) + 1 >= str_size)
@@ -1933,7 +1933,7 @@ int buildin_callfunc (struct script_state *st)
char *scr;
char *str = conv_str (st, &(st->stack->stack_data[st->start + 2]));
- if ((scr = strdb_search (script_get_userfunc_db (), str)))
+ if ((scr = (char*)strdb_search (script_get_userfunc_db (), str)))
{
int i, j;
for (i = st->start + 3, j = 0; i < st->end; i++, j++)
@@ -3916,14 +3916,14 @@ int buildin_getopt2 (struct script_state *st)
int buildin_setopt2 (struct script_state *st)
{
- int new;
+ int new_opt2;
struct map_session_data *sd;
- new = conv_num (st, &(st->stack->stack_data[st->start + 2]));
+ new_opt2 = conv_num (st, &(st->stack->stack_data[st->start + 2]));
sd = script_rid2sd (st);
- if (!(new ^ sd->opt2))
+ if (new_opt2 == sd->opt2)
return 0;
- sd->opt2 = new;
+ sd->opt2 = new_opt2;
clif_changeoption (&sd->bl);
pc_calcstatus (sd, 0);
@@ -4286,19 +4286,19 @@ int buildin_getexp (struct script_state *st)
*/
int buildin_monster (struct script_state *st)
{
- int class, amount, x, y;
+ int mob_class, amount, x, y;
char *str, *map, *event = "";
map = conv_str (st, &(st->stack->stack_data[st->start + 2]));
x = conv_num (st, &(st->stack->stack_data[st->start + 3]));
y = conv_num (st, &(st->stack->stack_data[st->start + 4]));
str = conv_str (st, &(st->stack->stack_data[st->start + 5]));
- class = conv_num (st, &(st->stack->stack_data[st->start + 6]));
+ mob_class = conv_num (st, &(st->stack->stack_data[st->start + 6]));
amount = conv_num (st, &(st->stack->stack_data[st->start + 7]));
if (st->end > st->start + 8)
event = conv_str (st, &(st->stack->stack_data[st->start + 8]));
- mob_once_spawn (map_id2sd (st->rid), map, x, y, str, class, amount,
+ mob_once_spawn (map_id2sd (st->rid), map, x, y, str, mob_class, amount,
event);
return 0;
}
@@ -4309,7 +4309,7 @@ int buildin_monster (struct script_state *st)
*/
int buildin_areamonster (struct script_state *st)
{
- int class, amount, x0, y0, x1, y1;
+ int mob_class, amount, x0, y0, x1, y1;
char *str, *map, *event = "";
map = conv_str (st, &(st->stack->stack_data[st->start + 2]));
@@ -4318,12 +4318,12 @@ int buildin_areamonster (struct script_state *st)
x1 = conv_num (st, &(st->stack->stack_data[st->start + 5]));
y1 = conv_num (st, &(st->stack->stack_data[st->start + 6]));
str = conv_str (st, &(st->stack->stack_data[st->start + 7]));
- class = conv_num (st, &(st->stack->stack_data[st->start + 8]));
+ mob_class = conv_num (st, &(st->stack->stack_data[st->start + 8]));
amount = conv_num (st, &(st->stack->stack_data[st->start + 9]));
if (st->end > st->start + 10)
event = conv_str (st, &(st->stack->stack_data[st->start + 10]));
- mob_once_spawn_area (map_id2sd (st->rid), map, x0, y0, x1, y1, str, class,
+ mob_once_spawn_area (map_id2sd (st->rid), map, x0, y0, x1, y1, str, mob_class,
amount, event);
return 0;
}
@@ -5071,15 +5071,15 @@ int buildin_changesex (struct script_state *st)
{
sd->status.sex = 1;
sd->sex = 1;
- if (sd->status.class == 20 || sd->status.class == 4021)
- sd->status.class -= 1;
+ if (sd->status.pc_class == 20 || sd->status.pc_class == 4021)
+ sd->status.pc_class -= 1;
}
else if (sd->status.sex == 1)
{
sd->status.sex = 0;
sd->sex = 0;
- if (sd->status.class == 19 || sd->status.class == 4020)
- sd->status.class += 1;
+ if (sd->status.pc_class == 19 || sd->status.pc_class == 4020)
+ sd->status.pc_class += 1;
}
chrif_char_ask_name (-1, sd->status.name, 5, 0, 0, 0, 0, 0, 0); // type: 5 - changesex
chrif_save (sd);
@@ -5543,7 +5543,7 @@ int buildin_pvpon (struct script_state *st)
for (i = 0; i < fd_max; i++)
{ //人数分ループ
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
if (m == pl_sd->bl.m && pl_sd->pvp_timer == -1)
@@ -5580,7 +5580,7 @@ int buildin_pvpoff (struct script_state *st)
for (i = 0; i < fd_max; i++)
{ //人数分ループ
- if (session[i] && (pl_sd = session[i]->session_data)
+ if (session[i] && (pl_sd = (struct map_session_data *)session[i]->session_data)
&& pl_sd->state.auth)
{
if (m == pl_sd->bl.m)
@@ -5672,7 +5672,7 @@ int buildin_maprespawnguildid_sub (struct block_list *bl, va_list ap)
}
if (md && flag & 4)
{
- if (md->class < 1285 || md->class > 1288)
+ if (md->mob_class < 1285 || md->mob_class > 1288)
mob_delete (md);
}
return 0;
@@ -6331,35 +6331,35 @@ int buildin_strmobinfo (struct script_state *st)
{
int num = conv_num (st, &(st->stack->stack_data[st->start + 2]));
- int class = conv_num (st, &(st->stack->stack_data[st->start + 3]));
+ int mob_class = conv_num (st, &(st->stack->stack_data[st->start + 3]));
- if (num <= 0 || num >= 8 || (class >= 0 && class <= 1000) || class > 2000)
+ if (num <= 0 || num >= 8 || (mob_class >= 0 && mob_class <= 1000) || mob_class > 2000)
return 0;
if (num == 1)
{
char *buf;
- buf = mob_db[class].name;
+ buf = mob_db[mob_class].name;
push_str (st->stack, C_STR, buf);
return 0;
}
else if (num == 2)
{
char *buf;
- buf = mob_db[class].jname;
+ buf = mob_db[mob_class].jname;
push_str (st->stack, C_STR, buf);
return 0;
}
else if (num == 3)
- push_val (st->stack, C_INT, mob_db[class].lv);
+ push_val (st->stack, C_INT, mob_db[mob_class].lv);
else if (num == 4)
- push_val (st->stack, C_INT, mob_db[class].max_hp);
+ push_val (st->stack, C_INT, mob_db[mob_class].max_hp);
else if (num == 5)
- push_val (st->stack, C_INT, mob_db[class].max_sp);
+ push_val (st->stack, C_INT, mob_db[mob_class].max_sp);
else if (num == 6)
- push_val (st->stack, C_INT, mob_db[class].base_exp);
+ push_val (st->stack, C_INT, mob_db[mob_class].base_exp);
else if (num == 7)
- push_val (st->stack, C_INT, mob_db[class].job_exp);
+ push_val (st->stack, C_INT, mob_db[mob_class].job_exp);
return 0;
}
@@ -6369,20 +6369,20 @@ int buildin_strmobinfo (struct script_state *st)
*/
int buildin_guardian (struct script_state *st)
{
- int class = 0, amount = 1, x = 0, y = 0, guardian = 0;
+ int mob_class = 0, amount = 1, x = 0, y = 0, guardian = 0;
char *str, *map, *event = "";
map = conv_str (st, &(st->stack->stack_data[st->start + 2]));
x = conv_num (st, &(st->stack->stack_data[st->start + 3]));
y = conv_num (st, &(st->stack->stack_data[st->start + 4]));
str = conv_str (st, &(st->stack->stack_data[st->start + 5]));
- class = conv_num (st, &(st->stack->stack_data[st->start + 6]));
+ mob_class = conv_num (st, &(st->stack->stack_data[st->start + 6]));
amount = conv_num (st, &(st->stack->stack_data[st->start + 7]));
event = conv_str (st, &(st->stack->stack_data[st->start + 8]));
if (st->end > st->start + 9)
guardian = conv_num (st, &(st->stack->stack_data[st->start + 9]));
- mob_spawn_guardian (map_id2sd (st->rid), map, x, y, str, class, amount,
+ mob_spawn_guardian (map_id2sd (st->rid), map, x, y, str, mob_class, amount,
event, guardian);
return 0;
@@ -6706,15 +6706,15 @@ int buildin_clearitem (struct script_state *st)
*/
int buildin_classchange (struct script_state *st)
{
- int class, type;
+ int npc_class, type;
struct block_list *bl = map_id2bl (st->oid);
if (bl == NULL)
return 0;
- class = conv_num (st, &(st->stack->stack_data[st->start + 2]));
+ npc_class = conv_num (st, &(st->stack->stack_data[st->start + 2]));
type = conv_num (st, &(st->stack->stack_data[st->start + 3]));
- clif_class_change (bl, class, type);
+ clif_npc_class_change (bl, npc_class, type);
return 0;
}
@@ -7107,7 +7107,7 @@ int buildin_getsavepoint (struct script_state *st)
switch (type)
{
case 0:
- mapname = calloc (24, 1);
+ mapname = (char*)calloc (24, 1);
strncpy (mapname, sd->status.save_point.map, 23);
push_str (st->stack, C_STR, mapname);
break;
@@ -7233,7 +7233,7 @@ int buildin_fakenpcname (struct script_state *st)
return 1;
strncpy (nd->name, newname, sizeof(nd->name)-1);
nd->name[sizeof(nd->name)-1] = '\0';
- nd->class = newsprite;
+ nd->npc_class = newsprite;
// Refresh this npc
npc_enable (name, 0);
@@ -7859,7 +7859,7 @@ int mapreg_setregstr (int num, const char *str)
{
char *p;
- if ((p = numdb_search (mapregstr_db, num)) != NULL)
+ if ((p = (char *)numdb_search (mapregstr_db, num)) != NULL)
free (p);
if (str == NULL || *str == 0)
@@ -7879,7 +7879,7 @@ int mapreg_setregstr (int num, const char *str)
* 永続的マップ変数の読み込み
*------------------------------------------
*/
-static int script_load_mapreg ()
+static int script_load_mapreg (void)
{
FILE *fp;
char line[1024];
@@ -7954,7 +7954,7 @@ static void script_save_mapreg_strsub (db_key_t key, db_val_t data, va_list ap)
}
}
-static int script_save_mapreg ()
+static int script_save_mapreg (void)
{
FILE *fp;
int lock;
@@ -8058,7 +8058,7 @@ static void userfunc_db_final (db_key_t key, db_val_t data, va_list ap)
free (data);
}
-int do_final_script ()
+int do_final_script (void)
{
if (mapreg_dirty >= 0)
script_save_mapreg ();
@@ -8086,7 +8086,7 @@ int do_final_script ()
* 初期化
*------------------------------------------
*/
-int do_init_script ()
+int do_init_script (void)
{
mapreg_db = numdb_init ();
mapregstr_db = numdb_init ();
diff --git a/src/map/script.h b/src/map/script.h
index b70aba3..62d3ee1 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -40,12 +40,12 @@ typedef struct argrec
int run_script_l (unsigned char *, int, int, int, int, argrec_t * args);
int run_script (unsigned char *, int, int, int);
-struct dbt *script_get_label_db ();
-struct dbt *script_get_userfunc_db ();
+struct dbt *script_get_label_db (void);
+struct dbt *script_get_userfunc_db (void);
int script_config_read (char *cfgName);
-int do_init_script ();
-int do_final_script ();
+int do_init_script (void);
+int do_final_script (void);
extern char mapreg_txt[];
diff --git a/src/map/skill.c b/src/map/skill.c
index d8b64e8..e232820 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -3242,7 +3242,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl,
heal = 0; /* 黄金蟲カード(ヒール量0) */
if (sd)
{
- s_class = pc_calc_base_job (sd->status.class);
+ s_class = pc_calc_base_job (sd->status.pc_class);
if ((skill = pc_checkskill (sd, HP_MEDITATIO)) > 0) // メディテイティオ
heal += heal * (skill * 2 / 100);
if (sd && dstsd && sd->status.partner_id == dstsd->status.char_id && s_class.job == 23 && sd->status.sex == 0) //自分も対象もPC、対象が自分のパートナー、自分がスパノビ、自分が♀なら
@@ -3719,9 +3719,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl,
|| (!sd->status.party_id && !sd->status.guild_id) // PTにもギルドにも所属無しはだめ
|| ((sd->status.party_id != dstsd->status.party_id) // 同じパーティーか、
|| (sd->status.guild_id != dstsd->status.guild_id)) // 同じギルドじゃないとだめ
- || (dstsd->status.class == 14 || dstsd->status.class == 21
- || dstsd->status.class == 4015
- || dstsd->status.class == 4022))
+ || (dstsd->status.pc_class == 14 || dstsd->status.pc_class == 21
+ || dstsd->status.pc_class == 4015
+ || dstsd->status.pc_class == 4022))
{ // クルセだめ
clif_skill_fail (sd, skillid, 0, 0);
map_freeblock_unlock ();
@@ -3799,7 +3799,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl,
//20%の確率で対象のLv*2のSPを回復する。成功したときはターゲット(σ゚Д゚)σゲッツ!!
if (MRAND (100) < 20)
{
- i = 2 * mob_db[dstmd->class].lv;
+ i = 2 * mob_db[dstmd->mob_class].lv;
mob_target (dstmd, src, 0);
}
}
@@ -4870,7 +4870,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl,
if (md && !md->master_id)
{
mob_summonslave (md,
- mob_db[md->class].skill[md->skillidx].val,
+ mob_db[md->mob_class].skill[md->skillidx].val,
skilllv,
(skillid == NPC_SUMMONSLAVE) ? 1 : 0);
}
@@ -4880,13 +4880,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl,
case NPC_METAMORPHOSIS:
if (md)
mob_class_change (md,
- mob_db[md->class].skill[md->skillidx].val);
+ mob_db[md->mob_class].skill[md->skillidx].val);
break;
case NPC_EMOTION: /* エモーション */
if (md)
clif_emotion (&md->bl,
- mob_db[md->class].skill[md->skillidx].val[0]);
+ mob_db[md->mob_class].skill[md->skillidx].val[0]);
break;
case NPC_DEFENDER:
@@ -5992,12 +5992,7 @@ struct skill_unit_group *skill_unitsetting (struct block_list *src,
group->range = range;
if (skillid == HT_TALKIEBOX || skillid == RG_GRAFFITI)
{
- group->valstr = calloc (80, 1);
- if (group->valstr == NULL)
- {
- printf ("skill_castend_map: out of memory !\n");
- exit (1);
- }
+ CREATE (group->valstr, char, 80);
memcpy (group->valstr, talkie_mes, 80);
}
for (i = 0; i < count; i++)
@@ -6929,12 +6924,7 @@ int skill_unit_onlimit (struct skill_unit *src, unsigned int tick)
src->bl.x, src->bl.y, 1);
if (group == NULL)
return 0;
- group->valstr = calloc (24, 1);
- if (group->valstr == NULL)
- {
- printf ("skill_unit_onlimit: out of memory !\n");
- exit (1);
- }
+ CREATE (group->valstr, char, 24);
memcpy (group->valstr, sg->valstr, 24);
group->val2 = sg->val2;
}
@@ -7185,7 +7175,7 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap)
nullpo_retr (0, c = va_arg (ap, int *));
nullpo_retr (0, ssd = (struct map_session_data *) src);
- s_class = pc_calc_base_job (sd->status.class);
+ s_class = pc_calc_base_job (sd->status.pc_class);
//チェックしない設定ならcにありえない大きな数字を返して終了
if (!battle_config.player_skill_partner_check)
{ //本当はforeachの前にやりたいけど設定適用箇所をまとめるためにここへ
@@ -7194,15 +7184,15 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap)
}
;
- ss_class = pc_calc_base_job (ssd->status.class);
+ ss_class = pc_calc_base_job (ssd->status.pc_class);
switch (ssd->skillid)
{
case PR_BENEDICTIO: /* 聖体降福 */
if (sd != ssd
- && (sd->status.class == 4 || sd->status.class == 8
- || sd->status.class == 15 || sd->status.class == 4005
- || sd->status.class == 4009 || sd->status.class == 4016)
+ && (sd->status.pc_class == 4 || sd->status.pc_class == 8
+ || sd->status.pc_class == 15 || sd->status.pc_class == 4005
+ || sd->status.pc_class == 4009 || sd->status.pc_class == 4016)
&& (sd->bl.x == ssd->bl.x - 1 || sd->bl.x == ssd->bl.x + 1)
&& sd->status.sp >= 10)
(*c)++;
@@ -7218,12 +7208,12 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap)
case BD_RAGNAROK: /* 神々の黄昏 */
case CG_MOONLIT: /* 月明りの泉に落ちる花びら */
if (sd != ssd &&
- ((ssd->status.class == 19 && sd->status.class == 20) ||
- (ssd->status.class == 20 && sd->status.class == 19) ||
- (ssd->status.class == 4020 && sd->status.class == 4021) ||
- (ssd->status.class == 4021 && sd->status.class == 4020) ||
- (ssd->status.class == 20 && sd->status.class == 4020) ||
- (ssd->status.class == 19 && sd->status.class == 4021)) &&
+ ((ssd->status.pc_class == 19 && sd->status.pc_class == 20) ||
+ (ssd->status.pc_class == 20 && sd->status.pc_class == 19) ||
+ (ssd->status.pc_class == 4020 && sd->status.pc_class == 4021) ||
+ (ssd->status.pc_class == 4021 && sd->status.pc_class == 4020) ||
+ (ssd->status.pc_class == 20 && sd->status.pc_class == 4020) ||
+ (ssd->status.pc_class == 19 && sd->status.pc_class == 4021)) &&
pc_checkskill (sd, ssd->skillid) > 0 &&
(*c) == 0 &&
sd->status.party_id == ssd->status.party_id &&
@@ -7256,7 +7246,7 @@ static int skill_check_condition_use_sub (struct block_list *bl, va_list ap)
nullpo_retr (0, c = va_arg (ap, int *));
nullpo_retr (0, ssd = (struct map_session_data *) src);
- s_class = pc_calc_base_job (sd->status.class);
+ s_class = pc_calc_base_job (sd->status.pc_class);
//チェックしない設定ならcにありえない大きな数字を返して終了
if (!battle_config.player_skill_partner_check)
@@ -7265,16 +7255,16 @@ static int skill_check_condition_use_sub (struct block_list *bl, va_list ap)
return 0;
}
- ss_class = pc_calc_base_job (ssd->status.class);
+ ss_class = pc_calc_base_job (ssd->status.pc_class);
skillid = ssd->skillid;
skilllv = ssd->skilllv;
switch (skillid)
{
case PR_BENEDICTIO: /* 聖体降福 */
if (sd != ssd
- && (sd->status.class == 4 || sd->status.class == 8
- || sd->status.class == 15 || sd->status.class == 4005
- || sd->status.class == 4009 || sd->status.class == 4016)
+ && (sd->status.pc_class == 4 || sd->status.pc_class == 8
+ || sd->status.pc_class == 15 || sd->status.pc_class == 4005
+ || sd->status.pc_class == 4009 || sd->status.pc_class == 4016)
&& (sd->bl.x == ssd->bl.x - 1 || sd->bl.x == ssd->bl.x + 1)
&& sd->status.sp >= 10)
{
@@ -7294,7 +7284,12 @@ static int skill_check_condition_use_sub (struct block_list *bl, va_list ap)
case BD_RAGNAROK: /* 神々の黄昏 */
case CG_MOONLIT: /* 月明りの泉に落ちる花びら */
if (sd != ssd && //本人以外で
- ((ssd->status.class == 19 && sd->status.class == 20) || (ssd->status.class == 20 && sd->status.class == 19) || (ssd->status.class == 4020 && sd->status.class == 4021) || (ssd->status.class == 4021 && sd->status.class == 4020) || (ssd->status.class == 20 && sd->status.class == 4020) || (ssd->status.class == 19 && sd->status.class == 4021)) && //自分がダンサーならバードで
+ ((ssd->status.pc_class == 19 && sd->status.pc_class == 20) ||
+ (ssd->status.pc_class == 20 && sd->status.pc_class == 19) ||
+ (ssd->status.pc_class == 4020 && sd->status.pc_class == 4021) ||
+ (ssd->status.pc_class == 4021 && sd->status.pc_class == 4020) ||
+ (ssd->status.pc_class == 20 && sd->status.pc_class == 4020) ||
+ (ssd->status.pc_class == 19 && sd->status.pc_class == 4021)) && //自分がダンサーならバードで
pc_checkskill (sd, skillid) > 0 && //スキルを持っていて
(*c) == 0 && //最初の一人で
sd->status.party_id == ssd->status.party_id && //パーティーが同じで
@@ -7339,7 +7334,7 @@ static int skill_check_condition_mob_master_sub (struct block_list *bl,
return 0;
nullpo_retr (0, c = va_arg (ap, int *));
- if (md->class == mob_class && md->master_id == src_id)
+ if (md->mob_class == mob_class && md->master_id == src_id)
(*c)++;
return 0;
}
@@ -8235,7 +8230,7 @@ int skill_use_id (struct map_session_data *sd, int target_id,
/* 詠唱反応モンスター */
if (bl->type == BL_MOB && (md = (struct mob_data *) bl)
- && mob_db[md->class].mode & 0x10 && md->state.state != MS_ATTACK
+ && mob_db[md->mob_class].mode & 0x10 && md->state.state != MS_ATTACK
&& sd->invincible_timer == -1)
{
md->target_id = sd->bl.id;
diff --git a/src/map/skill.h b/src/map/skill.h
index d0a698c..6c8795a 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -38,8 +38,8 @@ extern struct skill_db skill_db[MAX_SKILL_DB];
struct skill_name_db
{
int id; // skill id
- char *name; // search strings
- char *desc; // description that shows up for search's
+ const char *name; // search strings
+ const char *desc; // description that shows up for search's
};
extern struct skill_name_db skill_names[];
diff --git a/src/tool/eathena-monitor.c b/src/tool/eathena-monitor.c
index 6e26706..1b1abd5 100644
--- a/src/tool/eathena-monitor.c
+++ b/src/tool/eathena-monitor.c
@@ -76,7 +76,7 @@ pid_t pid_login, pid_map, pid_char;
const char* make_path (const char* base, const char* path) {
size_t base_len = strlen(base);
size_t path_len = strlen(path);
- char* out = malloc(base_len + 1 + path_len + 1);
+ char* out = (char *)malloc(base_len + 1 + path_len + 1);
memcpy(out, base, base_len);
out[base_len] = '/';
memcpy(out + base_len + 1, path, path_len);