summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/char/char.cpp3
-rw-r--r--src/char/int_party.cpp3
-rw-r--r--src/char/int_storage.cpp14
-rw-r--r--src/char/int_storage.hpp1
-rw-r--r--src/char/inter.cpp19
-rw-r--r--src/char/inter.hpp3
-rw-r--r--src/common/nullpo.cpp67
-rw-r--r--src/common/nullpo.hpp33
-rw-r--r--src/common/socket.hpp1
-rw-r--r--src/map/atcommand.cpp13
-rw-r--r--src/map/atcommand.hpp8
-rw-r--r--src/map/battle.cpp142
-rw-r--r--src/map/battle.hpp31
-rw-r--r--src/map/chat.cpp214
-rw-r--r--src/map/chat.hpp10
-rw-r--r--src/map/chrif.cpp61
-rw-r--r--src/map/chrif.hpp2
-rw-r--r--src/map/clif.cpp1244
-rw-r--r--src/map/clif.hpp20
-rw-r--r--src/map/intif.cpp19
-rw-r--r--src/map/intif.hpp1
-rw-r--r--src/map/itemdb.cpp17
-rw-r--r--src/map/itemdb.hpp8
-rw-r--r--src/map/magic-interpreter-parser.ypp1
-rw-r--r--src/map/magic-interpreter.hpp4
-rw-r--r--src/map/map.cpp49
-rw-r--r--src/map/map.hpp23
-rw-r--r--src/map/map.t.hpp3
-rw-r--r--src/map/mob.cpp75
-rw-r--r--src/map/mob.hpp2
-rw-r--r--src/map/npc.cpp61
-rw-r--r--src/map/npc.hpp4
-rw-r--r--src/map/party.cpp46
-rw-r--r--src/map/party.hpp3
-rw-r--r--src/map/path.cpp60
-rw-r--r--src/map/pc.cpp563
-rw-r--r--src/map/pc.hpp39
-rw-r--r--src/map/script.cpp374
-rw-r--r--src/map/skill-pools.cpp14
-rw-r--r--src/map/skill.cpp259
-rw-r--r--src/map/skill.hpp36
-rw-r--r--src/map/storage.cpp104
-rw-r--r--src/map/storage.hpp11
-rw-r--r--src/map/tmw.cpp8
-rw-r--r--src/map/tmw.hpp3
-rw-r--r--warnings2
46 files changed, 822 insertions, 2856 deletions
diff --git a/src/char/char.cpp b/src/char/char.cpp
index 899461a..67268f4 100644
--- a/src/char/char.cpp
+++ b/src/char/char.cpp
@@ -222,7 +222,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->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->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, uint16_t(p->option), p->karma, p->manner, //
p->party_id, 0/*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);
@@ -2226,7 +2226,6 @@ void parse_tologin(int fd)
return;
}
}
- RFIFOFLUSH(fd);
}
//--------------------------------
diff --git a/src/char/int_party.cpp b/src/char/int_party.cpp
index 4967676..f33febd 100644
--- a/src/char/int_party.cpp
+++ b/src/char/int_party.cpp
@@ -19,8 +19,11 @@ struct dbt *party_db;
static
int party_newid = 100;
+static
int mapif_party_broken(int party_id, int flag);
+static
int party_check_empty(struct party *p);
+static
int mapif_parse_PartyLeave(int fd, int party_id, int account_id);
// パーティデータの文字列への変換
diff --git a/src/char/int_storage.cpp b/src/char/int_storage.cpp
index cdc8d69..b0bc300 100644
--- a/src/char/int_storage.cpp
+++ b/src/char/int_storage.cpp
@@ -172,20 +172,6 @@ int inter_storage_init(void)
}
static
-void storage_db_final(db_key_t, db_val_t data)
-{
- struct storage *p = (struct storage *) data;
- if (p)
- free(p);
-}
-
-void inter_storage_final(void)
-{
- numdb_final(storage_db, storage_db_final);
- return;
-}
-
-static
void inter_storage_save_sub(db_key_t, db_val_t data, FILE *fp)
{
char line[65536];
diff --git a/src/char/int_storage.hpp b/src/char/int_storage.hpp
index a5e9e0b..286c5a6 100644
--- a/src/char/int_storage.hpp
+++ b/src/char/int_storage.hpp
@@ -2,7 +2,6 @@
#define INT_STORAGE_HPP
int inter_storage_init(void);
-void inter_storage_final(void);
int inter_storage_save(void);
int inter_storage_delete(int account_id);
struct storage *account2storage(int account_id);
diff --git a/src/char/inter.cpp b/src/char/inter.cpp
index 98ea03c..631f804 100644
--- a/src/char/inter.cpp
+++ b/src/char/inter.cpp
@@ -1,6 +1,5 @@
#include "inter.hpp"
-#include <cstdarg> // exception to "no va_list" rule
#include <cstdlib>
#include <cstring>
@@ -239,24 +238,6 @@ int inter_config_read(const char *cfgName)
return 0;
}
-// ログ書き出し
-int inter_log(const char *fmt, ...)
-{
- FILE *logfp;
- va_list ap;
-
- va_start(ap, fmt);
- logfp = fopen_(inter_log_filename, "a");
- if (logfp)
- {
- vfprintf(logfp, fmt, ap);
- fclose_(logfp);
- }
- va_end(ap);
-
- return 0;
-}
-
// セーブ
int inter_save(void)
{
diff --git a/src/char/inter.hpp b/src/char/inter.hpp
index f8cb3da..0adbf03 100644
--- a/src/char/inter.hpp
+++ b/src/char/inter.hpp
@@ -7,9 +7,6 @@ int inter_parse_frommap(int fd);
int inter_check_length(int fd, int length);
-__attribute__((format(printf, 1, 2)))
-int inter_log(const char *fmt, ...);
-
#define inter_cfgName "conf/inter_athena.conf"
extern int party_share_level;
diff --git a/src/common/nullpo.cpp b/src/common/nullpo.cpp
index 53ed37d..8aa2e6e 100644
--- a/src/common/nullpo.cpp
+++ b/src/common/nullpo.cpp
@@ -1,58 +1,10 @@
#include "nullpo.hpp"
-#include <cstdarg> // exception to "no va_list" rule
#include <cstdio>
#include <cstring>
-static
-void nullpo_info_core(const char *file, int line, const char *func);
-__attribute__((format(printf, 4, 0)))
-static
-void nullpo_info_core(const char *file, int line, const char *func,
- const char *fmt, va_list ap);
-
-/// Null check and print format
-bool nullpo_chk_f(const char *file, int line, const char *func,
- const void *target, const char *fmt, ...)
-{
- va_list ap;
-
- if (target)
- return 0;
-
- va_start(ap, fmt);
- nullpo_info_core(file, line, func, fmt, ap);
- va_end(ap);
- return 1;
-}
-bool nullpo_chk(const char *file, int line, const char *func,
- const void *target)
-{
- if (target)
- return 0;
-
- nullpo_info_core(file, line, func);
- return 1;
-}
-
-/// External functions
-void nullpo_info_f(const char *file, int line, const char *func,
- const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- nullpo_info_core(file, line, func, fmt, ap);
- va_end(ap);
-}
-void nullpo_info(const char *file, int line, const char *func)
-{
- nullpo_info_core(file, line, func);
-}
-
/// Actual output function
-static
-void nullpo_info_core(const char *file, int line, const char *func)
+void nullpo_info(const char *file, int line, const char *func)
{
if (!file)
file = "??";
@@ -62,15 +14,12 @@ void nullpo_info_core(const char *file, int line, const char *func)
fprintf(stderr, "%s:%d: in func `%s': NULL pointer\n", file, line, func);
}
-static
-void nullpo_info_core(const char *file, int line, const char *func,
- const char *fmt, va_list ap)
+bool nullpo_chk(const char *file, int line, const char *func,
+ const void *target)
{
- nullpo_info_core(file, line, func);
- if (fmt && *fmt)
- {
- vfprintf(stderr, fmt, ap);
- if (fmt[strlen(fmt) - 1] != '\n')
- fputc('\n', stderr);
- }
+ if (target)
+ return 0;
+
+ nullpo_info(file, line, func);
+ return 1;
}
diff --git a/src/common/nullpo.hpp b/src/common/nullpo.hpp
index 25ab2b9..b729d94 100644
--- a/src/common/nullpo.hpp
+++ b/src/common/nullpo.hpp
@@ -12,50 +12,23 @@
# ifdef NULLPO_CHECK
# define NLP_MARK __FILE__, __LINE__, __func__
-# define nullpo_ret(t) \
- if (nullpo_chk(NLP_MARK, t)) \
- return 0;
-# define nullpo_retv(t) \
- if (nullpo_chk(NLP_MARK, t)) \
- return;
# define nullpo_retr(ret, t) \
if (nullpo_chk(NLP_MARK, t)) \
return ret;
-# define nullpo_ret_f(t, fmt, ...) \
- if (nullpo_chk_f(NLP_MARK, t, fmt, ##__VA_ARGS__)) \
- return 0;
-# define nullpo_retv_f(t, fmt, ...) \
- if (nullpo_chk_f(NLP_MARK, t, fmt, ##__VA_ARGS__)) \
- return;
-# define nullpo_retr_f(ret, t, fmt, ...) \
- if (nullpo_chk_f(NLP_MARK, t, fmt, ##__VA_ARGS__)) \
- return ret;
# else // NULLPO_CHECK
-# define nullpo_ret(t) t;
-# define nullpo_retv(t) t;
# define nullpo_retr(ret, t) t;
-# define nullpo_ret_f(t, fmt, ...) t;
-# define nullpo_retv_f(t, fmt, ...) t;
-# define nullpo_retr_f(ret, t, fmt, ...) t;
# endif // NULLPO_CHECK
+# define nullpo_ret(t) nullpo_retr(0, t)
+# define nullpo_retv(t) nullpo_retr(, t)
+
# include "sanity.hpp"
/// Used by macros in this header
bool nullpo_chk(const char *file, int line, const char *func,
const void *target);
-/// Used by macros in this header
-bool nullpo_chk_f(const char *file, int line, const char *func,
- const void *target, const char *fmt, ...)
- __attribute__((format(printf, 5, 6)));
-
/// Used only by map/battle.c
void nullpo_info(const char *file, int line, const char *func);
-/// Not used
-void nullpo_info_f(const char *file, int line, const char *func,
- const char *fmt, ...)
- __attribute__((format(printf, 4, 5)));
-
#endif // NULLPO_HPP
diff --git a/src/common/socket.hpp b/src/common/socket.hpp
index 08dc3f6..ac7fbae 100644
--- a/src/common/socket.hpp
+++ b/src/common/socket.hpp
@@ -20,7 +20,6 @@
/// Done reading
void RFIFOSKIP(int fd, size_t len);
/// Internal - clean up by discarding handled bytes
-// Atm this is also called in char/char.c, but that is unnecessary
# define RFIFOFLUSH(fd) (memmove(session[fd]->rdata,RFIFOP(fd,0),RFIFOREST(fd)),\
session[fd]->rdata_size=RFIFOREST(fd),\
session[fd]->rdata_pos=0)
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index f38c62a..5a43b54 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -46,9 +46,9 @@ ATCOMMAND_FUNC(setup);
ATCOMMAND_FUNC(broadcast);
ATCOMMAND_FUNC(localbroadcast);
ATCOMMAND_FUNC(charwarp);
-//ATCOMMAND_FUNC (warp);
+ATCOMMAND_FUNC(warp);
ATCOMMAND_FUNC(where);
-//ATCOMMAND_FUNC (goto);
+ATCOMMAND_FUNC(goto);
ATCOMMAND_FUNC(jump);
ATCOMMAND_FUNC(who);
ATCOMMAND_FUNC(whogroup);
@@ -66,7 +66,7 @@ ATCOMMAND_FUNC(kill);
ATCOMMAND_FUNC(alive);
ATCOMMAND_FUNC(kami);
ATCOMMAND_FUNC(heal);
-//ATCOMMAND_FUNC (item);
+ATCOMMAND_FUNC(item);
ATCOMMAND_FUNC(itemreset);
ATCOMMAND_FUNC(itemcheck);
ATCOMMAND_FUNC(baselevelup);
@@ -77,7 +77,7 @@ ATCOMMAND_FUNC(pvpoff);
ATCOMMAND_FUNC(pvpon);
ATCOMMAND_FUNC(model);
ATCOMMAND_FUNC(go);
-//ATCOMMAND_FUNC (spawn);
+ATCOMMAND_FUNC(spawn);
ATCOMMAND_FUNC(killmonster);
ATCOMMAND_FUNC(killmonster2);
ATCOMMAND_FUNC(produce);
@@ -88,7 +88,7 @@ ATCOMMAND_FUNC(statuspoint);
ATCOMMAND_FUNC(skillpoint);
ATCOMMAND_FUNC(zeny);
ATCOMMAND_FUNC(param);
-//ATCOMMAND_FUNC (recall);
+ATCOMMAND_FUNC(recall);
ATCOMMAND_FUNC(recallall);
ATCOMMAND_FUNC(revive);
ATCOMMAND_FUNC(character_stats);
@@ -628,6 +628,9 @@ void gm_log(const char *fmt, ...)
fflush(gm_logfile);
}
+static
+AtCommandType atcommand(const int level, const char *message,
+ struct AtCommandInfo * info);
/*==========================================
*is_atcommand @コマンドに存在するかどうか確認する
*------------------------------------------
diff --git a/src/map/atcommand.hpp b/src/map/atcommand.hpp
index 86db2a5..50ad9b2 100644
--- a/src/map/atcommand.hpp
+++ b/src/map/atcommand.hpp
@@ -193,16 +193,8 @@ typedef struct AtCommandInfo
AtCommandType is_atcommand(const int fd, struct map_session_data *sd,
const char *message, int gmlvl);
-AtCommandType atcommand(const int level, const char *message,
- AtCommandInfo * info);
int get_atcommand_level(const AtCommandType type);
-int atcommand_item(const int fd, struct map_session_data *sd, const char *command, const char *message); // [Valaris]
-int atcommand_warp(const int fd, struct map_session_data *sd, const char *command, const char *message); // [Yor]
-int atcommand_spawn(const int fd, struct map_session_data *sd, const char *command, const char *message); // [Valaris]
-int atcommand_goto(const int fd, struct map_session_data *sd, const char *command, const char *message); // [Yor]
-int atcommand_recall(const int fd, struct map_session_data *sd, const char *command, const char *message); // [Yor]
-
int atcommand_config_read(const char *cfgName);
__attribute__((format(printf, 2, 3)))
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index d76abd5..43a4719 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -41,10 +41,11 @@ int distance(int x0, int y0, int x1, int y1)
* 戻りは整数で0以上
*------------------------------------------
*/
+static
int battle_counttargeted(struct block_list *bl, struct block_list *src,
int target_lv)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_PC)
return pc_counttargeted((struct map_session_data *) bl, src,
target_lv);
@@ -60,7 +61,7 @@ int battle_counttargeted(struct block_list *bl, struct block_list *src,
*/
int battle_get_class(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
return ((struct mob_data *) bl)->mob_class;
else if (bl->type == BL_PC && (struct map_session_data *) bl)
@@ -76,7 +77,7 @@ int battle_get_class(struct block_list *bl)
*/
int battle_get_dir(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
return ((struct mob_data *) bl)->dir;
else if (bl->type == BL_PC && (struct map_session_data *) bl)
@@ -92,7 +93,7 @@ int battle_get_dir(struct block_list *bl)
*/
int battle_get_lv(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
return ((struct mob_data *) bl)->stats[MOB_LV];
else if (bl->type == BL_PC && (struct map_session_data *) bl)
@@ -108,7 +109,7 @@ int battle_get_lv(struct block_list *bl)
*/
int battle_get_range(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
return mob_db[((struct mob_data *) bl)->mob_class].range;
else if (bl->type == BL_PC && (struct map_session_data *) bl)
@@ -186,7 +187,7 @@ int battle_get_str(struct block_list *bl)
int str = 0;
eptr<struct status_change, StatusChange> sc_data;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->type == BL_MOB && ((struct mob_data *) bl))
str = ((struct mob_data *) bl)->stats[MOB_STR];
@@ -226,7 +227,7 @@ int battle_get_agi(struct block_list *bl)
int agi = 0;
eptr<struct status_change, StatusChange> sc_data;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
agi = ((struct mob_data *) bl)->stats[MOB_AGI];
@@ -265,7 +266,7 @@ int battle_get_vit(struct block_list *bl)
int vit = 0;
eptr<struct status_change, StatusChange> sc_data;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
vit = ((struct mob_data *) bl)->stats[MOB_VIT];
@@ -294,7 +295,7 @@ int battle_get_int(struct block_list *bl)
int int_ = 0;
eptr<struct status_change, StatusChange> sc_data;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
int_ = ((struct mob_data *) bl)->stats[MOB_INT];
@@ -332,7 +333,7 @@ int battle_get_dex(struct block_list *bl)
int dex = 0;
eptr<struct status_change, StatusChange> sc_data;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
dex = ((struct mob_data *) bl)->stats[MOB_DEX];
@@ -375,7 +376,7 @@ int battle_get_luk(struct block_list *bl)
int luk = 0;
eptr<struct status_change, StatusChange> sc_data;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
luk = ((struct mob_data *) bl)->stats[MOB_LUK];
@@ -401,6 +402,7 @@ int battle_get_luk(struct block_list *bl)
* 戻りは整数で1以上
*------------------------------------------
*/
+static
int battle_get_flee(struct block_list *bl)
{
int flee = 1;
@@ -440,6 +442,7 @@ int battle_get_flee(struct block_list *bl)
* 戻りは整数で1以上
*------------------------------------------
*/
+static
int battle_get_hit(struct block_list *bl)
{
int hit = 1;
@@ -479,6 +482,7 @@ int battle_get_hit(struct block_list *bl)
* 戻りは整数で1以上
*------------------------------------------
*/
+static
int battle_get_flee2(struct block_list *bl)
{
int flee2 = 1;
@@ -555,6 +559,7 @@ int battle_get_critical(struct block_list *bl)
* 戻りは整数で1以上
*------------------------------------------
*/
+static
int battle_get_baseatk(struct block_list *bl)
{
eptr<struct status_change, StatusChange> sc_data;
@@ -590,12 +595,13 @@ int battle_get_baseatk(struct block_list *bl)
* 戻りは整数で0以上
*------------------------------------------
*/
+static
int battle_get_atk(struct block_list *bl)
{
eptr<struct status_change, StatusChange> sc_data;
int atk = 0;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->type == BL_PC && (struct map_session_data *) bl)
atk = ((struct map_session_data *) bl)->watk;
@@ -624,7 +630,7 @@ int battle_get_atk(struct block_list *bl)
static
int battle_get_atk_(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_PC && (struct map_session_data *) bl)
{
int atk = ((struct map_session_data *) bl)->watk_;
@@ -642,9 +648,10 @@ int battle_get_atk_(struct block_list *bl)
* 戻りは整数で0以上
*------------------------------------------
*/
+static
int battle_get_atk2(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_PC && (struct map_session_data *) bl)
return ((struct map_session_data *) bl)->watk2;
else
@@ -687,7 +694,7 @@ int battle_get_atk2(struct block_list *bl)
static
int battle_get_atk_2(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_PC)
return ((struct map_session_data *) bl)->watk_2;
else
@@ -703,7 +710,7 @@ static
int battle_get_matk1(struct block_list *bl)
{
eptr<struct status_change, StatusChange> sc_data;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->type == BL_MOB)
{
@@ -730,7 +737,7 @@ static
int battle_get_matk2(struct block_list *bl)
{
eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB)
{
int matk, int_ = battle_get_int(bl);
@@ -758,7 +765,7 @@ int battle_get_def(struct block_list *bl)
int def = 0, skilltimer = -1;
SkillID skillid = SkillID::ZERO;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->type == BL_PC && (struct map_session_data *) bl)
{
@@ -831,7 +838,7 @@ int battle_get_mdef(struct block_list *bl)
eptr<struct status_change, StatusChange> sc_data;
int mdef = 0;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->type == BL_PC && (struct map_session_data *) bl)
mdef = ((struct map_session_data *) bl)->mdef;
@@ -909,7 +916,7 @@ int battle_get_mdef2(struct block_list *bl)
int mdef2 = 0;
eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB)
mdef2 =
((struct mob_data *) bl)->stats[MOB_INT] +
@@ -1139,7 +1146,7 @@ int battle_get_dmotion(struct block_list *bl)
int ret;
eptr<struct status_change, StatusChange> sc_data;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
{
@@ -1189,12 +1196,13 @@ int battle_get_element(struct block_list *bl)
return ret;
}
+static
int battle_get_attack_element(struct block_list *bl)
{
int ret = 0;
eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(bl);
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
ret = 0;
else if (bl->type == BL_PC && (struct map_session_data *) bl)
@@ -1219,9 +1227,10 @@ int battle_get_attack_element(struct block_list *bl)
return ret;
}
+static
int battle_get_attack_element2(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_PC && (struct map_session_data *) bl)
{
int ret = ((struct map_session_data *) bl)->atk_ele_;
@@ -1250,7 +1259,7 @@ int battle_get_attack_element2(struct block_list *bl)
int battle_get_party_id(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_PC && (struct map_session_data *) bl)
return ((struct map_session_data *) bl)->status.party_id;
else if (bl->type == BL_MOB && (struct mob_data *) bl)
@@ -1268,7 +1277,7 @@ int battle_get_party_id(struct block_list *bl)
int battle_get_race(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
return mob_db[((struct mob_data *) bl)->mob_class].race;
else if (bl->type == BL_PC && (struct map_session_data *) bl)
@@ -1277,6 +1286,7 @@ int battle_get_race(struct block_list *bl)
return 0;
}
+static
int battle_get_size(struct block_list *bl)
{
nullpo_retr(1, bl);
@@ -1299,7 +1309,7 @@ int battle_get_mode(struct block_list *bl)
int battle_get_mexp(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
{
const struct mob_data *mob = (struct mob_data *) bl;
@@ -1363,7 +1373,7 @@ short *battle_get_sc_count(struct block_list *bl)
Opt1 *battle_get_opt1(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
return &((struct mob_data *) bl)->opt1;
else if (bl->type == BL_PC && (struct map_session_data *) bl)
@@ -1375,7 +1385,7 @@ Opt1 *battle_get_opt1(struct block_list *bl)
Opt2 *battle_get_opt2(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
return &((struct mob_data *) bl)->opt2;
else if (bl->type == BL_PC && (struct map_session_data *) bl)
@@ -1387,7 +1397,7 @@ Opt2 *battle_get_opt2(struct block_list *bl)
Opt3 *battle_get_opt3(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
return &((struct mob_data *) bl)->opt3;
else if (bl->type == BL_PC && (struct map_session_data *) bl)
@@ -1399,7 +1409,7 @@ Opt3 *battle_get_opt3(struct block_list *bl)
Option *battle_get_option(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB && (struct mob_data *) bl)
return &((struct mob_data *) bl)->option;
else if (bl->type == BL_PC && (struct map_session_data *) bl)
@@ -1418,31 +1428,6 @@ struct battle_delay_damage_
int damage;
int flag;
};
-static
-void battle_delay_damage_sub(timer_id, tick_t, custom_id_t id, custom_data_t data)
-{
- struct battle_delay_damage_ *dat = (struct battle_delay_damage_ *) data;
- if (dat && map_id2bl(id) == dat->src && dat->target->prev != NULL)
- battle_damage(dat->src, dat->target, dat->damage, dat->flag);
- free(dat);
-}
-
-int battle_delay_damage(unsigned int tick, struct block_list *src,
- struct block_list *target, int damage, int flag)
-{
- struct battle_delay_damage_ *dat;
- CREATE(dat, struct battle_delay_damage_, 1);
-
- nullpo_retr(0, src);
- nullpo_retr(0, target);
-
- dat->src = src;
- dat->target = target;
- dat->damage = damage;
- dat->flag = flag;
- add_timer(tick, battle_delay_damage_sub, src->id, (int) dat);
- return 0;
-}
// 実際にHPを操作
int battle_damage(struct block_list *bl, struct block_list *target,
@@ -1452,7 +1437,7 @@ int battle_damage(struct block_list *bl, struct block_list *target,
short *sc_count;
int i;
- nullpo_retr(0, target); //blはNULLで呼ばれることがあるので他でチェック
+ nullpo_ret(target); //blはNULLで呼ばれることがあるので他でチェック
if (damage == 0)
return 0;
@@ -1534,7 +1519,7 @@ int battle_damage(struct block_list *bl, struct block_list *target,
int battle_heal(struct block_list *bl, struct block_list *target, int hp,
int sp, int flag)
{
- nullpo_retr(0, target); //blはNULLで呼ばれることがあるので他でチェック
+ nullpo_ret(target); //blはNULLで呼ばれることがあるので他でチェック
if (target->type == BL_PC
&& pc_isdead((struct map_session_data *) target))
@@ -1555,7 +1540,7 @@ int battle_heal(struct block_list *bl, struct block_list *target, int hp,
// 攻撃停止
int battle_stopattack(struct block_list *bl)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB)
return mob_stopattack((struct mob_data *) bl);
else if (bl->type == BL_PC)
@@ -1566,7 +1551,7 @@ int battle_stopattack(struct block_list *bl)
// 移動停止
int battle_stopwalking(struct block_list *bl, int type)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB)
return mob_stop_walking((struct mob_data *) bl, type);
else if (bl->type == BL_PC)
@@ -1598,6 +1583,7 @@ int battle_attr_fix(int damage, int atk_elem, int def_elem)
* ダメージ最終計算
*------------------------------------------
*/
+static
int battle_calc_damage(struct block_list *src, struct block_list *bl,
int damage, int div_,
SkillID skill_num, int, int flag)
@@ -1607,7 +1593,7 @@ int battle_calc_damage(struct block_list *src, struct block_list *bl,
eptr<struct status_change, StatusChange> sc_data;
short *sc_count;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB)
md = (struct mob_data *) bl;
@@ -1806,7 +1792,7 @@ int battle_addmastery(struct map_session_data *sd, struct block_list *target,
int weapon;
damage = 0;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
// デーモンベイン(+3 〜 +30) vs 不死 or 悪魔 (死人は含めない?)
if ((skill = pc_checkskill(sd, AL_DEMONBANE)) > 0
@@ -4030,6 +4016,7 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src,
* 武器ダメージ計算
*------------------------------------------
*/
+static
struct Damage battle_calc_weapon_attack(struct block_list *src,
struct block_list *target,
SkillID skill_num, int skill_lv,
@@ -4109,6 +4096,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,
* 魔法ダメージ計算
*------------------------------------------
*/
+static
struct Damage battle_calc_magic_attack(struct block_list *bl,
struct block_list *target,
SkillID skill_num, int skill_lv, int flag)
@@ -4439,6 +4427,7 @@ struct Damage battle_calc_magic_attack(struct block_list *bl,
* その他ダメージ計算
*------------------------------------------
*/
+static
struct Damage battle_calc_misc_attack(struct block_list *bl,
struct block_list *target,
SkillID skill_num, int skill_lv, int flag)
@@ -4637,8 +4626,8 @@ int battle_weapon_attack(struct block_list *src, struct block_list *target,
int damage, rdamage = 0;
struct Damage wd;
- nullpo_retr(0, src);
- nullpo_retr(0, target);
+ nullpo_ret(src);
+ nullpo_ret(target);
if (src->type == BL_PC)
sd = (struct map_session_data *) src;
@@ -5098,8 +5087,8 @@ int battle_check_target(struct block_list *src, struct block_list *target,
int s_p, t_p;
struct block_list *ss = src;
- nullpo_retr(0, src);
- nullpo_retr(0, target);
+ nullpo_ret(src);
+ nullpo_ret(target);
if (flag & 0x40000)
{ // 反転フラグ
@@ -5258,8 +5247,8 @@ int battle_check_range(struct block_list *src, struct block_list *bl,
struct walkpath_data wpd;
int arange;
- nullpo_retr(0, src);
- nullpo_retr(0, bl);
+ nullpo_ret(src);
+ nullpo_ret(bl);
dx = abs(bl->x - src->x);
dy = abs(bl->y - src->y);
@@ -5292,23 +5281,6 @@ int battle_check_range(struct block_list *src, struct block_list *bl,
}
/*==========================================
- * Return numerical value of a switch configuration (modified by [Yor])
- * on/off, english, fran軋is, deutsch, espal
- *------------------------------------------
- */
-int battle_config_switch (const char *str)
-{
- if (strcasecmp(str, "on") == 0 || strcasecmp(str, "yes") == 0
- || strcasecmp(str, "oui") == 0 || strcasecmp(str, "ja") == 0
- || strcasecmp(str, "si") == 0)
- return 1;
- if (strcasecmp(str, "off") == 0 || strcasecmp(str, "no") == 0
- || strcasecmp(str, "non") == 0 || strcasecmp(str, "nein") == 0)
- return 0;
- return atoi(str);
-}
-
-/*==========================================
* 設定ファイルを読み込む
*------------------------------------------
*/
@@ -5959,7 +5931,7 @@ int battle_config_read(const char *cfgName)
continue;
for (i = 0; i < sizeof(data) / (sizeof(data[0])); i++)
if (strcasecmp(w1, data[i].str) == 0)
- *data[i].val = battle_config_switch (w2);
+ *data[i].val = config_switch(w2);
if (strcasecmp(w1, "import") == 0)
battle_config_read(w2);
diff --git a/src/map/battle.hpp b/src/map/battle.hpp
index b268616..25590ad 100644
--- a/src/map/battle.hpp
+++ b/src/map/battle.hpp
@@ -29,22 +29,10 @@ struct block_list;
struct Damage battle_calc_attack(int attack_type,
struct block_list *bl, struct block_list *target,
SkillID skill_num, int skill_lv, int flag);
-struct Damage battle_calc_weapon_attack(
- struct block_list *bl, struct block_list *target,
- SkillID skill_num, int skill_lv, int flag);
-struct Damage battle_calc_magic_attack(
- struct block_list *bl, struct block_list *target,
- SkillID skill_num, int skill_lv, int flag);
-struct Damage battle_calc_misc_attack(
- struct block_list *bl, struct block_list *target,
- SkillID skill_num, int skill_lv, int flag);
// 属性修正計算
int battle_attr_fix(int damage, int atk_elem, int def_elem);
-// ダメージ最終計算
-int battle_calc_damage(struct block_list *src, struct block_list *bl,
- int damage, int div_, SkillID skill_num, int skill_lv, int flag);
enum
{ // 最終計算のフラグ
BF_WEAPON = 0x0001,
@@ -60,8 +48,6 @@ enum
};
// 実際にHPを増減
-int battle_delay_damage(unsigned int tick, struct block_list *src,
- struct block_list *target, int damage, int flag);
int battle_damage(struct block_list *bl, struct block_list *target,
int damage, int flag);
int battle_heal(struct block_list *bl, struct block_list *target, int hp,
@@ -75,9 +61,6 @@ int battle_stopwalking(struct block_list *bl, int type);
int battle_weapon_attack(struct block_list *bl, struct block_list *target,
unsigned int tick, int flag);
-// 各種パラメータを得る
-int battle_counttargeted(struct block_list *bl, struct block_list *src,
- int target_lv);
int battle_is_unarmed(struct block_list *bl);
int battle_get_class(struct block_list *bl);
int battle_get_dir(struct block_list *bl);
@@ -91,28 +74,18 @@ int battle_get_vit(struct block_list *bl);
int battle_get_int(struct block_list *bl);
int battle_get_dex(struct block_list *bl);
int battle_get_luk(struct block_list *bl);
-int battle_get_hit(struct block_list *bl);
-int battle_get_flee(struct block_list *bl);
int battle_get_def(struct block_list *bl);
int battle_get_mdef(struct block_list *bl);
-int battle_get_flee2(struct block_list *bl);
int battle_get_def2(struct block_list *bl);
int battle_get_mdef2(struct block_list *bl);
-int battle_get_baseatk(struct block_list *bl);
-int battle_get_atk(struct block_list *bl);
-int battle_get_atk2(struct block_list *bl);
int battle_get_speed(struct block_list *bl);
int battle_get_adelay(struct block_list *bl);
int battle_get_amotion(struct block_list *bl);
int battle_get_dmotion(struct block_list *bl);
int battle_get_element(struct block_list *bl);
-int battle_get_attack_element(struct block_list *bl);
-int battle_get_attack_element2(struct block_list *bl); //左手武器属性取得
#define battle_get_elem_type(bl) (battle_get_element(bl)%10)
-#define battle_get_elem_level(bl) (battle_get_element(bl)/10/2)
int battle_get_party_id(struct block_list *bl);
int battle_get_race(struct block_list *bl);
-int battle_get_size(struct block_list *bl);
int battle_get_mode(struct block_list *bl);
int battle_get_mexp(struct block_list *bl);
int battle_get_stat(int stat_id /* SP_VIT or similar */ ,
@@ -141,10 +114,6 @@ int battle_check_target(struct block_list *src, struct block_list *target,
int battle_check_range(struct block_list *src, struct block_list *bl,
int range);
-// 設定
-
-int battle_config_switch (const char *str); // [Valaris]
-
extern struct Battle_Config
{
int warp_point_debug;
diff --git a/src/map/chat.cpp b/src/map/chat.cpp
index 89ee992..b9c8dfe 100644
--- a/src/map/chat.cpp
+++ b/src/map/chat.cpp
@@ -12,90 +12,10 @@
#include "npc.hpp"
#include "pc.hpp"
+static
int chat_triggerevent(struct chat_data *cd);
-
-/*==========================================
- * チャットルーム作成
- *------------------------------------------
- */
-int chat_createchat(struct map_session_data *sd, int limit, int pub,
- const char *pass, const char *title, int titlelen)
-{
- struct chat_data *cd;
-
- nullpo_retr(0, sd);
-
- CREATE(cd, struct chat_data, 1);
-
- cd->limit = limit;
- cd->pub = pub;
- cd->users = 1;
- memcpy(cd->pass, pass, 8);
- if (titlelen >= sizeof(cd->title) - 1)
- titlelen = sizeof(cd->title) - 1;
- memcpy(cd->title, title, titlelen);
- cd->title[titlelen] = 0;
-
- cd->owner = (struct block_list **)(&cd->usersd[0]);
- cd->usersd[0] = sd;
- cd->bl.m = sd->bl.m;
- cd->bl.x = sd->bl.x;
- cd->bl.y = sd->bl.y;
- cd->bl.type = BL_CHAT;
-
- cd->bl.id = map_addobject(&cd->bl);
- if (cd->bl.id == 0)
- {
- clif_createchat(sd, 1);
- free(cd);
- return 0;
- }
- pc_setchatid(sd, cd->bl.id);
-
- clif_createchat(sd, 0);
- clif_dispchat(cd, 0);
-
- return 0;
-}
-
-/*==========================================
- * 既存チャットルームに参加
- *------------------------------------------
- */
-int chat_joinchat(struct map_session_data *sd, int chatid, const char *pass)
-{
- struct chat_data *cd;
-
- nullpo_retr(0, sd);
-
- cd = (struct chat_data *) map_id2bl(chatid);
- if (cd == NULL)
- return 1;
-
- if (cd->bl.m != sd->bl.m || cd->limit <= cd->users)
- {
- clif_joinchatfail(sd, 0);
- return 0;
- }
- if (cd->pub == 0 && strncmp(pass, cd->pass, 8))
- {
- clif_joinchatfail(sd, 1);
- return 0;
- }
-
- cd->usersd[cd->users] = sd;
- cd->users++;
-
- pc_setchatid(sd, cd->bl.id);
-
- clif_joinchatok(sd, cd); // 新たに参加した人には全員のリスト
- clif_addchat(cd, sd); // 既に中に居た人には追加した人の報告
- clif_dispchat(cd, 0); // 周囲の人には人数変化報告
-
- chat_triggerevent(cd); // イベント
-
- return 0;
-}
+static
+int chat_npckickall(struct chat_data *cd);
/*==========================================
* チャットルームから抜ける
@@ -159,113 +79,6 @@ int chat_leavechat(struct map_session_data *sd)
}
/*==========================================
- * チャットルームの持ち主を譲る
- *------------------------------------------
- */
-int chat_changechatowner(struct map_session_data *sd, const char *nextownername)
-{
- struct chat_data *cd;
- struct map_session_data *tmp_sd;
- int i, nextowner;
-
- nullpo_retr(1, sd);
-
- cd = (struct chat_data *) map_id2bl(sd->chatID);
- if (cd == NULL || (struct block_list *) sd != (*cd->owner))
- return 1;
-
- for (i = 1, nextowner = -1; i < cd->users; i++)
- {
- if (strcmp(cd->usersd[i]->status.name, nextownername) == 0)
- {
- nextowner = i;
- break;
- }
- }
- if (nextowner < 0) // そんな人は居ない
- return -1;
-
- clif_changechatowner(cd, cd->usersd[nextowner]);
- // 一旦消す
- clif_clearchat(cd, 0);
-
- // userlistの順番変更 (0が所有者なので)
- if ((tmp_sd = cd->usersd[0]) == NULL)
- return 1; //ありえるのかな?
- cd->usersd[0] = cd->usersd[nextowner];
- cd->usersd[nextowner] = tmp_sd;
-
- // 新しい所有者の位置へ変更
- cd->bl.x = cd->usersd[0]->bl.x;
- cd->bl.y = cd->usersd[0]->bl.y;
-
- // 再度表示
- clif_dispchat(cd, 0);
-
- return 0;
-}
-
-/*==========================================
- * チャットの状態(タイトル等)を変更
- *------------------------------------------
- */
-int chat_changechatstatus(struct map_session_data *sd, int limit, int pub,
- const char *pass, const char *title, int titlelen)
-{
- struct chat_data *cd;
-
- nullpo_retr(1, sd);
-
- cd = (struct chat_data *) map_id2bl(sd->chatID);
- if (cd == NULL || (struct block_list *) sd != (*cd->owner))
- return 1;
-
- cd->limit = limit;
- cd->pub = pub;
- memcpy(cd->pass, pass, 8);
- if (titlelen >= sizeof(cd->title) - 1)
- titlelen = sizeof(cd->title) - 1;
- memcpy(cd->title, title, titlelen);
- cd->title[titlelen] = 0;
-
- clif_changechatstatus(cd);
- clif_dispchat(cd, 0);
-
- return 0;
-}
-
-/*==========================================
- * チャットルームから蹴り出す
- *------------------------------------------
- */
-int chat_kickchat(struct map_session_data *sd, const char *kickusername)
-{
- struct chat_data *cd;
- int i, kickuser;
-
- nullpo_retr(1, sd);
-
- cd = (struct chat_data *) map_id2bl(sd->chatID);
- if (cd == NULL || (struct block_list *) sd != (*cd->owner))
- return 1;
-
- for (i = 0, kickuser = -1; i < cd->users; i++)
- {
- if (strcmp(cd->usersd[i]->status.name, kickusername) == 0)
- {
- kickuser = i;
- break;
- }
- }
- if (kickuser < 0) // そんな人は居ない
- return -1;
-
- chat_leavechat(cd->usersd[kickuser]);
-
- return 0;
-}
-
-/*==========================================
* npcチャットルーム作成
*------------------------------------------
*/
@@ -318,8 +131,8 @@ int chat_deletenpcchat(struct npc_data *nd)
{
struct chat_data *cd;
- nullpo_retr(0, nd);
- nullpo_retr(0, cd = (struct chat_data *) map_id2bl(nd->chat_id));
+ nullpo_ret(nd);
+ nullpo_ret(cd = (struct chat_data *) map_id2bl(nd->chat_id));
chat_npckickall(cd);
clif_clearchat(cd, 0);
@@ -335,7 +148,7 @@ int chat_deletenpcchat(struct npc_data *nd)
*/
int chat_triggerevent(struct chat_data *cd)
{
- nullpo_retr(0, cd);
+ nullpo_ret(cd);
if (cd->users >= cd->trigger && cd->npc_event[0])
npc_event_do(cd->npc_event);
@@ -348,7 +161,7 @@ int chat_triggerevent(struct chat_data *cd)
*/
int chat_enableevent(struct chat_data *cd)
{
- nullpo_retr(0, cd);
+ nullpo_ret(cd);
cd->trigger &= 0x7f;
chat_triggerevent(cd);
@@ -361,7 +174,7 @@ int chat_enableevent(struct chat_data *cd)
*/
int chat_disableevent(struct chat_data *cd)
{
- nullpo_retr(0, cd);
+ nullpo_ret(cd);
cd->trigger |= 0x80;
return 0;
@@ -373,7 +186,7 @@ int chat_disableevent(struct chat_data *cd)
*/
int chat_npckickall(struct chat_data *cd)
{
- nullpo_retr(0, cd);
+ nullpo_ret(cd);
while (cd->users > 0)
{
@@ -381,12 +194,3 @@ int chat_npckickall(struct chat_data *cd)
}
return 0;
}
-
-/*==========================================
- * 終了
- *------------------------------------------
- */
-int do_final_chat(void)
-{
- return 0;
-}
diff --git a/src/map/chat.hpp b/src/map/chat.hpp
index 9768343..28cc623 100644
--- a/src/map/chat.hpp
+++ b/src/map/chat.hpp
@@ -3,22 +3,12 @@
#include "map.hpp"
-int chat_createchat(struct map_session_data *, int, int, const char *, const char *,
- int);
-int chat_joinchat(struct map_session_data *, int, const char *);
int chat_leavechat(struct map_session_data *);
-int chat_changechatowner(struct map_session_data *, const char *);
-int chat_changechatstatus(struct map_session_data *, int, int, const char *,
- const char *, int);
-int chat_kickchat(struct map_session_data *, const char *);
int chat_createnpcchat(struct npc_data *nd, int limit, int pub, int trigger,
const char *title, int titlelen, const char *ev);
int chat_deletenpcchat(struct npc_data *nd);
int chat_enableevent(struct chat_data *cd);
int chat_disableevent(struct chat_data *cd);
-int chat_npckickall(struct chat_data *cd);
-
-int do_final_chat(void);
#endif // CHAT_HPP
diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp
index ba295c3..c387c91 100644
--- a/src/map/chrif.cpp
+++ b/src/map/chrif.cpp
@@ -788,7 +788,7 @@ int chrif_divorce(int char_id, int partner_id)
}
}
- nullpo_retr(0, sd = map_nick2sd(map_charid2nick(partner_id)));
+ nullpo_ret(sd = map_nick2sd(map_charid2nick(partner_id)));
if (sd->status.partner_id == char_id)
sd->status.partner_id = 0;
@@ -961,65 +961,6 @@ int chrif_reloadGMdb(void)
return 0;
}
-/*==========================================
- * Send rates and motd to char server [Wizputer]
- *------------------------------------------
- */
-int chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate)
-{
- char buf[256];
- FILE *fp;
- int i;
-
- WFIFOW(char_fd, 0) = 0x2b16;
- WFIFOW(char_fd, 2) = base_rate;
- WFIFOW(char_fd, 4) = job_rate;
- WFIFOW(char_fd, 6) = drop_rate;
-
- if ((fp = fopen_(motd_txt, "r")) != NULL)
- {
- if (fgets(buf, 250, fp) != NULL)
- {
- for (i = 0; buf[i]; i++)
- {
- if (buf[i] == '\r' || buf[i] == '\n')
- {
- buf[i] = 0;
- break;
- }
- }
- WFIFOW(char_fd, 8) = sizeof(buf) + 10;
- memcpy(WFIFOP(char_fd, 10), buf, sizeof(buf));
- }
- fclose_(fp);
- }
- else
- {
- WFIFOW(char_fd, 8) = sizeof(buf) + 10;
- memcpy(WFIFOP(char_fd, 10), buf, sizeof(buf));
- }
- WFIFOSET(char_fd, WFIFOW(char_fd, 8));
-
- return 0;
-}
-
-/*=========================================
- * Tell char-server charcter disconnected [Wizputer]
- *-----------------------------------------
- */
-
-int chrif_char_offline(struct map_session_data *sd)
-{
- if (char_fd < 0)
- return -1;
-
- WFIFOW(char_fd, 0) = 0x2b17;
- WFIFOL(char_fd, 2) = sd->status.char_id;
- WFIFOSET(char_fd, 6);
-
- return 0;
-}
-
/*========================================
* Map item IDs
*----------------------------------------
diff --git a/src/map/chrif.hpp b/src/map/chrif.hpp
index 97debb8..b262a7f 100644
--- a/src/map/chrif.hpp
+++ b/src/map/chrif.hpp
@@ -26,8 +26,6 @@ int chrif_char_ask_name(int id, char *character_name, short operation_type,
int second);
int chrif_saveaccountreg2(struct map_session_data *sd);
int chrif_reloadGMdb(void);
-int chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate);
-int chrif_char_offline(struct map_session_data *sd);
int chrif_send_divorce(int char_id);
int do_init_chrif (void);
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index 4a065fa..881cee6 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -125,6 +125,10 @@ int map_port = 5121;
int map_fd;
char talkie_mes[80];
+static
+int clif_changelook_towards(struct block_list *bl, int type, int val,
+ struct map_session_data *dstsd);
+
/*==========================================
* map鯖のip設定
*------------------------------------------
@@ -291,7 +295,7 @@ int clif_send(const uint8_t *buf, int len, struct block_list *bl, int type)
if (type != ALL_CLIENT)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_PC)
{
@@ -479,7 +483,7 @@ int clif_authok(struct map_session_data *sd)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (!sd)
return 0;
@@ -549,7 +553,7 @@ int clif_set009e(struct flooritem_data *fitem, uint8_t *buf)
{
int view;
- nullpo_retr(0, fitem);
+ nullpo_ret(fitem);
//009e <ID>.l <name ID>.w <identify flag>.B <X>.w <Y>.w <subX>.B <subY>.B <amount>.w
WBUFW(buf, 0) = 0x9e;
@@ -576,7 +580,7 @@ int clif_dropflooritem(struct flooritem_data *fitem)
{
uint8_t buf[64];
- nullpo_retr(0, fitem);
+ nullpo_ret(fitem);
if (fitem->item_data.nameid <= 0)
return 0;
@@ -594,7 +598,7 @@ int clif_clearflooritem(struct flooritem_data *fitem, int fd)
{
unsigned char buf[16];
- nullpo_retr(0, fitem);
+ nullpo_ret(fitem);
WBUFW(buf, 0) = 0xa1;
WBUFL(buf, 2) = fitem->bl.id;
@@ -620,7 +624,7 @@ int clif_clearchar(struct block_list *bl, int type)
{
unsigned char buf[16];
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
WBUFW(buf, 0) = 0x80;
WBUFL(buf, 2) = bl->id;
@@ -698,7 +702,7 @@ int clif_set0078(struct map_session_data *sd, unsigned char *buf)
{
int level = 0;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->disguise > 23 && sd->disguise < 4001)
{ // mob disguises [Valaris]
@@ -788,7 +792,7 @@ static
int clif_set007b(struct map_session_data *sd, unsigned char *buf)
{
int level = 0;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->disguise > 23 && sd->disguise < 4001)
{ // mob disguises [Valaris]
@@ -871,7 +875,7 @@ int clif_npc_class_change(struct block_list *bl, int npc_class, int type)
{
uint8_t buf[16];
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (npc_class >= MAX_PC_CLASS)
{
@@ -894,7 +898,7 @@ int clif_mob_class_change(struct mob_data *md, int class_)
uint8_t buf[16];
int view = mob_get_viewclass(class_);
- nullpo_retr(0, md);
+ nullpo_ret(md);
if (view >= MAX_PC_CLASS)
{
@@ -914,7 +918,7 @@ int clif_mob_equip(struct mob_data *md, int nameid)
{
unsigned char buf[16];
- nullpo_retr(0, md);
+ nullpo_ret(md);
memset(buf, 0, packet_len_table[0x1a4]);
@@ -939,7 +943,7 @@ int clif_mob0078(struct mob_data *md, unsigned char *buf)
memset(buf, 0, packet_len_table[0x78]);
- nullpo_retr(0, md);
+ nullpo_ret(md);
WBUFW(buf, 0) = 0x78;
WBUFL(buf, 2) = md->bl.id;
@@ -987,7 +991,7 @@ int clif_mob007b(struct mob_data *md, unsigned char *buf)
memset(buf, 0, packet_len_table[0x7b]);
- nullpo_retr(0, md);
+ nullpo_ret(md);
WBUFW(buf, 0) = 0x7b;
WBUFL(buf, 2) = md->bl.id;
@@ -1032,7 +1036,7 @@ int clif_mob007b(struct mob_data *md, unsigned char *buf)
static
int clif_npc0078(struct npc_data *nd, unsigned char *buf)
{
- nullpo_retr(0, nd);
+ nullpo_ret(nd);
memset(buf, 0, packet_len_table[0x78]);
@@ -1055,7 +1059,7 @@ int clif_npc0078(struct npc_data *nd, unsigned char *buf)
static
int clif_set01e1(struct map_session_data *sd, unsigned char *buf)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
WBUFW(buf, 0) = 0x1e1;
WBUFL(buf, 2) = sd->bl.id;
@@ -1108,7 +1112,7 @@ int clif_spawnpc(struct map_session_data *sd)
{
unsigned char buf[128];
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->disguise > 23 && sd->disguise < 4001)
{ // mob disguises [Valaris]
@@ -1181,7 +1185,7 @@ int clif_spawnnpc(struct npc_data *nd)
unsigned char buf[64];
int len;
- nullpo_retr(0, nd);
+ nullpo_ret(nd);
if (nd->npc_class < 0 || nd->flag & 1 || nd->npc_class == INVISIBLE_CLASS)
return 0;
@@ -1206,7 +1210,7 @@ int clif_spawn_fake_npc_for_player(struct map_session_data *sd, int fake_npc_id)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
if (!fd)
@@ -1248,7 +1252,7 @@ int clif_spawnmob(struct mob_data *md)
unsigned char buf[64];
int len;
- nullpo_retr(0, md);
+ nullpo_ret(md);
if (mob_get_viewclass(md->mob_class) > 23)
{
@@ -1283,7 +1287,7 @@ int clif_servertick(struct map_session_data *sd)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x7f;
@@ -1301,7 +1305,7 @@ int clif_walkok(struct map_session_data *sd)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x87;
@@ -1322,7 +1326,7 @@ int clif_movechar(struct map_session_data *sd)
int len;
unsigned char buf[256];
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
len = clif_set007b(sd, buf);
@@ -1379,7 +1383,7 @@ int clif_changemap(struct map_session_data *sd, const char *mapname, int x, int
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
@@ -1404,7 +1408,7 @@ int clif_changemapserver(struct map_session_data *sd, const char *mapname, int x
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x92;
@@ -1426,7 +1430,7 @@ int clif_fixpos(struct block_list *bl)
{
uint8_t buf[16];
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
WBUFW(buf, 0) = 0x88;
WBUFL(buf, 2) = bl->id;
@@ -1446,7 +1450,7 @@ int clif_npcbuysell(struct map_session_data *sd, int id)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xc4;
@@ -1465,8 +1469,8 @@ int clif_buylist(struct map_session_data *sd, struct npc_data *nd)
struct item_data *id;
int fd, i, val;
- nullpo_retr(0, sd);
- nullpo_retr(0, nd);
+ nullpo_ret(sd);
+ nullpo_ret(nd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xc6;
@@ -1498,7 +1502,7 @@ int clif_selllist(struct map_session_data *sd)
{
int fd, i, c = 0, val;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xc7;
@@ -1531,7 +1535,7 @@ int clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xb4;
@@ -1551,7 +1555,7 @@ int clif_scriptnext(struct map_session_data *sd, int npcid)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xb5;
@@ -1569,7 +1573,7 @@ int clif_scriptclose(struct map_session_data *sd, int npcid)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xb6;
@@ -1587,7 +1591,7 @@ int clif_scriptmenu(struct map_session_data *sd, int npcid, const char *mes)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xb7;
@@ -1607,7 +1611,7 @@ int clif_scriptinput(struct map_session_data *sd, int npcid)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x142;
@@ -1625,7 +1629,7 @@ int clif_scriptinputstr(struct map_session_data *sd, int npcid)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x1d4;
@@ -1644,7 +1648,7 @@ int clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x,
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x144;
@@ -1667,7 +1671,7 @@ int clif_cutin(struct map_session_data *sd, const char *image, int type)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x1b3;
@@ -1687,7 +1691,7 @@ int clif_additem(struct map_session_data *sd, int n, int amount, int fail)
int fd, j;
unsigned char *buf;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
buf = WFIFOP(fd, 0);
@@ -1778,7 +1782,7 @@ int clif_delitem(struct map_session_data *sd, int n, int amount)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xaf;
@@ -1799,7 +1803,7 @@ int clif_itemlist(struct map_session_data *sd)
int i, n, fd, arrow = -1;
unsigned char *buf;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
buf = WFIFOP(fd, 0);
@@ -1851,7 +1855,7 @@ int clif_equiplist(struct map_session_data *sd)
int i, j, n, fd;
unsigned char *buf;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
buf = WFIFOP(fd, 0);
@@ -1930,8 +1934,8 @@ int clif_storageitemlist(struct map_session_data *sd, struct storage *stor)
int i, n, fd;
unsigned char *buf;
- nullpo_retr(0, sd);
- nullpo_retr(0, stor);
+ nullpo_ret(sd);
+ nullpo_ret(stor);
fd = sd->fd;
buf = WFIFOP(fd, 0);
@@ -1940,7 +1944,7 @@ int clif_storageitemlist(struct map_session_data *sd, struct storage *stor)
{
if (stor->storage_[i].nameid <= 0)
continue;
- nullpo_retr(0, id = itemdb_search(stor->storage_[i].nameid));
+ nullpo_ret(id = itemdb_search(stor->storage_[i].nameid));
if (itemdb_isequip2(id))
continue;
@@ -1977,8 +1981,8 @@ int clif_storageequiplist(struct map_session_data *sd, struct storage *stor)
int i, j, n, fd;
unsigned char *buf;
- nullpo_retr(0, sd);
- nullpo_retr(0, stor);
+ nullpo_ret(sd);
+ nullpo_ret(stor);
fd = sd->fd;
buf = WFIFOP(fd, 0);
@@ -1987,7 +1991,7 @@ int clif_storageequiplist(struct map_session_data *sd, struct storage *stor)
{
if (stor->storage_[i].nameid <= 0)
continue;
- nullpo_retr(0, id = itemdb_search(stor->storage_[i].nameid));
+ nullpo_ret(id = itemdb_search(stor->storage_[i].nameid));
if (!itemdb_isequip2(id))
continue;
WBUFW(buf, n * 20 + 4) = i + 1;
@@ -2055,7 +2059,7 @@ int clif_updatestatus(struct map_session_data *sd, int type)
{
int fd, len = 8;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
@@ -2261,7 +2265,7 @@ int clif_changestatus(struct block_list *bl, int type, int val)
unsigned char buf[12];
struct map_session_data *sd = NULL;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_PC)
sd = (struct map_session_data *) bl;
@@ -2303,7 +2307,7 @@ int clif_changelook_towards(struct block_list *bl, int type, int val,
unsigned char *buf = dstsd ? WFIFOP(dstsd->fd, 0) : rbuf; // pick target buffer or general-purpose one
struct map_session_data *sd = NULL;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_PC)
sd = (struct map_session_data *) bl;
@@ -2407,7 +2411,7 @@ int clif_initialstatus(struct map_session_data *sd)
int fd;
unsigned char *buf;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
buf = WFIFOP(fd, 0);
@@ -2465,7 +2469,7 @@ int clif_arrowequip(struct map_session_data *sd, int val)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->attacktarget && sd->attacktarget > 0) // [Valaris]
sd->attacktarget = 0;
@@ -2487,7 +2491,7 @@ int clif_arrow_fail(struct map_session_data *sd, int type)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x013b;
@@ -2506,7 +2510,7 @@ int clif_statusupack(struct map_session_data *sd, int type, int ok, int val)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xbc;
@@ -2526,7 +2530,7 @@ int clif_equipitemack(struct map_session_data *sd, int n, int pos, int ok)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xaa;
@@ -2546,7 +2550,7 @@ int clif_unequipitemack(struct map_session_data *sd, int n, int pos, int ok)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xac;
@@ -2566,7 +2570,7 @@ int clif_misceffect(struct block_list *bl, int type)
{
uint8_t buf[32];
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
WBUFW(buf, 0) = 0x19b;
WBUFL(buf, 2) = bl->id;
@@ -2589,7 +2593,7 @@ int clif_changeoption(struct block_list *bl)
static const StatusChange scnum[] = { SC_FALCON, SC_RIDING };
int i;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
Option option = *battle_get_option(bl);
sc_data = battle_get_sc_data(bl);
@@ -2639,7 +2643,7 @@ int clif_changeoption(struct block_list *bl)
int clif_useitemack(struct map_session_data *sd, int index, int amount,
int ok)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (!ok)
{
@@ -2674,24 +2678,6 @@ int clif_useitemack(struct map_session_data *sd, int index, int amount,
*
*------------------------------------------
*/
-int clif_createchat(struct map_session_data *sd, int fail)
-{
- int fd;
-
- nullpo_retr(0, sd);
-
- fd = sd->fd;
- WFIFOW(fd, 0) = 0xd6;
- WFIFOB(fd, 2) = fail;
- WFIFOSET(fd, packet_len_table[0xd6]);
-
- return 0;
-}
-
-/*==========================================
- *
- *------------------------------------------
- */
int clif_dispchat(struct chat_data *cd, int fd)
{
uint8_t buf[128]; // 最大title(60バイト)+17
@@ -2721,31 +2707,6 @@ int clif_dispchat(struct chat_data *cd, int fd)
}
/*==========================================
- * chatの状態変更成功
- * 外部の人用と命令コード(d7->df)が違うだけ
- *------------------------------------------
- */
-int clif_changechatstatus(struct chat_data *cd)
-{
- uint8_t buf[128]; // 最大title(60バイト)+17
-
- if (cd == NULL || cd->usersd[0] == NULL)
- return 1;
-
- WBUFW(buf, 0) = 0xdf;
- WBUFW(buf, 2) = strlen(cd->title) + 17;
- WBUFL(buf, 4) = cd->usersd[0]->bl.id;
- WBUFL(buf, 8) = cd->bl.id;
- WBUFW(buf, 12) = cd->limit;
- WBUFW(buf, 14) = cd->users;
- WBUFB(buf, 16) = cd->pub;
- strcpy((char *)WBUFP(buf, 17), cd->title);
- clif_send(buf, WBUFW(buf, 2), &cd->usersd[0]->bl, CHAT);
-
- return 0;
-}
-
-/*==========================================
*
*------------------------------------------
*/
@@ -2753,7 +2714,7 @@ int clif_clearchat(struct chat_data *cd, int fd)
{
uint8_t buf[32];
- nullpo_retr(0, cd);
+ nullpo_ret(cd);
WBUFW(buf, 0) = 0xd8;
WBUFL(buf, 2) = cd->bl.id;
@@ -2774,76 +2735,12 @@ int clif_clearchat(struct chat_data *cd, int fd)
*
*------------------------------------------
*/
-int clif_joinchatfail(struct map_session_data *sd, int fail)
-{
- int fd;
-
- nullpo_retr(0, sd);
-
- fd = sd->fd;
-
- WFIFOW(fd, 0) = 0xda;
- WFIFOB(fd, 2) = fail;
- WFIFOSET(fd, packet_len_table[0xda]);
-
- return 0;
-}
-
-/*==========================================
- *
- *------------------------------------------
- */
-int clif_joinchatok(struct map_session_data *sd, struct chat_data *cd)
-{
- int fd;
- int i;
-
- nullpo_retr(0, sd);
- nullpo_retr(0, cd);
-
- fd = sd->fd;
- WFIFOW(fd, 0) = 0xdb;
- WFIFOW(fd, 2) = 8 + (28 * cd->users);
- WFIFOL(fd, 4) = cd->bl.id;
- for (i = 0; i < cd->users; i++)
- {
- WFIFOL(fd, 8 + i * 28) = (i != 0) || ((*cd->owner)->type == BL_NPC);
- memcpy(WFIFOP(fd, 8 + i * 28 + 4), cd->usersd[i]->status.name, 24);
- }
- WFIFOSET(fd, WFIFOW(fd, 2));
-
- return 0;
-}
-
-/*==========================================
- *
- *------------------------------------------
- */
-int clif_addchat(struct chat_data *cd, struct map_session_data *sd)
-{
- uint8_t buf[32];
-
- nullpo_retr(0, sd);
- nullpo_retr(0, cd);
-
- WBUFW(buf, 0) = 0x0dc;
- WBUFW(buf, 2) = cd->users;
- memcpy(WBUFP(buf, 4), sd->status.name, 24);
- clif_send(buf, packet_len_table[0xdc], &sd->bl, CHAT_WOS);
-
- return 0;
-}
-
-/*==========================================
- *
- *------------------------------------------
- */
int clif_changechatowner(struct chat_data *cd, struct map_session_data *sd)
{
uint8_t buf[64];
- nullpo_retr(0, sd);
- nullpo_retr(0, cd);
+ nullpo_ret(sd);
+ nullpo_ret(cd);
WBUFW(buf, 0) = 0xe1;
WBUFL(buf, 2) = 1;
@@ -2865,8 +2762,8 @@ int clif_leavechat(struct chat_data *cd, struct map_session_data *sd)
{
uint8_t buf[32];
- nullpo_retr(0, sd);
- nullpo_retr(0, cd);
+ nullpo_ret(sd);
+ nullpo_ret(cd);
WBUFW(buf, 0) = 0xdd;
WBUFW(buf, 2) = cd->users - 1;
@@ -2886,7 +2783,7 @@ int clif_traderequest(struct map_session_data *sd, const char *name)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xe5;
@@ -2904,7 +2801,7 @@ int clif_tradestart(struct map_session_data *sd, int type)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xe7;
@@ -2923,8 +2820,8 @@ int clif_tradeadditem(struct map_session_data *sd,
{
int fd, j;
- nullpo_retr(0, sd);
- nullpo_retr(0, tsd);
+ nullpo_ret(sd);
+ nullpo_ret(tsd);
fd = tsd->fd;
WFIFOW(fd, 0) = 0xe9;
@@ -3005,7 +2902,7 @@ int clif_tradeitemok(struct map_session_data *sd, int index, int amount,
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x1b1;
@@ -3026,7 +2923,7 @@ int clif_tradedeal_lock(struct map_session_data *sd, int fail)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xec;
@@ -3044,7 +2941,7 @@ int clif_tradecancelled(struct map_session_data *sd)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xee;
@@ -3061,7 +2958,7 @@ int clif_tradecompleted(struct map_session_data *sd, int fail)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xf0;
@@ -3080,8 +2977,8 @@ int clif_updatestorageamount(struct map_session_data *sd,
{
int fd;
- nullpo_retr(0, sd);
- nullpo_retr(0, stor);
+ nullpo_ret(sd);
+ nullpo_ret(stor);
fd = sd->fd;
WFIFOW(fd, 0) = 0xf2; // update storage amount
@@ -3101,8 +2998,8 @@ int clif_storageitemadded(struct map_session_data *sd, struct storage *stor,
{
int fd, j;
- nullpo_retr(0, sd);
- nullpo_retr(0, stor);
+ nullpo_ret(sd);
+ nullpo_ret(stor);
fd = sd->fd;
WFIFOW(fd, 0) = 0xf4; // Storage item added
@@ -3164,7 +3061,7 @@ int clif_storageitemremoved(struct map_session_data *sd, int index,
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xf6; // Storage item removed
@@ -3183,7 +3080,7 @@ int clif_storageclose(struct map_session_data *sd)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xf8; // Storage Closed
@@ -3288,7 +3185,7 @@ int clif_movemob(struct mob_data *md)
unsigned char buf[256];
int len;
- nullpo_retr(0, md);
+ nullpo_ret(md);
len = clif_mob007b(md, buf);
clif_send(buf, len, &md->bl, AREA);
@@ -3308,7 +3205,7 @@ int clif_fixmobpos(struct mob_data *md)
unsigned char buf[256];
int len;
- nullpo_retr(0, md);
+ nullpo_ret(md);
if (md->state.state == MS_WALK)
{
@@ -3333,7 +3230,7 @@ int clif_fixpcpos(struct map_session_data *sd)
unsigned char buf[256];
int len;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->walktimer != -1)
{
@@ -3361,8 +3258,8 @@ int clif_damage(struct block_list *src, struct block_list *dst,
unsigned char buf[256];
eptr<struct status_change, StatusChange> sc_data;
- nullpo_retr(0, src);
- nullpo_retr(0, dst);
+ nullpo_ret(src);
+ nullpo_ret(dst);
sc_data = battle_get_sc_data(dst);
@@ -3469,7 +3366,7 @@ int clif_getareachar_skillunit(struct map_session_data *sd,
int fd;
struct block_list *bl;
- nullpo_retr(0, unit);
+ nullpo_ret(unit);
fd = sd->fd;
bl = map_id2bl(unit->group->src_id);
@@ -3527,7 +3424,7 @@ int clif_getareachar_skillunit(struct map_session_data *sd,
static
int clif_clearchar_skillunit(struct skill_unit *unit, int fd)
{
- nullpo_retr(0, unit);
+ nullpo_ret(unit);
WFIFOW(fd, 0) = 0x120;
WFIFOL(fd, 2) = unit->bl.id;
@@ -3546,7 +3443,7 @@ int clif_01ac(struct block_list *bl)
{
uint8_t buf[32];
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
WBUFW(buf, 0) = 0x1ac;
WBUFL(buf, 2) = bl->id;
@@ -3713,7 +3610,7 @@ int clif_skillinfo(struct map_session_data *sd, SkillID skillid, int type,
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
SkillID id = sd->status.skill[skillid].id;
@@ -3754,7 +3651,7 @@ int clif_skillinfoblock(struct map_session_data *sd)
int fd;
int len = 4, range;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x10f;
@@ -3796,7 +3693,7 @@ int clif_skillup(struct map_session_data *sd, SkillID skill_num)
{
int range, fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x10e;
@@ -3845,7 +3742,7 @@ int clif_skillcastcancel(struct block_list *bl)
{
unsigned char buf[16];
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
WBUFW(buf, 0) = 0x1b9;
WBUFL(buf, 2) = bl->id;
@@ -3863,7 +3760,7 @@ int clif_skill_fail(struct map_session_data *sd, SkillID skill_id, int type,
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
@@ -3894,8 +3791,8 @@ int clif_skill_damage(struct block_list *src, struct block_list *dst,
unsigned char buf[64];
eptr<struct status_change, StatusChange> sc_data;
- nullpo_retr(0, src);
- nullpo_retr(0, dst);
+ nullpo_ret(src);
+ nullpo_ret(dst);
sc_data = battle_get_sc_data(dst);
@@ -3928,52 +3825,6 @@ int clif_skill_damage(struct block_list *src, struct block_list *dst,
}
/*==========================================
- * 吹き飛ばしスキル攻撃エフェクト&ダメージ
- *------------------------------------------
- */
-int clif_skill_damage2(struct block_list *src, struct block_list *dst,
- unsigned int tick, int sdelay, int ddelay, int damage,
- int div, SkillID skill_id, int skill_lv, int type)
-{
- unsigned char buf[64];
- eptr<struct status_change, StatusChange> sc_data;
-
- nullpo_retr(0, src);
- nullpo_retr(0, dst);
-
- sc_data = battle_get_sc_data(dst);
-
- if (type != 5 && dst->type == BL_PC
- && ((struct map_session_data *) dst)->special_state.infinite_endure)
- type = 9;
- if (sc_data)
- {
- if (type != 5 && sc_data[SC_ENDURE].timer != -1)
- type = 9;
- if (sc_data[SC_HALLUCINATION].timer != -1 && damage > 0)
- damage =
- damage * (5 + sc_data[SC_HALLUCINATION].val1) + MRAND(100);
- }
-
- WBUFW(buf, 0) = 0x115;
- WBUFW(buf, 2) = uint16_t(skill_id);
- WBUFL(buf, 4) = src->id;
- WBUFL(buf, 8) = dst->id;
- WBUFL(buf, 12) = tick;
- WBUFL(buf, 16) = sdelay;
- WBUFL(buf, 20) = ddelay;
- WBUFW(buf, 24) = dst->x;
- WBUFW(buf, 26) = dst->y;
- WBUFW(buf, 28) = damage;
- WBUFW(buf, 30) = skill_lv;
- WBUFW(buf, 32) = div;
- WBUFB(buf, 34) = (type > 0) ? type : skill_get_hit(skill_id);
- clif_send(buf, packet_len_table[0x115], src, AREA);
-
- return 0;
-}
-
-/*==========================================
* 支援/回復スキルエフェクト
*------------------------------------------
*/
@@ -3982,8 +3833,8 @@ int clif_skill_nodamage(struct block_list *src, struct block_list *dst,
{
unsigned char buf[32];
- nullpo_retr(0, src);
- nullpo_retr(0, dst);
+ nullpo_ret(src);
+ nullpo_ret(dst);
WBUFW(buf, 0) = 0x11a;
WBUFW(buf, 2) = uint16_t(skill_id);
@@ -4005,7 +3856,7 @@ int clif_skill_poseffect(struct block_list *src, SkillID skill_id, int val,
{
unsigned char buf[32];
- nullpo_retr(0, src);
+ nullpo_ret(src);
WBUFW(buf, 0) = 0x117;
WBUFW(buf, 2) = uint16_t(skill_id);
@@ -4028,7 +3879,7 @@ int clif_skill_setunit(struct skill_unit *unit)
unsigned char buf[128];
struct block_list *bl;
- nullpo_retr(0, unit);
+ nullpo_ret(unit);
bl = map_id2bl(unit->group->src_id);
@@ -4084,7 +3935,7 @@ int clif_skill_delunit(struct skill_unit *unit)
{
unsigned char buf[16];
- nullpo_retr(0, unit);
+ nullpo_ret(unit);
WBUFW(buf, 0) = 0x120;
WBUFL(buf, 2) = unit->bl.id;
@@ -4102,7 +3953,7 @@ int clif_skill_warppoint(struct map_session_data *sd, SkillID skill_num,
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x11c;
@@ -4123,7 +3974,7 @@ int clif_skill_memo(struct map_session_data *sd, int flag)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
@@ -4137,7 +3988,7 @@ int clif_skill_teleportmessage(struct map_session_data *sd, int flag)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x189;
@@ -4157,8 +4008,8 @@ int clif_skill_estimation(struct map_session_data *sd,
unsigned char buf[64];
int i;
- nullpo_retr(0, sd);
- nullpo_retr(0, dst);
+ nullpo_ret(sd);
+ nullpo_ret(dst);
if (dst->type != BL_MOB)
return 0;
@@ -4196,7 +4047,7 @@ int clif_status_change(struct block_list *bl, StatusChange type, int flag)
{
unsigned char buf[16];
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
WBUFW(buf, 0) = 0x0196;
WBUFW(buf, 2) = uint16_t(type);
@@ -4271,7 +4122,7 @@ int clif_resurrection(struct block_list *bl, int type)
{
unsigned char buf[16];
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_PC)
{ // disguises [Valaris]
@@ -4309,7 +4160,7 @@ int clif_set0199(int fd, int type)
int clif_pvpset(struct map_session_data *sd, int pvprank, int pvpnum,
int type)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (map[sd->bl.m].flag.nopvp)
return 0;
@@ -4413,7 +4264,7 @@ int clif_solved_charname(struct map_session_data *sd, int char_id)
char *p = map_charid2nick(char_id);
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
if (p != NULL)
@@ -4432,80 +4283,6 @@ int clif_solved_charname(struct map_session_data *sd, int char_id)
}
/*==========================================
- * カードの挿入可能リストを返す
- *------------------------------------------
- */
-int clif_use_card(struct map_session_data *sd, int idx)
-{
- nullpo_retr(0, sd);
-
- if (sd->inventory_data[idx])
- {
- int i, c;
- int ep = sd->inventory_data[idx]->equip;
- int fd = sd->fd;
- WFIFOW(fd, 0) = 0x017b;
-
- for (i = c = 0; i < MAX_INVENTORY; i++)
- {
- int j;
-
- if (sd->inventory_data[i] == NULL)
- continue;
- if (sd->inventory_data[i]->type != 4 && sd->inventory_data[i]->type != 5) // 武器防具じゃない
- continue;
- if (sd->status.inventory[i].card[0] == 0x00ff) // 製造武器
- continue;
- if (sd->status.inventory[i].card[0] == (short) 0xff00
- || sd->status.inventory[i].card[0] == 0x00fe)
- continue;
- if (sd->status.inventory[i].identify == 0) // 未鑑定
- continue;
-
- if ((sd->inventory_data[i]->equip & ep) == 0) // 装備個所が違う
- continue;
- if (sd->inventory_data[i]->type == 4 && ep == 32) // 盾カードと両手武器
- continue;
-
- for (j = 0; j < sd->inventory_data[i]->slot; j++)
- {
- if (sd->status.inventory[i].card[j] == 0)
- break;
- }
- if (j == sd->inventory_data[i]->slot) // すでにカードが一杯
- continue;
-
- WFIFOW(fd, 4 + c * 2) = i + 2;
- c++;
- }
- WFIFOW(fd, 2) = 4 + c * 2;
- WFIFOSET(fd, WFIFOW(fd, 2));
- }
-
- return 0;
-}
-
-/*==========================================
- * カードの挿入終了
- *------------------------------------------
- */
-int clif_insert_card(struct map_session_data *sd, int idx_equip,
- int idx_card, int flag)
-{
- int fd;
-
- nullpo_retr(0, sd);
-
- fd = sd->fd;
- WFIFOW(fd, 0) = 0x17d;
- WFIFOW(fd, 2) = idx_equip + 2;
- WFIFOW(fd, 4) = idx_card + 2;
- WFIFOB(fd, 6) = flag;
- WFIFOSET(fd, packet_len_table[0x17d]);
- return 0;
-}
-
-/*==========================================
* 鑑定可能アイテムリスト送信
*------------------------------------------
*/
@@ -4514,7 +4291,7 @@ int clif_item_identify_list(struct map_session_data *sd)
int i, c;
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
@@ -4537,24 +4314,6 @@ int clif_item_identify_list(struct map_session_data *sd)
}
/*==========================================
- * 鑑定結果
- *------------------------------------------
- */
-int clif_item_identified(struct map_session_data *sd, int idx, int flag)
-{
- int fd;
-
- nullpo_retr(0, sd);
-
- fd = sd->fd;
- WFIFOW(fd, 0) = 0x179;
- WFIFOW(fd, 2) = idx + 2;
- WFIFOB(fd, 4) = flag;
- WFIFOSET(fd, packet_len_table[0x179]);
- return 0;
-}
-
-/*==========================================
* 修理可能アイテムリスト送信
* ※実際のパケットがわからないので動作しません
*------------------------------------------
@@ -4564,7 +4323,7 @@ int clif_item_repair_list(struct map_session_data *sd)
int i, c;
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
@@ -4595,7 +4354,7 @@ int clif_item_skill(struct map_session_data *sd, SkillID skillid, int skilllv,
{
int range, fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x147;
@@ -4624,7 +4383,7 @@ int clif_cart_additem(struct map_session_data *sd, int n, int amount,
int view, j, fd;
unsigned char *buf;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
buf = WFIFOP(fd, 0);
@@ -4688,7 +4447,7 @@ int clif_cart_delitem(struct map_session_data *sd, int n, int amount)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
@@ -4711,7 +4470,7 @@ int clif_cart_itemlist(struct map_session_data *sd)
int i, n, fd;
unsigned char *buf;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
buf = WFIFOP(fd, 0);
@@ -4756,7 +4515,7 @@ int clif_cart_equiplist(struct map_session_data *sd)
int i, j, n, fd;
unsigned char *buf;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
buf = WFIFOP(fd, 0);
@@ -4841,7 +4600,7 @@ int clif_party_created(struct map_session_data *sd, int flag)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xfa;
@@ -4860,7 +4619,7 @@ int clif_party_info(struct party *p, int fd)
int i, c;
struct map_session_data *sd = NULL;
- nullpo_retr(0, p);
+ nullpo_ret(p);
WBUFW(buf, 0) = 0xfb;
memcpy(WBUFP(buf, 4), p->name, 24);
@@ -4904,8 +4663,8 @@ int clif_party_invite(struct map_session_data *sd,
int fd;
struct party *p;
- nullpo_retr(0, sd);
- nullpo_retr(0, tsd);
+ nullpo_ret(sd);
+ nullpo_ret(tsd);
fd = tsd->fd;
@@ -4937,7 +4696,7 @@ int clif_party_inviteack(struct map_session_data *sd, const char *nick, int flag
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xfd;
@@ -4958,7 +4717,7 @@ int clif_party_option(struct party *p, struct map_session_data *sd, int flag)
{
unsigned char buf[16];
- nullpo_retr(0, p);
+ nullpo_ret(p);
// if(battle_config.etc_log)
// printf("clif_party_option: %d %d %d\n",p->exp,p->item,flag);
@@ -4994,7 +4753,7 @@ int clif_party_leaved(struct party *p, struct map_session_data *sd,
unsigned char buf[64];
int i;
- nullpo_retr(0, p);
+ nullpo_ret(p);
WBUFW(buf, 0) = 0x105;
WBUFL(buf, 2) = account_id;
@@ -5027,7 +4786,7 @@ int clif_party_message(struct party *p, int account_id, const char *mes, int len
struct map_session_data *sd;
int i;
- nullpo_retr(0, p);
+ nullpo_ret(p);
for (i = 0; i < MAX_PARTY; i++)
{
@@ -5054,7 +4813,7 @@ int clif_party_xy(struct party *, struct map_session_data *sd)
{
unsigned char buf[16];
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
WBUFW(buf, 0) = 0x107;
WBUFL(buf, 2) = sd->status.account_id;
@@ -5074,7 +4833,7 @@ int clif_party_hp(struct party *, struct map_session_data *sd)
{
unsigned char buf[16];
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
WBUFW(buf, 0) = 0x106;
WBUFL(buf, 2) = sd->status.account_id;
@@ -5088,30 +4847,6 @@ int clif_party_hp(struct party *, struct map_session_data *sd)
}
/*==========================================
- * パーティ場所移動(未使用)
- *------------------------------------------
- */
-int clif_party_move(struct party *p, struct map_session_data *sd, int online)
-{
- unsigned char buf[128];
-
- nullpo_retr(0, sd);
- nullpo_retr(0, p);
-
- WBUFW(buf, 0) = 0x104;
- WBUFL(buf, 2) = sd->status.account_id;
- WBUFL(buf, 6) = 0;
- WBUFW(buf, 10) = sd->bl.x;
- WBUFW(buf, 12) = sd->bl.y;
- WBUFB(buf, 14) = !online;
- memcpy(WBUFP(buf, 15), p->name, 24);
- memcpy(WBUFP(buf, 39), sd->status.name, 24);
- memcpy(WBUFP(buf, 63), map[sd->bl.m].name, 16);
- clif_send(buf, packet_len_table[0x104], &sd->bl, PARTY);
- return 0;
-}
-
-/*==========================================
* 攻撃するために移動が必要
*------------------------------------------
*/
@@ -5119,8 +4854,8 @@ int clif_movetoattack(struct map_session_data *sd, struct block_list *bl)
{
int fd;
- nullpo_retr(0, sd);
- nullpo_retr(0, bl);
+ nullpo_ret(sd);
+ nullpo_ret(bl);
fd = sd->fd;
WFIFOW(fd, 0) = 0x139;
@@ -5142,7 +4877,7 @@ int clif_produceeffect(struct map_session_data *sd, int flag, int nameid)
{
int view, fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
// 名前の登録と送信を先にしておく
@@ -5168,7 +4903,7 @@ int clif_autospell(struct map_session_data *sd, int skilllv)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x1cd;
@@ -5215,7 +4950,7 @@ int clif_devotion(struct map_session_data *sd, int)
unsigned char buf[56];
int n;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
WBUFW(buf, 0) = 0x1cf;
WBUFL(buf, 2) = sd->bl.id;
@@ -5238,7 +4973,7 @@ int clif_spiritball(struct map_session_data *sd)
{
unsigned char buf[16];
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
WBUFW(buf, 0) = 0x1d0;
WBUFL(buf, 2) = sd->bl.id;
@@ -5255,7 +4990,7 @@ int clif_combo_delay(struct block_list *bl, int wait)
{
unsigned char buf[32];
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
WBUFW(buf, 0) = 0x1d2;
WBUFL(buf, 2) = bl->id;
@@ -5273,8 +5008,8 @@ int clif_bladestop(struct block_list *src, struct block_list *dst, int boolean)
{
unsigned char buf[32];
- nullpo_retr(0, src);
- nullpo_retr(0, dst);
+ nullpo_ret(src);
+ nullpo_ret(dst);
WBUFW(buf, 0) = 0x1d1;
WBUFL(buf, 2) = src->id;
@@ -5319,7 +5054,7 @@ int clif_mvp_effect(struct map_session_data *sd)
{
unsigned char buf[16];
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
WBUFW(buf, 0) = 0x10c;
WBUFL(buf, 2) = sd->bl.id;
@@ -5335,7 +5070,7 @@ int clif_mvp_item(struct map_session_data *sd, int nameid)
{
int view, fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x10a;
@@ -5355,7 +5090,7 @@ int clif_mvp_exp(struct map_session_data *sd, int exp)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0x10b;
@@ -5434,32 +5169,6 @@ void clif_wedding_effect(struct block_list *bl)
}
/*==========================================
- * あなたに逢いたい使用時名前叫び
- *------------------------------------------
-
-void clif_callpartner(struct map_session_data *sd)
-{
- unsigned char buf[26];
- char *p;
-
- nullpo_retv(sd);
-
- if (sd->status.partner_id){
- WBUFW(buf,0)=0x1e6;
- p = map_charid2nick(sd->status.partner_id);
- if (p){
- memcpy(WBUFP(buf,2),p,24);
- }else{
- map_reqchariddb(sd,sd->status.partner_id);
- chrif_searchcharid(sd->status.partner_id);
- WBUFB(buf,2) = 0;
- }
- clif_send(buf,packet_len_table[0x1e6]&sd->bl,AREA);
- }
- return;
-}
-*/
-/*==========================================
* 座る
*------------------------------------------
*/
@@ -5485,7 +5194,7 @@ int clif_disp_onlyself(struct map_session_data *sd, const char *mes, int len)
unsigned char *buf =
(len + 32 >= sizeof(lbuf)) ? (unsigned char *)malloc(len + 32) : lbuf;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
WBUFW(buf, 0) = 0x17f;
WBUFW(buf, 2) = len + 8;
@@ -5503,12 +5212,12 @@ int clif_disp_onlyself(struct map_session_data *sd, const char *mes, int len)
*
*------------------------------------------
*/
-
+static
int clif_GM_kickack(struct map_session_data *sd, int id)
{
int fd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
fd = sd->fd;
WFIFOW(fd, 0) = 0xcd;
@@ -5517,12 +5226,13 @@ int clif_GM_kickack(struct map_session_data *sd, int id)
return 0;
}
+static
void clif_parse_QuitGame(int fd, struct map_session_data *sd);
int clif_GM_kick(struct map_session_data *sd, struct map_session_data *tsd,
int type)
{
- nullpo_retr(0, tsd);
+ nullpo_ret(tsd);
if (type)
clif_GM_kickack(sd, tsd->status.account_id);
@@ -5561,7 +5271,7 @@ int clif_specialeffect(struct block_list *bl, int type, int flag)
{
unsigned char buf[24];
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
memset(buf, 0, packet_len_table[0x19b]);
@@ -6065,7 +5775,7 @@ int clif_message(struct block_list *bl, const char *msg)
if (msg_len + 16 > 512)
return 0;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
WBUFW(buf, 0) = 0x8d;
WBUFW(buf, 2) = msg_len + 8;
@@ -6082,35 +5792,6 @@ int clif_message(struct block_list *bl, const char *msg)
*------------------------------------------
*/
static
-void clif_parse_MapMove(int fd, struct map_session_data *sd)
-{
-// /m /mapmove (as @rura GM command)
- char output[100];
- char map_name[17];
-
- nullpo_retv(sd);
-
- memset(output, '\0', sizeof(output));
- memset(map_name, '\0', sizeof(map_name));
-
- if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
- (pc_isGM(sd) >= get_atcommand_level(AtCommand_MapMove)))
- {
- memcpy(map_name, RFIFOP(fd, 2), 16);
- sprintf(output, "%s %d %d", map_name, RFIFOW(fd, 18),
- RFIFOW(fd, 20));
- log_atcommand(sd, "@warp %s", output);
- atcommand_warp(fd, sd, "@warp", output);
- }
-
- return;
-}
-
-/*==========================================
- *
- *------------------------------------------
- */
-static
void clif_parse_ChangeDir(int fd, struct map_session_data *sd)
{
unsigned char buf[64];
@@ -6658,68 +6339,6 @@ void clif_parse_NpcSellListSend(int fd, struct map_session_data *sd)
}
/*==========================================
- *
- *------------------------------------------
- */
-static
-void clif_parse_CreateChatRoom(int fd, struct map_session_data *sd)
-{
- chat_createchat(sd, RFIFOW(fd, 4), RFIFOB(fd, 6), (const char *)RFIFOP(fd, 7),
- (const char *)RFIFOP(fd, 15), RFIFOW(fd, 2) - 15);
-}
-
-/*==========================================
- *
- *------------------------------------------
- */
-static
-void clif_parse_ChatAddMember(int fd, struct map_session_data *sd)
-{
- chat_joinchat(sd, RFIFOL(fd, 2), (const char *)RFIFOP(fd, 6));
-}
-
-/*==========================================
- *
- *------------------------------------------
- */
-static
-void clif_parse_ChatRoomStatusChange(int fd, struct map_session_data *sd)
-{
- chat_changechatstatus(sd, RFIFOW(fd, 4), RFIFOB(fd, 6), (const char *)RFIFOP(fd, 7),
- (const char *)RFIFOP(fd, 15), RFIFOW(fd, 2) - 15);
-}
-
-/*==========================================
- *
- *------------------------------------------
- */
-static
-void clif_parse_ChangeChatOwner(int fd, struct map_session_data *sd)
-{
- chat_changechatowner(sd, (const char *)RFIFOP(fd, 6));
-}
-
-/*==========================================
- *
- *------------------------------------------
- */
-static
-void clif_parse_KickFromChat(int fd, struct map_session_data *sd)
-{
- chat_kickchat(sd, (const char *)RFIFOP(fd, 2));
-}
-
-/*==========================================
- *
- *------------------------------------------
- */
-static
-void clif_parse_ChatLeave(int, struct map_session_data *sd)
-{
- chat_leavechat(sd);
-}
-
-/*==========================================
* 取引要請を相手に送る
*------------------------------------------
*/
@@ -6802,69 +6421,6 @@ void clif_parse_StopAttack(int, struct map_session_data *sd)
}
/*==========================================
- * カートへアイテムを移す
- *------------------------------------------
- */
-static
-void clif_parse_PutItemToCart(int fd, struct map_session_data *sd)
-{
- nullpo_retv(sd);
-
- if (sd->npc_id != 0 || sd->trade_partner != 0)
- return;
- pc_putitemtocart(sd, RFIFOW(fd, 2) - 2, RFIFOL(fd, 4));
-}
-
-/*==========================================
- * カートからアイテムを出す
- *------------------------------------------
- */
-static
-void clif_parse_GetItemFromCart(int fd, struct map_session_data *sd)
-{
- nullpo_retv(sd);
-
- if (sd->npc_id != 0 || sd->trade_partner != 0)
- return;
- pc_getitemfromcart(sd, RFIFOW(fd, 2) - 2, RFIFOL(fd, 4));
-}
-
-/*==========================================
- * 付属品(鷹,ペコ,カート)をはずす
- *------------------------------------------
- */
-static
-void clif_parse_RemoveOption(int, struct map_session_data *sd)
-{
- if (pc_isriding(sd))
- { // jobchange when removing peco [Valaris]
- if (sd->status.pc_class == 13)
- sd->status.pc_class = sd->view_class = 7;
-
- if (sd->status.pc_class == 21)
- sd->status.pc_class = sd->view_class = 14;
-
- if (sd->status.pc_class == 4014)
- sd->status.pc_class = sd->view_class = 4008;
-
- if (sd->status.pc_class == 4022)
- sd->status.pc_class = sd->view_class = 4015;
- }
-
- pc_setoption(sd, Option::ZERO);
-}
-
-/*==========================================
- * チェンジカート
- *------------------------------------------
- */
-static
-void clif_parse_ChangeCart(int fd, struct map_session_data *sd)
-{
- pc_setcart(sd, RFIFOW(fd, 2));
-}
-
-/*==========================================
* ステータスアップ
*------------------------------------------
*/
@@ -7065,16 +6621,6 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data *sd)
}
/*==========================================
- * メモ要求
- *------------------------------------------
- */
-static
-void clif_parse_RequestMemo(int, struct map_session_data *sd)
-{
- pc_memo(sd, -1);
-}
-
-/*==========================================
*
*------------------------------------------
*/
@@ -7106,12 +6652,7 @@ void clif_parse_NpcAmountInput(int fd, struct map_session_data *sd)
{
nullpo_retv(sd);
-#define RFIFOL_(fd,pos) (*(int*)(session[fd]->rdata+session[fd]->rdata_pos+(pos)))
- //Input Value overflow Exploit FIX
- sd->npc_amount = RFIFOL_(fd, 6); //fixed by Lupus. npc_amount is (int) but was RFIFOL changing it to (unsigned int)
-
-#undef RFIFOL_
-
+ sd->npc_amount = RFIFOL(fd, 6);
map_scriptcont(sd, RFIFOL(fd, 2));
}
@@ -7160,89 +6701,6 @@ void clif_parse_NpcCloseClicked(int fd, struct map_session_data *sd)
}
/*==========================================
- * アイテム鑑定
- *------------------------------------------
- */
-static
-void clif_parse_ItemIdentify(int fd, struct map_session_data *sd)
-{
- pc_item_identify(sd, RFIFOW(fd, 2) - 2);
-}
-
-/*==========================================
- * オートスペル受信
- *------------------------------------------
- */
-static
-void clif_parse_AutoSpell(int fd, struct map_session_data *sd)
-{
- SkillID skill_id = SkillID(RFIFOW(fd, 2));
- skill_autospell(sd, skill_id);
-}
-
-/*==========================================
- * カード使用
- *------------------------------------------
- */
-static
-void clif_parse_UseCard(int fd, struct map_session_data *sd)
-{
- clif_use_card(sd, RFIFOW(fd, 2) - 2);
-}
-
-/*==========================================
- * カード挿入装備選択
- *------------------------------------------
- */
-static
-void clif_parse_InsertCard(int fd, struct map_session_data *sd)
-{
- pc_insert_card(sd, RFIFOW(fd, 2) - 2, RFIFOW(fd, 4) - 2);
-}
-
-/*==========================================
- * 0193 キャラID名前引き
- *------------------------------------------
- */
-static
-void clif_parse_SolveCharName(int fd, struct map_session_data *sd)
-{
- int char_id;
-
- char_id = RFIFOL(fd, 2);
- clif_solved_charname(sd, char_id);
-}
-
-/*==========================================
- * 0197 /resetskill /resetstate
- *------------------------------------------
- */
-static
-void clif_parse_ResetChar(int fd, struct map_session_data *sd)
-{
- nullpo_retv(sd);
-
- if (battle_config.atc_gmonly == 0 || pc_isGM(sd))
- {
- switch (RFIFOW(fd, 2))
- {
- case 0:
- log_atcommand(sd, "@charstreset %s", sd->status.name);
- if (pc_isGM(sd) >=
- get_atcommand_level(AtCommand_ResetState))
- pc_resetstate(sd);
- break;
- case 1:
- log_atcommand(sd, "@charskreset %s", sd->status.name);
- if (pc_isGM(sd) >=
- get_atcommand_level(AtCommand_ResetState))
- pc_resetskill(sd);
- break;
- }
- }
-}
-
-/*==========================================
* 019c /lb等
*------------------------------------------
*/
@@ -7308,38 +6766,6 @@ void clif_parse_MoveFromKafra(int fd, struct map_session_data *sd)
}
/*==========================================
- * カプラ倉庫へカートから入れる
- *------------------------------------------
- */
-static
-void clif_parse_MoveToKafraFromCart(int fd, struct map_session_data *sd)
-{
- nullpo_retv(sd);
-
- if ((sd->npc_id != 0 && !sd->npc_flags.storage) || sd->trade_partner != 0
- || !sd->state.storage_open)
- return;
- if (sd->state.storage_open)
- storage_storageaddfromcart(sd, RFIFOW(fd, 2) - 2, RFIFOL(fd, 4));
-}
-
-/*==========================================
- * カプラ倉庫から出す
- *------------------------------------------
- */
-static
-void clif_parse_MoveFromKafraToCart(int fd, struct map_session_data *sd)
-{
- nullpo_retv(sd);
-
- if ((sd->npc_id != 0 && !sd->npc_flags.storage) || sd->trade_partner != 0
- || !sd->state.storage_open)
- return;
- if (sd->state.storage_open)
- storage_storagegettocart(sd, RFIFOW(fd, 2) - 1, RFIFOL(fd, 4));
-}
-
-/*==========================================
* カプラ倉庫を閉じる
*------------------------------------------
*/
@@ -7372,30 +6798,6 @@ void clif_parse_CreateParty(int fd, struct map_session_data *sd)
}
/*==========================================
- * パーティを作る
- * Process request to create a party.
- *
- * (S 01e8 <party_name>.24B <exp>.B <itm>.B)
- *
- * Note: Upstream eAthena uses this to
- * specify experience/item sharing,
- * respectively, but it was left
- * incomplete here.
- *------------------------------------------
- */
-static
-void clif_parse_CreateParty2(int fd, struct map_session_data *sd)
-{
- if (battle_config.basic_skill_check == 0
- || pc_checkskill(sd, NV_PARTY) >= 2)
- {
- party_create(sd, (const char *)RFIFOP(fd, 2));
- }
- else
- clif_skill_fail(sd, SkillID::ONE, 0, 4);
-}
-
-/*==========================================
* パーティに勧誘
* Process invitation to join a party.
*
@@ -7503,43 +6905,6 @@ void clif_parse_PartyMessage(int fd, struct map_session_data *sd)
free(buf);
}
-/*==========================================
- * /monster /item rewriten by [Yor]
- *------------------------------------------
- */
-static
-void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd)
-{
- char monster_item_name[25];
-
- nullpo_retv(sd);
-
- memset(monster_item_name, '\0', sizeof(monster_item_name));
-
- if (battle_config.atc_gmonly == 0 || pc_isGM(sd))
- {
- memcpy(monster_item_name, RFIFOP(fd, 2), 24);
-
- if (mobdb_searchname(monster_item_name) != 0)
- {
- if (pc_isGM(sd) >= get_atcommand_level(AtCommand_Monster))
- {
- log_atcommand(sd, "@spawn %s", monster_item_name);
- atcommand_spawn(fd, sd, "@spawn", monster_item_name); // as @spawn
- }
- }
- else if (itemdb_searchname(monster_item_name) != NULL)
- {
- if (pc_isGM(sd) >= get_atcommand_level(AtCommand_Item))
- {
- log_atcommand(sd, "@item %s", monster_item_name);
- atcommand_item(fd, sd, "@item", monster_item_name); // as @item
- }
- }
-
- }
-}
-
// Kick (right click menu for GM "(name) force to quit")
static
void clif_parse_GMKick(int fd, struct map_session_data *sd)
@@ -7579,54 +6944,6 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
}
}
-/*==========================================
- * /shift
- *------------------------------------------
- */
-static
-void clif_parse_Shift(int fd, struct map_session_data *sd)
-{ // Rewriten by [Yor]
- char player_name[25];
-
- nullpo_retv(sd);
-
- memset(player_name, '\0', sizeof(player_name));
-
- if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
- (pc_isGM(sd) >= get_atcommand_level(AtCommand_Goto)))
- {
- memcpy(player_name, RFIFOP(fd, 2), 24);
- log_atcommand(sd, "@goto %s", player_name);
- atcommand_goto(fd, sd, "@goto", player_name); // as @jumpto
- }
-
- return;
-}
-
-/*==========================================
- * /recall
- *------------------------------------------
- */
-static
-void clif_parse_Recall(int fd, struct map_session_data *sd)
-{ // Added by RoVeRT
- char player_name[25];
-
- nullpo_retv(sd);
-
- memset(player_name, '\0', sizeof(player_name));
-
- if ((battle_config.atc_gmonly == 0 || pc_isGM(sd)) &&
- (pc_isGM(sd) >= get_atcommand_level(AtCommand_Recall)))
- {
- memcpy(player_name, RFIFOP(fd, 2), 24);
- log_atcommand(sd, "@recall %s", player_name);
- atcommand_recall(fd, sd, "@recall", player_name); // as @recall
- }
-
- return;
-}
-
static
void clif_parse_GMHide(int fd, struct map_session_data *sd)
{ // Modified by [Yor]
@@ -7701,159 +7018,7 @@ void clif_parse_GMReqNoChat(int fd, struct map_session_data *sd)
return;
}
-/*==========================================
- * GMによるチャット禁止時間参照(?)
- *------------------------------------------
- */
-static
-void clif_parse_GMReqNoChatCount(int fd, struct map_session_data *)
-{
- int tid = RFIFOL(fd, 2);
-
- WFIFOW(fd, 0) = 0x1e0;
- WFIFOL(fd, 2) = tid;
- sprintf((char *)WFIFOP(fd, 6), "%d", tid);
-// memcpy(WFIFOP(fd,6),"TESTNAME",24);
- WFIFOSET(fd, packet_len_table[0x1e0]);
-
- return;
-}
-
-static
-void clif_parse_PMIgnore(int fd, struct map_session_data *sd)
-{ // Rewritten by [Yor]
- char output[1024];
- char *nick; // S 00cf <nick>.24B <type>.B: 00 (/ex nick) deny speech from nick, 01 (/in nick) allow speech from nick
- int i;
- int pos;
-
- memset(output, '\0', sizeof(output));
-
- nick = (char *)RFIFOP(fd, 2); // speed up
- //printf("Ignore: char '%s' state: %d\n", nick, RFIFOB(fd,26));
- // we ask for deny (we add nick only if it's not already exist
- if (RFIFOB(fd, 26) == 0)
- { // type
- if (strlen(nick) >= 4 && strlen(nick) < 24)
- { // do something only if nick can be exist
- pos = -1;
- for (i = 0; i < (sizeof(sd->ignore) / sizeof(sd->ignore[0]));
- i++)
- {
- if (strcmp(sd->ignore[i].name, nick) == 0)
- break;
- else if (pos == -1 && sd->ignore[i].name[0] == '\0')
- pos = i;
- }
- WFIFOW(fd, 0) = 0x0d1; // R 00d1 <type>.B <fail>.B: type: 0: deny, 1: allow, fail: 0: success, 1: fail
- WFIFOB(fd, 2) = 0;
- // if a position is found and name not found, we add it in the list
- if (pos != -1
- && i == (sizeof(sd->ignore) / sizeof(sd->ignore[0])))
- {
- memcpy(sd->ignore[pos].name, nick, 24);
- WFIFOB(fd, 3) = 0; // success
- WFIFOSET(fd, packet_len_table[0x0d1]);
- if (strcmp(wisp_server_name, nick) == 0)
- { // to found possible bot users that automaticaly ignores people.
- sprintf(output,
- "Character '%s' (account: %d) has tried to block wisps from '%s' (wisp name of the server). Bot user?",
- sd->status.name, sd->status.account_id,
- wisp_server_name);
- intif_wis_message_to_gm(wisp_server_name,
- battle_config.hack_info_GM_level,
- output, strlen(output) + 1);
- // send something to be inform and force bot to ignore twice... If GM receiving block + block again, it's a bot :)
- clif_wis_message(fd, wisp_server_name,
- "Add me in your ignore list, doesn't block my wisps.",
- strlen("Add me in your ignore list, doesn't block my wisps.")
- + 1);
- }
- }
- else
- {
- WFIFOB(fd, 3) = 1; // fail
- if (i == (sizeof(sd->ignore) / sizeof(sd->ignore[0])))
- {
- clif_wis_message(fd, wisp_server_name,
- "You can not block more people.",
- strlen("You can not block more people.") + 1);
- if (strcmp(wisp_server_name, nick) == 0)
- { // to found possible bot users that automaticaly ignores people.
- sprintf(output,
- "Character '%s' (account: %d) has tried to block wisps from '%s' (wisp name of the server). Bot user?",
- sd->status.name, sd->status.account_id,
- wisp_server_name);
- intif_wis_message_to_gm(wisp_server_name,
- battle_config.hack_info_GM_level,
- output, strlen(output) + 1);
- }
- }
- else
- {
- clif_wis_message(fd, wisp_server_name,
- "This player is already blocked.",
- strlen("This player is already blocked.") +
- 1);
- if (strcmp(wisp_server_name, nick) == 0)
- { // to found possible bot users that automaticaly ignores people.
- sprintf(output,
- "Character '%s' (account: %d) has tried AGAIN to block wisps from '%s' (wisp name of the server). Bot user?",
- sd->status.name, sd->status.account_id,
- wisp_server_name);
- intif_wis_message_to_gm(wisp_server_name,
- battle_config.hack_info_GM_level,
- output, strlen(output) + 1);
- }
- }
- }
- }
- else
- clif_wis_message(fd, wisp_server_name,
- "It's impossible to block this player.",
- strlen("It's impossible to block this player.")
- + 1);
- // we ask for allow (we remove all same nick if exist)
- }
- else
- {
- if (strlen(nick) >= 4 && strlen(nick) < 24)
- { // do something only if nick can be exist
- WFIFOW(fd, 0) = 0x0d1; // R 00d1 <type>.B <fail>.B: type: 0: deny, 1: allow, fail: 0: success, 1: fail
- WFIFOB(fd, 2) = 1;
- for (i = 0; i < (sizeof(sd->ignore) / sizeof(sd->ignore[0]));
- i++)
- if (strcmp(sd->ignore[i].name, nick) == 0)
- {
- memset(sd->ignore[i].name, 0,
- sizeof(sd->ignore[i].name));
- WFIFOB(fd, 3) = 0; // success
- WFIFOSET(fd, packet_len_table[0x0d1]);
- break;
- }
- if (i == (sizeof(sd->ignore) / sizeof(sd->ignore[0])))
- {
- WFIFOB(fd, 3) = 1; // fail
- WFIFOSET(fd, packet_len_table[0x0d1]);
- clif_wis_message(fd, wisp_server_name,
- "This player is not blocked by you.",
- strlen("This player is not blocked by you.") + 1);
- }
- }
- else
- clif_wis_message(fd, wisp_server_name,
- "It's impossible to unblock this player.",
- strlen("It's impossible to unblock this player.") +
- 1);
- }
-
-// for(i = 0; i < (sizeof(sd->ignore) / sizeof(sd->ignore[0])); i++) // for debug only
-// if (sd->ignore[i].name[0] != '\0')
-// printf("Ignored player: '%s'\n", sd->ignore[i].name);
-
- return;
-}
-
+// 4144 wants this, but I don't like it ...
static
void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd)
{ // Rewritten by [Yor]
@@ -7900,59 +7065,12 @@ void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd)
return;
}
-/*==========================================
- * スパノビの/doridoriによるSPR2倍
- *------------------------------------------
- */
-static
-void clif_parse_sn_doridori(int, struct map_session_data *sd)
-{
- if (sd)
- sd->doridori_counter = 1;
-
- return;
-}
-
-/*==========================================
- * スパノビの爆裂波動
- *------------------------------------------
- */
-static
-void clif_parse_sn_explosionspirits(int, struct map_session_data *sd)
-{
- if (sd)
- {
- int nextbaseexp = pc_nextbaseexp(sd);
- struct pc_base_job s_class = pc_calc_base_job(sd->status.pc_class);
- if (battle_config.etc_log)
- {
- if (nextbaseexp != 0)
- printf("SuperNovice explosionspirits!! %d %d %d %d\n",
- sd->bl.id, s_class.job, sd->status.base_exp,
- (int)((double) 1000 * sd->status.base_exp /
- nextbaseexp));
- else
- printf("SuperNovice explosionspirits!! %d %d %d 000\n",
- sd->bl.id, s_class.job, sd->status.base_exp);
- }
- if (s_class.job == 23 && sd->status.base_exp > 0 && nextbaseexp > 0
- && (int)((double) 1000 * sd->status.base_exp / nextbaseexp) %
- 100 == 0)
- {
- clif_skill_nodamage(&sd->bl, &sd->bl, MO_EXPLOSIONSPIRITS, 5, 1);
- skill_status_change_start(&sd->bl,
- SkillStatusChangeTable[MO_EXPLOSIONSPIRITS],
- 5, 0, 0, 0,
- skill_get_time(MO_EXPLOSIONSPIRITS, 5), 0);
- }
- }
- return;
-}
-
// functions list. Rate is how many milliseconds are required between
// calls. Packets exceeding this rate will be dropped. flood_rates in
// map.h must be the same length as this table. rate 0 is default
// rate -1 is unlimited
+
+// TODO: merge this with the packet length table, and put the pointer last
typedef struct func_table
{
void(*func)(int fd, struct map_session_data *sd);
@@ -8168,27 +7286,27 @@ func_table clif_parse_func_table[0x220] =
{ clif_parse_GMKick, 0 }, // cc
{ NULL, 0 }, // cd
{ NULL, 0 }, // ce
- { clif_parse_PMIgnore, 0 }, // cf
+ { NULL, 0 }, // cf
{ clif_parse_PMIgnoreAll, 0 }, // d0
{ NULL, 0 }, // d1
{ NULL, 0 }, // d2
{ NULL, 0 }, // d3
{ NULL, 0 }, // d4
- { clif_parse_CreateChatRoom, 1000 }, // d5
+ { NULL, 0 }, // d5
{ NULL, 0 }, // d6
{ NULL, 0 }, // d7
{ NULL, 0 }, // d8
- { clif_parse_ChatAddMember, 0 }, // d9
+ { NULL, 0 }, // d9
{ NULL, 0 }, // da
{ NULL, 0 }, // db
{ NULL, 0 }, // dc
{ NULL, 0 }, // dd
- { clif_parse_ChatRoomStatusChange, 0 }, // de
+ { NULL, 0 }, // de
{ NULL, 0 }, // df
- { clif_parse_ChangeChatOwner, 0 }, // e0
+ { NULL, 0 }, // e0
{ NULL, 0 }, // e1
- { clif_parse_KickFromChat, 0 }, // e2
- { clif_parse_ChatLeave, 0 }, // e3
+ { NULL, 0 }, // e2
+ { NULL, 0 }, // e3
{ clif_parse_TradeRequest, 2000 }, // e4
{ NULL, 0 }, // e5
{ clif_parse_TradeAck, 0 }, // e6
@@ -8246,7 +7364,7 @@ func_table clif_parse_func_table[0x220] =
{ NULL, 0 }, // 11a
{ clif_parse_UseSkillMap, 0 }, // 11b
{ NULL, 0 }, // 11c
- { clif_parse_RequestMemo, 0 }, // 11d
+ { NULL, 0 }, // 11d
{ NULL, 0 }, // 11e
{ NULL, 0 }, // 11f
{ NULL, 0 }, // 120
@@ -8255,11 +7373,11 @@ func_table clif_parse_func_table[0x220] =
{ NULL, 0 }, // 123
{ NULL, 0 }, // 124
{ NULL, 0 }, // 125
- { clif_parse_PutItemToCart, 0 }, // 126
- { clif_parse_GetItemFromCart, 0 }, // 127
- { clif_parse_MoveFromKafraToCart, 0 }, // 128
- { clif_parse_MoveToKafraFromCart, 0 }, // 129
- { clif_parse_RemoveOption, 0 }, // 12a
+ { NULL, 0 }, // 126
+ { NULL, 0 }, // 127
+ { NULL, 0 }, // 128
+ { NULL, 0 }, // 129
+ { NULL, 0 }, // 12a
{ NULL, 0 }, // 12b
{ NULL, 0 }, // 12c
{ NULL, 0 }, // 12d
@@ -8280,8 +7398,8 @@ func_table clif_parse_func_table[0x220] =
{ NULL, 0 }, // 13c
{ NULL, 0 }, // 13d
{ NULL, 0 }, // 13e
- { clif_parse_GM_Monster_Item, 0 }, // 13f
- { clif_parse_MapMove, 0 }, // 140
+ { NULL, 0 }, // 13f
+ { NULL, 0 }, // 140
{ NULL, 0 }, // 141
{ NULL, 0 }, // 142
{ clif_parse_NpcAmountInput, 300 }, // 143
@@ -8337,11 +7455,11 @@ func_table clif_parse_func_table[0x220] =
{ NULL, 0 }, // 175
{ NULL, 0 }, // 176
{ NULL, 0 }, // 177
- { clif_parse_ItemIdentify, 0 }, // 178
+ { NULL, 0 }, // 178
{ NULL, 0 }, // 179
- { clif_parse_UseCard, 0 }, // 17a
+ { NULL, 0 }, // 17a
{ NULL, 0 }, // 17b
- { clif_parse_InsertCard, 0 }, // 17c
+ { NULL, 0 }, // 17c
{ NULL, 0 }, // 17d
{ NULL, 0 }, // 17e
{ NULL, 0 }, // 17f
@@ -8364,11 +7482,11 @@ func_table clif_parse_func_table[0x220] =
{ clif_parse_UseSkillToPos, 0 }, // 190
{ NULL, 0 }, // 191
{ NULL, 0 }, // 192
- { clif_parse_SolveCharName, 0 }, // 193
+ { NULL, 0 }, // 193
{ NULL, 0 }, // 194
{ NULL, 0 }, // 195
{ NULL, 0 }, // 196
- { clif_parse_ResetChar, 0 }, // 197
+ { NULL, 0 }, // 197
{ NULL, 0 }, // 198
{ NULL, 0 }, // 199
{ NULL, 0 }, // 19a
@@ -8392,7 +7510,7 @@ func_table clif_parse_func_table[0x220] =
{ NULL, 0 }, // 1ac
{ NULL, 0 }, // 1ad
{ NULL, 0 }, // 1ae
- { clif_parse_ChangeCart, 0 }, // 1af
+ { NULL, 0 }, // 1af
{ NULL, 0 }, // 1b0
{ NULL, 0 }, // 1b1
{ NULL, 0 }, // 1b2
@@ -8403,10 +7521,10 @@ func_table clif_parse_func_table[0x220] =
{ NULL, 0 }, // 1b7
{ NULL, 0 }, // 1b8
{ NULL, 0 }, // 1b9
- { clif_parse_Shift, 300 }, // 1ba
- { clif_parse_Shift, 300 }, // 1bb
- { clif_parse_Recall, 300 }, // 1bc
- { clif_parse_Recall, 300 }, // 1bd
+ { NULL, 0 }, // 1ba
+ { NULL, 0 }, // 1bb
+ { NULL, 0 }, // 1bc
+ { NULL, 0 }, // 1bd
{ NULL, 0 }, // 1be
{ NULL, 0 }, // 1bf
{ NULL, 0 }, // 1c0
@@ -8423,7 +7541,7 @@ func_table clif_parse_func_table[0x220] =
{ NULL, 0 }, // 1cb
{ NULL, 0 }, // 1cc
{ NULL, 0 }, // 1cd
- { clif_parse_AutoSpell, 0 }, // 1ce
+ { NULL, 0 }, // 1ce
{ NULL, 0 }, // 1cf
{ NULL, 0 }, // 1d0
{ NULL, 0 }, // 1d1
@@ -8440,7 +7558,7 @@ func_table clif_parse_func_table[0x220] =
{ NULL, 0 }, // 1dc
{ NULL, 0 }, // 1dd
{ NULL, 0 }, // 1de
- { clif_parse_GMReqNoChatCount, 0 }, // 1df
+ { NULL, 0 }, // 1df
{ NULL, 0 }, // 1e0
{ NULL, 0 }, // 1e1
{ NULL, 0 }, // 1e2
@@ -8448,13 +7566,13 @@ func_table clif_parse_func_table[0x220] =
{ NULL, 0 }, // 1e4
{ NULL, 0 }, // 1e5
{ NULL, 0 }, // 1e6
- { clif_parse_sn_doridori, 0 }, // 1e7
- { clif_parse_CreateParty2, 1000 }, // 1e8
+ { NULL, 0 }, // 1e7
+ { NULL, 0 }, // 1e8
{ NULL, 0 }, // 1e9
{ NULL, 0 }, // 1ea
{ NULL, 0 }, // 1eb
{ NULL, 0 }, // 1ec
- { clif_parse_sn_explosionspirits, 0 }, // 1ed
+ { NULL, 0 }, // 1ed
{ NULL, 0 }, // 1ee
{ NULL, 0 }, // 1ef
{ NULL, 0 }, // 1f0
diff --git a/src/map/clif.hpp b/src/map/clif.hpp
index b072d3c..3952933 100644
--- a/src/map/clif.hpp
+++ b/src/map/clif.hpp
@@ -57,7 +57,6 @@ int clif_changestatus(struct block_list *, int, int); //area
int clif_damage(struct block_list *, struct block_list *, unsigned int, int, int, int, int, int, int); // area
#define clif_takeitem(src,dst) clif_damage(src,dst,0,0,0,0,0,1,0)
int clif_changelook(struct block_list *, int, int); // area
-int clif_changelook_towards(struct block_list *, int, int, struct map_session_data *dst); // area or target
void clif_changelook_accessories(struct block_list *bl, struct map_session_data *dst); // area or target; list gloves, boots etc.
int clif_arrowequip(struct map_session_data *sd, int val); //self
int clif_arrow_fail(struct map_session_data *sd, int type); //self
@@ -68,21 +67,15 @@ int clif_misceffect(struct block_list *, int); // area
int clif_changeoption(struct block_list *); // area
int clif_useitemack(struct map_session_data *, int, int, int); // self
-int clif_createchat(struct map_session_data *, int); // self
int clif_dispchat(struct chat_data *, int); // area or fd
-int clif_joinchatfail(struct map_session_data *, int); // self
-int clif_joinchatok(struct map_session_data *, struct chat_data *); // self
-int clif_addchat(struct chat_data *, struct map_session_data *); // chat
int clif_changechatowner(struct chat_data *, struct map_session_data *); // chat
int clif_clearchat(struct chat_data *, int); // area or fd
int clif_leavechat(struct chat_data *, struct map_session_data *); // chat
-int clif_changechatstatus(struct chat_data *); // chat
void clif_emotion(struct block_list *bl, int type);
void clif_talkiebox(struct block_list *bl, const char *talkie);
void clif_wedding_effect(struct block_list *bl);
void clif_sitting(int fd, struct map_session_data *sd);
-//void clif_callpartner(struct map_session_data *sd);
//void clif_sitting(struct map_session_data *sd);
void clif_soundeffect(struct map_session_data *sd, struct block_list *bl,
const char *name, int type);
@@ -134,10 +127,6 @@ int clif_skill_fail(struct map_session_data *sd, SkillID skill_id, int type,
int clif_skill_damage(struct block_list *src, struct block_list *dst,
unsigned int tick, int sdelay, int ddelay, int damage,
int div, SkillID skill_id, int skill_lv, int type);
-int clif_skill_damage2(struct block_list *src, struct block_list *dst,
- unsigned int tick, int sdelay, int ddelay,
- int damage, int div, SkillID skill_id, int skill_lv,
- int type);
int clif_skill_nodamage(struct block_list *src, struct block_list *dst,
SkillID skill_id, int heal, int fail);
int clif_skill_poseffect(struct block_list *src, SkillID skill_id, int val,
@@ -173,10 +162,6 @@ int clif_wis_end(int fd, int flag);
int clif_solved_charname(struct map_session_data *sd, int char_id);
-int clif_use_card(struct map_session_data *sd, int idx);
-int clif_insert_card(struct map_session_data *sd, int idx_equip,
- int idx_card, int flag);
-
int clif_itemlist(struct map_session_data *sd);
int clif_equiplist(struct map_session_data *sd);
@@ -186,7 +171,6 @@ int clif_cart_itemlist(struct map_session_data *sd);
int clif_cart_equiplist(struct map_session_data *sd);
int clif_item_identify_list(struct map_session_data *sd);
-int clif_item_identified(struct map_session_data *sd, int idx, int flag);
int clif_item_repair_list(struct map_session_data *sd);
int clif_item_skill(struct map_session_data *sd, SkillID skillid, int skilllv,
@@ -209,8 +193,6 @@ int clif_party_option(struct party *p, struct map_session_data *sd,
int clif_party_leaved(struct party *p, struct map_session_data *sd,
int account_id, const char *name, int flag);
int clif_party_message(struct party *p, int account_id, const char *mes, int len);
-int clif_party_move(struct party *p, struct map_session_data *sd,
- int online);
int clif_party_xy(struct party *p, struct map_session_data *sd);
int clif_party_hp(struct party *p, struct map_session_data *sd);
@@ -230,13 +212,11 @@ int clif_refine(int fd, struct map_session_data *sd, int fail, int index,
int clif_specialeffect(struct block_list *bl, int type, int flag); // special effects [Valaris]
int clif_message(struct block_list *bl, const char *msg); // messages (from mobs/npcs) [Valaris]
-int clif_GM_kickack(struct map_session_data *sd, int id);
int clif_GM_kick(struct map_session_data *sd, struct map_session_data *tsd,
int type);
int clif_foreachclient(std::function<void(struct map_session_data *)>);
-int do_final_clif (void);
int do_init_clif (void);
#endif // CLIF_HPP
diff --git a/src/map/intif.cpp b/src/map/intif.cpp
index 0107155..87ea5d0 100644
--- a/src/map/intif.cpp
+++ b/src/map/intif.cpp
@@ -63,7 +63,7 @@ int intif_GMmessage(const char *mes, int len, int flag)
int intif_wis_message(struct map_session_data *sd, const char *nick, const char *mes,
int mes_len)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
WFIFOW(inter_fd, 0) = 0x3001;
WFIFOW(inter_fd, 2) = mes_len + 52;
@@ -117,7 +117,7 @@ int intif_saveaccountreg(struct map_session_data *sd)
{
int j, p;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
WFIFOW(inter_fd, 0) = 0x3004;
WFIFOL(inter_fd, 4) = sd->bl.id;
@@ -134,7 +134,7 @@ int intif_saveaccountreg(struct map_session_data *sd)
// アカウント変数要求
int intif_request_accountreg(struct map_session_data *sd)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
WFIFOW(inter_fd, 0) = 0x3005;
WFIFOL(inter_fd, 2) = sd->bl.id;
@@ -154,7 +154,7 @@ int intif_request_storage(int account_id)
// 倉庫データ送信
int intif_send_storage(struct storage *stor)
{
- nullpo_retr(0, stor);
+ nullpo_ret(stor);
WFIFOW(inter_fd, 0) = 0x3011;
WFIFOW(inter_fd, 2) = sizeof(struct storage) + 8;
WFIFOL(inter_fd, 4) = stor->account_id;
@@ -166,7 +166,7 @@ int intif_send_storage(struct storage *stor)
// パーティ作成要求
int intif_create_party(struct map_session_data *sd, const char *name)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
WFIFOW(inter_fd, 0) = 0x3020;
WFIFOL(inter_fd, 2) = sd->status.account_id;
@@ -253,15 +253,6 @@ int intif_party_changemap(struct map_session_data *sd, int online)
return 0;
}
-// パーティー解散要求
-int intif_break_party(int party_id)
-{
- WFIFOW(inter_fd, 0) = 0x3026;
- WFIFOL(inter_fd, 2) = party_id;
- WFIFOSET(inter_fd, 6);
- return 0;
-}
-
// パーティ会話送信
int intif_party_message(int party_id, int account_id, const char *mes, int len)
{
diff --git a/src/map/intif.hpp b/src/map/intif.hpp
index c2a4d5f..720c7cd 100644
--- a/src/map/intif.hpp
+++ b/src/map/intif.hpp
@@ -23,7 +23,6 @@ int intif_party_changeoption(int party_id, int account_id, int exp,
int item);
int intif_party_leave(int party_id, int accound_id);
int intif_party_changemap(struct map_session_data *sd, int online);
-int intif_break_party(int party_id);
int intif_party_message(int party_id, int account_id, const char *mes, int len);
int intif_party_checkconflict(int party_id, int account_id, const char *nick);
diff --git a/src/map/itemdb.cpp b/src/map/itemdb.cpp
index 7861796..19b5d3e 100644
--- a/src/map/itemdb.cpp
+++ b/src/map/itemdb.cpp
@@ -219,23 +219,6 @@ int itemdb_isequip3(int nameid)
return 0;
}
-/*==========================================
- * 捨てられるアイテムは1、そうでないアイテムは0
- *------------------------------------------
- */
-int itemdb_isdropable(int nameid)
-{
- //結婚指輪は捨てられない
- switch (nameid)
- {
- case 2634: //結婚指輪
- case 2635: //結婚指輪
- return 0;
- }
-
- return 1;
-}
-
//
// 初期化
//
diff --git a/src/map/itemdb.hpp b/src/map/itemdb.hpp
index ffca4bd..97d39dd 100644
--- a/src/map/itemdb.hpp
+++ b/src/map/itemdb.hpp
@@ -49,22 +49,15 @@ struct item_data *itemdb_searchname(const char *name);
struct item_data *itemdb_search(int nameid);
struct item_data *itemdb_exists(int nameid);
#define itemdb_type(n) itemdb_search(n)->type
-#define itemdb_atk(n) itemdb_search(n)->atk
-#define itemdb_def(n) itemdb_search(n)->def
#define itemdb_look(n) itemdb_search(n)->look
#define itemdb_weight(n) itemdb_search(n)->weight
-#define itemdb_equip(n) itemdb_search(n)->equip
-#define itemdb_usescript(n) itemdb_search(n)->use_script
#define itemdb_equipscript(n) itemdb_search(n)->equip_script
#define itemdb_wlv(n) itemdb_search(n)->wlv
-#define itemdb_range(n) itemdb_search(n)->range
-#define itemdb_slot(n) itemdb_search(n)->slot
#define itemdb_available(n) (itemdb_exists(n) && itemdb_search(n)->flag.available)
#define itemdb_viewid(n) (itemdb_search(n)->view_id)
int itemdb_searchrandomid(int flags);
-#define itemdb_value_buy(n) itemdb_search(n)->value_buy
#define itemdb_value_sell(n) itemdb_search(n)->value_sell
#define itemdb_value_notdc(n) itemdb_search(n)->flag.value_notdc
#define itemdb_value_notoc(n) itemdb_search(n)->flag.value_notoc
@@ -72,7 +65,6 @@ int itemdb_searchrandomid(int flags);
int itemdb_isequip(int);
int itemdb_isequip2(struct item_data *);
int itemdb_isequip3(int);
-int itemdb_isdropable(int nameid);
void itemdb_reload(void);
diff --git a/src/map/magic-interpreter-parser.ypp b/src/map/magic-interpreter-parser.ypp
index 09dc67e..860103a 100644
--- a/src/map/magic-interpreter-parser.ypp
+++ b/src/map/magic-interpreter-parser.ypp
@@ -55,6 +55,7 @@ void add_teleport_anchor(teleport_anchor_t *anchor, int line_nr);
static
effect_t *op_effect(char *name, int args_nr, expr_t **args, int line, int column);
+// in magic-interpreter-lexer.cpp
int magic_frontend_lex(YYSTYPE *, YYLTYPE *);
static
diff --git a/src/map/magic-interpreter.hpp b/src/map/magic-interpreter.hpp
index 664c818..744d367 100644
--- a/src/map/magic-interpreter.hpp
+++ b/src/map/magic-interpreter.hpp
@@ -469,8 +469,8 @@ invocation_t *spell_instantiate(effect_set_t *effect, env_t *env);
*/
void spell_bind(character_t *subject, invocation_t *invocation);
-int // 1 on failure
- spell_unbind(character_t *subject, invocation_t *invocation);
+// 1 on failure
+int spell_unbind(character_t *subject, invocation_t *invocation);
/**
* Clones a spell to run the at_effect field
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 3bbfa9f..2d49739 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -191,7 +191,7 @@ int map_addblock(struct block_list *bl)
{
int m, x, y;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->prev != NULL)
{
@@ -242,7 +242,7 @@ int map_addblock(struct block_list *bl)
int map_delblock(struct block_list *bl)
{
int b;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
// 既にblocklistから抜けている
if (bl->prev == NULL)
@@ -290,38 +290,6 @@ int map_delblock(struct block_list *bl)
}
/*==========================================
- * 周囲のPC人数を数える (現在未使用)
- *------------------------------------------
- */
-int map_countnearpc(int m, int x, int y)
-{
- int bx, by, c = 0;
- struct block_list *bl = NULL;
-
- if (map[m].users == 0)
- return 0;
- for (by = y / BLOCK_SIZE - AREA_SIZE / BLOCK_SIZE - 1;
- by <= y / BLOCK_SIZE + AREA_SIZE / BLOCK_SIZE + 1; by++)
- {
- if (by < 0 || by >= map[m].bys)
- continue;
- for (bx = x / BLOCK_SIZE - AREA_SIZE / BLOCK_SIZE - 1;
- bx <= x / BLOCK_SIZE + AREA_SIZE / BLOCK_SIZE + 1; bx++)
- {
- if (bx < 0 || bx >= map[m].bxs)
- continue;
- bl = map[m].block[bx + by * map[m].bxs];
- for (; bl; bl = bl->next)
- {
- if (bl->type == BL_PC)
- c++;
- }
- }
- }
- return c;
-}
-
-/*==========================================
* セル上のPCとMOBの数を数える (グランドクロス用)
*------------------------------------------
*/
@@ -804,6 +772,7 @@ void map_clearflooritem_timer(timer_id tid, tick_t, custom_id_t id, custom_data_
* 現状range=1でアイテムドロップ用途のみ
*------------------------------------------
*/
+static
int map_searchrandfreecell(int m, int x, int y, int range)
{
int free_cell, i, j, c;
@@ -862,7 +831,7 @@ int map_addflooritem_any(struct item *item_data, int amount, int m, int x,
unsigned int tick;
struct flooritem_data *fitem = NULL;
- nullpo_retr(0, item_data);
+ nullpo_ret(item_data);
if ((xy = map_searchrandfreecell(m, x, y, dispersal)) < 0)
return 0;
@@ -950,7 +919,7 @@ int map_addflooritem(struct item *item_data, int amount, int m, int x, int y,
/* unsigned int tick; */
/* struct flooritem_data *fitem=NULL; */
-/* nullpo_retr(0, item_data); */
+/* nullpo_ret(item_data); */
/* if ((xy=map_searchrandfreecell(m,x,y,1))<0) */
/* return 0; */
@@ -1043,7 +1012,7 @@ void map_addchariddb(int charid, const char *name)
*/
int map_reqchariddb(struct map_session_data *sd, int charid)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
struct charid2nick *p = (struct charid2nick *)numdb_search(charid_db, charid);
if (p != NULL) // データベースにすでにある
@@ -1095,7 +1064,7 @@ void map_addnickdb(struct map_session_data *sd)
*/
int map_quit(struct map_session_data *sd)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->chatID) // チャットから出る
chat_leavechat(sd);
@@ -1350,7 +1319,7 @@ int map_addnpc(int m, struct npc_data *nd)
map[m].npc_num++;
}
- nullpo_retr(0, nd);
+ nullpo_ret(nd);
map[m].npc[i] = nd;
nd->n = i;
@@ -1468,7 +1437,7 @@ int map_calc_dir(struct block_list *src, int x, int y)
int dir = 0;
int dx, dy;
- nullpo_retr(0, src);
+ nullpo_ret(src);
dx = x - src->x;
dy = y - src->y;
diff --git a/src/map/map.hpp b/src/map/map.hpp
index dce3b76..1c9eb82 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -612,8 +612,20 @@ struct map_data_other_server
struct in_addr ip;
unsigned int port;
};
-#define read_gat(m,x,y) (map[m].gat[(x)+(y)*map[m].xs])
-#define read_gatp(m,x,y) (m->gat[(x)+(y)*m->xs])
+
+extern struct map_data map[];
+extern int map_num;
+
+inline
+uint8_t read_gatp(struct map_data *m, int x, int y)
+{
+ return (m->gat[x + y * m->xs]);
+}
+inline
+uint8_t read_gat(int m, int x, int y)
+{
+ return read_gatp(&map[m], x, y);
+}
struct flooritem_data
{
@@ -708,8 +720,6 @@ struct chat_data
char npc_event[50];
};
-extern struct map_data map[];
-extern int map_num;
extern int autosave_interval;
extern int save_settings;
extern int night_flag; // 0=day, 1=night [Yor]
@@ -745,7 +755,6 @@ void map_foreachinmovearea(std::function<void(struct block_list *)>,
int, int, int, int,
int, int,
int);
-int map_countnearpc(int, int, int);
//block関連に追加
int map_count_oncell(int m, int x, int y);
// 一時的object関連
@@ -776,11 +785,9 @@ int map_addflooritem_any(struct item *, int amount, int m, int x, int y,
int map_addflooritem(struct item *, int, int, int, int,
struct map_session_data *, struct map_session_data *,
struct map_session_data *, int);
-int map_searchrandfreecell(int, int, int, int);
// キャラid=>キャラ名 変換関連
void map_addchariddb(int charid, const char *name);
-void map_delchariddb(int charid);
int map_reqchariddb(struct map_session_data *sd, int charid);
char *map_charid2nick(int);
@@ -789,7 +796,6 @@ struct block_list *map_id2bl(int);
int map_mapname2mapid(const char *);
int map_mapname2ipport(const char *, struct in_addr *, int *);
int map_setipport(const char *name, struct in_addr ip, int port);
-int map_eraseipport(const char *name, struct in_addr ip, int port);
void map_addiddb(struct block_list *);
void map_deliddb(struct block_list *bl);
void map_foreachiddb(db_func_t);
@@ -817,7 +823,6 @@ int map_calc_dir(struct block_list *src, int x, int y);
int path_search(struct walkpath_data *, int, int, int, int, int, int);
int path_blownpos(int m, int x0, int y0, int dx, int dy, int count);
-int map_who(int fd);
int map_delmap(char *mapname);
diff --git a/src/map/map.t.hpp b/src/map/map.t.hpp
index 50110e9..3562fa3 100644
--- a/src/map/map.t.hpp
+++ b/src/map/map.t.hpp
@@ -60,7 +60,6 @@ enum class Opt2 : uint16_t
_atkpot = 0x0080,
_heal = 0x0100,
_slowpoison = 0x0200,
- sign = 0x8000,
};
enum class Opt3 : uint16_t
{
@@ -75,8 +74,6 @@ enum class Opt3 : uint16_t
_marionette = 0x0400,
_assumptio = 0x0800,
-
- sign = 0x8000,
};
ENUM_BITWISE_OPERATORS(Option)
diff --git a/src/map/mob.cpp b/src/map/mob.cpp
index de3cb5c..db4e326 100644
--- a/src/map/mob.cpp
+++ b/src/map/mob.cpp
@@ -93,7 +93,7 @@ void mob_init(struct mob_data *md);
static
int mob_spawn_dataset(struct mob_data *md, const char *mobname, int mob_class)
{
- nullpo_retr(0, md);
+ nullpo_ret(md);
if (strcmp(mobname, "--en--") == 0)
memcpy(md->name, mob_db[mob_class].name, 24);
@@ -611,7 +611,7 @@ int mob_get_equip(int mob_class) // mob equip [Valaris]
static
int mob_can_move(struct mob_data *md)
{
- nullpo_retr(0, md);
+ nullpo_ret(md);
if (md->canmove_tick > gettick()
|| (bool(md->opt1) && md->opt1 != Opt1::_stone6)
@@ -635,7 +635,7 @@ int mob_can_move(struct mob_data *md)
static
int calc_next_walk_step(struct mob_data *md)
{
- nullpo_retr(0, md);
+ nullpo_ret(md);
if (md->walkpath.path_pos >= md->walkpath.path_len)
return -1;
@@ -660,7 +660,7 @@ int mob_walk(struct mob_data *md, unsigned int tick, int data)
static int diry[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
int x, y, dx, dy;
- nullpo_retr(0, md);
+ nullpo_ret(md);
md->state.state = MS_IDLE;
if (md->walkpath.path_pos >= md->walkpath.path_len
@@ -761,7 +761,7 @@ int mob_check_attack(struct mob_data *md)
int mode, race, range;
- nullpo_retr(0, md);
+ nullpo_ret(md);
md->min_chase = 13;
md->state.state = MS_IDLE;
@@ -864,7 +864,7 @@ int mob_attack(struct mob_data *md, unsigned int tick, int)
{
struct block_list *tbl = NULL;
- nullpo_retr(0, md);
+ nullpo_ret(md);
if ((tbl = map_id2bl(md->target_id)) == NULL)
return 0;
@@ -925,7 +925,7 @@ int mob_changestate(struct mob_data *md, int state, int type)
unsigned int tick;
int i;
- nullpo_retr(0, md);
+ nullpo_ret(md);
if (md->timer != -1)
delete_timer(md->timer, mob_timer);
@@ -1054,7 +1054,7 @@ int mob_walktoxy_sub(struct mob_data *md)
{
struct walkpath_data wpd;
- nullpo_retr(0, md);
+ nullpo_ret(md);
if (path_search(&wpd, md->bl.m, md->bl.x, md->bl.y, md->to_x, md->to_y,
md->state.walk_easy))
@@ -1072,11 +1072,12 @@ int mob_walktoxy_sub(struct mob_data *md)
* mob move start
*------------------------------------------
*/
+static
int mob_walktoxy(struct mob_data *md, int x, int y, int easy)
{
struct walkpath_data wpd;
- nullpo_retr(0, md);
+ nullpo_ret(md);
if (md->state.state == MS_WALK
&& path_search(&wpd, md->bl.m, md->bl.x, md->bl.y, x, y, easy))
@@ -1324,7 +1325,7 @@ int mob_stopattack(struct mob_data *md)
*/
int mob_stop_walking(struct mob_data *md, int type)
{
- nullpo_retr(0, md);
+ nullpo_ret(md);
if (md->state.state == MS_WALK || md->state.state == MS_IDLE)
{
@@ -1377,8 +1378,8 @@ int mob_can_reach(struct mob_data *md, struct block_list *bl, int range)
struct walkpath_data wpd;
int i;
- nullpo_retr(0, md);
- nullpo_retr(0, bl);
+ nullpo_ret(md);
+ nullpo_ret(bl);
dx = abs(bl->x - md->bl.x);
dy = abs(bl->y - md->bl.y);
@@ -1434,8 +1435,8 @@ int mob_target(struct mob_data *md, struct block_list *bl, int dist)
eptr<struct status_change, StatusChange> sc_data;
int mode, race;
- nullpo_retr(0, md);
- nullpo_retr(0, bl);
+ nullpo_ret(md);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
Option *option = battle_get_option(bl);
@@ -1468,7 +1469,7 @@ int mob_target(struct mob_data *md, struct block_list *bl, int dist)
{
if (bl->type == BL_PC)
{
- nullpo_retr(0, sd = (struct map_session_data *) bl);
+ nullpo_ret(sd = (struct map_session_data *) bl);
if (sd->invincible_timer != -1 || pc_isinvisible(sd))
return 0;
if (!(mode & 0x20) && race != 4 && race != 6
@@ -1654,7 +1655,7 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md, unsigned int tick)
struct block_list *bl;
int mode, race, old_dist;
- nullpo_retr(0, md);
+ nullpo_ret(md);
if ((bl = map_id2bl(md->master_id)) != NULL)
mmd = (struct mob_data *) bl;
@@ -1797,7 +1798,7 @@ int mob_ai_sub_hard_slavemob(struct mob_data *md, unsigned int tick)
static
int mob_unlocktarget(struct mob_data *md, int tick)
{
- nullpo_retr(0, md);
+ nullpo_ret(md);
md->target_id = 0;
md->state.targettype = NONE_ATTACKABLE;
@@ -1816,7 +1817,7 @@ int mob_randomwalk(struct mob_data *md, int tick)
const int retrycount = 20;
int speed;
- nullpo_retr(0, md);
+ nullpo_ret(md);
speed = battle_get_speed(&md->bl);
if (DIFF_TICK(md->next_walktime, tick) < 0)
@@ -2464,7 +2465,7 @@ void mob_deleteslave_sub(struct block_list *bl, int id)
*/
int mob_deleteslave(struct mob_data *md)
{
- nullpo_retr(0, md);
+ nullpo_ret(md);
map_foreachinarea(std::bind(mob_deleteslave_sub, ph::_1, md->bl.id),
md->bl.m, 0, 0,
@@ -2501,7 +2502,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage,
int ret;
int skill, sp;
- nullpo_retr(0, md); //srcはNULLで呼ばれる場合もあるので、他でチェック
+ nullpo_ret(md); //srcはNULLで呼ばれる場合もあるので、他でチェック
if (src && src->id == md->master_id
&& md->mode & MOB_MODE_TURNS_AGAINST_BAD_MASTER)
@@ -2602,7 +2603,7 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage,
damage);
}
- nullpo_retr(0, md2);
+ nullpo_ret(md2);
int i;
for (i = 0, minpos = 0, mindmg = 0x7fffffff; i < DAMAGELOG_SIZE;
i++)
@@ -2997,8 +2998,8 @@ int mob_class_change(struct mob_data *md, int *value)
unsigned int tick = gettick();
int i, c, hp_rate, max_hp, mob_class, count = 0;
- nullpo_retr(0, md);
- nullpo_retr(0, value);
+ nullpo_ret(md);
+ nullpo_ret(value);
if (value[0] <= 1000 || value[0] > 2000)
return 0;
@@ -3075,7 +3076,7 @@ int mob_heal(struct mob_data *md, int heal)
{
int max_hp = battle_get_max_hp(&md->bl);
- nullpo_retr(0, md);
+ nullpo_ret(md);
md->hp += heal;
if (max_hp < md->hp)
@@ -3121,7 +3122,7 @@ int mob_warp(struct mob_data *md, int m, int x, int y, int type)
{
int i = 0, c, xs = 0, ys = 0, bx = x, by = y;
- nullpo_retr(0, md);
+ nullpo_ret(md);
if (md->bl.prev == NULL)
return 0;
@@ -3219,7 +3220,7 @@ int mob_countslave(struct mob_data *md)
{
int c = 0;
- nullpo_retr(0, md);
+ nullpo_ret(md);
map_foreachinarea(std::bind(mob_countslave_sub, ph::_1, md->bl.id, &c),
md->bl.m, 0, 0,
@@ -3236,8 +3237,8 @@ int mob_summonslave(struct mob_data *md2, int *value, int amount, int flag)
struct mob_data *md;
int bx, by, m, count = 0, mob_class, k, a = amount;
- nullpo_retr(0, md2);
- nullpo_retr(0, value);
+ nullpo_ret(md2);
+ nullpo_ret(value);
bx = md2->bl.x;
by = md2->bl.y;
@@ -3346,7 +3347,7 @@ int mob_counttargeted(struct mob_data *md, struct block_list *src,
{
int c = 0;
- nullpo_retr(0, md);
+ nullpo_ret(md);
map_foreachinarea(std::bind(mob_counttargeted_sub, ph::_1, md->bl.id, &c, src, target_lv),
md->bl.m, md->bl.x - AREA_SIZE, md->bl.y - AREA_SIZE,
@@ -3628,8 +3629,8 @@ int mobskill_use_id(struct mob_data *md, struct block_list *target,
SkillID skill_id;
int skill_lv, forcecast = 0;
- nullpo_retr(0, md);
- nullpo_retr(0, ms = &mob_db[md->mob_class].skill[skill_idx]);
+ nullpo_ret(md);
+ nullpo_ret(ms = &mob_db[md->mob_class].skill[skill_idx]);
if (target == NULL && (target = map_id2bl(md->target_id)) == NULL)
return 0;
@@ -3759,8 +3760,8 @@ int mobskill_use_pos(struct mob_data *md,
struct block_list bl;
int skill_lv;
- nullpo_retr(0, md);
- nullpo_retr(0, ms = &mob_db[md->mob_class].skill[skill_idx]);
+ nullpo_ret(md);
+ nullpo_ret(ms = &mob_db[md->mob_class].skill[skill_idx]);
if (md->bl.prev == NULL)
return 0;
@@ -3909,7 +3910,7 @@ struct mob_data *mob_getfriendstatus(struct mob_data *md,
struct mob_data *fr = NULL;
const int r = 8;
- nullpo_retr(0, md);
+ nullpo_ret(md);
map_foreachinarea(std::bind(mob_getfriendstatus_sub, ph::_1, md, cond1, cond2, &fr),
md->bl.m, md->bl.x - r, md->bl.y - r,
@@ -3928,8 +3929,8 @@ int mobskill_use(struct mob_data *md, unsigned int tick,
// struct block_list *target=NULL;
int max_hp;
- nullpo_retr(0, md);
- nullpo_retr(0, ms = mob_db[md->mob_class].skill);
+ nullpo_ret(md);
+ nullpo_ret(ms = mob_db[md->mob_class].skill);
max_hp = battle_get_max_hp(&md->bl);
@@ -4138,7 +4139,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick,
*/
int mobskill_event(struct mob_data *md, int flag)
{
- nullpo_retr(0, md);
+ nullpo_ret(md);
if (flag == -1 && mobskill_use(md, gettick(), MSC_CASTTARGETED))
return 1;
diff --git a/src/map/mob.hpp b/src/map/mob.hpp
index e3bb0d6..8157b3e 100644
--- a/src/map/mob.hpp
+++ b/src/map/mob.hpp
@@ -70,8 +70,6 @@ int mob_once_spawn_area(struct map_session_data *sd, const char *mapname, int x0
int mob_spawn_guardian(struct map_session_data *sd, const 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 mob_walktoxy(struct mob_data *md, int x, int y, int easy);
-
int mob_target(struct mob_data *md, struct block_list *bl, int dist);
int mob_stop_walking(struct mob_data *md, int type);
int mob_stopattack(struct mob_data *);
diff --git a/src/map/npc.cpp b/src/map/npc.cpp
index e22110e..54c21b3 100644
--- a/src/map/npc.cpp
+++ b/src/map/npc.cpp
@@ -134,7 +134,7 @@ struct npc_data *npc_name2id(const char *name)
*/
int npc_event_dequeue(struct map_session_data *sd)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
sd->npc_id = 0;
@@ -172,6 +172,7 @@ int npc_delete(struct npc_data *nd)
* イベントの遅延実行
*------------------------------------------
*/
+static
void npc_event_timer(timer_id, tick_t, custom_id_t id, custom_data_t data)
{
struct map_session_data *sd = map_id2sd(id);
@@ -429,7 +430,7 @@ int npc_timerevent_start(struct npc_data *nd)
{
int j, n, next;
- nullpo_retr(0, nd);
+ nullpo_ret(nd);
n = nd->u.scr.timeramount;
if (nd->u.scr.nexttimer >= 0 || n == 0)
@@ -458,7 +459,7 @@ int npc_timerevent_start(struct npc_data *nd)
*/
int npc_timerevent_stop(struct npc_data *nd)
{
- nullpo_retr(0, nd);
+ nullpo_ret(nd);
if (nd->u.scr.nexttimer >= 0)
{
@@ -479,7 +480,7 @@ int npc_gettimerevent_tick(struct npc_data *nd)
{
int tick;
- nullpo_retr(0, nd);
+ nullpo_ret(nd);
tick = nd->u.scr.timer;
@@ -496,7 +497,7 @@ int npc_settimerevent_tick(struct npc_data *nd, int newtimer)
{
int flag;
- nullpo_retr(0, nd);
+ nullpo_ret(nd);
flag = nd->u.scr.nexttimer;
@@ -702,11 +703,12 @@ int npc_touch_areanpc(struct map_session_data *sd, int m, int x, int y)
* 近くかどうかの判定
*------------------------------------------
*/
+static
int npc_checknear(struct map_session_data *sd, int id)
{
struct npc_data *nd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
nd = (struct npc_data *) map_id2bl(id);
if (nd == NULL || nd->bl.type != BL_NPC)
@@ -1714,6 +1716,7 @@ int npc_parse_function(char *, char *, char *w3, char *,
* mob行解析
*------------------------------------------
*/
+static
int npc_parse_mob(const char *w1, const char *, const char *w3, const char *w4)
{
int m, x, y, xs, ys, mob_class, num, delay1, delay2;
@@ -1966,14 +1969,6 @@ int npc_parse_mapflag(char *w1, char *, char *w3, char *w4)
return 0;
}
-static
-void ev_db_final(db_key_t key, db_val_t data)
-{
- free(data);
- if (strstr(key.s, "::") != NULL)
- free((char*)key.s);
-}
-
struct npc_data *npc_spawn_text(int m, int x, int y,
int npc_class, const char *name, const char *message)
{
@@ -2056,44 +2051,6 @@ void npc_free(struct npc_data *nd)
npc_free_internal(nd);
}
-/*==========================================
- * 終了
- *------------------------------------------
- */
-int do_final_npc(void)
-{
- int i;
- struct block_list *bl;
- struct npc_data *nd;
- struct mob_data *md;
-
- if (ev_db)
- strdb_final(ev_db, ev_db_final);
- if (npcname_db)
- strdb_final(npcname_db, NULL);
-
- for (i = START_NPC_NUM; i < npc_id; i++)
- {
- if ((bl = map_id2bl(i)))
- {
- if (bl->type == BL_NPC && (nd = (struct npc_data *) bl))
- npc_free_internal(nd);
- else if (bl->type == BL_MOB && (md = (struct mob_data *) bl))
- {
- if (md->lootitem)
- {
- free(md->lootitem);
- md->lootitem = NULL;
- }
- free(md);
- md = NULL;
- }
- }
- }
-
- return 0;
-}
-
static
void ev_release(db_key_t key, db_val_t val)
{
diff --git a/src/map/npc.hpp b/src/map/npc.hpp
index f6d0adc..0654701 100644
--- a/src/map/npc.hpp
+++ b/src/map/npc.hpp
@@ -10,18 +10,15 @@
#define INVISIBLE_CLASS 32767
int npc_event_dequeue(struct map_session_data *sd);
-void npc_event_timer(timer_id, tick_t, custom_id_t, custom_data_t);
int npc_event(struct map_session_data *sd, const char *npcname, int);
int npc_timer_event(const char *eventname); // Added by RoVeRT
int npc_command(struct map_session_data *sd, const char *npcname, const char *command);
int npc_touch_areanpc(struct map_session_data *, int, int, int);
int npc_click(struct map_session_data *, int);
int npc_scriptcont(struct map_session_data *, int);
-int npc_checknear(struct map_session_data *, int);
int npc_buysellsel(struct map_session_data *, int, int);
int npc_buylist(struct map_session_data *, int, unsigned short *);
int npc_selllist(struct map_session_data *, int, unsigned short *);
-int npc_parse_mob(const char *w1, const char *w2, const char *w3, const char *w4);
int npc_parse_warp(const char *w1, const char *w2, const char *w3, const char *w4);
int npc_enable(const char *name, int flag);
@@ -43,7 +40,6 @@ void npc_free(struct npc_data *npc);
void npc_addsrcfile(char *);
void npc_delsrcfile(char *);
-int do_final_npc(void);
int do_init_npc(void);
int npc_event_do_oninit(void);
int npc_do_ontimer(int, struct map_session_data *, int);
diff --git a/src/map/party.cpp b/src/map/party.cpp
index 0c6e20e..46374d3 100644
--- a/src/map/party.cpp
+++ b/src/map/party.cpp
@@ -22,22 +22,10 @@
static
struct dbt *party_db;
-void party_send_xyhp_timer(timer_id tid, tick_t tick, custom_id_t id, custom_data_t data);
-/*==========================================
- * 終了
- *------------------------------------------
- */
static
-void party_db_final(db_key_t, db_val_t data)
-{
- free(data);
-}
-
-void do_final_party(void)
-{
- if (party_db)
- numdb_final(party_db, party_db_final);
-}
+int party_check_conflict(struct map_session_data *sd);
+static
+void party_send_xyhp_timer(timer_id tid, tick_t tick, custom_id_t id, custom_data_t data);
// 初期化
void do_init_party(void)
@@ -74,7 +62,7 @@ struct party *party_searchname(const char *str)
int party_create(struct map_session_data *sd, const char *name)
{
char pname[24];
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
strncpy(pname, name, 24);
pname[23] = '\0';
@@ -99,7 +87,7 @@ int party_created(int account_id, int fail, int party_id, const char *name)
struct map_session_data *sd;
sd = map_id2sd(account_id);
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
/* The party name is valid and not already taken. */
if (!fail)
@@ -141,7 +129,7 @@ int party_check_member(struct party *p)
int i;
struct map_session_data *sd;
- nullpo_retr(0, p);
+ nullpo_ret(p);
for (i = 0; i < fd_max; i++)
{
@@ -195,7 +183,7 @@ int party_recv_info(struct party *sp)
struct party *p;
int i;
- nullpo_retr(0, sp);
+ nullpo_ret(sp);
if ((p = (struct party *)numdb_search(party_db, sp->party_id)) == NULL)
{
@@ -238,7 +226,7 @@ int party_invite(struct map_session_data *sd, int account_id)
int i;
int full = 1; /* Indicates whether or not there's room for one more. */
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (!tsd || !p || !tsd->fd)
return 0;
@@ -297,7 +285,7 @@ int party_invite(struct map_session_data *sd, int account_id)
/* Process response to party invitation. */
int party_reply_invite(struct map_session_data *sd, int account_id, int flag)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
/* There is no pending invitation. */
if (!sd->party_invite || !sd->party_invite_account)
@@ -384,7 +372,7 @@ int party_removemember(struct map_session_data *sd, int account_id, const char *
struct party *p;
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if ((p = party_search(sd->status.party_id)) == NULL)
return 0;
@@ -413,7 +401,7 @@ int party_leave(struct map_session_data *sd)
struct party *p;
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if ((p = party_search(sd->status.party_id)) == NULL)
return 0;
@@ -481,7 +469,7 @@ int party_changeoption(struct map_session_data *sd, int exp, int item)
{
struct party *p;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->status.party_id == 0
|| (p = party_search(sd->status.party_id)) == NULL)
@@ -558,7 +546,7 @@ int party_send_movemap(struct map_session_data *sd)
{
struct party *p;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->status.party_id == 0)
return 0;
@@ -590,7 +578,7 @@ int party_send_logout(struct map_session_data *sd)
{
struct party *p;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->status.party_id > 0)
intif_party_changemap(sd, 0);
@@ -630,7 +618,7 @@ int party_recv_message(int party_id, int account_id, const char *mes, int len)
// パーティ競合確認
int party_check_conflict(struct map_session_data *sd)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
intif_party_checkconflict(sd->status.party_id, sd->status.account_id,
sd->status.name);
@@ -680,7 +668,7 @@ int party_send_xy_clear(struct party *p)
{
int i;
- nullpo_retr(0, p);
+ nullpo_ret(p);
for (i = 0; i < MAX_PARTY; i++)
{
@@ -716,7 +704,7 @@ int party_exp_share(struct party *p, int mapid, int base_exp, int job_exp)
struct map_session_data *sd;
int i, c;
- nullpo_retr(0, p);
+ nullpo_ret(p);
for (i = c = 0; i < MAX_PARTY; i++)
if ((sd = p->member[i].sd) != NULL && sd->bl.m == mapid)
diff --git a/src/map/party.hpp b/src/map/party.hpp
index 853087e..ecb0cc4 100644
--- a/src/map/party.hpp
+++ b/src/map/party.hpp
@@ -8,7 +8,6 @@ struct map_session_data;
struct block_list;
void do_init_party(void);
-void do_final_party(void);
struct party *party_search(int party_id);
struct party *party_searchname(const char *str);
@@ -38,8 +37,6 @@ int party_send_logout(struct map_session_data *sd);
int party_send_message(struct map_session_data *sd, const char *mes, int len);
int party_recv_message(int party_id, int account_id, const char *mes, int len);
-int party_check_conflict(struct map_session_data *sd);
-
int party_send_xy_clear(struct party *p);
void party_send_hp_check(struct block_list *bl, int party_id, int *flag);
diff --git a/src/map/path.cpp b/src/map/path.cpp
index fb5eedf..afdae03 100644
--- a/src/map/path.cpp
+++ b/src/map/path.cpp
@@ -112,7 +112,7 @@ int calc_cost(struct tmp_path *p, int x1, int y1)
{
int xd, yd;
- nullpo_retr(0, p);
+ nullpo_ret(p);
xd = x1 - p->x;
if (xd < 0)
@@ -133,8 +133,8 @@ int add_path(int *heap, struct tmp_path *tp, int x, int y, int dist,
{
int i;
- nullpo_retr(0, heap);
- nullpo_retr(0, tp);
+ nullpo_ret(heap);
+ nullpo_ret(tp);
i = calc_index(x, y);
@@ -180,7 +180,7 @@ int can_place(struct map_data *m, int x, int y, int flag)
{
int c;
- nullpo_retr(0, m);
+ nullpo_ret(m);
c = read_gatp(m, x, y);
@@ -199,7 +199,7 @@ static
int can_move(struct map_data *m, int x0, int y0, int x1, int y1,
int flag)
{
- nullpo_retr(0, m);
+ nullpo_ret(m);
if (x0 - x1 < -1 || x0 - x1 > 1 || y0 - y1 < -1 || y0 - y1 > 1)
return 0;
@@ -280,7 +280,7 @@ int path_search(struct walkpath_data *wpd, int m, int x0, int y0, int x1,
struct map_data *md;
int dx, dy;
- nullpo_retr(0, wpd);
+ nullpo_ret(wpd);
if (!map[m].gat)
return -1;
@@ -397,51 +397,3 @@ int path_search(struct walkpath_data *wpd, int m, int x0, int y0, int x1,
}
return -1;
}
-
-#ifdef PATH_STANDALONETEST
-char gat[64][64] = {
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
- {0, 0, 0, 0, 1, 0, 0, 0, 0, 0},
-};
-
-struct map_data map[1];
-
-/*==========================================
- * 経路探索ルーチン単体テスト用main関数
- *------------------------------------------
- */
-void main(int argc, char *argv[])
-{
- struct walkpath_data wpd;
-
- map[0].gat = gat;
- map[0].xs = 64;
- map[0].ys = 64;
-
- path_search(&wpd, 0, 3, 4, 5, 4);
- path_search(&wpd, 0, 5, 4, 3, 4);
- path_search(&wpd, 0, 6, 4, 3, 4);
- path_search(&wpd, 0, 7, 4, 3, 4);
- path_search(&wpd, 0, 4, 3, 4, 5);
- path_search(&wpd, 0, 4, 2, 4, 5);
- path_search(&wpd, 0, 4, 1, 4, 5);
- path_search(&wpd, 0, 4, 5, 4, 3);
- path_search(&wpd, 0, 4, 6, 4, 3);
- path_search(&wpd, 0, 4, 7, 4, 3);
- path_search(&wpd, 0, 7, 4, 3, 4);
- path_search(&wpd, 0, 8, 4, 3, 4);
- path_search(&wpd, 0, 9, 4, 3, 4);
- path_search(&wpd, 0, 10, 4, 3, 4);
- path_search(&wpd, 0, 11, 4, 3, 4);
- path_search(&wpd, 0, 12, 4, 3, 4);
- path_search(&wpd, 0, 13, 4, 3, 4);
- path_search(&wpd, 0, 14, 4, 3, 4);
- path_search(&wpd, 0, 15, 4, 3, 4);
- path_search(&wpd, 0, 16, 4, 3, 4);
- path_search(&wpd, 0, 17, 4, 3, 4);
- path_search(&wpd, 0, 18, 4, 3, 4);
-}
-#endif
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index b780fd4..4aa87c9 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -113,12 +113,28 @@ struct gm_account *gm_account = NULL;
static
int GM_num = 0;
+static
+int pc_checkoverhp(struct map_session_data *sd);
+static
+int pc_checkoversp(struct map_session_data *sd);
+static
+int pc_equiplookall(struct map_session_data *sd);
+static
+int pc_nextbaseafter(struct map_session_data *sd);
+static
+int pc_nextjobafter(struct map_session_data *sd);
+static
+void pc_setdead(struct map_session_data *sd)
+{
+ sd->state.dead_sit = 1;
+}
+
int pc_isGM(struct map_session_data *sd)
{
// struct gm_account *p;
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
/* p = numdb_search(gm_account_db, sd->status.account_id);
if (p == NULL)
@@ -135,7 +151,7 @@ int pc_isGM(struct map_session_data *sd)
int pc_iskiller(struct map_session_data *src,
struct map_session_data *target)
{
- nullpo_retr(0, src);
+ nullpo_ret(src);
if (src->bl.type != BL_PC)
return 0;
@@ -206,7 +222,7 @@ void pc_invincible_timer(timer_id tid, tick_t, custom_id_t id, custom_data_t)
int pc_setinvincibletimer(struct map_session_data *sd, int val)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->invincible_timer != -1)
delete_timer(sd->invincible_timer, pc_invincible_timer);
@@ -217,7 +233,7 @@ int pc_setinvincibletimer(struct map_session_data *sd, int val)
int pc_delinvincibletimer(struct map_session_data *sd)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->invincible_timer != -1)
{
@@ -259,7 +275,7 @@ int pc_addspiritball(struct map_session_data *sd, int interval, int max)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (max > MAX_SKILL_LEVEL)
max = MAX_SKILL_LEVEL;
@@ -293,7 +309,7 @@ int pc_delspiritball(struct map_session_data *sd, int count, int type)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->spiritball <= 0)
{
@@ -332,7 +348,7 @@ int pc_setrestartvalue(struct map_session_data *sd, int type)
//転生や養子の場合の元の職業を算出する
struct pc_base_job s_class;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
s_class = pc_calc_base_job(sd->status.pc_class);
@@ -445,7 +461,7 @@ int pc_walktoxy_sub(struct map_session_data *);
*/
int pc_makesavestatus(struct map_session_data *sd)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
// 服の色は色々弊害が多いので保存対象にはしない
if (!battle_config.save_clothcolor)
@@ -490,7 +506,7 @@ int pc_makesavestatus(struct map_session_data *sd)
int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id,
int login_id1, int client_tick, int sex, int)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
sd->bl.id = account_id;
sd->char_id = char_id;
@@ -513,7 +529,7 @@ int pc_equippoint(struct map_session_data *sd, int n)
//転生や養子の場合の元の職業を算出する
struct pc_base_job s_class;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (!sd->inventory_data[n])
return 0;
@@ -538,7 +554,7 @@ int pc_setinventorydata(struct map_session_data *sd)
{
int i, id;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0; i < MAX_INVENTORY; i++)
{
@@ -551,7 +567,7 @@ int pc_setinventorydata(struct map_session_data *sd)
static
int pc_calcweapontype(struct map_session_data *sd)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->weapontype1 != 0 && sd->weapontype2 == 0)
sd->status.weapon = sd->weapontype1;
@@ -580,7 +596,7 @@ int pc_setequipindex(struct map_session_data *sd)
{
int i, j;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0; i < 11; i++)
sd->equip_index[i] = -1;
@@ -625,13 +641,14 @@ int pc_setequipindex(struct map_session_data *sd)
return 0;
}
+static
int pc_isequip(struct map_session_data *sd, int n)
{
struct item_data *item;
eptr<struct status_change, StatusChange> sc_data;
//転生や養子の場合の元の職業を算出する
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
item = sd->inventory_data[n];
sc_data = battle_get_sc_data(&sd->bl);
@@ -1001,7 +1018,7 @@ int pc_calc_skillpoint(struct map_session_data *sd)
{
int i, skill_points = 0;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0; i < skill_pool_skills_size; i++) {
int lv = sd->status.skill[skill_pool_skills[i]].lv;
@@ -1024,7 +1041,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
//転生や養子の場合の元の職業を算出する
struct pc_base_job s_class;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
s_class = pc_calc_base_job(sd->status.pc_class);
c = s_class.job;
@@ -1202,7 +1219,7 @@ int pc_checkweighticon(struct map_session_data *sd)
{
int flag = 0;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->weight * 2 >= sd->max_weight
&& sd->sc_data[SC_FLYING_BACKPACK].timer == -1)
@@ -1263,7 +1280,7 @@ int pc_calcstatus(struct map_session_data *sd, int first)
int str, dstr, dex;
struct pc_base_job s_class;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
//転生や養子の場合の元の職業を算出する
s_class = pc_calc_base_job(sd->status.pc_class);
@@ -2490,7 +2507,7 @@ int pc_calcstatus(struct map_session_data *sd, int first)
*/
int pc_bonus(struct map_session_data *sd, int type, int val)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
switch (type)
{
@@ -2898,7 +2915,7 @@ int pc_bonus2(struct map_session_data *sd, int type, int type2, int val)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
switch (type)
{
@@ -3170,7 +3187,7 @@ int pc_bonus3(struct map_session_data *sd, int type, int type2, int type3,
*/
int pc_skill(struct map_session_data *sd, SkillID id, int level, int flag)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (level > MAX_SKILL_LEVEL)
{
@@ -3193,56 +3210,6 @@ int pc_skill(struct map_session_data *sd, SkillID id, int level, int flag)
return 0;
}
-/*==========================================
- * カード挿入
- *------------------------------------------
- */
-int pc_insert_card(struct map_session_data *sd, int idx_card, int idx_equip)
-{
- nullpo_retr(0, sd);
-
- if (idx_card >= 0 && idx_card < MAX_INVENTORY && idx_equip >= 0
- && idx_equip < MAX_INVENTORY && sd->inventory_data[idx_card])
- {
- int i;
- int nameid = sd->status.inventory[idx_equip].nameid;
- int cardid = sd->status.inventory[idx_card].nameid;
- int ep = sd->inventory_data[idx_card]->equip;
-
- if (nameid <= 0 || sd->inventory_data[idx_equip] == NULL ||
- (sd->inventory_data[idx_equip]->type != 4 && sd->inventory_data[idx_equip]->type != 5) || // 装 備じゃない
- (sd->status.inventory[idx_equip].identify == 0) || // 未鑑定
- (sd->status.inventory[idx_equip].card[0] == 0x00ff) || // 製造武器
- (sd->status.inventory[idx_equip].card[0] == 0x00fe) ||
- ((sd->inventory_data[idx_equip]->equip & ep) == 0) || // 装 備個所違い
- (sd->inventory_data[idx_equip]->type == 4 && ep == 32) || // 両 手武器と盾カード
- (sd->status.inventory[idx_equip].card[0] == (short) 0xff00)
- || sd->status.inventory[idx_equip].equip)
- {
-
- clif_insert_card(sd, idx_equip, idx_card, 1);
- return 0;
- }
- for (i = 0; i < sd->inventory_data[idx_equip]->slot; i++)
- {
- if (sd->status.inventory[idx_equip].card[i] == 0)
- {
- // 空きスロットがあったので差し込む
- sd->status.inventory[idx_equip].card[i] = cardid;
-
- // カードは減らす
- clif_insert_card(sd, idx_equip, idx_card, 0);
- pc_delitem(sd, idx_card, 1, 1);
- return 0;
- }
- }
- }
- else
- clif_insert_card(sd, idx_equip, idx_card, 1);
-
- return 0;
-}
-
//
// アイテム物
//
@@ -3298,7 +3265,7 @@ int pc_checkadditem(struct map_session_data *sd, int nameid, int amount)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (itemdb_isequip(nameid))
return ADDITEM_NEW;
@@ -3326,7 +3293,7 @@ int pc_inventoryblank(struct map_session_data *sd)
{
int i, b;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0, b = 0; i < MAX_INVENTORY; i++)
{
@@ -3345,7 +3312,7 @@ int pc_payzeny(struct map_session_data *sd, int zeny)
{
double z;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
z = (double) sd->status.zeny;
if (sd->status.zeny < zeny || z - (double) zeny > MAX_ZENY)
@@ -3364,7 +3331,7 @@ int pc_getzeny(struct map_session_data *sd, int zeny)
{
double z;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
z = (double) sd->status.zeny;
if (z + (double) zeny > MAX_ZENY)
@@ -3403,7 +3370,7 @@ int pc_count_all_items(struct map_session_data *player, int item_id)
int i;
int count = 0;
- nullpo_retr(0, player);
+ nullpo_ret(player);
for (i = 0; i < MAX_INVENTORY; i++)
{
@@ -3418,7 +3385,7 @@ int pc_remove_items(struct map_session_data *player, int item_id, int count)
{
int i;
- nullpo_retr(0, player);
+ nullpo_ret(player);
for (i = 0; i < MAX_INVENTORY && count; i++)
{
@@ -3620,8 +3587,8 @@ int pc_takeitem(struct map_session_data *sd, struct flooritem_data *fitem)
unsigned int tick = gettick();
int can_take;
- nullpo_retr(0, sd);
- nullpo_retr(0, fitem);
+ nullpo_ret(sd);
+ nullpo_ret(fitem);
/* Sometimes the owners reported to us are buggy: */
@@ -3677,7 +3644,7 @@ int pc_isUseitem(struct map_session_data *sd, int n)
struct item_data *item;
int nameid;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
item = sd->inventory_data[n];
nameid = sd->status.inventory[n].nameid;
@@ -3737,73 +3704,10 @@ int pc_useitem(struct map_session_data *sd, int n)
}
/*==========================================
- * カートアイテム追加。個数のみitem構造体の数字を無視
- *------------------------------------------
- */
-int pc_cart_additem(struct map_session_data *sd, struct item *item_data,
- int amount)
-{
- struct item_data *data;
- int i, w;
-
- nullpo_retr(1, sd);
- nullpo_retr(1, item_data);
-
- if (item_data->nameid <= 0 || amount <= 0)
- return 1;
- data = itemdb_search(item_data->nameid);
-
- if ((w = data->weight * amount) + sd->cart_weight > sd->cart_max_weight)
- return 1;
-
- i = MAX_CART;
- if (!itemdb_isequip2(data))
- {
- // 装 備品ではないので、既所有品なら個数のみ変化させる
- for (i = 0; i < MAX_CART; i++)
- {
- if (sd->status.cart[i].nameid == item_data->nameid &&
- sd->status.cart[i].card[0] == item_data->card[0]
- && sd->status.cart[i].card[1] == item_data->card[1]
- && sd->status.cart[i].card[2] == item_data->card[2]
- && sd->status.cart[i].card[3] == item_data->card[3])
- {
- if (sd->status.cart[i].amount + amount > MAX_AMOUNT)
- return 1;
- sd->status.cart[i].amount += amount;
- clif_cart_additem(sd, i, amount, 0);
- break;
- }
- }
- }
- if (i >= MAX_CART)
- {
- // 装 備品か未所有品だったので空き欄へ追加
- for (i = 0; i < MAX_CART; i++)
- {
- if (sd->status.cart[i].nameid == 0)
- {
- memcpy(&sd->status.cart[i], item_data,
- sizeof(sd->status.cart[0]));
- sd->status.cart[i].amount = amount;
- sd->cart_num++;
- clif_cart_additem(sd, i, amount, 0);
- break;
- }
- }
- if (i >= MAX_CART)
- return 1;
- }
- sd->cart_weight += w;
- clif_updatestatus(sd, SP_CARTINFO);
-
- return 0;
-}
-
-/*==========================================
* カートアイテムを減らす
*------------------------------------------
*/
+static
int pc_cart_delitem(struct map_session_data *sd, int n, int amount, int type)
{
nullpo_retr(1, sd);
@@ -3828,107 +3732,6 @@ int pc_cart_delitem(struct map_session_data *sd, int n, int amount, int type)
}
/*==========================================
- * カートへアイテム移動
- *------------------------------------------
- */
-int pc_putitemtocart(struct map_session_data *sd, int idx, int amount)
-{
- struct item *item_data;
-
- nullpo_retr(0, sd);
-
- if (idx < 0 || idx >= MAX_INVENTORY)
- return 1;
-
- nullpo_retr(0, item_data = &sd->status.inventory[idx]);
-
- if (!pc_iscarton(sd))
- return 1;
- if (item_data->nameid == 0 || item_data->amount < amount)
- return 1;
- if (pc_cart_additem(sd, item_data, amount) == 0)
- return pc_delitem(sd, idx, amount, 0);
-
- return 1;
-}
-
-/*==========================================
- * カート内のアイテム数確認(個数の差分を返す)
- *------------------------------------------
- */
-int pc_cartitem_amount(struct map_session_data *sd, int idx, int amount)
-{
- struct item *item_data;
-
- nullpo_retr(-1, sd);
-
- if (idx < 0 || idx >= MAX_CART)
- return -1;
-
- nullpo_retr(-1, item_data = &sd->status.cart[idx]);
-
- if (!pc_iscarton(sd))
- return -1;
- if (item_data->nameid == 0 || !item_data->amount)
- return -1;
- return item_data->amount - amount;
-}
-
-/*==========================================
- * カートからアイテム移動
- *------------------------------------------
- */
-
-int pc_getitemfromcart(struct map_session_data *sd, int idx, int amount)
-{
- struct item *item_data;
- int flag;
-
- nullpo_retr(0, sd);
-
- if (idx < 0 || idx >= MAX_CART)
- return 1;
-
- nullpo_retr(0, item_data = &sd->status.cart[idx]);
-
- if (!pc_iscarton(sd))
- return 1;
- if (item_data->nameid == 0 || item_data->amount < amount)
- return 1;
- if ((flag = pc_additem(sd, item_data, amount)) == 0)
- return pc_cart_delitem(sd, idx, amount, 0);
-
- clif_additem(sd, 0, 0, flag);
- return 1;
-}
-
-/*==========================================
- * アイテム鑑定
- *------------------------------------------
- */
-int pc_item_identify(struct map_session_data *sd, int idx)
-{
- int flag = 1;
-
- nullpo_retr(0, sd);
-
- if (idx >= 0 && idx < MAX_INVENTORY)
- {
- if (sd->status.inventory[idx].nameid > 0
- && sd->status.inventory[idx].identify == 0)
- {
- flag = 0;
- sd->status.inventory[idx].identify = 1;
- }
- clif_item_identified(sd, idx, flag);
- }
- else
- clif_item_identified(sd, idx, flag);
-
- return !flag;
-}
-
-/*==========================================
* スティル品公開
*------------------------------------------
*/
@@ -4072,7 +3875,7 @@ int pc_setpos(struct map_session_data *sd, const char *mapname_org, int x, int y
char mapname[24];
int m = 0, c = 0, disguise = 0;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->chatID) // チャットから出る
chat_leavechat(sd);
@@ -4211,7 +4014,7 @@ int pc_randomwarp(struct map_session_data *sd, int type)
int x, y, c, i = 0;
int m;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
m = sd->bl.m;
@@ -4232,75 +4035,15 @@ int pc_randomwarp(struct map_session_data *sd, int type)
}
/*==========================================
- * 現在位置のメモ
- *------------------------------------------
- */
-int pc_memo(struct map_session_data *sd, int i)
-{
- int skill;
- int j;
-
- nullpo_retr(0, sd);
-
- skill = pc_checkskill(sd, AL_WARP);
-
- if (i >= MIN_PORTAL_MEMO)
- i -= MIN_PORTAL_MEMO;
- else if (map[sd->bl.m].flag.nomemo
- || (map[sd->bl.m].flag.nowarpto
- && battle_config.any_warp_GM_min_level > pc_isGM(sd)))
- {
- clif_skill_teleportmessage(sd, 1);
- return 0;
- }
-
- if (skill < 1)
- {
- clif_skill_memo(sd, 2);
- }
-
- if (skill < 2 || i < -1 || i > 2)
- {
- clif_skill_memo(sd, 1);
- return 0;
- }
-
- for (j = 0; j < 3; j++)
- {
- if (strcmp(sd->status.memo_point[j].map, map[sd->bl.m].name) == 0)
- {
- i = j;
- break;
- }
- }
-
- if (i == -1)
- {
- for (i = skill - 3; i >= 0; i--)
- {
- memcpy(&sd->status.memo_point[i + 1], &sd->status.memo_point[i],
- sizeof(struct point));
- }
- i = 0;
- }
- memcpy(sd->status.memo_point[i].map, map[sd->bl.m].name, 24);
- sd->status.memo_point[i].x = sd->bl.x;
- sd->status.memo_point[i].y = sd->bl.y;
-
- clif_skill_memo(sd, 0);
-
- return 1;
-}
-
-/*==========================================
*
*------------------------------------------
*/
+static
int pc_can_reach(struct map_session_data *sd, int x, int y)
{
struct walkpath_data wpd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->bl.x == x && sd->bl.y == y) // 同じマス
return 1;
@@ -4323,7 +4066,7 @@ int pc_can_reach(struct map_session_data *sd, int x, int y)
static
int calc_next_walk_step(struct map_session_data *sd)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->walkpath.path_pos >= sd->walkpath.path_len)
return -1;
@@ -4513,7 +4256,7 @@ int pc_walktoxy_sub(struct map_session_data *sd)
int pc_walktoxy(struct map_session_data *sd, int x, int y)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
sd->to_x = x;
sd->to_y = y;
@@ -4541,7 +4284,7 @@ int pc_walktoxy(struct map_session_data *sd, int x, int y)
*/
int pc_stop_walking(struct map_session_data *sd, int type)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->walktimer != -1)
{
@@ -4583,7 +4326,7 @@ int pc_movepos(struct map_session_data *sd, int dst_x, int dst_y)
struct walkpath_data wpd;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (path_search(&wpd, sd->bl.m, sd->bl.x, sd->bl.y, dst_x, dst_y, 0))
return 1;
@@ -4670,9 +4413,10 @@ int pc_checkskill(struct map_session_data *sd, SkillID skill_id)
* -1 スキルを解除
*------------------------------------------
*/
+static
int pc_checkallowskill(struct map_session_data *sd)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (!(skill_get_weapontype(KN_TWOHANDQUICKEN) & (1 << sd->status.weapon))
&& sd->sc_data[SC_TWOHANDQUICKEN].timer != -1)
@@ -4961,7 +4705,7 @@ int pc_attack(struct map_session_data *sd, int target_id, int type)
struct block_list *bl;
int d;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
bl = map_id2bl(target_id);
if (bl == NULL)
@@ -5001,7 +4745,7 @@ int pc_attack(struct map_session_data *sd, int target_id, int type)
*/
int pc_stopattack(struct map_session_data *sd)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->attacktimer != -1)
{
@@ -5015,77 +4759,11 @@ int pc_stopattack(struct map_session_data *sd)
}
static
-void pc_follow_timer(timer_id tid, tick_t tick, custom_id_t id, custom_data_t)
-{
- struct map_session_data *sd, *bl;
-
- sd = map_id2sd(id);
- if (sd == NULL || sd->followtimer != tid)
- return;
-
- sd->followtimer = -1;
-
- do
- {
- if (sd->bl.prev == NULL)
- break;
-
- bl = (struct map_session_data *) map_id2bl(sd->followtarget);
-
- if (bl == NULL)
- return;
-
- if (bl->bl.prev == NULL)
- break;
-
- if (bl->bl.type == BL_PC
- && pc_isdead((struct map_session_data *) bl))
- return;
-
- if (sd->skilltimer == -1 && sd->attacktimer == -1
- && sd->walktimer == -1)
- {
- if ((sd->bl.m == bl->bl.m)
- && pc_can_reach(sd, bl->bl.x, bl->bl.y))
- {
- if (distance(sd->bl.x, sd->bl.y, bl->bl.x, bl->bl.y) > 5)
- pc_walktoxy(sd, bl->bl.x, bl->bl.y);
- }
- else
- pc_setpos((struct map_session_data *) sd, bl->mapname,
- bl->bl.x, bl->bl.y, 3);
- }
- }
- while (0);
-
- sd->followtimer =
- add_timer(tick + sd->aspd, pc_follow_timer, sd->bl.id, 0);
-}
-
-int pc_follow(struct map_session_data *sd, int target_id)
-{
- struct block_list *bl;
-
- bl = map_id2bl(target_id);
- if (bl == NULL)
- return 1;
- sd->followtarget = target_id;
- if (sd->followtimer != -1)
- {
- delete_timer(sd->followtimer, pc_follow_timer);
- sd->followtimer = -1;
- }
-
- pc_follow_timer(-1, gettick(), sd->bl.id, 0);
-
- return 0;
-}
-
int pc_checkbaselevelup(struct map_session_data *sd)
{
int next = pc_nextbaseexp(sd);
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->status.base_exp >= next && next > 0)
{
@@ -5158,11 +4836,12 @@ int pc_skillpt_potential(struct map_session_data *sd)
return potential;
}
+static
int pc_checkjoblevelup(struct map_session_data *sd)
{
int next = pc_nextjobexp(sd);
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->status.job_exp >= next && next > 0)
{
@@ -5208,7 +4887,7 @@ int pc_gainexp_reason(struct map_session_data *sd, int base_exp, int job_exp,
int reason)
{
char output[256];
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->bl.prev == NULL || pc_isdead(sd))
return 0;
@@ -5288,7 +4967,7 @@ int pc_gainexp_reason(struct map_session_data *sd, int base_exp, int job_exp,
int pc_extract_healer_exp(struct map_session_data *sd, int max)
{
int amount;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
amount = sd->heal_xp;
if (max < amount)
@@ -5306,7 +4985,7 @@ int pc_nextbaseexp(struct map_session_data *sd)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->status.base_level >= MAX_LEVEL || sd->status.base_level <= 0)
return 0;
@@ -5351,7 +5030,7 @@ int pc_nextbaseafter(struct map_session_data *sd)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->status.base_level >= MAX_LEVEL || sd->status.base_level <= 0)
return 0;
@@ -5382,7 +5061,7 @@ int pc_nextjobafter(struct map_session_data *sd)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->status.job_level >= MAX_LEVEL || sd->status.job_level <= 0)
return 0;
@@ -5436,7 +5115,7 @@ int pc_statusup(struct map_session_data *sd, int type)
{
int need, val = 0;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
switch (type)
{
@@ -5511,7 +5190,7 @@ int pc_statusup(struct map_session_data *sd, int type)
*/
int pc_statusup2(struct map_session_data *sd, int type, int val)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (type < SP_STR || type > SP_LUK)
{
@@ -5590,7 +5269,7 @@ int pc_statusup2(struct map_session_data *sd, int type, int val)
*/
int pc_skillup(struct map_session_data *sd, SkillID skill_num)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->status.skill[skill_num].id != SkillID::ZERO
&& sd->status.skill_point >= sd->status.skill[skill_num].lv
@@ -5620,7 +5299,7 @@ int pc_allskillup(struct map_session_data *sd)
//転生や養子の場合の元の職業を算出する
struct pc_base_job s_class;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
s_class = pc_calc_base_job(sd->status.pc_class);
c = s_class.job;
@@ -5669,7 +5348,7 @@ int pc_allskillup(struct map_session_data *sd)
*/
int pc_resetlvl(struct map_session_data *sd, int type)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (SkillID i : erange(SkillID(1), MAX_SKILL))
{
@@ -5759,24 +5438,13 @@ int pc_resetlvl(struct map_session_data *sd, int type)
*/
int pc_resetstate(struct map_session_data *sd)
{
-#define sumsp(a) ((a)*((a-2)/10+2) - 5*((a-2)/10)*((a-2)/10) - 6*((a-2)/10) -2)
-// int add=0; // Removed by Dexity
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
// New statpoint table used here - Dexity
sd->status.status_point = atoi(statp[sd->status.base_level - 1]);
// End addition
-// Removed by Dexity - old count
-// add += sumsp(sd->status.str);
-// add += sumsp(sd->status.agi);
-// add += sumsp(sd->status.vit);
-// add += sumsp(sd->status.int_);
-// add += sumsp(sd->status.dex);
-// add += sumsp(sd->status.luk);
-// sd->status.status_point+=add;
-
clif_updatestatus(sd, SP_STATUSPOINT);
sd->status.str = 1;
@@ -5813,7 +5481,7 @@ int pc_resetskill(struct map_session_data *sd)
{
int skill;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
sd->status.skill_point += pc_calc_skillpoint(sd);
@@ -5841,7 +5509,7 @@ int pc_damage(struct block_list *src, struct map_session_data *sd,
int i = 0, j = 0;
struct pc_base_job s_class;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
//転生や養子の場合の元の職業を算出する
s_class = pc_calc_base_job(sd->status.pc_class);
@@ -6123,7 +5791,7 @@ int pc_readparam(struct map_session_data *sd, int type)
s_class = pc_calc_base_job(sd->status.pc_class);
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
switch (type)
{
@@ -6219,7 +5887,7 @@ int pc_setparam(struct map_session_data *sd, int type, int val)
int i = 0, up_level = 50;
struct pc_base_job s_class;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
s_class = pc_calc_base_job(sd->status.pc_class);
@@ -6356,7 +6024,7 @@ int pc_heal(struct map_session_data *sd, int hp, int sp)
// if(battle_config.battle_log)
// printf("heal %d %d\n",hp,sp);
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (pc_checkoverhp(sd))
{
@@ -6482,7 +6150,7 @@ int pc_itemheal_effect(struct map_session_data *sd, int hp, int sp)
// if(battle_config.battle_log)
// printf("heal %d %d\n",hp,sp);
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->sc_data[SC_GOSPEL].timer != -1) //バーサーク中は回復させないらしい
return 0;
@@ -6553,7 +6221,7 @@ int pc_itemheal_effect(struct map_session_data *sd, int hp, int sp)
*/
int pc_percentheal(struct map_session_data *sd, int hp, int sp)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->state.potionpitcher_flag)
{
@@ -6636,7 +6304,7 @@ int pc_jobchange(struct map_session_data *sd, int job, int upper)
//転生や養子の場合の元の職業を算出する
struct pc_base_job s_class = pc_calc_base_job(sd->status.pc_class);
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if ((job > 23) && (job < 68))
job += 3977;
@@ -6720,7 +6388,7 @@ int pc_jobchange(struct map_session_data *sd, int job, int upper)
*/
int pc_equiplookall(struct map_session_data *sd)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
clif_changelook(&sd->bl, LOOK_WEAPON, 0);
// clif_changelook(&sd->bl,LOOK_SHOES,0);
@@ -6739,7 +6407,7 @@ int pc_equiplookall(struct map_session_data *sd)
*/
int pc_changelook(struct map_session_data *sd, int type, int val)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
switch (type)
{
@@ -6781,7 +6449,7 @@ int pc_changelook(struct map_session_data *sd, int type, int val)
*/
int pc_setoption(struct map_session_data *sd, Option type)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
sd->status.option = type;
clif_changeoption(&sd->bl);
@@ -6799,7 +6467,7 @@ int pc_setcart(struct map_session_data *sd, int type)
Option cart[6] = {Option::ZERO, Option::CART1, Option::CART2,
Option::CART3, Option::CART4, Option::CART5};
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (pc_checkskill(sd, MC_PUSHCART) > 0)
{ // プッシュカートスキル所持
@@ -6875,7 +6543,7 @@ int pc_readreg(struct map_session_data *sd, int reg)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0; i < sd->reg_num; i++)
if (sd->reg[i].index == reg)
@@ -6892,7 +6560,7 @@ int pc_setreg(struct map_session_data *sd, int reg, int val)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0; i < sd->reg_num; i++)
{
@@ -6918,7 +6586,7 @@ char *pc_readregstr(struct map_session_data *sd, int reg)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0; i < sd->regstr_num; i++)
if (sd->regstr[i].index == reg)
@@ -6935,7 +6603,7 @@ int pc_setregstr(struct map_session_data *sd, int reg, const char *str)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (strlen(str) + 1 > sizeof(sd->regstr[0].data))
{
@@ -6965,7 +6633,7 @@ int pc_readglobalreg(struct map_session_data *sd, const char *reg)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0; i < sd->status.global_reg_num; i++)
{
@@ -6984,7 +6652,7 @@ int pc_setglobalreg(struct map_session_data *sd, const char *reg, int val)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
//PC_DIE_COUNTERがスクリプトなどで変更された時の処理
if (strcmp(reg, "PC_DIE_COUNTER") == 0 && sd->die_counter != val)
@@ -7036,7 +6704,7 @@ int pc_readaccountreg(struct map_session_data *sd, const char *reg)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0; i < sd->status.account_reg_num; i++)
{
@@ -7055,7 +6723,7 @@ int pc_setaccountreg(struct map_session_data *sd, const char *reg, int val)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (val == 0)
{
@@ -7104,7 +6772,7 @@ int pc_readaccountreg2(struct map_session_data *sd, const char *reg)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0; i < sd->status.account_reg2_num; i++)
{
@@ -7172,7 +6840,7 @@ int pc_percentrefinery(struct map_session_data *sd, struct item *item)
{
int percent;
- nullpo_retr(0, item);
+ nullpo_ret(item);
percent = percentrefinery[itemdb_wlv(item->nameid)][(int) item->refine];
percent += pc_checkskill(sd, BS_WEAPONRESEARCH); // 武器研究スキル所持
@@ -7227,7 +6895,7 @@ int pc_addeventtimer(struct map_session_data *sd, int tick, const char *name)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0; i < MAX_EVENTTIMER; i++)
if (sd->eventtimer[i] == -1)
@@ -7255,7 +6923,7 @@ int pc_deleventtimer(struct map_session_data *sd, const char *name)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0; i < MAX_EVENTTIMER; i++)
if (sd->eventtimer[i] != -1 && strcmp((char
@@ -7280,7 +6948,7 @@ int pc_addeventtimercount(struct map_session_data *sd, const char *name,
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0; i < MAX_EVENTTIMER; i++)
if (sd->eventtimer[i] != -1 && strcmp((char
@@ -7303,7 +6971,7 @@ int pc_cleareventtimer(struct map_session_data *sd)
{
int i;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0; i < MAX_EVENTTIMER; i++)
if (sd->eventtimer[i] != -1)
@@ -7344,7 +7012,7 @@ int pc_equipitem(struct map_session_data *sd, int n, int pos)
struct item_data *id;
//ソス]ソスソスソスソスソス{ソスqソスフ場合ソスフ鯉ソスソスフ職ソスニゑソスソスZソスoソスソスソスソス
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (n < 0 || n >= MAX_INVENTORY)
{
@@ -7517,7 +7185,7 @@ int pc_equipitem(struct map_session_data *sd, int n, int pos)
*/
int pc_unequipitem(struct map_session_data *sd, int n, int type)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
// -- moonsoul (if player is berserk then cannot unequip)
//
@@ -7624,7 +7292,7 @@ int pc_checkitem(struct map_session_data *sd)
int i, j, k, id, calc_flag = 0;
struct item_data *it = NULL;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
// 所持品空き詰め
for (i = j = 0; i < MAX_INVENTORY; i++)
@@ -7709,7 +7377,7 @@ int pc_checkitem(struct map_session_data *sd)
int pc_checkoverhp(struct map_session_data *sd)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->status.hp == sd->status.max_hp)
return 1;
@@ -7725,7 +7393,7 @@ int pc_checkoverhp(struct map_session_data *sd)
int pc_checkoversp(struct map_session_data *sd)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->status.sp == sd->status.max_sp)
return 1;
@@ -7765,8 +7433,8 @@ int pc_calc_pvprank(struct map_session_data *sd)
int old;
struct map_data *m;
- nullpo_retr(0, sd);
- nullpo_retr(0, m = &map[sd->bl.m]);
+ nullpo_ret(sd);
+ nullpo_ret(m = &map[sd->bl.m]);
old = sd->pvp_rank;
@@ -7804,6 +7472,7 @@ void pc_calc_pvprank_timer(timer_id, tick_t, custom_id_t id, custom_data_t data)
* sdは結婚しているか(既婚の場合は相方のchar_idを返す)
*------------------------------------------
*/
+static
int pc_ismarried(struct map_session_data *sd)
{
if (sd == NULL)
@@ -7900,7 +7569,7 @@ int pc_spheal(struct map_session_data *sd)
{
int a;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
a = natural_heal_diff_tick;
if (pc_issit(sd))
@@ -7920,7 +7589,7 @@ int pc_hpheal(struct map_session_data *sd)
{
int a;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
a = natural_heal_diff_tick;
if (pc_issit(sd))
@@ -7937,7 +7606,7 @@ int pc_natural_heal_hp(struct map_session_data *sd)
int bhp;
int inc_num, bonus, skill, hp_flag;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->sc_data[SC_TRICKDEAD].timer != -1) // Modified by RoVeRT
return 0;
@@ -8062,7 +7731,7 @@ int pc_natural_heal_sp(struct map_session_data *sd)
int bsp;
int inc_num, bonus;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->sc_data[SC_TRICKDEAD].timer != -1) // Modified by RoVeRT
return 0;
@@ -8142,7 +7811,7 @@ int pc_spirit_heal_hp(struct map_session_data *sd, int)
int bonus_hp, interval = battle_config.natural_heal_skill_interval;
eptr<struct status_change, StatusChange> sc_data = battle_get_sc_data(&sd->bl);
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (pc_checkoverhp(sd))
{
@@ -8194,7 +7863,7 @@ int pc_spirit_heal_sp(struct map_session_data *sd, int)
{
int bonus_sp, interval = battle_config.natural_heal_skill_interval;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (pc_checkoversp(sd))
{
@@ -8363,7 +8032,7 @@ void pc_natural_heal(timer_id, tick_t tick, custom_id_t, custom_data_t)
*/
int pc_setsavepoint(struct map_session_data *sd, const char *mapname, int x, int y)
{
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
strncpy(sd->status.save_point.map, mapname, 23);
sd->status.save_point.map[23] = '\0';
@@ -8436,6 +8105,7 @@ int pc_read_gm_account(int fd)
* timer to do the day
*------------------------------------------
*/
+static
void map_day_timer(timer_id, tick_t, custom_id_t, custom_data_t)
{
// by [yor]
@@ -8468,6 +8138,7 @@ void map_day_timer(timer_id, tick_t, custom_id_t, custom_data_t)
* timer to do the night
*------------------------------------------
*/
+static
void map_night_timer(timer_id, tick_t, custom_id_t, custom_data_t)
{
// by [yor]
diff --git a/src/map/pc.hpp b/src/map/pc.hpp
index 91ad633..c881178 100644
--- a/src/map/pc.hpp
+++ b/src/map/pc.hpp
@@ -4,11 +4,6 @@
#include "map.hpp"
inline
-void pc_setdead(struct map_session_data *sd)
-{
- sd->state.dead_sit = 1;
-}
-inline
void pc_setsit(struct map_session_data *sd)
{
sd->state.dead_sit = 2;
@@ -60,11 +55,6 @@ bool pc_isinvisible(struct map_session_data *sd)
return bool(sd->status.option & Option::HIDE);
}
inline
-bool pc_is50overweight(struct map_session_data *sd)
-{
- return sd->weight*2 >= sd->max_weight;
-}
-inline
bool pc_is90overweight(struct map_session_data *sd)
{
return sd->weight*10 >= sd->max_weight*9;
@@ -86,27 +76,20 @@ int pc_setnewpc(struct map_session_data *, int, int, int, int, int, int);
int pc_authok(int, int, time_t, short tmw_version, struct mmo_charstatus *);
int pc_authfail(int);
-int pc_isequip(struct map_session_data *sd, int n);
int pc_equippoint(struct map_session_data *sd, int n);
int pc_breakweapon(struct map_session_data *sd); // weapon breaking [Valaris]
int pc_breakarmor(struct map_session_data *sd); // armor breaking [Valaris]
int pc_checkskill(struct map_session_data *sd, SkillID skill_id);
-int pc_checkallowskill(struct map_session_data *sd);
int pc_checkequip(struct map_session_data *sd, int pos);
-int pc_checkoverhp(struct map_session_data *);
-int pc_checkoversp(struct map_session_data *);
-
-int pc_can_reach(struct map_session_data *, int, int);
int pc_walktoxy(struct map_session_data *, int, int);
int pc_stop_walking(struct map_session_data *, int);
int pc_movepos(struct map_session_data *, int, int);
int pc_setpos(struct map_session_data *, const char *, int, int, int);
int pc_setsavepoint(struct map_session_data *, const char *, int, int);
int pc_randomwarp(struct map_session_data *sd, int type);
-int pc_memo(struct map_session_data *sd, int i);
int pc_checkadditem(struct map_session_data *, int, int);
int pc_inventoryblank(struct map_session_data *);
@@ -120,14 +103,6 @@ int pc_count_all_items(struct map_session_data *player, int item_id);
int pc_remove_items(struct map_session_data *player, int item_id,
int count);
-int pc_cart_additem(struct map_session_data *sd, struct item *item_data,
- int amount);
-int pc_cart_delitem(struct map_session_data *sd, int n, int amount,
- int type);
-int pc_putitemtocart(struct map_session_data *sd, int idx, int amount);
-int pc_getitemfromcart(struct map_session_data *sd, int idx, int amount);
-int pc_cartitem_amount(struct map_session_data *sd, int idx, int amount);
-
int pc_takeitem(struct map_session_data *, struct flooritem_data *);
int pc_dropitem(struct map_session_data *, int, int);
@@ -139,10 +114,6 @@ int pc_bonus2(struct map_session_data *sd, int, int, int);
int pc_bonus3(struct map_session_data *sd, int, int, int, int);
int pc_skill(struct map_session_data *, SkillID, int, int);
-int pc_insert_card(struct map_session_data *sd, int idx_card,
- int idx_equip);
-
-int pc_item_identify(struct map_session_data *sd, int idx);
int pc_steal_item(struct map_session_data *sd, struct block_list *bl);
int pc_steal_coin(struct map_session_data *sd, struct block_list *bl);
@@ -152,10 +123,6 @@ int pc_modifysellvalue(struct map_session_data *, int);
int pc_attack(struct map_session_data *, int, int);
int pc_stopattack(struct map_session_data *);
-int pc_follow(struct map_session_data *, int); // [MouseJstr]
-
-int pc_checkbaselevelup(struct map_session_data *sd);
-int pc_checkjoblevelup(struct map_session_data *sd);
int pc_gainexp(struct map_session_data *, int, int);
#define PC_GAINEXP_REASON_KILLING 0
@@ -165,9 +132,7 @@ int pc_gainexp_reason(struct map_session_data *, int, int, int reason);
int pc_extract_healer_exp(struct map_session_data *, int max); // [Fate] Used by healers: extract healer-xp from the target, return result (up to max)
int pc_nextbaseexp(struct map_session_data *);
-int pc_nextbaseafter(struct map_session_data *); // [Valaris]
int pc_nextjobexp(struct map_session_data *);
-int pc_nextjobafter(struct map_session_data *); // [Valaris]
int pc_need_status_point(struct map_session_data *, int);
int pc_statusup(struct map_session_data *, int);
int pc_statusup2(struct map_session_data *, int, int);
@@ -191,7 +156,6 @@ int pc_setcart(struct map_session_data *sd, int type);
int pc_setfalcon(struct map_session_data *sd);
int pc_setriding(struct map_session_data *sd);
int pc_changelook(struct map_session_data *, int, int);
-int pc_equiplookall(struct map_session_data *sd);
int pc_readparam(struct map_session_data *, int);
int pc_setparam(struct map_session_data *, int, int);
@@ -217,7 +181,6 @@ int pc_addeventtimercount(struct map_session_data *sd, const char *name,
int pc_calc_pvprank(struct map_session_data *sd);
void pc_calc_pvprank_timer(timer_id, tick_t, custom_id_t, custom_data_t);
-int pc_ismarried(struct map_session_data *sd);
int pc_marriage(struct map_session_data *sd,
struct map_session_data *dstsd);
int pc_divorce(struct map_session_data *sd);
@@ -250,7 +213,5 @@ enum
// timer for night.day
extern timer_id day_timer_tid;
extern timer_id night_timer_tid;
-void map_day_timer(timer_id, tick_t, custom_id_t, custom_data_t); // by [yor]
-void map_night_timer(timer_id, tick_t, custom_id_t, custom_data_t); // by [yor]
#endif // PC_HPP
diff --git a/src/map/script.cpp b/src/map/script.cpp
index 647f7fd..45cede3 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -110,197 +110,201 @@ int parse_cmd;
* ローカルプロトタイプ宣言 (必要な物のみ)
*------------------------------------------
*/
+static
const char *parse_subexpr(const char *, int);
-void builtin_mes(ScriptState *st);
-void builtin_goto(ScriptState *st);
-void builtin_callsub(ScriptState *st);
-void builtin_callfunc(ScriptState *st);
-void builtin_return(ScriptState *st);
-void builtin_getarg(ScriptState *st);
-void builtin_next(ScriptState *st);
-void builtin_close(ScriptState *st);
-void builtin_close2(ScriptState *st);
-void builtin_menu(ScriptState *st);
-void builtin_rand(ScriptState *st);
-void builtin_pow(ScriptState *st);
-void builtin_warp(ScriptState *st);
-void builtin_isat(ScriptState *st);
-void builtin_areawarp(ScriptState *st);
-void builtin_heal(ScriptState *st);
-void builtin_itemheal(ScriptState *st);
-void builtin_percentheal(ScriptState *st);
-void builtin_jobchange(ScriptState *st);
-void builtin_input(ScriptState *st);
-void builtin_setlook(ScriptState *st);
-void builtin_set(ScriptState *st);
-void builtin_setarray(ScriptState *st);
-void builtin_cleararray(ScriptState *st);
-void builtin_copyarray(ScriptState *st);
-void builtin_getarraysize(ScriptState *st);
-void builtin_deletearray(ScriptState *st);
-void builtin_getelementofarray(ScriptState *st);
-void builtin_if (ScriptState *st);
-void builtin_getitem(ScriptState *st);
-void builtin_getitem2(ScriptState *st);
-void builtin_makeitem(ScriptState *st);
-void builtin_delitem(ScriptState *st);
-void builtin_viewpoint(ScriptState *st);
-void builtin_countitem(ScriptState *st);
-void builtin_checkweight(ScriptState *st);
-void builtin_readparam(ScriptState *st);
-void builtin_getcharid(ScriptState *st);
-void builtin_getpartyname(ScriptState *st);
-void builtin_getpartymember(ScriptState *st);
-void builtin_strcharinfo(ScriptState *st);
-void builtin_getequipid(ScriptState *st);
-void builtin_getequipname(ScriptState *st);
-void builtin_getbrokenid(ScriptState *st); // [Valaris]
-void builtin_repair(ScriptState *st); // [Valaris]
-void builtin_getequipisequiped(ScriptState *st);
-void builtin_getequipisenableref(ScriptState *st);
-void builtin_getequipisidentify(ScriptState *st);
-void builtin_getequiprefinerycnt(ScriptState *st);
-void builtin_getequipweaponlv(ScriptState *st);
-void builtin_getequippercentrefinery(ScriptState *st);
-void builtin_successrefitem(ScriptState *st);
-void builtin_failedrefitem(ScriptState *st);
-void builtin_cutin(ScriptState *st);
-void builtin_cutincard(ScriptState *st);
-void builtin_statusup(ScriptState *st);
-void builtin_statusup2(ScriptState *st);
-void builtin_bonus(ScriptState *st);
-void builtin_bonus2(ScriptState *st);
-void builtin_bonus3(ScriptState *st);
-void builtin_skill(ScriptState *st);
-void builtin_setskill(ScriptState *st);
-void builtin_getskilllv(ScriptState *st);
-void builtin_basicskillcheck(ScriptState *st);
-void builtin_getgmlevel(ScriptState *st);
-void builtin_end(ScriptState *st);
-void builtin_getopt2(ScriptState *st);
-void builtin_setopt2(ScriptState *st);
-void builtin_checkoption(ScriptState *st);
-void builtin_setoption(ScriptState *st);
-void builtin_setcart(ScriptState *st);
-void builtin_checkcart(ScriptState *st); // check cart [Valaris]
-void builtin_setfalcon(ScriptState *st);
-void builtin_checkfalcon(ScriptState *st); // check falcon [Valaris]
-void builtin_setriding(ScriptState *st);
-void builtin_checkriding(ScriptState *st); // check for pecopeco [Valaris]
-void builtin_savepoint(ScriptState *st);
-void builtin_gettimetick(ScriptState *st);
-void builtin_gettime(ScriptState *st);
-void builtin_gettimestr(ScriptState *st);
-void builtin_openstorage(ScriptState *st);
-void builtin_itemskill(ScriptState *st);
-void builtin_monster(ScriptState *st);
-void builtin_areamonster(ScriptState *st);
-void builtin_killmonster(ScriptState *st);
-void builtin_killmonsterall(ScriptState *st);
-void builtin_doevent(ScriptState *st);
-void builtin_donpcevent(ScriptState *st);
-void builtin_addtimer(ScriptState *st);
-void builtin_deltimer(ScriptState *st);
-void builtin_addtimercount(ScriptState *st);
-void builtin_initnpctimer(ScriptState *st);
-void builtin_stopnpctimer(ScriptState *st);
-void builtin_startnpctimer(ScriptState *st);
-void builtin_setnpctimer(ScriptState *st);
-void builtin_getnpctimer(ScriptState *st);
-void builtin_announce(ScriptState *st);
-void builtin_mapannounce(ScriptState *st);
-void builtin_areaannounce(ScriptState *st);
-void builtin_getusers(ScriptState *st);
-void builtin_getmapusers(ScriptState *st);
-void builtin_getareausers(ScriptState *st);
-void builtin_getareadropitem(ScriptState *st);
-void builtin_enablenpc(ScriptState *st);
-void builtin_disablenpc(ScriptState *st);
-void builtin_enablearena(ScriptState *st); // Added by RoVeRT
-void builtin_disablearena(ScriptState *st); // Added by RoVeRT
-void builtin_hideoffnpc(ScriptState *st);
-void builtin_hideonnpc(ScriptState *st);
-void builtin_sc_start(ScriptState *st);
-void builtin_sc_start2(ScriptState *st);
-void builtin_sc_end(ScriptState *st);
-void builtin_sc_check(ScriptState *st); // [Fate]
-void builtin_getscrate(ScriptState *st);
-void builtin_debugmes(ScriptState *st);
-void builtin_resetlvl(ScriptState *st);
-void builtin_resetstatus(ScriptState *st);
-void builtin_resetskill(ScriptState *st);
-void builtin_changebase(ScriptState *st);
-void builtin_changesex(ScriptState *st);
-void builtin_waitingroom(ScriptState *st);
-void builtin_delwaitingroom(ScriptState *st);
-void builtin_enablewaitingroomevent(ScriptState *st);
-void builtin_disablewaitingroomevent(ScriptState *st);
-void builtin_getwaitingroomstate(ScriptState *st);
-void builtin_warpwaitingpc(ScriptState *st);
-void builtin_attachrid(ScriptState *st);
-void builtin_detachrid(ScriptState *st);
-void builtin_isloggedin(ScriptState *st);
-void builtin_setmapflagnosave(ScriptState *st);
-void builtin_setmapflag(ScriptState *st);
-void builtin_removemapflag(ScriptState *st);
-void builtin_getmapflag(ScriptState *st);
-void builtin_pvpon(ScriptState *st);
-void builtin_pvpoff(ScriptState *st);
-void builtin_emotion(ScriptState *st);
-void builtin_getequipcardcnt(ScriptState *st);
-void builtin_successremovecards(ScriptState *st);
-void builtin_failedremovecards(ScriptState *st);
-void builtin_marriage(ScriptState *st);
-void builtin_wedding_effect(ScriptState *st);
-void builtin_divorce(ScriptState *st);
-void builtin_getitemname(ScriptState *st);
-void builtin_getspellinvocation(ScriptState *st); // [Fate]
-void builtin_getanchorinvocation(ScriptState *st); // [Fate]
-void builtin_getexp(ScriptState *st);
-void builtin_getinventorylist(ScriptState *st);
-void builtin_getskilllist(ScriptState *st);
-void builtin_get_pool_skills(ScriptState *st); // [fate]
-void builtin_get_activated_pool_skills(ScriptState *st); // [fate]
-void builtin_get_unactivated_pool_skills(ScriptState *st); // [PO]
-void builtin_activate_pool_skill(ScriptState *st); // [fate]
-void builtin_deactivate_pool_skill(ScriptState *st); // [fate]
-void builtin_check_pool_skill(ScriptState *st); // [fate]
-void builtin_clearitem(ScriptState *st);
-void builtin_classchange(ScriptState *st);
-void builtin_misceffect(ScriptState *st);
-void builtin_soundeffect(ScriptState *st);
-void builtin_mapwarp(ScriptState *st);
-void builtin_inittimer(ScriptState *st);
-void builtin_stoptimer(ScriptState *st);
-void builtin_cmdothernpc(ScriptState *st);
-void builtin_mobcount(ScriptState *st);
-void builtin_strmobinfo(ScriptState *st); // Script for displaying mob info [Valaris]
-void builtin_npcskilleffect(ScriptState *st); // skill effects for npcs [Valaris]
-void builtin_specialeffect(ScriptState *st); // special effect script [Valaris]
-void builtin_specialeffect2(ScriptState *st); // special effect script [Valaris]
-void builtin_nude(ScriptState *st); // nude [Valaris]
-void builtin_gmcommand(ScriptState *st); // [MouseJstr]
-void builtin_npcwarp(ScriptState *st); // [remoitnane]
-void builtin_message(ScriptState *st); // [MouseJstr]
-void builtin_npctalk(ScriptState *st); // [Valaris]
-void builtin_hasitems(ScriptState *st); // [Valaris]
-void builtin_getlook(ScriptState *st); //Lorky [Lupus]
-void builtin_getsavepoint(ScriptState *st); //Lorky [Lupus]
-void builtin_getpartnerid(ScriptState *st); // [Fate]
-void builtin_areatimer(ScriptState *st); // [Jaxad0127]
-void builtin_isin(ScriptState *st); // [Jaxad0127]
-void builtin_shop(ScriptState *st); // [MadCamel]
-void builtin_isdead(ScriptState *st); // [Jaxad0127]
-void builtin_fakenpcname(ScriptState *st); //[Kage]
-void builtin_unequip_by_id(ScriptState *st); // [Freeyorp]
-void builtin_getx(ScriptState *st); // [Kage]
-void builtin_gety(ScriptState *st); // [Kage]
-void builtin_getmap(ScriptState *st);
+static void builtin_mes(ScriptState *st);
+static void builtin_goto(ScriptState *st);
+static void builtin_callsub(ScriptState *st);
+static void builtin_callfunc(ScriptState *st);
+static void builtin_return(ScriptState *st);
+static void builtin_getarg(ScriptState *st);
+static void builtin_next(ScriptState *st);
+static void builtin_close(ScriptState *st);
+static void builtin_close2(ScriptState *st);
+static void builtin_menu(ScriptState *st);
+static void builtin_rand(ScriptState *st);
+static void builtin_pow(ScriptState *st);
+static void builtin_warp(ScriptState *st);
+static void builtin_isat(ScriptState *st);
+static void builtin_areawarp(ScriptState *st);
+static void builtin_heal(ScriptState *st);
+static void builtin_itemheal(ScriptState *st);
+static void builtin_percentheal(ScriptState *st);
+static void builtin_jobchange(ScriptState *st);
+static void builtin_input(ScriptState *st);
+static void builtin_setlook(ScriptState *st);
+static void builtin_set(ScriptState *st);
+static void builtin_setarray(ScriptState *st);
+static void builtin_cleararray(ScriptState *st);
+static void builtin_copyarray(ScriptState *st);
+static void builtin_getarraysize(ScriptState *st);
+static void builtin_deletearray(ScriptState *st);
+static void builtin_getelementofarray(ScriptState *st);
+static void builtin_if (ScriptState *st);
+static void builtin_getitem(ScriptState *st);
+static void builtin_getitem2(ScriptState *st);
+static void builtin_makeitem(ScriptState *st);
+static void builtin_delitem(ScriptState *st);
+static void builtin_viewpoint(ScriptState *st);
+static void builtin_countitem(ScriptState *st);
+static void builtin_checkweight(ScriptState *st);
+static void builtin_readparam(ScriptState *st);
+static void builtin_getcharid(ScriptState *st);
+static void builtin_getpartyname(ScriptState *st);
+static void builtin_getpartymember(ScriptState *st);
+static void builtin_strcharinfo(ScriptState *st);
+static void builtin_getequipid(ScriptState *st);
+static void builtin_getequipname(ScriptState *st);
+static void builtin_getbrokenid(ScriptState *st); // [Valaris]
+static void builtin_repair(ScriptState *st); // [Valaris]
+static void builtin_getequipisequiped(ScriptState *st);
+static void builtin_getequipisenableref(ScriptState *st);
+static void builtin_getequipisidentify(ScriptState *st);
+static void builtin_getequiprefinerycnt(ScriptState *st);
+static void builtin_getequipweaponlv(ScriptState *st);
+static void builtin_getequippercentrefinery(ScriptState *st);
+static void builtin_successrefitem(ScriptState *st);
+static void builtin_failedrefitem(ScriptState *st);
+static void builtin_cutin(ScriptState *st);
+static void builtin_cutincard(ScriptState *st);
+static void builtin_statusup(ScriptState *st);
+static void builtin_statusup2(ScriptState *st);
+static void builtin_bonus(ScriptState *st);
+static void builtin_bonus2(ScriptState *st);
+static void builtin_bonus3(ScriptState *st);
+static void builtin_skill(ScriptState *st);
+static void builtin_setskill(ScriptState *st);
+static void builtin_getskilllv(ScriptState *st);
+static void builtin_basicskillcheck(ScriptState *st);
+static void builtin_getgmlevel(ScriptState *st);
+static void builtin_end(ScriptState *st);
+static void builtin_getopt2(ScriptState *st);
+static void builtin_setopt2(ScriptState *st);
+static void builtin_checkoption(ScriptState *st);
+static void builtin_setoption(ScriptState *st);
+static void builtin_setcart(ScriptState *st);
+static void builtin_checkcart(ScriptState *st); // check cart [Valaris]
+static void builtin_setfalcon(ScriptState *st);
+static void builtin_checkfalcon(ScriptState *st); // check falcon [Valaris]
+static void builtin_setriding(ScriptState *st);
+static void builtin_checkriding(ScriptState *st); // check for pecopeco [Valaris]
+static void builtin_savepoint(ScriptState *st);
+static void builtin_gettimetick(ScriptState *st);
+static void builtin_gettime(ScriptState *st);
+static void builtin_gettimestr(ScriptState *st);
+static void builtin_openstorage(ScriptState *st);
+static void builtin_itemskill(ScriptState *st);
+static void builtin_monster(ScriptState *st);
+static void builtin_areamonster(ScriptState *st);
+static void builtin_killmonster(ScriptState *st);
+static void builtin_killmonsterall(ScriptState *st);
+static void builtin_doevent(ScriptState *st);
+static void builtin_donpcevent(ScriptState *st);
+static void builtin_addtimer(ScriptState *st);
+static void builtin_deltimer(ScriptState *st);
+static void builtin_addtimercount(ScriptState *st);
+static void builtin_initnpctimer(ScriptState *st);
+static void builtin_stopnpctimer(ScriptState *st);
+static void builtin_startnpctimer(ScriptState *st);
+static void builtin_setnpctimer(ScriptState *st);
+static void builtin_getnpctimer(ScriptState *st);
+static void builtin_announce(ScriptState *st);
+static void builtin_mapannounce(ScriptState *st);
+static void builtin_areaannounce(ScriptState *st);
+static void builtin_getusers(ScriptState *st);
+static void builtin_getmapusers(ScriptState *st);
+static void builtin_getareausers(ScriptState *st);
+static void builtin_getareadropitem(ScriptState *st);
+static void builtin_enablenpc(ScriptState *st);
+static void builtin_disablenpc(ScriptState *st);
+static void builtin_enablearena(ScriptState *st); // Added by RoVeRT
+static void builtin_disablearena(ScriptState *st); // Added by RoVeRT
+static void builtin_hideoffnpc(ScriptState *st);
+static void builtin_hideonnpc(ScriptState *st);
+static void builtin_sc_start(ScriptState *st);
+static void builtin_sc_start2(ScriptState *st);
+static void builtin_sc_end(ScriptState *st);
+static void builtin_sc_check(ScriptState *st); // [Fate]
+static void builtin_getscrate(ScriptState *st);
+static void builtin_debugmes(ScriptState *st);
+static void builtin_resetlvl(ScriptState *st);
+static void builtin_resetstatus(ScriptState *st);
+static void builtin_resetskill(ScriptState *st);
+static void builtin_changebase(ScriptState *st);
+static void builtin_changesex(ScriptState *st);
+static void builtin_waitingroom(ScriptState *st);
+static void builtin_delwaitingroom(ScriptState *st);
+static void builtin_enablewaitingroomevent(ScriptState *st);
+static void builtin_disablewaitingroomevent(ScriptState *st);
+static void builtin_getwaitingroomstate(ScriptState *st);
+static void builtin_warpwaitingpc(ScriptState *st);
+static void builtin_attachrid(ScriptState *st);
+static void builtin_detachrid(ScriptState *st);
+static void builtin_isloggedin(ScriptState *st);
+static void builtin_setmapflagnosave(ScriptState *st);
+static void builtin_setmapflag(ScriptState *st);
+static void builtin_removemapflag(ScriptState *st);
+static void builtin_getmapflag(ScriptState *st);
+static void builtin_pvpon(ScriptState *st);
+static void builtin_pvpoff(ScriptState *st);
+static void builtin_emotion(ScriptState *st);
+static void builtin_getequipcardcnt(ScriptState *st);
+static void builtin_successremovecards(ScriptState *st);
+static void builtin_failedremovecards(ScriptState *st);
+static void builtin_marriage(ScriptState *st);
+static void builtin_wedding_effect(ScriptState *st);
+static void builtin_divorce(ScriptState *st);
+static void builtin_getitemname(ScriptState *st);
+static void builtin_getspellinvocation(ScriptState *st); // [Fate]
+static void builtin_getanchorinvocation(ScriptState *st); // [Fate]
+static void builtin_getexp(ScriptState *st);
+static void builtin_getinventorylist(ScriptState *st);
+static void builtin_getskilllist(ScriptState *st);
+static void builtin_get_pool_skills(ScriptState *st); // [fate]
+static void builtin_get_activated_pool_skills(ScriptState *st); // [fate]
+static void builtin_get_unactivated_pool_skills(ScriptState *st); // [PO]
+static void builtin_activate_pool_skill(ScriptState *st); // [fate]
+static void builtin_deactivate_pool_skill(ScriptState *st); // [fate]
+static void builtin_check_pool_skill(ScriptState *st); // [fate]
+static void builtin_clearitem(ScriptState *st);
+static void builtin_classchange(ScriptState *st);
+static void builtin_misceffect(ScriptState *st);
+static void builtin_soundeffect(ScriptState *st);
+static void builtin_mapwarp(ScriptState *st);
+static void builtin_inittimer(ScriptState *st);
+static void builtin_stoptimer(ScriptState *st);
+static void builtin_cmdothernpc(ScriptState *st);
+static void builtin_mobcount(ScriptState *st);
+static void builtin_strmobinfo(ScriptState *st); // Script for displaying mob info [Valaris]
+static void builtin_npcskilleffect(ScriptState *st); // skill effects for npcs [Valaris]
+static void builtin_specialeffect(ScriptState *st); // special effect script [Valaris]
+static void builtin_specialeffect2(ScriptState *st); // special effect script [Valaris]
+static void builtin_nude(ScriptState *st); // nude [Valaris]
+static void builtin_gmcommand(ScriptState *st); // [MouseJstr]
+static void builtin_npcwarp(ScriptState *st); // [remoitnane]
+static void builtin_message(ScriptState *st); // [MouseJstr]
+static void builtin_npctalk(ScriptState *st); // [Valaris]
+static void builtin_hasitems(ScriptState *st); // [Valaris]
+static void builtin_getlook(ScriptState *st); //Lorky [Lupus]
+static void builtin_getsavepoint(ScriptState *st); //Lorky [Lupus]
+static void builtin_getpartnerid(ScriptState *st); // [Fate]
+static void builtin_areatimer(ScriptState *st); // [Jaxad0127]
+static void builtin_isin(ScriptState *st); // [Jaxad0127]
+static void builtin_shop(ScriptState *st); // [MadCamel]
+static void builtin_isdead(ScriptState *st); // [Jaxad0127]
+static void builtin_fakenpcname(ScriptState *st); //[Kage]
+static void builtin_unequip_by_id(ScriptState *st); // [Freeyorp]
+static void builtin_getx(ScriptState *st); // [Kage]
+static void builtin_gety(ScriptState *st); // [Kage]
+static void builtin_getmap(ScriptState *st);
+static
void run_func(ScriptState *st);
+static
void mapreg_setreg(int num, int val);
+static
void mapreg_setregstr(int num, const char *str);
struct
diff --git a/src/map/skill-pools.cpp b/src/map/skill-pools.cpp
index 5f9351b..b936518 100644
--- a/src/map/skill-pools.cpp
+++ b/src/map/skill-pools.cpp
@@ -54,17 +54,6 @@ int skill_pool(struct map_session_data *sd, SkillID *skills)
return count;
}
-void skill_pool_empty(struct map_session_data *sd)
-{
- int i;
-
- for (i = 0; i < skill_pool_skills_size; i++)
- {
- SkillID skill_id = skill_pool_skills[i];
- sd->status.skill[skill_id].flags = 0;
- }
-}
-
int skill_pool_size(struct map_session_data *sd)
{
return skill_pool(sd, NULL);
@@ -111,6 +100,9 @@ int skill_pool_deactivate(struct map_session_data *sd, SkillID skill_id)
return 1;
}
+// Yields the stat associated with a skill.
+// Returns zero if none, or SP_STR, SP_VIT, ... otherwise
+static
int skill_stat(SkillID skill_id)
{
return skill_db[skill_id].stat;
diff --git a/src/map/skill.cpp b/src/map/skill.cpp
index a283073..f45f73d 100644
--- a/src/map/skill.cpp
+++ b/src/map/skill.cpp
@@ -958,8 +958,39 @@ int rdamage;
earray<struct skill_db, SkillID, MAX_SKILL_DB> skill_db;
-#define UNARMED_PLAYER_DAMAGE_MIN(bl) (skill_power_bl((bl), TMW_BRAWLING) >> 4) // +50 for 200
-#define UNARMED_PLAYER_DAMAGE_MAX(bl) (skill_power_bl((bl), TMW_BRAWLING)) // +200 for 200
+
+static
+int skill_addtimerskill(struct block_list *src, unsigned int tick,
+ int target, int x, int y, SkillID skill_id, int skill_lv,
+ int type, int flag);
+static
+int skill_attack(int attack_type, struct block_list *src,
+ struct block_list *dsrc, struct block_list *bl,
+ SkillID skillid, int skilllv, unsigned int tick, int flag);
+static
+void skill_brandishspear_dir(struct square *tc, int dir, int are);
+static
+void skill_brandishspear_first(struct square *tc, int dir, int x, int y);
+static
+int skill_delunitgroup(struct skill_unit_group *group);
+static
+void skill_devotion_end(struct map_session_data *md,
+ struct map_session_data *sd, int target);
+static
+struct skill_unit *skill_initunit(struct skill_unit_group *group, int idx,
+ int x, int y);
+static
+struct skill_unit_group *skill_initunitgroup(struct block_list *src,
+ int count, SkillID skillid, int skilllv, int unit_id);
+static
+void skill_status_change_timer(timer_id tid, tick_t tick,
+ custom_id_t id, custom_data_t data);
+static
+int skill_unitgrouptickset_delete(struct block_list *bl, int group_id);
+static
+struct skill_unit_group_tickset *skill_unitgrouptickset_search(
+ struct block_list *bl, int group_id);
+
int skill_get_hit(SkillID id)
{
@@ -996,6 +1027,7 @@ int skill_get_range(SkillID id, int lv)
return (lv <= 0) ? 0 : skill_db[id].range[lv - 1];
}
+static
int skill_get_hp(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].hp[lv - 1];
@@ -1006,6 +1038,7 @@ int skill_get_sp(SkillID id, int lv)
return (lv <= 0) ? 0 : skill_db[id].sp[lv - 1];
}
+static
int skill_get_zeny(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].zeny[lv - 1];
@@ -1061,6 +1094,7 @@ int skill_get_blewcount(SkillID id, int lv)
return (lv <= 0) ? 0 : skill_db[id].blewcount[lv - 1];
}
+static
int skill_get_mhp(SkillID id, int lv)
{
return (lv <= 0) ? 0 : skill_db[id].mhp[lv - 1];
@@ -1126,6 +1160,7 @@ int distance(int x0, int y0, int x1, int y1)
}
/* スキルユニットIDを返す(これもデータベースに入れたいな) */
+static
int skill_get_unit_id(SkillID id, int flag)
{
@@ -1286,19 +1321,19 @@ int skill_additional_effect(struct block_list *src, struct block_list *bl,
int sc_def_mdef2, sc_def_vit2, sc_def_int2, sc_def_luk2;
int sc_def_phys_shield_spell;
- nullpo_retr(0, src);
- nullpo_retr(0, bl);
+ nullpo_ret(src);
+ nullpo_ret(bl);
if (skilllv < 0)
return 0;
if (src->type == BL_PC)
{
- nullpo_retr(0, sd = (struct map_session_data *) src);
+ nullpo_ret(sd = (struct map_session_data *) src);
}
else if (src->type == BL_MOB)
{
- nullpo_retr(0, md = (struct mob_data *) src); //未使用?
+ nullpo_ret(md = (struct mob_data *) src); //未使用?
}
sc_def_phys_shield_spell = 0;
@@ -1763,20 +1798,20 @@ int skill_blown(struct block_list *src, struct block_list *target, int count)
struct mob_data *md = NULL;
struct skill_unit *su = NULL;
- nullpo_retr(0, src);
- nullpo_retr(0, target);
+ nullpo_ret(src);
+ nullpo_ret(target);
if (target->type == BL_PC)
{
- nullpo_retr(0, sd = (struct map_session_data *) target);
+ nullpo_ret(sd = (struct map_session_data *) target);
}
else if (target->type == BL_MOB)
{
- nullpo_retr(0, md = (struct mob_data *) target);
+ nullpo_ret(md = (struct mob_data *) target);
}
else if (target->type == BL_SKILL)
{
- nullpo_retr(0, su = (struct skill_unit *) target);
+ nullpo_ret(su = (struct skill_unit *) target);
}
else
return 0;
@@ -1908,9 +1943,9 @@ int skill_attack(int attack_type, struct block_list *src,
int type, lv, damage;
rdamage = 0;
- nullpo_retr(0, src);
- nullpo_retr(0, dsrc);
- nullpo_retr(0, bl);
+ nullpo_ret(src);
+ nullpo_ret(dsrc);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
@@ -2005,7 +2040,7 @@ int skill_attack(int attack_type, struct block_list *src,
if (src->type == BL_PC)
{
struct map_session_data *sd = (struct map_session_data *) src;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
//連打掌(MO_CHAINCOMBO)ここから
if (skillid == MO_CHAINCOMBO)
{
@@ -2113,7 +2148,7 @@ int skill_attack(int attack_type, struct block_list *src,
if (bl->type == BL_PC)
{ //対象がPCの時
struct map_session_data *tsd = (struct map_session_data *) bl;
- nullpo_retr(0, tsd);
+ nullpo_ret(tsd);
if (tsd->short_weapon_damage_return > 0)
{ //近距離攻撃跳ね返し?※
rdamage += damage * tsd->short_weapon_damage_return / 100;
@@ -2133,7 +2168,7 @@ int skill_attack(int attack_type, struct block_list *src,
if (bl->type == BL_PC)
{ //対象がPCの時
struct map_session_data *tsd = (struct map_session_data *) bl;
- nullpo_retr(0, tsd);
+ nullpo_ret(tsd);
if (tsd->long_weapon_damage_return > 0)
{ //遠距離攻撃跳ね返し?※
rdamage += damage * tsd->long_weapon_damage_return / 100;
@@ -2196,7 +2231,7 @@ int skill_attack(int attack_type, struct block_list *src,
/*
if (damage > 0 && dmg.flag&BF_SKILL && bl->type==BL_PC && pc_checkskill((struct map_session_data *)bl,RG_PLAGIARISM)){
struct map_session_data *tsd = (struct map_session_data *)bl;
- nullpo_retr(0, tsd);
+ nullpo_ret(tsd);
if (!tsd->status.skill[skillid].id && !tsd->status.skill[skillid].id
&& !(skillid > NPC_PIERCINGATT && skillid < NPC_SUMMONMONSTER) ){
//既に盗んでいるスキルがあれば該当スキルを消す
@@ -2219,7 +2254,7 @@ int skill_attack(int attack_type, struct block_list *src,
if (bl->prev != NULL)
{
struct map_session_data *sd = (struct map_session_data *) bl;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (bl->type != BL_PC || (sd && !pc_isdead(sd)))
{
if (damage > 0)
@@ -2228,7 +2263,7 @@ int skill_attack(int attack_type, struct block_list *src,
if (bl->type == BL_MOB && src != bl) /* スキル使用条件のMOBスキル */
{
struct mob_data *md = (struct mob_data *) bl;
- nullpo_retr(0, md);
+ nullpo_ret(md);
if (battle_config.mob_changetarget_byskill == 1)
{
int target;
@@ -2249,7 +2284,7 @@ int skill_attack(int attack_type, struct block_list *src,
{
struct map_session_data *sd = (struct map_session_data *) src;
int hp = 0, sp = 0;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->hp_drain_rate && dmg.damage > 0
&& MRAND(100) < sd->hp_drain_rate)
{
@@ -2681,12 +2716,12 @@ int skill_cleartimerskill(struct block_list *src)
{
int i;
- nullpo_retr(0, src);
+ nullpo_ret(src);
if (src->type == BL_PC)
{
struct map_session_data *sd = (struct map_session_data *) src;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
for (i = 0; i < MAX_SKILLTIMERSKILL; i++)
{
if (sd->skilltimerskill[i].timer != -1)
@@ -2699,7 +2734,7 @@ int skill_cleartimerskill(struct block_list *src)
else if (src->type == BL_MOB)
{
struct mob_data *md = (struct mob_data *) src;
- nullpo_retr(0, md);
+ nullpo_ret(md);
for (i = 0; i < MAX_MOBSKILLTIMERSKILL; i++)
{
if (md->skilltimerskill[i].timer != -1)
@@ -5470,11 +5505,11 @@ int skill_castend_pos2(struct block_list *src, int x, int y,
struct map_session_data *sd = NULL;
int i, tmpx = 0, tmpy = 0, x1 = 0, y1 = 0;
- nullpo_retr(0, src);
+ nullpo_ret(src);
if (src->type == BL_PC)
{
- nullpo_retr(0, sd = (struct map_session_data *) src);
+ nullpo_ret(sd = (struct map_session_data *) src);
}
if (skillid != WZ_METEOR &&
skillid != WZ_SIGHTRASHER &&
@@ -5683,7 +5718,7 @@ int skill_castend_map(struct map_session_data *sd, SkillID skill_num,
{
int x = 0, y = 0;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->bl.prev == NULL || pc_isdead(sd))
return 0;
@@ -5794,7 +5829,7 @@ struct skill_unit_group *skill_unitsetting(struct block_list *src,
int target = BCT_ENEMY, interval = 1000, range_ = 0;
int dir = 0, aoe_diameter = 0; // -- aoe_diameter (moonsoul) added for sage Area Of Effect skills
- nullpo_retr(0, src);
+ nullpo_ret(src);
switch (skillid)
{ /* 設定 */
@@ -6407,24 +6442,24 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl,
struct map_session_data *srcsd = NULL;
int diff, goflag, splash_count = 0;
- nullpo_retr(0, src);
- nullpo_retr(0, bl);
+ nullpo_ret(src);
+ nullpo_ret(bl);
if (bl->prev == NULL || !src->alive
|| (bl->type == BL_PC && pc_isdead((struct map_session_data *) bl)))
return 0;
- nullpo_retr(0, sg = src->group);
- nullpo_retr(0, ss = map_id2bl(sg->src_id));
+ nullpo_ret(sg = src->group);
+ nullpo_ret(ss = map_id2bl(sg->src_id));
if (ss->type == BL_PC)
- nullpo_retr(0, srcsd = (struct map_session_data *) ss);
+ nullpo_ret(srcsd = (struct map_session_data *) ss);
if (srcsd && srcsd->chatID)
return 0;
if (bl->type != BL_PC && bl->type != BL_MOB)
return 0;
- nullpo_retr(0, ts = skill_unitgrouptickset_search(bl, sg->group_id));
+ nullpo_ret(ts = skill_unitgrouptickset_search(bl, sg->group_id));
diff = DIFF_TICK(tick, ts->tick);
goflag = (diff > sg->interval || diff < 0);
if (sg->skill_id == CR_GRANDCROSS && !battle_config.gx_allhit) // 重なっていたら3HITしない
@@ -6859,9 +6894,9 @@ int skill_unit_onout(struct skill_unit *src, struct block_list *bl,
{
struct skill_unit_group *sg;
- nullpo_retr(0, src);
- nullpo_retr(0, bl);
- nullpo_retr(0, sg = src->group);
+ nullpo_ret(src);
+ nullpo_ret(bl);
+ nullpo_ret(sg = src->group);
if (bl->prev == NULL || !src->alive)
return 0;
@@ -6989,9 +7024,9 @@ int skill_unit_ondelete(struct skill_unit *src, struct block_list *bl,
{
struct skill_unit_group *sg;
- nullpo_retr(0, src);
- nullpo_retr(0, bl);
- nullpo_retr(0, sg = src->group);
+ nullpo_ret(src);
+ nullpo_ret(bl);
+ nullpo_ret(sg = src->group);
if (bl->prev == NULL || !src->alive)
return 0;
@@ -7046,8 +7081,8 @@ int skill_unit_onlimit(struct skill_unit *src, unsigned int)
{
struct skill_unit_group *sg;
- nullpo_retr(0, src);
- nullpo_retr(0, sg = src->group);
+ nullpo_ret(src);
+ nullpo_ret(sg = src->group);
switch (sg->unit_id)
{
@@ -7097,8 +7132,8 @@ int skill_unit_ondamaged(struct skill_unit *src, struct block_list *bl,
{
struct skill_unit_group *sg;
- nullpo_retr(0, src);
- nullpo_retr(0, sg = src->group);
+ nullpo_ret(src);
+ nullpo_ret(sg = src->group);
switch (sg->unit_id)
{
@@ -7483,7 +7518,7 @@ int skill_check_condition(struct map_session_data *sd, int type)
lv, mhp;
int index[10], itemid[10], amount[10];
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (battle_config.gm_skilluncond > 0
&& pc_isGM(sd) >= battle_config.gm_skilluncond)
@@ -7947,7 +7982,7 @@ int skill_castfix(struct block_list *bl, int time)
SkillID skill;
int lv, castnodex;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_MOB)
{ // Crash fix [Valaris]
@@ -8010,7 +8045,7 @@ int skill_delayfix(struct block_list *bl, int time)
{
eptr<struct status_change, StatusChange> sc_data;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (time <= 0)
@@ -8052,7 +8087,7 @@ int skill_use_id(struct map_session_data *sd, int target_id,
eptr<struct status_change, StatusChange> sc_data;
tick = gettick();
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if ((bl = map_id2bl(target_id)) == NULL)
{
@@ -8411,7 +8446,7 @@ int skill_use_pos(struct map_session_data *sd,
unsigned int tick;
int casttime = 0, delay = 0, skill, range;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (pc_isdead(sd))
return 0;
@@ -8526,13 +8561,13 @@ int skill_castcancel(struct block_list *bl, int type)
{
int inf;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_PC)
{
struct map_session_data *sd = (struct map_session_data *) bl;
unsigned long tick = gettick();
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
sd->canact_tick = tick;
sd->canmove_tick = tick;
if (sd->skilltimer != -1)
@@ -8565,7 +8600,7 @@ int skill_castcancel(struct block_list *bl, int type)
else if (bl->type == BL_MOB)
{
struct mob_data *md = (struct mob_data *) bl;
- nullpo_retr(0, md);
+ nullpo_ret(md);
if (md->skilltimer != -1)
{
if ((inf = skill_get_inf(md->skillid)) == 2 || inf == 32)
@@ -8819,61 +8854,6 @@ void skill_devotion_end(struct map_session_data *md,
}
/*==========================================
- * オートスペル
- *------------------------------------------
- */
-int skill_autospell(struct map_session_data *sd, SkillID skillid)
-{
- int skilllv;
- int maxlv = 1, lv;
-
- nullpo_retr(0, sd);
-
- skilllv = pc_checkskill(sd, SA_AUTOSPELL);
-
- if (skillid == MG_NAPALMBEAT)
- maxlv = 3;
- else if (skillid == MG_COLDBOLT || skillid == MG_FIREBOLT
- || skillid == MG_LIGHTNINGBOLT)
- {
- if (skilllv == 2)
- maxlv = 1;
- else if (skilllv == 3)
- maxlv = 2;
- else if (skilllv >= 4)
- maxlv = 3;
- }
- else if (skillid == MG_SOULSTRIKE)
- {
- if (skilllv == 5)
- maxlv = 1;
- else if (skilllv == 6)
- maxlv = 2;
- else if (skilllv >= 7)
- maxlv = 3;
- }
- else if (skillid == MG_FIREBALL)
- {
- if (skilllv == 8)
- maxlv = 1;
- else if (skilllv >= 9)
- maxlv = 2;
- }
- else if (skillid == MG_FROSTDIVER)
- maxlv = 1;
- else
- return 0;
-
- if (maxlv > (lv = pc_checkskill(sd, skillid)))
- maxlv = lv;
-
- skill_status_change_start(&sd->bl, SC_AUTOSPELL,
- skilllv, uint16_t(skillid), maxlv, 0,
- skill_get_time(SA_AUTOSPELL, skilllv), 0);
- return 0;
-}
-
-/*==========================================
* ギャングスターパラダイス判定処理(foreachinarea)
*------------------------------------------
*/
@@ -8923,7 +8903,7 @@ int skill_gangsterparadise(struct map_session_data *sd, int type)
int range = 1;
int c = 0;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (pc_checkskill(sd, RG_GANGSTER) <= 0)
return 0;
@@ -9182,7 +9162,7 @@ int skill_status_change_active(struct block_list *bl, StatusChange type)
{
eptr<struct status_change, StatusChange> sc_data;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type != BL_PC && bl->type != BL_MOB)
{
if (battle_config.error_log)
@@ -9207,7 +9187,7 @@ int skill_status_change_end(struct block_list *bl, StatusChange type, int tid)
Opt2 *opt2;
Opt3 *opt3;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type != BL_PC && bl->type != BL_MOB)
{
if (battle_config.error_log)
@@ -9217,11 +9197,11 @@ int skill_status_change_end(struct block_list *bl, StatusChange type, int tid)
sc_data = battle_get_sc_data(bl);
if (not sc_data)
return 0;
- nullpo_retr(0, sc_count = battle_get_sc_count(bl));
- nullpo_retr(0, option = battle_get_option(bl));
- nullpo_retr(0, opt1 = battle_get_opt1(bl));
- nullpo_retr(0, opt2 = battle_get_opt2(bl));
- nullpo_retr(0, opt3 = battle_get_opt3(bl));
+ nullpo_ret(sc_count = battle_get_sc_count(bl));
+ nullpo_ret(option = battle_get_option(bl));
+ nullpo_ret(opt1 = battle_get_opt1(bl));
+ nullpo_ret(opt2 = battle_get_opt2(bl));
+ nullpo_ret(opt3 = battle_get_opt3(bl));
if ((*sc_count) > 0 && sc_data[type].timer != -1
&& (sc_data[type].timer == tid || tid == -1))
@@ -9527,7 +9507,7 @@ int skill_update_heal_animation(struct map_session_data *sd)
{
const Opt2 mask = Opt2::_heal;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
bool was_active = bool(sd->opt2 & mask);
bool is_active = sd->quick_regeneration_hp.amount > 0;
@@ -10004,7 +9984,7 @@ int skill_encchant_eremental_end(struct block_list *bl, StatusChange type)
{
eptr<struct status_change, StatusChange> sc_data;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (not sc_data)
return 0;
@@ -10052,17 +10032,17 @@ int skill_status_effect(struct block_list *bl, StatusChange type,
0, race, mode, elem, undead_flag;
int scdef = 0;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_SKILL)
return 0;
sc_data = battle_get_sc_data(bl);
if (not sc_data)
return 0;
- nullpo_retr(0, sc_count = battle_get_sc_count(bl));
- nullpo_retr(0, option = battle_get_option(bl));
- nullpo_retr(0, opt1 = battle_get_opt1(bl));
- nullpo_retr(0, opt2 = battle_get_opt2(bl));
- nullpo_retr(0, opt3 = battle_get_opt3(bl));
+ nullpo_ret(sc_count = battle_get_sc_count(bl));
+ nullpo_ret(option = battle_get_option(bl));
+ nullpo_ret(opt1 = battle_get_opt1(bl));
+ nullpo_ret(opt2 = battle_get_opt2(bl));
+ nullpo_ret(opt3 = battle_get_opt3(bl));
race = battle_get_race(bl);
mode = battle_get_mode(bl);
@@ -10917,15 +10897,15 @@ int skill_status_change_clear(struct block_list *bl, int type)
Opt2 *opt2;
Opt3 *opt3;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
sc_data = battle_get_sc_data(bl);
if (not sc_data)
return 0;
- nullpo_retr(0, sc_count = battle_get_sc_count(bl));
- nullpo_retr(0, option = battle_get_option(bl));
- nullpo_retr(0, opt1 = battle_get_opt1(bl));
- nullpo_retr(0, opt2 = battle_get_opt2(bl));
- nullpo_retr(0, opt3 = battle_get_opt3(bl));
+ nullpo_ret(sc_count = battle_get_sc_count(bl));
+ nullpo_ret(option = battle_get_option(bl));
+ nullpo_ret(opt1 = battle_get_opt1(bl));
+ nullpo_ret(opt2 = battle_get_opt2(bl));
+ nullpo_ret(opt3 = battle_get_opt3(bl));
if (*sc_count == 0)
return 0;
@@ -10967,7 +10947,7 @@ int skill_check_cloaking(struct block_list *bl)
static int dy[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int end = 1, i;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (pc_checkskill(sd, AS_CLOAKING) > 2)
return 0;
@@ -11001,6 +10981,7 @@ int skill_check_cloaking(struct block_list *bl)
* 戻り ダンスじゃない=0 合奏=2 それ以外のダンス=1
*------------------------------------------
*/
+static
int skill_is_danceskill(SkillID id)
{
switch (id)
@@ -11139,10 +11120,10 @@ int skill_delunit(struct skill_unit *unit)
struct skill_unit_group *group;
int range;
- nullpo_retr(0, unit);
+ nullpo_ret(unit);
if (!unit->alive)
return 0;
- nullpo_retr(0, group = unit->group);
+ nullpo_ret(group = unit->group);
/* onlimitイベント呼び出し */
skill_unit_onlimit(unit, gettick());
@@ -11284,7 +11265,7 @@ int skill_delunitgroup(struct skill_unit_group *group)
struct block_list *src;
int i;
- nullpo_retr(0, group);
+ nullpo_ret(group);
if (group->unit_count <= 0)
return 0;
@@ -11325,7 +11306,7 @@ int skill_clear_unitgroup(struct block_list *src)
struct skill_unit_group *group = NULL;
int maxsug = 0;
- nullpo_retr(0, src);
+ nullpo_ret(src);
if (src->type == BL_PC)
{
@@ -11357,7 +11338,7 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search(
int i, j = 0, k, s = group_id % MAX_SKILLUNITGROUPTICKSET;
struct skill_unit_group_tickset *set = NULL;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_PC)
{
@@ -11388,7 +11369,7 @@ int skill_unitgrouptickset_delete(struct block_list *bl, int group_id)
int i, s = group_id % MAX_SKILLUNITGROUPTICKSET;
struct skill_unit_group_tickset *set = NULL, *ts;
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->type == BL_PC)
{
@@ -11593,7 +11574,7 @@ void skill_unit_out_all_sub(struct block_list *bl,
*/
int skill_unit_out_all(struct block_list *bl, unsigned int tick, int range)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->prev == NULL)
return 0;
@@ -11646,7 +11627,7 @@ void skill_unit_move_sub(struct block_list *bl,
*/
int skill_unit_move(struct block_list *bl, unsigned int tick, int range)
{
- nullpo_retr(0, bl);
+ nullpo_ret(bl);
if (bl->prev == NULL)
return 0;
@@ -11699,7 +11680,7 @@ void skill_unit_move_unit_group_sub(struct block_list *bl,
int skill_unit_move_unit_group(struct skill_unit_group *group, int m, int dx,
int dy)
{
- nullpo_retr(0, group);
+ nullpo_ret(group);
if (group->unit_count <= 0)
return 0;
diff --git a/src/map/skill.hpp b/src/map/skill.hpp
index 3e45c8b..8b23d64 100644
--- a/src/map/skill.hpp
+++ b/src/map/skill.hpp
@@ -65,10 +65,7 @@ int skill_get_nk(SkillID id);
int skill_get_max(SkillID id);
int skill_get_max_raise(SkillID id);
int skill_get_range(SkillID id, int lv);
-int skill_get_hp(SkillID id, int lv);
-int skill_get_mhp(SkillID id, int lv);
int skill_get_sp(SkillID id, int lv);
-int skill_get_zeny(SkillID id, int lv);
int skill_get_num(SkillID id, int lv);
int skill_get_cast(SkillID id, int lv);
int skill_get_delay(SkillID id, int lv);
@@ -76,7 +73,6 @@ int skill_get_time(SkillID id, int lv);
int skill_get_time2(SkillID id, int lv);
int skill_get_castdef(SkillID id);
int skill_get_weapontype(SkillID id);
-int skill_get_unit_id(SkillID id, int flag);
int skill_get_inf2(SkillID id);
int skill_get_maxcount(SkillID id);
int skill_get_blewcount(SkillID id, int lv);
@@ -91,26 +87,13 @@ int skill_castend_map(struct map_session_data *sd, SkillID skill_num,
const char *map);
int skill_cleartimerskill(struct block_list *src);
-int skill_addtimerskill(struct block_list *src, unsigned int tick,
- int target, int x, int y, SkillID skill_id,
- int skill_lv, int type, int flag);
// 追加効果
int skill_additional_effect(struct block_list *src, struct block_list *bl,
SkillID skillid, int skilllv, int attack_type,
unsigned int tick);
-// ユニットスキル
-struct skill_unit *skill_initunit(struct skill_unit_group *group, int idx,
- int x, int y);
int skill_delunit(struct skill_unit *unit);
-struct skill_unit_group *skill_initunitgroup(struct block_list *src,
- int count, SkillID skillid,
- int skilllv, int unit_id);
-int skill_delunitgroup(struct skill_unit_group *group);
-struct skill_unit_group_tickset *skill_unitgrouptickset_search(
- struct block_list *bl, int group_id);
-int skill_unitgrouptickset_delete(struct block_list *bl, int group_id);
int skill_clear_unitgroup(struct block_list *src);
int skill_unit_ondamaged(struct skill_unit *src, struct block_list *bl,
@@ -120,34 +103,25 @@ int skill_castfix(struct block_list *bl, int time);
int skill_delayfix(struct block_list *bl, int time);
int skill_check_unit_range(int m, int x, int y, int range, SkillID skillid);
int skill_check_unit_range2(int m, int x, int y, int range);
-// -- moonsoul (added skill_check_unit_cell)
-int skill_check_unit_cell(SkillID skillid, int m, int x, int y, int unit_id);
int skill_unit_out_all(struct block_list *bl, unsigned int tick, int range);
int skill_unit_move(struct block_list *bl, unsigned int tick, int range);
int skill_unit_move_unit_group(struct skill_unit_group *group, int m,
int dx, int dy);
-struct skill_unit_group *skill_check_dancing(struct block_list *src);
void skill_stop_dancing(struct block_list *src, int flag);
// 詠唱キャンセル
int skill_castcancel(struct block_list *bl, int type);
int skill_gangsterparadise(struct map_session_data *sd, int type);
-void skill_brandishspear_first(struct square *tc, int dir, int x, int y);
-void skill_brandishspear_dir(struct square *tc, int dir, int are);
-int skill_autospell(struct map_session_data *md, SkillID skillid);
void skill_devotion(struct map_session_data *md, int target);
void skill_devotion2(struct block_list *bl, int crusader);
int skill_devotion3(struct block_list *bl, int target);
-void skill_devotion_end(struct map_session_data *md,
- struct map_session_data *sd, int target);
#define skill_calc_heal(bl,skill_lv) (( battle_get_lv(bl)+battle_get_int(bl) )/8 *(4+ skill_lv*8))
// その他
int skill_check_cloaking(struct block_list *bl);
-int skill_is_danceskill(SkillID id);
// ステータス異常
int skill_status_effect(struct block_list *bl, StatusChange type,
@@ -155,7 +129,6 @@ int skill_status_effect(struct block_list *bl, StatusChange type,
int tick, int flag, int spell_invocation);
int skill_status_change_start(struct block_list *bl, StatusChange type,
int val1, int val2, int val3, int val4, int tick, int flag);
-void skill_status_change_timer(timer_id, tick_t, custom_id_t, custom_data_t);
int skill_status_change_active(struct block_list *bl, StatusChange type); // [fate]
int skill_encchant_eremental_end(struct block_list *bl, StatusChange type);
int skill_status_change_end(struct block_list *bl, StatusChange type, int tid);
@@ -171,11 +144,6 @@ int skill_castend_damage_id(struct block_list *src, struct block_list *bl,
int skill_castend_pos2(struct block_list *src, int x, int y, SkillID skillid,
int skilllv, unsigned int tick, int flag);
-// スキル攻撃一括処理
-int skill_attack(int attack_type, struct block_list *src,
- struct block_list *dsrc, struct block_list *bl,
- SkillID skillid, int skilllv, unsigned int tick, int flag);
-
int skill_update_heal_animation(struct map_session_data *sd); // [Fate] Check whether the healing flag must be updated, do so if needed
void skill_reload(void);
@@ -196,7 +164,6 @@ extern int skill_pool_skills_size; // Number of entries in skill_pool_skills
int skill_pool(struct map_session_data *sd, SkillID *skills);
int skill_pool_size(struct map_session_data *sd);
int skill_pool_max(struct map_session_data *sd); // Max. number of pool skills
-void skill_pool_empty(struct map_session_data *sd); // Deactivate all pool skills
// Skill into skill pool. Return is zero iff okay.
int skill_pool_activate(struct map_session_data *sd, SkillID skill);
// Skill into skill pool. Return is zero when activated.
@@ -209,9 +176,6 @@ const char *skill_name(SkillID skill)
{
return skill_lookup_by_id(skill).desc;
}
-// Yields the stat associated with a skill.
-// Returns zero if none, or SP_STR, SP_VIT, ... otherwise
-int skill_stat(SkillID skill);
// Yields the power of a skill.
// This is zero if the skill is unknown
// or if it's a pool skill that is outside of the skill pool,
diff --git a/src/map/storage.cpp b/src/map/storage.cpp
index 09b8893..041a735 100644
--- a/src/map/storage.cpp
+++ b/src/map/storage.cpp
@@ -25,6 +25,7 @@ struct dbt *storage_db;
* 倉庫内アイテムソート
*------------------------------------------
*/
+static
int storage_comp_item(const void *_i1, const void *_i2)
{
struct item *i1 = (struct item *) _i1;
@@ -46,6 +47,7 @@ void storage_db_final(db_key_t, db_val_t data)
free(stor);
}
+static
void sortage_sortitem(struct storage *stor)
{
nullpo_retv(stor);
@@ -69,21 +71,6 @@ void do_final_storage(void) // by [MC Cameri]
numdb_final(storage_db, storage_db_final);
}
-static
-void storage_reconnect_sub(db_key_t, db_val_t data)
-{
- //Parses storage and saves 'dirty' ones upon reconnect. [Skotlex]
- struct storage *stor = (struct storage *) data;
- if (stor->dirty && stor->storage_status == 0) //Save closed storages.
- storage_storage_save(stor->account_id, stor->dirty == 2 ? 1 : 0);
-}
-
-//Function to be invoked upon server reconnection to char. To save all 'dirty' storages [Skotlex
-void do_reconnect_storage(void)
-{
- numdb_foreach(storage_db, storage_reconnect_sub);
-}
-
struct storage *account2storage(int account_id)
{
struct storage *stor =
@@ -103,6 +90,7 @@ struct storage *account2storage2(int account_id)
return (struct storage *) numdb_search(storage_db, account_id);
}
+static
int storage_delete(int account_id)
{
struct storage *stor =
@@ -122,7 +110,7 @@ int storage_delete(int account_id)
int storage_storageopen(struct map_session_data *sd)
{
struct storage *stor;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
if (sd->state.storage_open)
return 1; //Already open?
@@ -225,8 +213,8 @@ int storage_storageadd(struct map_session_data *sd, int index, int amount)
{
struct storage *stor;
- nullpo_retr(0, sd);
- nullpo_retr(0, stor = account2storage2(sd->status.account_id));
+ nullpo_ret(sd);
+ nullpo_ret(stor = account2storage2(sd->status.account_id));
if ((stor->storage_amount > MAX_STORAGE) || !stor->storage_status)
return 0; // storage full / storage closed
@@ -260,8 +248,8 @@ int storage_storageget(struct map_session_data *sd, int index, int amount)
struct storage *stor;
int flag;
- nullpo_retr(0, sd);
- nullpo_retr(0, stor = account2storage2(sd->status.account_id));
+ nullpo_ret(sd);
+ nullpo_ret(stor = account2storage2(sd->status.account_id));
if (index < 0 || index >= MAX_STORAGE)
return 0;
@@ -281,66 +269,6 @@ int storage_storageget(struct map_session_data *sd, int index, int amount)
}
/*==========================================
- * Move an item from cart to storage.
- *------------------------------------------
- */
-int storage_storageaddfromcart(struct map_session_data *sd, int index,
- int amount)
-{
- struct storage *stor;
-
- nullpo_retr(0, sd);
- nullpo_retr(0, stor = account2storage2(sd->status.account_id));
-
- if (stor->storage_amount > MAX_STORAGE || !stor->storage_status)
- return 0; // storage full / storage closed
-
- if (index < 0 || index >= MAX_CART)
- return 0;
-
- if (sd->status.cart[index].nameid <= 0)
- return 0; //No item there.
-
- if (amount < 1 || amount > sd->status.cart[index].amount)
- return 0;
-
- if (storage_additem(sd, stor, &sd->status.cart[index], amount) == 0)
- pc_cart_delitem(sd, index, amount, 0);
-
- return 1;
-}
-
-/*==========================================
- * Get from Storage to the Cart
- *------------------------------------------
- */
-int storage_storagegettocart(struct map_session_data *sd, int index,
- int amount)
-{
- struct storage *stor;
-
- nullpo_retr(0, sd);
- nullpo_retr(0, stor = account2storage2(sd->status.account_id));
-
- if (!stor->storage_status)
- return 0;
-
- if (index < 0 || index >= MAX_STORAGE)
- return 0;
-
- if (stor->storage_[index].nameid <= 0)
- return 0; //Nothing there.
-
- if (amount < 1 || amount > stor->storage_[index].amount)
- return 0;
-
- if (pc_cart_additem(sd, &stor->storage_[index], amount) == 0)
- storage_delitem(sd, stor, index, amount);
-
- return 1;
-}
-
-/*==========================================
* Modified By Valaris to save upon closing [massdriller]
*------------------------------------------
*/
@@ -348,8 +276,8 @@ int storage_storageclose(struct map_session_data *sd)
{
struct storage *stor;
- nullpo_retr(0, sd);
- nullpo_retr(0, stor = account2storage2(sd->status.account_id));
+ nullpo_ret(sd);
+ nullpo_ret(stor = account2storage2(sd->status.account_id));
clif_storageclose(sd);
if (stor->storage_status)
@@ -379,7 +307,7 @@ int storage_storage_quit(struct map_session_data *sd)
{
struct storage *stor;
- nullpo_retr(0, sd);
+ nullpo_ret(sd);
stor = account2storage2(sd->status.account_id);
if (stor)
@@ -392,16 +320,6 @@ int storage_storage_quit(struct map_session_data *sd)
return 0;
}
-void storage_storage_dirty(struct map_session_data *sd)
-{
- struct storage *stor;
-
- stor = account2storage2(sd->status.account_id);
-
- if (stor)
- stor->dirty = 1;
-}
-
int storage_storage_save(int account_id, int final)
{
struct storage *stor;
diff --git a/src/map/storage.hpp b/src/map/storage.hpp
index 0345c0b..e1c46ad 100644
--- a/src/map/storage.hpp
+++ b/src/map/storage.hpp
@@ -9,24 +9,13 @@
int storage_storageopen(struct map_session_data *sd);
int storage_storageadd(struct map_session_data *sd, int index, int amount);
int storage_storageget(struct map_session_data *sd, int index, int amount);
-int storage_storageaddfromcart(struct map_session_data *sd, int index,
- int amount);
-int storage_storagegettocart(struct map_session_data *sd, int index,
- int amount);
int storage_storageclose(struct map_session_data *sd);
int do_init_storage(void);
void do_final_storage(void);
-void do_reconnect_storage(void);
struct storage *account2storage(int account_id);
struct storage *account2storage2(int account_id);
-int storage_delete(int account_id);
int storage_storage_quit(struct map_session_data *sd);
int storage_storage_save(int account_id, int final);
int storage_storage_saved(int account_id);
-void storage_storage_dirty(struct map_session_data *sd);
-
-int storage_comp_item(const void *_i1, const void *_i2);
-//int storage_comp_item(const struct item* i1, const struct item* i2);
-void sortage_sortitem(struct storage *stor);
#endif // STORAGE_HPP
diff --git a/src/map/tmw.cpp b/src/map/tmw.cpp
index 93ab37f..0ddec5b 100644
--- a/src/map/tmw.cpp
+++ b/src/map/tmw.cpp
@@ -27,6 +27,14 @@
#include "storage.hpp"
#include "trade.hpp"
+static
+void tmw_AutoBan(struct map_session_data *sd, const char *reason, int length);
+static
+int tmw_CheckChatLameness(struct map_session_data *sd, const char *message);
+static
+int tmw_ShorterStrlen(const char *s1, const char *s2);
+
+
int tmw_CheckChatSpam(struct map_session_data *sd, const char *message)
{
nullpo_retr(1, sd);
diff --git a/src/map/tmw.hpp b/src/map/tmw.hpp
index 6a3131a..879d123 100644
--- a/src/map/tmw.hpp
+++ b/src/map/tmw.hpp
@@ -4,11 +4,8 @@
#include "map.hpp"
int tmw_CheckChatSpam(struct map_session_data *sd, const char *message);
-int tmw_ShorterStrlen(const char *s1, const char *s2);
-int tmw_CheckChatLameness(struct map_session_data *sd, const char *message);
__attribute__((format(printf, 1, 2)))
void tmw_GmHackMsg(const char *fmt, ...);
-void tmw_AutoBan(struct map_session_data *sd, const char *reason, int length);
void tmw_TrimStr(char *str);
#endif // TMW_HPP
diff --git a/warnings b/warnings
index 7c1ce0f..a937f59 100644
--- a/warnings
+++ b/warnings
@@ -26,3 +26,5 @@
-Wno-switch
-Wno-format-zero-length
+-Wno-error=format-zero-length
+-Wno-error=missing-braces