diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2014-06-26 18:18:01 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2014-06-26 20:45:30 -0700 |
commit | ec21450522e3c2124f3510eef5cfd88420483248 (patch) | |
tree | 2d3dbd342dccd34bc3545ae3ab7902042abe6815 /src | |
parent | 296629e067563e82b4a08b2a785d1c2f13b5a285 (diff) | |
download | tmwa-ec21450522e3c2124f3510eef5cfd88420483248.tar.gz tmwa-ec21450522e3c2124f3510eef5cfd88420483248.tar.bz2 tmwa-ec21450522e3c2124f3510eef5cfd88420483248.tar.xz tmwa-ec21450522e3c2124f3510eef5cfd88420483248.zip |
Low hanging fruit
Diffstat (limited to 'src')
72 files changed, 1317 insertions, 1353 deletions
diff --git a/src/admin/ladmin.cpp b/src/admin/ladmin.cpp index 69fc074..bab5a7c 100644 --- a/src/admin/ladmin.cpp +++ b/src/admin/ladmin.cpp @@ -2865,7 +2865,7 @@ bool admin_confs(XString w1, ZString w2) if (w1 == "login_ip"_s) { struct hostent *h = gethostbyname(w2.c_str()); - if (h != NULL) + if (h != nullptr) { Iprintf("Login server IP address: %s -> %s\n"_fmt, w2, login_ip); diff --git a/src/char/char.cpp b/src/char/char.cpp index a0a92f1..3b0d43e 100644 --- a/src/char/char.cpp +++ b/src/char/char.cpp @@ -1083,7 +1083,7 @@ int set_account_reg2(AccountId acc, Slice<GlobalReg> reg) static int char_divorce(CharPair *cp) { - if (cp == NULL) + if (cp == nullptr) return 0; CharKey *ck = &cp->key; @@ -2465,7 +2465,7 @@ void parse_char(Session *s) else PRINTF("Account Logged On; Account ID: %d.\n"_fmt, account_id); - if (sd == NULL) + if (sd == nullptr) { s->session_data = make_unique<char_session_data, SessionDeleter>(); sd = static_cast<char_session_data *>(s->session_data.get()); @@ -2833,14 +2833,14 @@ void check_connect_login_server(TimerData *, tick_t) static bool char_lan_config(XString w1, ZString w2) { - struct hostent *h = NULL; + struct hostent *h = nullptr; { if (w1 == "lan_map_ip"_s) { // Read map-server Lan IP Address h = gethostbyname(w2.c_str()); - if (h != NULL) + if (h != nullptr) { lan_map_ip = IP4Address({ static_cast<uint8_t>(h->h_addr[0]), @@ -2894,7 +2894,7 @@ bool lan_check() static bool char_config(XString w1, ZString w2) { - struct hostent *h = NULL; + struct hostent *h = nullptr; { if (w1 == "userid"_s) @@ -2914,7 +2914,7 @@ bool char_config(XString w1, ZString w2) else if (w1 == "login_ip"_s) { h = gethostbyname(w2.c_str()); - if (h != NULL) + if (h != nullptr) { login_ip = IP4Address({ static_cast<uint8_t>(h->h_addr[0]), @@ -2938,7 +2938,7 @@ bool char_config(XString w1, ZString w2) else if (w1 == "char_ip"_s) { h = gethostbyname(w2.c_str()); - if (h != NULL) + if (h != nullptr) { char_ip = IP4Address({ static_cast<uint8_t>(h->h_addr[0]), diff --git a/src/char/int_storage.cpp b/src/char/int_storage.cpp index 9527806..784347b 100644 --- a/src/char/int_storage.cpp +++ b/src/char/int_storage.cpp @@ -116,7 +116,7 @@ bool extract(XString str, Storage *p) Storage *account2storage(AccountId account_id) { Storage *s = storage_db.search(account_id); - if (s == NULL) + if (s == nullptr) { s = storage_db.init(account_id); s->account_id = account_id; diff --git a/src/char/inter.cpp b/src/char/inter.cpp index 04c1146..354cba7 100644 --- a/src/char/inter.cpp +++ b/src/char/inter.cpp @@ -406,7 +406,7 @@ RecvResult mapif_parse_AccReg(Session *s) struct accreg *reg = accreg_db.search(head.account_id); - if (reg == NULL) + if (reg == nullptr) { AccountId account_id = head.account_id; reg = accreg_db.init(account_id); diff --git a/src/compat/iter_test.cpp b/src/compat/iter_test.cpp index b9bfb6a..f0e6031 100644 --- a/src/compat/iter_test.cpp +++ b/src/compat/iter_test.cpp @@ -26,6 +26,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + TEST(iterpair, strings) { IteratorPair<ValueIterator<char>> pair = value_range('0', ':'); @@ -144,7 +147,7 @@ TEST(iterpair, filter3) int one = 1; int two = 2; int three = 3; - std::vector<int *> vals = {0, &one, 0, &two, 0, &three, 0}; + std::vector<int *> vals = {nullptr, &one, nullptr, &two, nullptr, &three, nullptr}; int sum = 0, count = 0; for (int *i : filter_iterator<int *>(&vals)) diff --git a/src/compat/nullpo.hpp b/src/compat/nullpo.hpp index d6e39a5..5de8ab6 100644 --- a/src/compat/nullpo.hpp +++ b/src/compat/nullpo.hpp @@ -26,7 +26,8 @@ //# define BUG_FREE /// All functions print to standard error (was: standard output) -/// nullpo_ret(cond) - return 0 if given pointer is NULL +/// nullpo_retn(cond) - return nullptr if given pointer is nullptr +/// nullpo_retz(cond) - return 0 if given pointer is nullptr /// nullpo_retv(cond) - just return (function returns void) /// nullpo_retr(rv, cond) - return given value instead @@ -38,7 +39,8 @@ # define nullpo_retr(ret, t) /*t*/ # endif // BUG_FREE -# define nullpo_ret(t) nullpo_retr(0, t) +# define nullpo_retn(t) nullpo_retr(nullptr, t) +# define nullpo_retz(t) nullpo_retr(0, t) # define nullpo_retv(t) nullpo_retr(, t) # include "fwd.hpp" diff --git a/src/generic/array_test.cpp b/src/generic/array_test.cpp index 7b5ffca..a4d4d74 100644 --- a/src/generic/array_test.cpp +++ b/src/generic/array_test.cpp @@ -23,6 +23,8 @@ #include "../poison.hpp" +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + TEST(Array, simple) { GenericArray<int, SimpleIndexing<3>> a; diff --git a/src/generic/intern-pool_test.cpp b/src/generic/intern-pool_test.cpp index bef001f..66490be 100644 --- a/src/generic/intern-pool_test.cpp +++ b/src/generic/intern-pool_test.cpp @@ -24,6 +24,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + TEST(InternPool, whydoesthisalwaysneedasecondname) { InternPool p; diff --git a/src/generic/md5_test.cpp b/src/generic/md5_test.cpp index 047b082..b7854c9 100644 --- a/src/generic/md5_test.cpp +++ b/src/generic/md5_test.cpp @@ -25,6 +25,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + // This should be made part of the main API, // but is not yet to keep the diff small. // Edit: hack to fix the new strict comparison. diff --git a/src/generic/oops.hpp b/src/generic/oops.hpp index 231a4e4..cc0cdcd 100644 --- a/src/generic/oops.hpp +++ b/src/generic/oops.hpp @@ -30,14 +30,13 @@ class AssertionError : public std::runtime_error { - const char *_what; public: AssertionError(const char *desc, const char *expr, const char *file, size_t line, const char *function); }; # define ALLEGE(desc, expr) \ - if (expr) {} \ + if (expr) {} \ else throw AssertionError(desc, #expr, __FILE__, __LINE__, __PRETTY_FUNCTION__) #endif // TMWA_GENERIC_OOPS_HPP diff --git a/src/generic/oops_test.cpp b/src/generic/oops_test.cpp index d16db04..13f7fac 100644 --- a/src/generic/oops_test.cpp +++ b/src/generic/oops_test.cpp @@ -22,6 +22,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + TEST(oops, okay) { try @@ -45,6 +48,6 @@ TEST(oops, uhoh) catch (const AssertionError& e) { ASSERT_STREQ(strstr(e.what(), "src/generic/"), - "src/generic/oops_test.cpp:42: error: in 'virtual void oops_uhoh_Test::TestBody()', incorrectly alleged that 'the sky is falling' (1 == 0)"); + "src/generic/oops_test.cpp:45: error: in 'virtual void oops_uhoh_Test::TestBody()', incorrectly alleged that 'the sky is falling' (1 == 0)"); } } diff --git a/src/ints/cmp_test.cpp b/src/ints/cmp_test.cpp index 5767579..bcff87d 100644 --- a/src/ints/cmp_test.cpp +++ b/src/ints/cmp_test.cpp @@ -24,6 +24,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + // Google Test is *really* slow to compile this file #undef EXPECT_EQ #define EXPECT_EQ(a, b) assert(a == b) diff --git a/src/ints/udl_test.cpp b/src/ints/udl_test.cpp index acb4f76..3fe01f5 100644 --- a/src/ints/udl_test.cpp +++ b/src/ints/udl_test.cpp @@ -24,6 +24,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-variable" TEST(ints, smc) diff --git a/src/io/cxxstdio.cpp b/src/io/cxxstdio.cpp index fbfdd46..8b18701 100644 --- a/src/io/cxxstdio.cpp +++ b/src/io/cxxstdio.cpp @@ -1,5 +1,5 @@ #include "cxxstdio.hpp" -// cxxstdio.cpp - pass C++ types through scanf/printf +// cxxstdio.cpp - pass C++ types through printf // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> // diff --git a/src/io/cxxstdio.hpp b/src/io/cxxstdio.hpp index c040d90..fc5829f 100644 --- a/src/io/cxxstdio.hpp +++ b/src/io/cxxstdio.hpp @@ -1,6 +1,6 @@ #ifndef TMWA_IO_CXXSTDIO_HPP #define TMWA_IO_CXXSTDIO_HPP -// cxxstdio.hpp - pass C++ types through scanf/printf +// cxxstdio.hpp - pass C++ types through printf // // Copyright © 2011-2013 Ben Longbons <b.r.longbons@gmail.com> // @@ -31,30 +31,13 @@ namespace cxxstdio { - // other implementations of do_vprint or do_vscan are injected by ADL. + // other implementations of do_vprint are injected by ADL. inline __attribute__((format(printf, 2, 0))) int do_vprint(FILE *out, const char *fmt, va_list ap) { return vfprintf(out, fmt, ap); } - inline __attribute__((format(scanf, 2, 0))) - int do_vscan(FILE *in, const char *fmt, va_list ap) - { - return vfscanf(in, fmt, ap); - } - -# if 0 - inline __attribute__((format(scanf, 2, 0))) - int do_vscan(const char *in, const char *fmt, va_list ap) - { - return vsscanf(in, fmt, ap); - } -# else - inline - int do_vscan(const char *, const char *, va_list) = delete; -# endif - template<class T> inline __attribute__((format(printf, 2, 3))) int do_print(T&& t, const char *fmt, ...) @@ -67,19 +50,6 @@ namespace cxxstdio return rv; } - template<class T> - inline __attribute__((format(scanf, 2, 3))) - int do_scan(T&& t, const char *fmt, ...) - { - int rv; - va_list ap; - va_start(ap, fmt); - rv = do_vscan(std::forward<T>(t), fmt, ap); - va_end(ap); - return rv; - } - - template<class T, typename=typename std::enable_if<!std::is_class<T>::value>::type> typename remove_enum<T>::type decay_for_printf(T v) { @@ -93,16 +63,8 @@ namespace cxxstdio return std::forward<T>(v); } - template<class T, typename = typename std::enable_if<!std::is_enum<T>::value>::type> - T& convert_for_scanf(T& v) - { - return v; - } - inline const char *convert_for_printf(const char *) = delete; - inline - char *convert_for_scanf(char *) = delete; # if 0 template<class E> @@ -180,12 +142,6 @@ namespace cxxstdio } }; - template<class T, typename = typename std::enable_if<std::is_enum<T>::value>::type> - EnumConverter<T> convert_for_scanf(T& v) - { - return v; - } - template<class Format> class PrintFormatter { @@ -201,21 +157,6 @@ namespace cxxstdio } }; - template<class Format> - class ScanFormatter - { - public: - template<class T, class... A> - static - int scan(T&& t, A&&... a) - { - constexpr static - const char *scan_format = Format::scan_format().format_string(); - return do_scan(std::forward<T>(t), scan_format, - &convert_for_scanf(*a)...); - } - }; - # define XPRINTF(out, fmt, ...) \ ({ \ struct format_impl \ @@ -226,29 +167,10 @@ namespace cxxstdio cxxstdio::PrintFormatter<format_impl>::print(out, ## __VA_ARGS__); \ }) -# if 0 -# define XSCANF(out, fmt, ...) \ - ({ \ - struct format_impl \ - { \ - constexpr static \ - FormatString scan_format() { return fmt; } \ - }; \ - cxxstdio::ScanFormatter<format_impl>::scan(out, ## __VA_ARGS__); \ - }) -# endif - # define FPRINTF(file, fmt, ...) XPRINTF(/*no_cast<FILE *>*/(file), fmt, ## __VA_ARGS__) -# if 0 -# define FSCANF(file, fmt, ...) XSCANF(no_cast<FILE *>(file), fmt, ## __VA_ARGS__) -# endif # define PRINTF(fmt, ...) FPRINTF(stdout, fmt, ## __VA_ARGS__) # define SPRINTF(str, fmt, ...) XPRINTF(base_cast<AString&>(str), fmt, ## __VA_ARGS__) # define SNPRINTF(str, n, fmt, ...) XPRINTF(base_cast<VString<n-1>&>(str), fmt, ## __VA_ARGS__) -# if 0 -# define SCANF(fmt, ...) FSCANF(stdin, fmt, ## __VA_ARGS__) -# define SSCANF(str, fmt, ...) XSCANF(maybe_cast<ZString>(str), fmt, ## __VA_ARGS__) -# endif # define STRPRINTF(fmt, ...) \ ({ \ diff --git a/src/io/line_test.cpp b/src/io/line_test.cpp index 6a4a55c..d6efa67 100644 --- a/src/io/line_test.cpp +++ b/src/io/line_test.cpp @@ -25,6 +25,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + static io::FD string_pipe(ZString sz) { diff --git a/src/io/read_test.cpp b/src/io/read_test.cpp index 77b2286..8cf7d7a 100644 --- a/src/io/read_test.cpp +++ b/src/io/read_test.cpp @@ -26,6 +26,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + static io::FD string_pipe(ZString sz) { diff --git a/src/io/write_test.cpp b/src/io/write_test.cpp index 970be42..ff2553a 100644 --- a/src/io/write_test.cpp +++ b/src/io/write_test.cpp @@ -30,6 +30,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + static io::FD pipew(io::FD& rfd) { diff --git a/src/login/login.cpp b/src/login/login.cpp index b86950d..4322b33 100644 --- a/src/login/login.cpp +++ b/src/login/login.cpp @@ -285,7 +285,7 @@ static GmLevel isGM(AccountId account_id) { GM_Account *p = gm_account_db.search(account_id); - if (p == NULL) + if (p == nullptr) return GmLevel(); return p->level; } @@ -3255,14 +3255,14 @@ void parse_login(Session *s) static bool login_lan_config(XString w1, ZString w2) { - struct hostent *h = NULL; + struct hostent *h = nullptr; { if (w1 == "lan_char_ip"_s) { // Read Char-Server Lan IP Address h = gethostbyname(w2.c_str()); - if (h != NULL) + if (h != nullptr) { lan_char_ip = IP4Address({ static_cast<uint8_t>(h->h_addr[0]), diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index f405f14..1b857f4 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -214,7 +214,7 @@ AString gm_log; io::AppendFile *get_gm_log() { if (!gm_log) - return NULL; + return nullptr; struct tm ctime = TimeT::now(); @@ -334,7 +334,7 @@ void atkillmonster_sub(dumb_ptr<block_list> bl, int flag) dumb_ptr<mob_data> md = bl->is_mob(); if (flag) - mob_damage(NULL, md, md->hp, 2); + mob_damage(nullptr, md, md->hp, 2); else mob_delete(md); } @@ -369,7 +369,7 @@ bool atcommand_config_read(ZString cfgName) continue; } AtCommandInfo *p = get_atcommandinfo_byname(w1); - if (p != NULL) + if (p != nullptr) { p->level = GmLevel::from(static_cast<uint32_t>(atoi(w2.c_str()))); } @@ -639,7 +639,7 @@ ATCE atcommand_where(Session *s, dumb_ptr<map_session_data> sd, extract(message, &character); dumb_ptr<map_session_data> pl_sd = character.to__actual() ? map_nick2sd(character) : sd; - if (pl_sd != NULL && + if (pl_sd != nullptr && !((battle_config.hide_GM_session || bool(pl_sd->status.option & Option::HIDE)) && !(pc_isGM(sd).detects(pc_isGM(pl_sd))))) @@ -673,7 +673,7 @@ ATCE atcommand_goto(Session *s, dumb_ptr<map_session_data> sd, } dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pl_sd->bl_m && pl_sd->bl_m->flag.get(MapFlag::NOWARPTO) && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) @@ -1152,7 +1152,7 @@ ATCE atcommand_storage(Session *s, dumb_ptr<map_session_data> sd, return ATCE::EXIST; } - if ((stor = account2storage2(sd->status_key.account_id)) != NULL + if ((stor = account2storage2(sd->status_key.account_id)) != nullptr && stor->storage_status == 1) { clif_displaymessage(s, "msg_table[250]"_s); @@ -1209,7 +1209,7 @@ static ATCE atcommand_die(Session *s, dumb_ptr<map_session_data> sd, ZString) { - pc_damage(NULL, sd, sd->status.hp + 1); + pc_damage(nullptr, sd, sd->status.hp + 1); clif_displaymessage(s, "A pity! You've died."_s); return ATCE::OKAY; @@ -1225,12 +1225,12 @@ ATCE atcommand_kill(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can kill only lower or same level - pc_damage(NULL, pl_sd, pl_sd->status.hp + 1); + pc_damage(nullptr, pl_sd, pl_sd->status.hp + 1); clif_displaymessage(s, "Character killed."_s); } else @@ -1334,7 +1334,7 @@ ATCE atcommand_item(Session *s, dumb_ptr<map_session_data> sd, XString item_name; int number = 0; ItemNameId item_id; - struct item_data *item_data = NULL; + struct item_data *item_data = nullptr; int get_count, i; if (!extract(message, record<' ', 1>(&item_name, &number))) @@ -1347,9 +1347,9 @@ ATCE atcommand_item(Session *s, dumb_ptr<map_session_data> sd, if (number <= 0) number = 1; - if ((item_data = itemdb_searchname(item_name)) != NULL) + if ((item_data = itemdb_searchname(item_name)) != nullptr) item_id = item_data->nameid; - else if (extract(item_name, &item_id) && (item_data = itemdb_exists(item_id)) != NULL) + else if (extract(item_name, &item_id) && (item_data = itemdb_exists(item_id)) != nullptr) item_id = item_data->nameid; else return ATCE::EXIST; @@ -2068,7 +2068,7 @@ ATCE atcommand_recall(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { @@ -2116,7 +2116,7 @@ ATCE atcommand_revive(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { pl_sd->status.hp = pl_sd->status.max_hp; pc_setstand(pl_sd); @@ -2146,7 +2146,7 @@ ATCE atcommand_character_stats(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { AString output; output = STRPRINTF("'%s' stats:"_fmt, pl_sd->status_key.name); @@ -2256,7 +2256,7 @@ ATCE atcommand_character_option(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { @@ -2391,7 +2391,7 @@ ATCE atcommand_character_save(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { @@ -2445,7 +2445,7 @@ ATCE atcommand_doom(Session *s, dumb_ptr<map_session_data> sd, && pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can doom only lower or same gm level - pc_damage(NULL, pl_sd, pl_sd->status.hp + 1); + pc_damage(nullptr, pl_sd, pl_sd->status.hp + 1); clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement."_s); } } @@ -2469,7 +2469,7 @@ ATCE atcommand_doommap(Session *s, dumb_ptr<map_session_data> sd, && pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can doom only lower or same gm level - pc_damage(NULL, pl_sd, pl_sd->status.hp + 1); + pc_damage(nullptr, pl_sd, pl_sd->status.hp + 1); clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement."_s); } } @@ -2541,7 +2541,7 @@ ATCE atcommand_character_baselevel(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { @@ -2627,7 +2627,7 @@ ATCE atcommand_character_joblevel(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { @@ -2699,7 +2699,7 @@ ATCE atcommand_kick(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) // you can kick only lower or same gm level @@ -2797,7 +2797,7 @@ ATCE atcommand_charquestskill(Session *s, dumb_ptr<map_session_data>, if (skill_get_inf2(skill_id) & 0x01) { dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_checkskill(pl_sd, skill_id) == 0) { @@ -2887,7 +2887,7 @@ ATCE atcommand_charlostskill(Session *s, dumb_ptr<map_session_data>, if (skill_get_inf2(skill_id) & 0x01) { dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_checkskill(pl_sd, skill_id) > 0) { @@ -2976,7 +2976,7 @@ ATCE atcommand_idsearch(Session *s, dumb_ptr<map_session_data>, match = 0; for (ItemNameId i = wrap<ItemNameId>(0); i < wrap<ItemNameId>(-1); i = next(i)) { - if ((item = itemdb_exists(i)) != NULL + if ((item = itemdb_exists(i)) != nullptr && item->jname.contains_seq(item_name)) { match++; @@ -3000,7 +3000,7 @@ ATCE atcommand_charskreset(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { @@ -3035,7 +3035,7 @@ ATCE atcommand_charstreset(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { @@ -3071,7 +3071,7 @@ ATCE atcommand_charreset(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { @@ -3111,7 +3111,7 @@ ATCE atcommand_char_wipe(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { @@ -3191,7 +3191,7 @@ ATCE atcommand_charmodel(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE && hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR && @@ -3229,7 +3229,7 @@ ATCE atcommand_charskpoint(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { new_skill_point = pl_sd->status.skill_point + point; if (point > 0 && (point > 0x7FFF || new_skill_point > 0x7FFF)) @@ -3269,7 +3269,7 @@ ATCE atcommand_charstpoint(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { new_status_point = pl_sd->status.status_point + point; if (point > 0 && (point > 0x7FFF || new_status_point > 0x7FFF)) @@ -3307,7 +3307,7 @@ ATCE atcommand_charzeny(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { new_zeny = pl_sd->status.zeny + zeny; if (zeny > 0 && (zeny > MAX_ZENY || new_zeny > MAX_ZENY)) @@ -3445,7 +3445,7 @@ static ATCE atcommand_mapinfo(Session *s, dumb_ptr<map_session_data> sd, ZString message) { - dumb_ptr<npc_data> nd = NULL; + dumb_ptr<npc_data> nd = nullptr; MapName map_name; LString direction = ""_s; int list = 0; @@ -3618,7 +3618,7 @@ ATCE atcommand_enablenpc(Session *s, dumb_ptr<map_session_data>, if (!extract(message, &NPCname) || !NPCname) return ATCE::USAGE; - if (npc_name2id(NPCname) != NULL) + if (npc_name2id(NPCname) != nullptr) { npc_enable(NPCname, 1); clif_displaymessage(s, "Npc Enabled."_s); @@ -3641,7 +3641,7 @@ ATCE atcommand_disablenpc(Session *s, dumb_ptr<map_session_data>, if (!extract(message, &NPCname) || !NPCname) return ATCE::USAGE; - if (npc_name2id(NPCname) != NULL) + if (npc_name2id(NPCname) != nullptr) { npc_enable(NPCname, 0); clif_displaymessage(s, "Npc Disabled."_s); @@ -3681,15 +3681,15 @@ ATCE atcommand_chardelitem(Session *s, dumb_ptr<map_session_data> sd, if (!asplit(message, &item_name, &number, &character) || number < 1) return ATCE::USAGE; - if ((item_data = itemdb_searchname(item_name)) != NULL) + if ((item_data = itemdb_searchname(item_name)) != nullptr) item_id = item_data->nameid; - else if (extract(item_name, &item_id) && (item_data = itemdb_exists(item_id)) != NULL) + else if (extract(item_name, &item_id) && (item_data = itemdb_exists(item_id)) != nullptr) item_id = item_data->nameid; if (item_id) { dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { @@ -3845,7 +3845,7 @@ static ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd, ZString message) { - struct item_data *item_data = NULL; + struct item_data *item_data = nullptr; int count, counter; CharName character; @@ -3853,7 +3853,7 @@ ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { @@ -3865,7 +3865,7 @@ ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd, if (pl_sd->status.inventory[i].nameid && (item_data = itemdb_search(pl_sd->status.inventory[i].nameid)) != - NULL) + nullptr) { counter = counter + pl_sd->status.inventory[i].amount; count++; @@ -3957,7 +3957,7 @@ ATCE atcommand_character_storage_list(Session *s, dumb_ptr<map_session_data> sd, ZString message) { Storage *stor; - struct item_data *item_data = NULL; + struct item_data *item_data = nullptr; int count, counter; CharName character; @@ -3965,12 +3965,12 @@ ATCE atcommand_character_storage_list(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can look items only lower or same level - if ((stor = account2storage2(pl_sd->status_key.account_id)) != NULL) + if ((stor = account2storage2(pl_sd->status_key.account_id)) != nullptr) { counter = 0; count = 0; @@ -3978,7 +3978,7 @@ ATCE atcommand_character_storage_list(Session *s, dumb_ptr<map_session_data> sd, { if (stor->storage_[i].nameid && (item_data = - itemdb_search(stor->storage_[i].nameid)) != NULL) + itemdb_search(stor->storage_[i].nameid)) != nullptr) { counter = counter + stor->storage_[i].amount; count++; @@ -4054,7 +4054,7 @@ ATCE atcommand_charkiller(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd == NULL) + if (pl_sd == nullptr) return ATCE::EXIST; pl_sd->special_state.killer = !pl_sd->special_state.killer; @@ -4097,7 +4097,7 @@ ATCE atcommand_charkillable(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd == NULL) + if (pl_sd == nullptr) return ATCE::EXIST; pl_sd->special_state.killable = !pl_sd->special_state.killable; @@ -4116,13 +4116,13 @@ ATCE atcommand_npcmove(Session *, dumb_ptr<map_session_data>, { NpcName character; int x = 0, y = 0; - dumb_ptr<npc_data> nd = 0; + dumb_ptr<npc_data> nd = nullptr; if (!asplit(message, &x, &y, &character)) return ATCE::USAGE; nd = npc_name2id(character); - if (nd == NULL) + if (nd == nullptr) return ATCE::EXIST; npc_enable(character, 0); @@ -4172,7 +4172,7 @@ ATCE atcommand_chareffect(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(target); - if (pl_sd == NULL) + if (pl_sd == nullptr) return ATCE::EXIST; clif_specialeffect(pl_sd, type, 0); @@ -4206,7 +4206,7 @@ ATCE atcommand_chardropall(Session *s, dumb_ptr<map_session_data>, if (!asplit(message, &character)) return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd == NULL) + if (pl_sd == nullptr) return ATCE::EXIST; for (IOff0 i : IOff0::iter()) { @@ -4268,7 +4268,7 @@ ATCE atcommand_charstoreall(Session *s, dumb_ptr<map_session_data> sd, if (!asplit(message, &character)) return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd == NULL) + if (pl_sd == nullptr) return ATCE::EXIST; if (storage_storageopen(pl_sd) == 1) @@ -4451,7 +4451,7 @@ ATCE atcommand_adjgmlvl(Session *s, dumb_ptr<map_session_data>, } dumb_ptr<map_session_data> pl_sd = map_nick2sd(user); - if (pl_sd == NULL) + if (pl_sd == nullptr) return ATCE::EXIST; pc_set_gm_level(pl_sd->status_key.account_id, newlev); @@ -4583,7 +4583,7 @@ ATCE atcommand_set_magic(Session *s, dumb_ptr<map_session_data>, } dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (skill_index == SkillID::ZERO) for (SkillID sk : magic_skills) @@ -4713,7 +4713,7 @@ ATCE atcommand_skillpool_info(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { SkillID pool_skills[MAX_SKILL_POOL]; int pool_skills_nr = skill_pool(pl_sd, pool_skills); @@ -4773,7 +4773,7 @@ ATCE atcommand_skillpool_focus(Session *s, dumb_ptr<map_session_data>, } dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (skill_pool_activate(pl_sd, skill)) clif_displaymessage(s, "Activation failed."_s); @@ -4797,7 +4797,7 @@ ATCE atcommand_skillpool_unfocus(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (skill_pool_deactivate(pl_sd, skill)) clif_displaymessage(s, "Deactivation failed."_s); @@ -4822,7 +4822,7 @@ ATCE atcommand_skill_learn(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { set_skill(pl_sd, skill, level); clif_skillinfoblock(pl_sd); @@ -4843,7 +4843,7 @@ ATCE atcommand_ipcheck(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd == NULL) + if (pl_sd == nullptr) { clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; @@ -4894,7 +4894,7 @@ ATCE atcommand_doomspot(Session *s, dumb_ptr<map_session_data> sd, && pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can doom only lower or same gm level - pc_damage(NULL, pl_sd, pl_sd->status.hp + 1); + pc_damage(nullptr, pl_sd, pl_sd->status.hp + 1); clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement."_s); } } diff --git a/src/map/battle.cpp b/src/map/battle.cpp index a653cac..95826bb 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -63,7 +63,7 @@ static int battle_counttargeted(dumb_ptr<block_list> bl, dumb_ptr<block_list> src, ATK target_lv) { - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type == BL::PC) return pc_counttargeted(bl->is_player(), src, target_lv); @@ -111,7 +111,7 @@ DIR battle_get_dir(dumb_ptr<block_list> bl) */ int battle_get_lv(dumb_ptr<block_list> bl) { - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type == BL::MOB) return bl->is_mob()->stats[mob_stat::LV]; else if (bl->bl_type == BL::PC) @@ -127,7 +127,7 @@ int battle_get_lv(dumb_ptr<block_list> bl) */ int battle_get_range(dumb_ptr<block_list> bl) { - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type == BL::MOB) return get_mob_db(bl->is_mob()->mob_class).range; else if (bl->bl_type == BL::PC) @@ -189,7 +189,7 @@ int battle_get_str(dumb_ptr<block_list> bl) int str = 0; eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; - nullpo_ret(bl); + nullpo_retz(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::MOB) str = bl->is_mob()->stats[mob_stat::STR]; @@ -212,7 +212,7 @@ int battle_get_agi(dumb_ptr<block_list> bl) int agi = 0; eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; - nullpo_ret(bl); + nullpo_retz(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::MOB) agi = bl->is_mob()->stats[mob_stat::AGI]; @@ -234,7 +234,7 @@ int battle_get_vit(dumb_ptr<block_list> bl) int vit = 0; eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; - nullpo_ret(bl); + nullpo_retz(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::MOB) vit = bl->is_mob()->stats[mob_stat::VIT]; @@ -256,7 +256,7 @@ int battle_get_int(dumb_ptr<block_list> bl) int int_ = 0; eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; - nullpo_ret(bl); + nullpo_retz(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::MOB) int_ = bl->is_mob()->stats[mob_stat::INT]; @@ -278,7 +278,7 @@ int battle_get_dex(dumb_ptr<block_list> bl) int dex = 0; eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; - nullpo_ret(bl); + nullpo_retz(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::MOB) dex = bl->is_mob()->stats[mob_stat::DEX]; @@ -300,7 +300,7 @@ int battle_get_luk(dumb_ptr<block_list> bl) int luk = 0; eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; - nullpo_ret(bl); + nullpo_retz(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::MOB) luk = bl->is_mob()->stats[mob_stat::LUK]; @@ -466,7 +466,7 @@ int battle_get_atk(dumb_ptr<block_list> bl) eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; int atk = 0; - nullpo_ret(bl); + nullpo_retz(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::PC) atk = bl->is_player()->watk; @@ -486,7 +486,7 @@ int battle_get_atk(dumb_ptr<block_list> bl) static int battle_get_atk_(dumb_ptr<block_list> bl) { - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type == BL::PC) return bl->is_player()->watk_; else @@ -501,7 +501,7 @@ int battle_get_atk_(dumb_ptr<block_list> bl) static int battle_get_atk2(dumb_ptr<block_list> bl) { - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type == BL::PC) return bl->is_player()->watk2; else @@ -524,7 +524,7 @@ int battle_get_atk2(dumb_ptr<block_list> bl) static int battle_get_atk_2(dumb_ptr<block_list> bl) { - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type == BL::PC) return bl->is_player()->watk_2; else @@ -540,7 +540,7 @@ static int battle_get_matk1(dumb_ptr<block_list> bl) { eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; - nullpo_ret(bl); + nullpo_retz(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::MOB) { @@ -563,7 +563,7 @@ int battle_get_matk1(dumb_ptr<block_list> bl) static int battle_get_matk2(dumb_ptr<block_list> bl) { - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type == BL::MOB) { int matk, int_ = battle_get_int(bl); @@ -587,7 +587,7 @@ int battle_get_def(dumb_ptr<block_list> bl) eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; int def = 0; - nullpo_ret(bl); + nullpo_retz(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::PC) { @@ -623,7 +623,7 @@ int battle_get_mdef(dumb_ptr<block_list> bl) eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; int mdef = 0; - nullpo_ret(bl); + nullpo_retz(bl); sc_data = battle_get_sc_data(bl); if (bl->bl_type == BL::PC) mdef = bl->is_player()->mdef; @@ -685,7 +685,7 @@ int battle_get_mdef2(dumb_ptr<block_list> bl) { int mdef2 = 0; - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type == BL::MOB) { dumb_ptr<mob_data> md = bl->is_mob(); @@ -883,60 +883,60 @@ eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> battle_ short *battle_get_sc_count(dumb_ptr<block_list> bl) { - nullpo_retr(NULL, bl); + nullpo_retr(nullptr, bl); if (bl->bl_type == BL::MOB) return &bl->is_mob()->sc_count; else if (bl->bl_type == BL::PC) return &bl->is_player()->sc_count; - return NULL; + return nullptr; } Opt1 *battle_get_opt1(dumb_ptr<block_list> bl) { - nullpo_ret(bl); + nullpo_retn(bl); if (bl->bl_type == BL::MOB) return &bl->is_mob()->opt1; else if (bl->bl_type == BL::PC) return &bl->is_player()->opt1; else if (bl->bl_type == BL::NPC) return &bl->is_npc()->opt1; - return 0; + return nullptr; } Opt2 *battle_get_opt2(dumb_ptr<block_list> bl) { - nullpo_ret(bl); + nullpo_retn(bl); if (bl->bl_type == BL::MOB) return &bl->is_mob()->opt2; else if (bl->bl_type == BL::PC) return &bl->is_player()->opt2; else if (bl->bl_type == BL::NPC) return &bl->is_npc()->opt2; - return 0; + return nullptr; } Opt3 *battle_get_opt3(dumb_ptr<block_list> bl) { - nullpo_ret(bl); + nullpo_retn(bl); if (bl->bl_type == BL::MOB) return &bl->is_mob()->opt3; else if (bl->bl_type == BL::PC) return &bl->is_player()->opt3; else if (bl->bl_type == BL::NPC) return &bl->is_npc()->opt3; - return 0; + return nullptr; } Option *battle_get_option(dumb_ptr<block_list> bl) { - nullpo_ret(bl); + nullpo_retn(bl); if (bl->bl_type == BL::MOB) return &bl->is_mob()->option; else if (bl->bl_type == BL::PC) return &bl->is_player()->status.option; else if (bl->bl_type == BL::NPC) return &bl->is_npc()->option; - return 0; + return nullptr; } //------------------------------------------------------------------- @@ -953,17 +953,17 @@ struct battle_delay_damage_ int battle_damage(dumb_ptr<block_list> bl, dumb_ptr<block_list> target, int damage, int flag) { - nullpo_ret(target); //blはNULLで呼ばれることがあるので他でチェック + nullpo_retz(target); //blはNULLで呼ばれることがあるので他でチェック if (damage == 0) return 0; - if (target->bl_prev == NULL) + if (target->bl_prev == nullptr) return 0; if (bl) { - if (bl->bl_prev == NULL) + if (bl->bl_prev == nullptr) return 0; } @@ -991,7 +991,7 @@ int battle_damage(dumb_ptr<block_list> bl, dumb_ptr<block_list> target, int battle_heal(dumb_ptr<block_list> bl, dumb_ptr<block_list> target, int hp, int sp, int flag) { - nullpo_ret(target); //blはNULLで呼ばれることがあるので他でチェック + nullpo_retz(target); //blはNULLで呼ばれることがあるので他でチェック if (target->bl_type == BL::PC && pc_isdead(target->is_player())) @@ -1012,7 +1012,7 @@ int battle_heal(dumb_ptr<block_list> bl, dumb_ptr<block_list> target, int hp, // 攻撃停止 int battle_stopattack(dumb_ptr<block_list> bl) { - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type == BL::MOB) return mob_stopattack(bl->is_mob()); else if (bl->bl_type == BL::PC) @@ -1023,7 +1023,7 @@ int battle_stopattack(dumb_ptr<block_list> bl) // 移動停止 int battle_stopwalking(dumb_ptr<block_list> bl, int type) { - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type == BL::MOB) return mob_stop_walking(bl->is_mob(), type); else if (bl->bl_type == BL::PC) @@ -1040,9 +1040,9 @@ int battle_calc_damage(dumb_ptr<block_list>, dumb_ptr<block_list> bl, int damage, int div_, SkillID, int, BF flag) { - dumb_ptr<mob_data> md = NULL; + dumb_ptr<mob_data> md = nullptr; - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type == BL::MOB) md = bl->is_mob(); @@ -1059,7 +1059,7 @@ int battle_calc_damage(dumb_ptr<block_list>, dumb_ptr<block_list> bl, damage = 3; } - if (md != NULL && md->hp > 0 && damage > 0) // 反撃などのMOBスキル判定 + if (md != nullptr && md->hp > 0 && damage > 0) // 反撃などのMOBスキル判定 mobskill_event(md, flag); return damage; @@ -1071,8 +1071,8 @@ struct Damage battle_calc_mob_weapon_attack(dumb_ptr<block_list> src, SkillID skill_num, int skill_lv, int) { - dumb_ptr<map_session_data> tsd = NULL; - dumb_ptr<mob_data> md = src->is_mob(), tmd = NULL; + dumb_ptr<map_session_data> tsd = nullptr; + dumb_ptr<mob_data> md = src->is_mob(), tmd = nullptr; int hitrate, flee, cri = 0, atkmin, atkmax; int target_count = 1; int def1 = battle_get_def(target); @@ -1282,7 +1282,7 @@ struct Damage battle_calc_mob_weapon_attack(dumb_ptr<block_list> src, damage = 0; // 完全回避の判定 - if (skill_num == SkillID::ZERO && skill_lv >= 0 && tsd != NULL + if (skill_num == SkillID::ZERO && skill_lv >= 0 && tsd != nullptr && random_::chance({battle_get_flee2(target), 1000})) { damage = 0; @@ -1292,7 +1292,7 @@ struct Damage battle_calc_mob_weapon_attack(dumb_ptr<block_list> src, if (battle_config.enemy_perfect_flee) { - if (skill_num == SkillID::ZERO && skill_lv >= 0 && tmd != NULL + if (skill_num == SkillID::ZERO && skill_lv >= 0 && tmd != nullptr && random_::chance({battle_get_flee2(target), 1000})) { damage = 0; @@ -1346,8 +1346,8 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, SkillID skill_num, int skill_lv, int) { - dumb_ptr<map_session_data> sd = src->is_player(), tsd = NULL; - dumb_ptr<mob_data> tmd = NULL; + dumb_ptr<map_session_data> sd = src->is_player(), tsd = nullptr; + dumb_ptr<mob_data> tmd = nullptr; int hitrate, flee, cri = 0, atkmin, atkmax; int dex, target_count = 1; int def1 = battle_get_def(target); @@ -1708,7 +1708,7 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, } // 完全回避の判定 - if (skill_num == SkillID::ZERO && skill_lv >= 0 && tsd != NULL && div_ < 255 + if (skill_num == SkillID::ZERO && skill_lv >= 0 && tsd != nullptr && div_ < 255 && random_::chance({battle_get_flee2(target), 1000})) { damage = damage2 = 0; @@ -1719,7 +1719,7 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, // 対象が完全回避をする設定がONなら if (battle_config.enemy_perfect_flee) { - if (skill_num == SkillID::ZERO && skill_lv >= 0 && tmd != NULL && div_ < 255 + if (skill_num == SkillID::ZERO && skill_lv >= 0 && tmd != nullptr && div_ < 255 && random_::chance({battle_get_flee2(target), 1000})) { damage = damage2 = 0; @@ -1809,7 +1809,7 @@ struct Damage battle_calc_magic_attack(dumb_ptr<block_list> bl, int matk1, matk2, damage = 0, div_ = 1; struct Damage md {}; int normalmagic_flag = 1; - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; nullpo_retr(md, bl); nullpo_retr(md, target); @@ -1885,7 +1885,7 @@ struct Damage battle_calc_misc_attack(dumb_ptr<block_list> bl, dumb_ptr<block_list> target, SkillID skill_num, int skill_lv, int) { - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; int damage = 0, div_ = 1; struct Damage md {}; int damagefix = 1; @@ -1979,7 +1979,7 @@ struct Damage battle_calc_attack(BF attack_type, ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target, tick_t tick) { - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> t_sc_data = battle_get_sc_data(target); struct Damage wd; @@ -1989,7 +1989,7 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target, if (src->bl_type == BL::PC) sd = src->is_player(); - if (src->bl_prev == NULL || target->bl_prev == NULL) + if (src->bl_prev == nullptr || target->bl_prev == nullptr) return ATK::ZERO; if (src->bl_type == BL::PC && pc_isdead(sd)) return ATK::ZERO; @@ -1998,7 +1998,7 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target, return ATK::ZERO; Opt1 *opt1 = battle_get_opt1(src); - if (opt1 != NULL && bool(*opt1)) + if (opt1 != nullptr && bool(*opt1)) { battle_stopattack(src); return ATK::ZERO; @@ -2088,7 +2088,7 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target, } battle_damage(src, target, (wd.damage + wd.damage2), 0); - if (target->bl_prev != NULL && + if (target->bl_prev != nullptr && (target->bl_type != BL::PC || (target->bl_type == BL::PC && !pc_isdead(target->is_player())))) @@ -2164,8 +2164,8 @@ int battle_check_target(dumb_ptr<block_list> src, dumb_ptr<block_list> target, PartyId s_p, t_p; dumb_ptr<block_list> ss = src; - nullpo_ret(src); - nullpo_ret(target); + nullpo_retz(src); + nullpo_retz(target); if (flag & BCT_ENEMY) { // 反転フラグ @@ -2214,7 +2214,7 @@ int battle_check_target(dumb_ptr<block_list> src, dumb_ptr<block_list> target, } } } - if ((ss = map_id2bl(md->master_id)) == NULL) + if ((ss = map_id2bl(md->master_id)) == nullptr) return -1; } } @@ -2226,7 +2226,7 @@ int battle_check_target(dumb_ptr<block_list> src, dumb_ptr<block_list> target, && pc_isinvisible(target->is_player())) return -1; - if (src->bl_prev == NULL || // 死んでるならエラー + if (src->bl_prev == nullptr || // 死んでるならエラー (src->bl_type == BL::PC && pc_isdead(src->is_player()))) return -1; @@ -2275,8 +2275,8 @@ int battle_check_range(dumb_ptr<block_list> src, dumb_ptr<block_list> bl, struct walkpath_data wpd; int arange; - nullpo_ret(src); - nullpo_ret(bl); + nullpo_retz(src); + nullpo_retz(bl); dx = abs(bl->bl_x - src->bl_x); dy = abs(bl->bl_y - src->bl_y); diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp index 55e5810..18482f6 100644 --- a/src/map/chrif.cpp +++ b/src/map/chrif.cpp @@ -257,7 +257,7 @@ int chrif_changemapserverack(Session *, const Packet_Fixed<0x2b06>& fixed) { dumb_ptr<map_session_data> sd = map_id2sd(account_to_block(fixed.account_id)); - if (sd == NULL || sd->status_key.char_id != fixed.char_id) + if (sd == nullptr || sd->status_key.char_id != fixed.char_id) return -1; // I am fairly certain that this is not possible @@ -480,7 +480,7 @@ int chrif_char_ask_name_answer(Session *, const Packet_Fixed<0x2b0f>& fixed) CharName player_name = fixed.char_name; dumb_ptr<map_session_data> sd = map_id2sd(account_to_block(acc)); - if (acc && sd != NULL) + if (acc && sd != nullptr) { AString output; if (fixed.error == 1) // player not found @@ -621,7 +621,7 @@ void chrif_changedgm(Session *, const Packet_Fixed<0x2b0b>& fixed) if (battle_config.etc_log) PRINTF("chrif_changedgm: account: %d, GM level 0 -> %d.\n"_fmt, acc, level); - if (sd != NULL) + if (sd != nullptr) { if (level) clif_displaymessage(sd->sess, "GM modification success."_s); @@ -646,7 +646,7 @@ void chrif_changedsex(Session *, const Packet_Fixed<0x2b0d>& fixed) sd = map_id2sd(account_to_block(acc)); if (acc) { - if (sd != NULL && sd->status.sex != sex) + if (sd != nullptr && sd->status.sex != sex) { if (sd->status.sex == SEX::MALE) sd->sex = sd->status.sex = SEX::FEMALE; @@ -670,7 +670,7 @@ void chrif_changedsex(Session *, const Packet_Fixed<0x2b0d>& fixed) } else { - if (sd != NULL) + if (sd != nullptr) { PRINTF("chrif_changedsex failed.\n"_fmt); } @@ -716,7 +716,7 @@ static int chrif_accountreg2(Session *, const Packet_Head<0x2b11>& head, const std::vector<Packet_Repeat<0x2b11>>& repeat) { dumb_ptr<map_session_data> sd = map_id2sd(account_to_block(head.account_id)); - if (sd == NULL) + if (sd == nullptr) return 1; size_t jlim = std::min(ACCOUNT_REG2_NUM, repeat.size()); @@ -739,7 +739,7 @@ int chrif_accountreg2(Session *, const Packet_Head<0x2b11>& head, const std::vec static int chrif_divorce(CharId char_id, CharId partner_id) { - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; if (!char_id || !partner_id) return 0; @@ -757,7 +757,7 @@ int chrif_divorce(CharId char_id, CharId partner_id) } sd = map_nick2sd(map_charid2nick(partner_id)); - nullpo_ret(sd); + nullpo_retz(sd); if (sd->status.partner_id == char_id) sd->status.partner_id = CharId(); @@ -795,7 +795,7 @@ int chrif_accountdeletion(Session *, const Packet_Fixed<0x2b13>& fixed) sd = map_id2sd(account_to_block(acc)); if (acc) { - if (sd != NULL) + if (sd != nullptr) { sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters clif_displaymessage(sd->sess, @@ -805,7 +805,7 @@ int chrif_accountdeletion(Session *, const Packet_Fixed<0x2b13>& fixed) } else { - if (sd != NULL) + if (sd != nullptr) PRINTF("chrif_accountdeletion failed - player not online.\n"_fmt); } @@ -827,7 +827,7 @@ int chrif_accountban(Session *, const Packet_Fixed<0x2b14>& fixed) sd = map_id2sd(account_to_block(acc)); if (acc) { - if (sd != NULL) + if (sd != nullptr) { sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters if (fixed.ban_not_status == 0) @@ -894,7 +894,7 @@ int chrif_accountban(Session *, const Packet_Fixed<0x2b14>& fixed) } else { - if (sd != NULL) + if (sd != nullptr) PRINTF("chrif_accountban failed - player not online.\n"_fmt); } diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 2ae9825..addfa59 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -274,7 +274,7 @@ void clif_send_sub(dumb_ptr<block_list> bl, const Buffer& buf, break; } - if (sd->sess != NULL) + if (sd->sess != nullptr) { { { @@ -296,7 +296,7 @@ int clif_send(const Buffer& buf, dumb_ptr<block_list> bl, SendWho type) if (type != SendWho::ALL_CLIENT) { - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type == BL::PC) { @@ -461,7 +461,7 @@ int clif_send(const Buffer& buf, dumb_ptr<block_list> bl, SendWho type) */ int clif_authok(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); if (!sd) return 0; @@ -507,7 +507,7 @@ int clif_charselectok(BlockId id) { dumb_ptr<map_session_data> sd; - if ((sd = map_id2sd(id)) == NULL) + if ((sd = map_id2sd(id)) == nullptr) return 1; if (!sd->sess) @@ -549,7 +549,7 @@ void clif_set009e(dumb_ptr<flooritem_data> fitem, Buffer& buf) */ int clif_dropflooritem(dumb_ptr<flooritem_data> fitem) { - nullpo_ret(fitem); + nullpo_retz(fitem); if (!fitem->item_data.nameid) return 0; @@ -567,7 +567,7 @@ int clif_dropflooritem(dumb_ptr<flooritem_data> fitem) */ int clif_clearflooritem(dumb_ptr<flooritem_data> fitem, Session *s) { - nullpo_ret(fitem); + nullpo_retz(fitem); Packet_Fixed<0x00a1> fixed_a1; fixed_a1.block_id = fitem->bl_id; @@ -591,7 +591,7 @@ int clif_clearflooritem(dumb_ptr<flooritem_data> fitem, Session *s) */ int clif_clearchar(dumb_ptr<block_list> bl, BeingRemoveWhy type) { - nullpo_ret(bl); + nullpo_retz(bl); Packet_Fixed<0x0080> fixed_80; fixed_80.block_id = bl->bl_id; @@ -931,7 +931,7 @@ earray<EQUIP, LOOK, LOOK::COUNT> equip_points //= */ int clif_spawnpc(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); Buffer buf; clif_set0078_alt_1d9(sd, buf); @@ -949,7 +949,7 @@ int clif_spawnpc(dumb_ptr<map_session_data> sd) if (sd->bl_m->flag.get(MapFlag::RAIN)) clif_specialeffect(sd, 161, 1); -// clif_changelook_accessories(sd, NULL); +// clif_changelook_accessories(sd, nullptr); return 0; } @@ -960,7 +960,7 @@ int clif_spawnpc(dumb_ptr<map_session_data> sd) */ int clif_spawnnpc(dumb_ptr<npc_data> nd) { - nullpo_ret(nd); + nullpo_retz(nd); if (nd->npc_class == NEGATIVE_SPECIES || nd->flag & 1 || nd->npc_class == INVISIBLE_CLASS) return 0; @@ -983,7 +983,7 @@ int clif_spawnnpc(dumb_ptr<npc_data> nd) int clif_spawn_fake_npc_for_player(dumb_ptr<map_session_data> sd, BlockId fake_npc_id) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; @@ -1028,7 +1028,7 @@ int clif_spawn_fake_npc_for_player(dumb_ptr<map_session_data> sd, BlockId fake_n */ int clif_spawnmob(dumb_ptr<mob_data> md) { - nullpo_ret(md); + nullpo_retz(md); { Packet_Fixed<0x007c> fixed_7c; @@ -1058,7 +1058,7 @@ int clif_spawnmob(dumb_ptr<mob_data> md) static int clif_servertick(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x007f> fixed_7f; @@ -1074,7 +1074,7 @@ int clif_servertick(dumb_ptr<map_session_data> sd) */ int clif_walkok(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x0087> fixed_87; @@ -1095,7 +1095,7 @@ int clif_walkok(dumb_ptr<map_session_data> sd) */ int clif_movechar(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); Buffer buf; clif_set007b(sd, buf); @@ -1201,7 +1201,7 @@ void clif_fixpos(dumb_ptr<block_list> bl) */ int clif_npcbuysell(dumb_ptr<map_session_data> sd, BlockId id) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x00c4> fixed_c4; @@ -1220,8 +1220,8 @@ int clif_buylist(dumb_ptr<map_session_data> sd, dumb_ptr<npc_data_shop> nd) struct item_data *id; int i, val; - nullpo_ret(sd); - nullpo_ret(nd); + nullpo_retz(sd); + nullpo_retz(nd); Session *s = sd->sess; std::vector<Packet_Repeat<0x00c6>> repeat_c6(nd->shop_items.size()); @@ -1245,7 +1245,7 @@ int clif_buylist(dumb_ptr<map_session_data> sd, dumb_ptr<npc_data_shop> nd) */ int clif_selllist(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; std::vector<Packet_Repeat<0x00c7>> repeat_c7; @@ -1359,7 +1359,7 @@ void clif_scriptinputstr(dumb_ptr<map_session_data> sd, BlockId npcid) */ int clif_additem(dumb_ptr<map_session_data> sd, IOff0 n, int amount, PickupFail fail) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x00a0> fixed_a0; @@ -1373,7 +1373,7 @@ int clif_additem(dumb_ptr<map_session_data> sd, IOff0 n, int amount, PickupFail else { if (!n.ok() || !sd->status.inventory[n].nameid - || sd->inventory_data[n] == NULL) + || sd->inventory_data[n] == nullptr) return 1; fixed_a0.ioff2 = n.shift(); @@ -1429,7 +1429,7 @@ void clif_itemlist(dumb_ptr<map_session_data> sd) for (IOff0 i : IOff0::iter()) { if (!sd->status.inventory[i].nameid - || sd->inventory_data[i] == NULL + || sd->inventory_data[i] == nullptr || itemdb_isequip2(sd->inventory_data[i])) continue; Packet_Repeat<0x01ee> info; @@ -1473,7 +1473,7 @@ void clif_equiplist(dumb_ptr<map_session_data> sd) for (IOff0 i : IOff0::iter()) { if (!sd->status.inventory[i].nameid - || sd->inventory_data[i] == NULL + || sd->inventory_data[i] == nullptr || !itemdb_isequip2(sd->inventory_data[i])) continue; Packet_Repeat<0x00a4> info; @@ -1508,8 +1508,8 @@ void clif_equiplist(dumb_ptr<map_session_data> sd) */ int clif_storageitemlist(dumb_ptr<map_session_data> sd, Storage *stor) { - nullpo_ret(sd); - nullpo_ret(stor); + nullpo_retz(sd); + nullpo_retz(stor); Session *s = sd->sess; std::vector<Packet_Repeat<0x01f0>> repeat_1f0; @@ -1520,7 +1520,7 @@ int clif_storageitemlist(dumb_ptr<map_session_data> sd, Storage *stor) struct item_data *id; id = itemdb_search(stor->storage_[i].nameid); - nullpo_ret(id); + nullpo_retz(id); if (itemdb_isequip2(id)) continue; @@ -1550,8 +1550,8 @@ int clif_storageitemlist(dumb_ptr<map_session_data> sd, Storage *stor) */ int clif_storageequiplist(dumb_ptr<map_session_data> sd, Storage *stor) { - nullpo_ret(sd); - nullpo_ret(stor); + nullpo_retz(sd); + nullpo_retz(stor); Session *s = sd->sess; std::vector<Packet_Repeat<0x00a6>> repeat_a6; @@ -1562,7 +1562,7 @@ int clif_storageequiplist(dumb_ptr<map_session_data> sd, Storage *stor) struct item_data *id; id = itemdb_search(stor->storage_[i].nameid); - nullpo_ret(id); + nullpo_retz(id); if (!itemdb_isequip2(id)) continue; Packet_Repeat<0x00a6> info; @@ -1596,7 +1596,7 @@ int clif_storageequiplist(dumb_ptr<map_session_data> sd, Storage *stor) */ int clif_updatestatus(dumb_ptr<map_session_data> sd, SP type) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; @@ -1809,15 +1809,15 @@ not_141: */ int clif_changelook(dumb_ptr<block_list> bl, LOOK type, int val) { - return clif_changelook_towards(bl, type, val, NULL); + return clif_changelook_towards(bl, type, val, nullptr); } int clif_changelook_towards(dumb_ptr<block_list> bl, LOOK type, int val, dumb_ptr<map_session_data> dstsd) { - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type == BL::PC) sd = bl->is_player(); @@ -1898,7 +1898,7 @@ int clif_changelook_towards(dumb_ptr<block_list> bl, LOOK type, int val, static int clif_initialstatus(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; @@ -1954,7 +1954,7 @@ int clif_initialstatus(dumb_ptr<map_session_data> sd) */ int clif_arrowequip(dumb_ptr<map_session_data> sd, IOff0 val) { - nullpo_ret(sd); + nullpo_retz(sd); sd->attacktarget = BlockId(); @@ -1972,7 +1972,7 @@ int clif_arrowequip(dumb_ptr<map_session_data> sd, IOff0 val) */ int clif_arrow_fail(dumb_ptr<map_session_data> sd, int type) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; @@ -1989,7 +1989,7 @@ int clif_arrow_fail(dumb_ptr<map_session_data> sd, int type) */ int clif_statusupack(dumb_ptr<map_session_data> sd, SP type, int ok, int val) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x00bc> fixed_bc; @@ -2007,7 +2007,7 @@ int clif_statusupack(dumb_ptr<map_session_data> sd, SP type, int ok, int val) */ int clif_equipitemack(dumb_ptr<map_session_data> sd, IOff0 n, EPOS pos, int ok) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x00aa> fixed_aa; @@ -2025,7 +2025,7 @@ int clif_equipitemack(dumb_ptr<map_session_data> sd, IOff0 n, EPOS pos, int ok) */ int clif_unequipitemack(dumb_ptr<map_session_data> sd, IOff0 n, EPOS pos, int ok) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x00ac> fixed_ac; @@ -2043,7 +2043,7 @@ int clif_unequipitemack(dumb_ptr<map_session_data> sd, IOff0 n, EPOS pos, int ok */ int clif_misceffect(dumb_ptr<block_list> bl, int type) { - nullpo_ret(bl); + nullpo_retz(bl); Packet_Fixed<0x019b> fixed_19b; fixed_19b.block_id = bl->bl_id; @@ -2063,7 +2063,7 @@ int clif_changeoption(dumb_ptr<block_list> bl) { eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; - nullpo_ret(bl); + nullpo_retz(bl); Option option = *battle_get_option(bl); sc_data = battle_get_sc_data(bl); @@ -2088,7 +2088,7 @@ int clif_changeoption(dumb_ptr<block_list> bl) int clif_useitemack(dumb_ptr<map_session_data> sd, IOff0 index, int amount, int ok) { - nullpo_ret(sd); + nullpo_retz(sd); if (!ok) { @@ -2190,7 +2190,7 @@ void clif_tradeadditem(dumb_ptr<map_session_data> sd, int clif_tradeitemok(dumb_ptr<map_session_data> sd, IOff2 index2, int amount, int fail) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x01b1> fixed_1b1; @@ -2208,7 +2208,7 @@ int clif_tradeitemok(dumb_ptr<map_session_data> sd, IOff2 index2, int amount, */ int clif_tradedeal_lock(dumb_ptr<map_session_data> sd, int fail) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x00ec> fixed_ec; @@ -2224,7 +2224,7 @@ int clif_tradedeal_lock(dumb_ptr<map_session_data> sd, int fail) */ int clif_tradecancelled(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x00ee> fixed_ee; @@ -2239,7 +2239,7 @@ int clif_tradecancelled(dumb_ptr<map_session_data> sd) */ int clif_tradecompleted(dumb_ptr<map_session_data> sd, int fail) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x00f0> fixed_f0; @@ -2256,8 +2256,8 @@ int clif_tradecompleted(dumb_ptr<map_session_data> sd, int fail) int clif_updatestorageamount(dumb_ptr<map_session_data> sd, Storage *stor) { - nullpo_ret(sd); - nullpo_ret(stor); + nullpo_retz(sd); + nullpo_retz(stor); Session *s = sd->sess; Packet_Fixed<0x00f2> fixed_f2; @@ -2275,8 +2275,8 @@ int clif_updatestorageamount(dumb_ptr<map_session_data> sd, int clif_storageitemadded(dumb_ptr<map_session_data> sd, Storage *stor, SOff0 index, int amount) { - nullpo_ret(sd); - nullpo_ret(stor); + nullpo_retz(sd); + nullpo_retz(stor); Session *s = sd->sess; Packet_Fixed<0x00f4> fixed_f4; @@ -2304,7 +2304,7 @@ int clif_storageitemadded(dumb_ptr<map_session_data> sd, Storage *stor, int clif_storageitemremoved(dumb_ptr<map_session_data> sd, SOff0 index, int amount) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x00f6> fixed_f6; @@ -2321,7 +2321,7 @@ int clif_storageitemremoved(dumb_ptr<map_session_data> sd, SOff0 index, */ int clif_storageclose(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x00f8> fixed_f8; @@ -2397,7 +2397,7 @@ void clif_getareachar_npc(dumb_ptr<map_session_data> sd, dumb_ptr<npc_data> nd) */ int clif_movemob(dumb_ptr<mob_data> md) { - nullpo_ret(md); + nullpo_retz(md); Buffer buf; clif_mob007b(md, buf); @@ -2412,7 +2412,7 @@ int clif_movemob(dumb_ptr<mob_data> md) */ int clif_fixmobpos(dumb_ptr<mob_data> md) { - nullpo_ret(md); + nullpo_retz(md); if (md->state.state == MS::WALK) { @@ -2436,7 +2436,7 @@ int clif_fixmobpos(dumb_ptr<mob_data> md) */ int clif_fixpcpos(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); if (sd->walktimer) { @@ -2450,7 +2450,7 @@ int clif_fixpcpos(dumb_ptr<map_session_data> sd) clif_set0078_main_1d8(sd, buf); clif_send(buf, sd, SendWho::AREA); } - clif_changelook_accessories(sd, NULL); + clif_changelook_accessories(sd, nullptr); return 0; } @@ -2465,8 +2465,8 @@ int clif_damage(dumb_ptr<block_list> src, dumb_ptr<block_list> dst, { eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; - nullpo_ret(src); - nullpo_ret(dst); + nullpo_retz(src); + nullpo_retz(dst); sc_data = battle_get_sc_data(dst); @@ -2683,7 +2683,7 @@ void clif_mobinsight(dumb_ptr<block_list> bl, dumb_ptr<mob_data> md) int clif_skillinfo(dumb_ptr<map_session_data> sd, SkillID skillid, int type, int range) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; if (!sd->status.skill[skillid].lv) @@ -2755,7 +2755,7 @@ void clif_skillinfoblock(dumb_ptr<map_session_data> sd) */ int clif_skillup(dumb_ptr<map_session_data> sd, SkillID skill_num) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x010e> fixed_10e; @@ -2793,7 +2793,7 @@ int clif_skillcastcancel(dumb_ptr<block_list> bl) int clif_skill_fail(dumb_ptr<map_session_data> sd, SkillID skill_id, int type, int btype) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; @@ -2823,8 +2823,8 @@ int clif_skill_damage(dumb_ptr<block_list> src, dumb_ptr<block_list> dst, { eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; - nullpo_ret(src); - nullpo_ret(dst); + nullpo_retz(src); + nullpo_retz(dst); sc_data = battle_get_sc_data(dst); @@ -2851,7 +2851,7 @@ int clif_skill_damage(dumb_ptr<block_list> src, dumb_ptr<block_list> dst, */ int clif_status_change(dumb_ptr<block_list> bl, StatusChange type, int flag) { - nullpo_ret(bl); + nullpo_retz(bl); Packet_Fixed<0x0196> fixed_196; fixed_196.sc_type = type; @@ -2944,7 +2944,7 @@ void clif_wis_end(Session *s, int flag) // R 0098 <type>.B: 0: success to send w */ int clif_party_created(dumb_ptr<map_session_data> sd, int flag) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x00fa> fixed_fa; @@ -2960,9 +2960,9 @@ int clif_party_created(dumb_ptr<map_session_data> sd, int flag) int clif_party_info(PartyPair p, Session *s) { int i; - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; - nullpo_ret(p); + nullpo_retz(p); Packet_Head<0x00fb> head_fb; std::vector<Packet_Repeat<0x00fb>> repeat_fb; @@ -2973,7 +2973,7 @@ int clif_party_info(PartyPair p, Session *s) if (m->account_id) { Packet_Repeat<0x00fb> info; - if (sd == NULL) + if (sd == nullptr) sd = dumb_ptr<map_session_data>(m->sd); info.account_id = m->account_id; @@ -2991,7 +2991,7 @@ int clif_party_info(PartyPair p, Session *s) return 9; } // else, send it to all the party, if they exist. - if (sd != NULL) + if (sd != nullptr) { Buffer buf = create_vpacket<0x00fb, 28, 46>(head_fb, repeat_fb); clif_send(buf, sd, SendWho::PARTY); @@ -3061,14 +3061,14 @@ void clif_party_option(PartyPair p, dumb_ptr<map_session_data> sd, int flag) { nullpo_retv(p); - if (sd == NULL && flag == 0) + if (sd == nullptr && flag == 0) { int i; for (i = 0; i < MAX_PARTY; i++) - if ((sd = map_id2sd(account_to_block(p->member[i].account_id))) != NULL) + if ((sd = map_id2sd(account_to_block(p->member[i].account_id))) != nullptr) break; } - if (sd == NULL) + if (sd == nullptr) return; Packet_Fixed<0x0101> fixed_101; fixed_101.exp = ((flag & 0x01) ? 2 : p->exp); @@ -3102,20 +3102,20 @@ void clif_party_leaved(PartyPair p, dumb_ptr<map_session_data> sd, if ((flag & 0xf0) == 0) { - if (sd == NULL) + if (sd == nullptr) for (i = 0; i < MAX_PARTY; i++) { sd = dumb_ptr<map_session_data>(p->member[i].sd); - if (sd != NULL) + if (sd != nullptr) break; } - if (sd != NULL) + if (sd != nullptr) { Buffer buf = create_fpacket<0x0105, 31>(fixed_105); clif_send(buf, sd, SendWho::PARTY); } } - else if (sd != NULL) + else if (sd != nullptr) { send_fpacket<0x0105, 31>(sd->sess, fixed_105); } @@ -3136,10 +3136,10 @@ void clif_party_message(PartyPair p, AccountId account_id, XString mes) for (i = 0; i < MAX_PARTY; i++) { sd = dumb_ptr<map_session_data>(p->member[i].sd); - if (sd != NULL) + if (sd != nullptr) break; } - if (sd != NULL) + if (sd != nullptr) { Packet_Head<0x0109> head_109; head_109.account_id = account_id; @@ -3154,7 +3154,7 @@ void clif_party_message(PartyPair p, AccountId account_id, XString mes) */ int clif_party_xy(PartyPair , dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); Packet_Fixed<0x0107> fixed_107; fixed_107.account_id = sd->status_key.account_id; @@ -3171,7 +3171,7 @@ int clif_party_xy(PartyPair , dumb_ptr<map_session_data> sd) */ int clif_party_hp(PartyPair , dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); Packet_Fixed<0x0106> fixed_106; fixed_106.account_id = sd->status_key.account_id; @@ -3189,8 +3189,8 @@ int clif_party_hp(PartyPair , dumb_ptr<map_session_data> sd) */ int clif_movetoattack(dumb_ptr<map_session_data> sd, dumb_ptr<block_list> bl) { - nullpo_ret(sd); - nullpo_ret(bl); + nullpo_retz(sd); + nullpo_retz(bl); Session *s = sd->sess; Packet_Fixed<0x0139> fixed_139; @@ -3210,7 +3210,7 @@ int clif_movetoattack(dumb_ptr<map_session_data> sd, dumb_ptr<block_list> bl) */ int clif_mvp_effect(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); Packet_Fixed<0x010c> fixed_10c; fixed_10c.block_id = sd->bl_id; @@ -3275,7 +3275,7 @@ void clif_sitting(Session *, dumb_ptr<map_session_data> sd) static int clif_GM_kickack(dumb_ptr<map_session_data> sd, AccountId id) { - nullpo_ret(sd); + nullpo_retz(sd); Session *s = sd->sess; Packet_Fixed<0x00cd> fixed_cd; @@ -3290,7 +3290,7 @@ void clif_do_quit_game(Session *s, dumb_ptr<map_session_data> sd); int clif_GM_kick(dumb_ptr<map_session_data> sd, dumb_ptr<map_session_data> tsd, int type) { - nullpo_ret(tsd); + nullpo_retz(tsd); if (type) clif_GM_kickack(sd, tsd->status_key.account_id); @@ -3304,7 +3304,7 @@ int clif_GM_kick(dumb_ptr<map_session_data> sd, dumb_ptr<map_session_data> tsd, // displaying special effects (npcs, weather, etc) [Valaris] int clif_specialeffect(dumb_ptr<block_list> bl, int type, int flag) { - nullpo_ret(bl); + nullpo_retz(bl); Packet_Fixed<0x019b> fixed_19b; fixed_19b.block_id = bl->bl_id; @@ -3401,7 +3401,7 @@ RecvResult clif_parse_WantToConnection(Session *s, dumb_ptr<map_session_data> sd static RecvResult clif_parse_LoadEndAck(Session *s, dumb_ptr<map_session_data> sd) { - if (sd->bl_prev != NULL) + if (sd->bl_prev != nullptr) return RecvResult::Error; Packet_Fixed<0x007d> fixed; @@ -3479,7 +3479,7 @@ RecvResult clif_parse_LoadEndAck(Session *s, dumb_ptr<map_session_data> sd) clif_changeoption(sd); // broken equipment -// clif_changelook_accessories(sd, NULL); +// clif_changelook_accessories(sd, nullptr); map_foreachinarea(std::bind(clif_getareachar, ph::_1, sd), sd->bl_m, @@ -3613,7 +3613,7 @@ RecvResult clif_parse_GetCharNameRequest(Session *s, dumb_ptr<map_session_data> account_id = fixed.block_id; bl = map_id2bl(account_id); - if (bl == NULL) + if (bl == nullptr) return rv; Packet_Fixed<0x0095> fixed_95; @@ -3999,7 +3999,7 @@ RecvResult clif_parse_Wis(Session *s, dumb_ptr<map_session_data> sd) if (rv != RecvResult::Complete) return rv; - dumb_ptr<map_session_data> dstsd = NULL; + dumb_ptr<map_session_data> dstsd = nullptr; AString mbuf = clif_validate_chat(sd, ChatType::Whisper, repeat); if (!mbuf) @@ -4081,7 +4081,7 @@ RecvResult clif_parse_TakeItem(Session *s, dumb_ptr<map_session_data> sd) || sd->opt1 != Opt1::ZERO) //会話禁止 return rv; - if (fitem == NULL || fitem->bl_m != sd->bl_m) + if (fitem == nullptr || fitem->bl_m != sd->bl_m) return rv; if (abs(sd->bl_x - fitem->bl_x) >= 2 @@ -4808,550 +4808,550 @@ RecvResult clif_parse_PartyMessage(Session *s, dumb_ptr<map_session_data> sd) func_table clif_parse_func_table[0x0220] = { - {0, 10, NULL, }, // 0x0000 - {0, 0, NULL, }, // 0x0001 - {0, 0, NULL, }, // 0x0002 - {0, 0, NULL, }, // 0x0003 - {0, 0, NULL, }, // 0x0004 - {0, 0, NULL, }, // 0x0005 - {0, 0, NULL, }, // 0x0006 - {0, 0, NULL, }, // 0x0007 - {0, 0, NULL, }, // 0x0008 - {0, 0, NULL, }, // 0x0009 - {0, 0, NULL, }, // 0x000a - {0, 0, NULL, }, // 0x000b - {0, 0, NULL, }, // 0x000c - {0, 0, NULL, }, // 0x000d - {0, 0, NULL, }, // 0x000e - {0, 0, NULL, }, // 0x000f - {0, 0, NULL, }, // 0x0010 - {0, 0, NULL, }, // 0x0011 - {0, 0, NULL, }, // 0x0012 - {0, 0, NULL, }, // 0x0013 - {0, 0, NULL, }, // 0x0014 - {0, 0, NULL, }, // 0x0015 - {0, 0, NULL, }, // 0x0016 - {0, 0, NULL, }, // 0x0017 - {0, 0, NULL, }, // 0x0018 - {0, 0, NULL, }, // 0x0019 - {0, 0, NULL, }, // 0x001a - {0, 0, NULL, }, // 0x001b - {0, 0, NULL, }, // 0x001c - {0, 0, NULL, }, // 0x001d - {0, 0, NULL, }, // 0x001e - {0, 0, NULL, }, // 0x001f - {0, 0, NULL, }, // 0x0020 - {0, 0, NULL, }, // 0x0021 - {0, 0, NULL, }, // 0x0022 - {0, 0, NULL, }, // 0x0023 - {0, 0, NULL, }, // 0x0024 - {0, 0, NULL, }, // 0x0025 - {0, 0, NULL, }, // 0x0026 - {0, 0, NULL, }, // 0x0027 - {0, 0, NULL, }, // 0x0028 - {0, 0, NULL, }, // 0x0029 - {0, 0, NULL, }, // 0x002a - {0, 0, NULL, }, // 0x002b - {0, 0, NULL, }, // 0x002c - {0, 0, NULL, }, // 0x002d - {0, 0, NULL, }, // 0x002e - {0, 0, NULL, }, // 0x002f - {0, 0, NULL, }, // 0x0030 - {0, 0, NULL, }, // 0x0031 - {0, 0, NULL, }, // 0x0032 - {0, 0, NULL, }, // 0x0033 - {0, 0, NULL, }, // 0x0034 - {0, 0, NULL, }, // 0x0035 - {0, 0, NULL, }, // 0x0036 - {0, 0, NULL, }, // 0x0037 - {0, 0, NULL, }, // 0x0038 - {0, 0, NULL, }, // 0x0039 - {0, 0, NULL, }, // 0x003a - {0, 0, NULL, }, // 0x003b - {0, 0, NULL, }, // 0x003c - {0, 0, NULL, }, // 0x003d - {0, 0, NULL, }, // 0x003e - {0, 0, NULL, }, // 0x003f - {0, 0, NULL, }, // 0x0040 - {0, 0, NULL, }, // 0x0041 - {0, 0, NULL, }, // 0x0042 - {0, 0, NULL, }, // 0x0043 - {0, 0, NULL, }, // 0x0044 - {0, 0, NULL, }, // 0x0045 - {0, 0, NULL, }, // 0x0046 - {0, 0, NULL, }, // 0x0047 - {0, 0, NULL, }, // 0x0048 - {0, 0, NULL, }, // 0x0049 - {0, 0, NULL, }, // 0x004a - {0, 0, NULL, }, // 0x004b - {0, 0, NULL, }, // 0x004c - {0, 0, NULL, }, // 0x004d - {0, 0, NULL, }, // 0x004e - {0, 0, NULL, }, // 0x004f - {0, 0, NULL, }, // 0x0050 - {0, 0, NULL, }, // 0x0051 - {0, 0, NULL, }, // 0x0052 - {0, 0, NULL, }, // 0x0053 - {0, 0, NULL, }, // 0x0054 - {0, 0, NULL, }, // 0x0055 - {0, 0, NULL, }, // 0x0056 - {0, 0, NULL, }, // 0x0057 - {0, 0, NULL, }, // 0x0058 - {0, 0, NULL, }, // 0x0059 - {0, 0, NULL, }, // 0x005a - {0, 0, NULL, }, // 0x005b - {0, 0, NULL, }, // 0x005c - {0, 0, NULL, }, // 0x005d - {0, 0, NULL, }, // 0x005e - {0, 0, NULL, }, // 0x005f - {0, 0, NULL, }, // 0x0060 - {0, 0, NULL, }, // 0x0061 - {0, 0, NULL, }, // 0x0062 - {0, VAR,NULL, }, // 0x0063 - {0, 55, NULL, }, // 0x0064 - {0, 17, NULL, }, // 0x0065 - {0, 3, NULL, }, // 0x0066 - {0, 37, NULL, }, // 0x0067 - {0, 46, NULL, }, // 0x0068 - {0, VAR,NULL, }, // 0x0069 - {0, 23, NULL, }, // 0x006a - {0, VAR,NULL, }, // 0x006b - {0, 3, NULL, }, // 0x006c - {0, 108,NULL, }, // 0x006d - {0, 3, NULL, }, // 0x006e - {0, 2, NULL, }, // 0x006f - {0, 3, NULL, }, // 0x0070 - {0, 28, NULL, }, // 0x0071 + {0, 10, nullptr, }, // 0x0000 + {0, 0, nullptr, }, // 0x0001 + {0, 0, nullptr, }, // 0x0002 + {0, 0, nullptr, }, // 0x0003 + {0, 0, nullptr, }, // 0x0004 + {0, 0, nullptr, }, // 0x0005 + {0, 0, nullptr, }, // 0x0006 + {0, 0, nullptr, }, // 0x0007 + {0, 0, nullptr, }, // 0x0008 + {0, 0, nullptr, }, // 0x0009 + {0, 0, nullptr, }, // 0x000a + {0, 0, nullptr, }, // 0x000b + {0, 0, nullptr, }, // 0x000c + {0, 0, nullptr, }, // 0x000d + {0, 0, nullptr, }, // 0x000e + {0, 0, nullptr, }, // 0x000f + {0, 0, nullptr, }, // 0x0010 + {0, 0, nullptr, }, // 0x0011 + {0, 0, nullptr, }, // 0x0012 + {0, 0, nullptr, }, // 0x0013 + {0, 0, nullptr, }, // 0x0014 + {0, 0, nullptr, }, // 0x0015 + {0, 0, nullptr, }, // 0x0016 + {0, 0, nullptr, }, // 0x0017 + {0, 0, nullptr, }, // 0x0018 + {0, 0, nullptr, }, // 0x0019 + {0, 0, nullptr, }, // 0x001a + {0, 0, nullptr, }, // 0x001b + {0, 0, nullptr, }, // 0x001c + {0, 0, nullptr, }, // 0x001d + {0, 0, nullptr, }, // 0x001e + {0, 0, nullptr, }, // 0x001f + {0, 0, nullptr, }, // 0x0020 + {0, 0, nullptr, }, // 0x0021 + {0, 0, nullptr, }, // 0x0022 + {0, 0, nullptr, }, // 0x0023 + {0, 0, nullptr, }, // 0x0024 + {0, 0, nullptr, }, // 0x0025 + {0, 0, nullptr, }, // 0x0026 + {0, 0, nullptr, }, // 0x0027 + {0, 0, nullptr, }, // 0x0028 + {0, 0, nullptr, }, // 0x0029 + {0, 0, nullptr, }, // 0x002a + {0, 0, nullptr, }, // 0x002b + {0, 0, nullptr, }, // 0x002c + {0, 0, nullptr, }, // 0x002d + {0, 0, nullptr, }, // 0x002e + {0, 0, nullptr, }, // 0x002f + {0, 0, nullptr, }, // 0x0030 + {0, 0, nullptr, }, // 0x0031 + {0, 0, nullptr, }, // 0x0032 + {0, 0, nullptr, }, // 0x0033 + {0, 0, nullptr, }, // 0x0034 + {0, 0, nullptr, }, // 0x0035 + {0, 0, nullptr, }, // 0x0036 + {0, 0, nullptr, }, // 0x0037 + {0, 0, nullptr, }, // 0x0038 + {0, 0, nullptr, }, // 0x0039 + {0, 0, nullptr, }, // 0x003a + {0, 0, nullptr, }, // 0x003b + {0, 0, nullptr, }, // 0x003c + {0, 0, nullptr, }, // 0x003d + {0, 0, nullptr, }, // 0x003e + {0, 0, nullptr, }, // 0x003f + {0, 0, nullptr, }, // 0x0040 + {0, 0, nullptr, }, // 0x0041 + {0, 0, nullptr, }, // 0x0042 + {0, 0, nullptr, }, // 0x0043 + {0, 0, nullptr, }, // 0x0044 + {0, 0, nullptr, }, // 0x0045 + {0, 0, nullptr, }, // 0x0046 + {0, 0, nullptr, }, // 0x0047 + {0, 0, nullptr, }, // 0x0048 + {0, 0, nullptr, }, // 0x0049 + {0, 0, nullptr, }, // 0x004a + {0, 0, nullptr, }, // 0x004b + {0, 0, nullptr, }, // 0x004c + {0, 0, nullptr, }, // 0x004d + {0, 0, nullptr, }, // 0x004e + {0, 0, nullptr, }, // 0x004f + {0, 0, nullptr, }, // 0x0050 + {0, 0, nullptr, }, // 0x0051 + {0, 0, nullptr, }, // 0x0052 + {0, 0, nullptr, }, // 0x0053 + {0, 0, nullptr, }, // 0x0054 + {0, 0, nullptr, }, // 0x0055 + {0, 0, nullptr, }, // 0x0056 + {0, 0, nullptr, }, // 0x0057 + {0, 0, nullptr, }, // 0x0058 + {0, 0, nullptr, }, // 0x0059 + {0, 0, nullptr, }, // 0x005a + {0, 0, nullptr, }, // 0x005b + {0, 0, nullptr, }, // 0x005c + {0, 0, nullptr, }, // 0x005d + {0, 0, nullptr, }, // 0x005e + {0, 0, nullptr, }, // 0x005f + {0, 0, nullptr, }, // 0x0060 + {0, 0, nullptr, }, // 0x0061 + {0, 0, nullptr, }, // 0x0062 + {0, VAR,nullptr, }, // 0x0063 + {0, 55, nullptr, }, // 0x0064 + {0, 17, nullptr, }, // 0x0065 + {0, 3, nullptr, }, // 0x0066 + {0, 37, nullptr, }, // 0x0067 + {0, 46, nullptr, }, // 0x0068 + {0, VAR,nullptr, }, // 0x0069 + {0, 23, nullptr, }, // 0x006a + {0, VAR,nullptr, }, // 0x006b + {0, 3, nullptr, }, // 0x006c + {0, 108,nullptr, }, // 0x006d + {0, 3, nullptr, }, // 0x006e + {0, 2, nullptr, }, // 0x006f + {0, 3, nullptr, }, // 0x0070 + {0, 28, nullptr, }, // 0x0071 {0, 19, clif_parse_WantToConnection, }, // 0x0072 - {0, 11, NULL, }, // 0x0073 - {0, 3, NULL, }, // 0x0074 - {0, VAR,NULL, }, // 0x0075 - {0, 9, NULL, }, // 0x0076 - {0, 5, NULL, }, // 0x0077 - {0, 54, NULL, }, // 0x0078 - {0, 53, NULL, }, // 0x0079 - {0, 58, NULL, }, // 0x007a - {0, 60, NULL, }, // 0x007b - {0, 41, NULL, }, // 0x007c + {0, 11, nullptr, }, // 0x0073 + {0, 3, nullptr, }, // 0x0074 + {0, VAR,nullptr, }, // 0x0075 + {0, 9, nullptr, }, // 0x0076 + {0, 5, nullptr, }, // 0x0077 + {0, 54, nullptr, }, // 0x0078 + {0, 53, nullptr, }, // 0x0079 + {0, 58, nullptr, }, // 0x007a + {0, 60, nullptr, }, // 0x007b + {0, 41, nullptr, }, // 0x007c {-1, 2, clif_parse_LoadEndAck, }, // 0x007d {0, 6, clif_parse_TickSend, }, // 0x007e - {0, 6, NULL, }, // 0x007f - {0, 7, NULL, }, // 0x0080 - {0, 3, NULL, }, // 0x0081 - {0, 2, NULL, }, // 0x0082 - {0, 2, NULL, }, // 0x0083 - {0, 2, NULL, }, // 0x0084 + {0, 6, nullptr, }, // 0x007f + {0, 7, nullptr, }, // 0x0080 + {0, 3, nullptr, }, // 0x0081 + {0, 2, nullptr, }, // 0x0082 + {0, 2, nullptr, }, // 0x0083 + {0, 2, nullptr, }, // 0x0084 {-1, 5, clif_parse_WalkToXY, }, // 0x0085 Walk code limits this on it's own - {0, 16, NULL, }, // 0x0086 - {0, 12, NULL, }, // 0x0087 - {0, 10, NULL, }, // 0x0088 + {0, 16, nullptr, }, // 0x0086 + {0, 12, nullptr, }, // 0x0087 + {0, 10, nullptr, }, // 0x0088 {1000, 7, clif_parse_ActionRequest, }, // 0x0089 Special case - see below - {0, 29, NULL, }, // 0x008a - {0, 23, NULL, }, // 0x008b unknown... size 2 or 23? + {0, 29, nullptr, }, // 0x008a + {0, 23, nullptr, }, // 0x008b unknown... size 2 or 23? {300, VAR,clif_parse_GlobalMessage, }, // 0x008c - {0, VAR,NULL, }, // 0x008d - {0, VAR,NULL, }, // 0x008e - {0, 0, NULL, }, // 0x008f + {0, VAR,nullptr, }, // 0x008d + {0, VAR,nullptr, }, // 0x008e + {0, 0, nullptr, }, // 0x008f {500, 7, clif_parse_NpcClicked, }, // 0x0090 - {0, 22, NULL, }, // 0x0091 - {0, 28, NULL, }, // 0x0092 - {0, 2, NULL, }, // 0x0093 + {0, 22, nullptr, }, // 0x0091 + {0, 28, nullptr, }, // 0x0092 + {0, 2, nullptr, }, // 0x0093 {-1, 6, clif_parse_GetCharNameRequest, }, // 0x0094 - {0, 30, NULL, }, // 0x0095 + {0, 30, nullptr, }, // 0x0095 {300, VAR,clif_parse_Wis, }, // 0x0096 - {0, VAR,NULL, }, // 0x0097 - {0, 3, NULL, }, // 0x0098 - {300, VAR,NULL, }, // 0x0099 - {0, VAR,NULL, }, // 0x009a + {0, VAR,nullptr, }, // 0x0097 + {0, 3, nullptr, }, // 0x0098 + {300, VAR,nullptr, }, // 0x0099 + {0, VAR,nullptr, }, // 0x009a {-1, 5, clif_parse_ChangeDir, }, // 0x009b - {0, 9, NULL, }, // 0x009c - {0, 17, NULL, }, // 0x009d - {0, 17, NULL, }, // 0x009e + {0, 9, nullptr, }, // 0x009c + {0, 17, nullptr, }, // 0x009d + {0, 17, nullptr, }, // 0x009e {400, 6, clif_parse_TakeItem, }, // 0x009f - {0, 23, NULL, }, // 0x00a0 - {0, 6, NULL, }, // 0x00a1 + {0, 23, nullptr, }, // 0x00a0 + {0, 6, nullptr, }, // 0x00a1 {50, 6, clif_parse_DropItem, }, // 0x00a2 - {0, VAR,NULL, }, // 0x00a3 - {0, VAR,NULL, }, // 0x00a4 - {0, VAR,NULL, }, // 0x00a5 - {0, VAR,NULL, }, // 0x00a6 + {0, VAR,nullptr, }, // 0x00a3 + {0, VAR,nullptr, }, // 0x00a4 + {0, VAR,nullptr, }, // 0x00a5 + {0, VAR,nullptr, }, // 0x00a6 {0, 8, clif_parse_UseItem, }, // 0x00a7 - {0, 7, NULL, }, // 0x00a8 + {0, 7, nullptr, }, // 0x00a8 {-1, 6, clif_parse_EquipItem, }, // 0x00a9 Special case - outfit window (not implemented yet - needs to allow bursts) - {0, 7, NULL, }, // 0x00aa + {0, 7, nullptr, }, // 0x00aa {-1, 4, clif_parse_UnequipItem, }, // 0x00ab Special case - outfit window (not implemented yet - needs to allow bursts) - {0, 7, NULL, }, // 0x00ac - {0, 0, NULL, }, // 0x00ad - {0, VAR,NULL, }, // 0x00ae - {0, 6, NULL, }, // 0x00af - {0, 8, NULL, }, // 0x00b0 - {0, 8, NULL, }, // 0x00b1 + {0, 7, nullptr, }, // 0x00ac + {0, 0, nullptr, }, // 0x00ad + {0, VAR,nullptr, }, // 0x00ae + {0, 6, nullptr, }, // 0x00af + {0, 8, nullptr, }, // 0x00b0 + {0, 8, nullptr, }, // 0x00b1 {0, 3, clif_parse_Restart, }, // 0x00b2 - {0, 3, NULL, }, // 0x00b3 - {0, VAR,NULL, }, // 0x00b4 - {0, 6, NULL, }, // 0x00b5 - {0, 6, NULL, }, // 0x00b6 - {0, VAR,NULL, }, // 0x00b7 + {0, 3, nullptr, }, // 0x00b3 + {0, VAR,nullptr, }, // 0x00b4 + {0, 6, nullptr, }, // 0x00b5 + {0, 6, nullptr, }, // 0x00b6 + {0, VAR,nullptr, }, // 0x00b7 {0, 7, clif_parse_NpcSelectMenu, }, // 0x00b8 {-1, 6, clif_parse_NpcNextClicked, }, // 0x00b9 - {0, 2, NULL, }, // 0x00ba + {0, 2, nullptr, }, // 0x00ba {-1, 5, clif_parse_StatusUp, }, // 0x00bb People click this very quickly - {0, 6, NULL, }, // 0x00bc - {0, 44, NULL, }, // 0x00bd - {0, 5, NULL, }, // 0x00be + {0, 6, nullptr, }, // 0x00bc + {0, 44, nullptr, }, // 0x00bd + {0, 5, nullptr, }, // 0x00be {1000, 3, clif_parse_Emotion, }, // 0x00bf - {0, 7, NULL, }, // 0x00c0 + {0, 7, nullptr, }, // 0x00c0 {0, 2, clif_parse_HowManyConnections, }, // 0x00c1 - {0, 6, NULL, }, // 0x00c2 - {0, 8, NULL, }, // 0x00c3 - {0, 6, NULL, }, // 0x00c4 + {0, 6, nullptr, }, // 0x00c2 + {0, 8, nullptr, }, // 0x00c3 + {0, 6, nullptr, }, // 0x00c4 {0, 7, clif_parse_NpcBuySellSelected, }, // 0x00c5 - {0, VAR,NULL, }, // 0x00c6 - {0, VAR,NULL, }, // 0x00c7 + {0, VAR,nullptr, }, // 0x00c6 + {0, VAR,nullptr, }, // 0x00c7 {-1, VAR,clif_parse_NpcBuyListSend, }, // 0x00c8 {-1, VAR,clif_parse_NpcSellListSend, }, // 0x00c9 Selling multiple 1-slot items - {0, 3, NULL, }, // 0x00ca - {0, 3, NULL, }, // 0x00cb - {0, 6, NULL, }, // 0x00cc - {0, 6, NULL, }, // 0x00cd - {0, 2, NULL, }, // 0x00ce - {0, 27, NULL, }, // 0x00cf - {0, 3, NULL, }, // 0x00d0 - {0, 4, NULL, }, // 0x00d1 - {0, 4, NULL, }, // 0x00d2 - {0, 2, NULL, }, // 0x00d3 - {0, VAR,NULL, }, // 0x00d4 - {0, VAR,NULL, }, // 0x00d5 - {0, 3, NULL, }, // 0x00d6 - {0, VAR,NULL, }, // 0x00d7 - {0, 6, NULL, }, // 0x00d8 - {0, 14, NULL, }, // 0x00d9 - {0, 3, NULL, }, // 0x00da - {0, VAR,NULL, }, // 0x00db - {0, 28, NULL, }, // 0x00dc - {0, 29, NULL, }, // 0x00dd - {0, VAR,NULL, }, // 0x00de - {0, VAR,NULL, }, // 0x00df - {0, 30, NULL, }, // 0x00e0 - {0, 30, NULL, }, // 0x00e1 - {0, 26, NULL, }, // 0x00e2 - {0, 2, NULL, }, // 0x00e3 + {0, 3, nullptr, }, // 0x00ca + {0, 3, nullptr, }, // 0x00cb + {0, 6, nullptr, }, // 0x00cc + {0, 6, nullptr, }, // 0x00cd + {0, 2, nullptr, }, // 0x00ce + {0, 27, nullptr, }, // 0x00cf + {0, 3, nullptr, }, // 0x00d0 + {0, 4, nullptr, }, // 0x00d1 + {0, 4, nullptr, }, // 0x00d2 + {0, 2, nullptr, }, // 0x00d3 + {0, VAR,nullptr, }, // 0x00d4 + {0, VAR,nullptr, }, // 0x00d5 + {0, 3, nullptr, }, // 0x00d6 + {0, VAR,nullptr, }, // 0x00d7 + {0, 6, nullptr, }, // 0x00d8 + {0, 14, nullptr, }, // 0x00d9 + {0, 3, nullptr, }, // 0x00da + {0, VAR,nullptr, }, // 0x00db + {0, 28, nullptr, }, // 0x00dc + {0, 29, nullptr, }, // 0x00dd + {0, VAR,nullptr, }, // 0x00de + {0, VAR,nullptr, }, // 0x00df + {0, 30, nullptr, }, // 0x00e0 + {0, 30, nullptr, }, // 0x00e1 + {0, 26, nullptr, }, // 0x00e2 + {0, 2, nullptr, }, // 0x00e3 {2000, 6, clif_parse_TradeRequest, }, // 0x00e4 - {0, 26, NULL, }, // 0x00e5 + {0, 26, nullptr, }, // 0x00e5 {0, 3, clif_parse_TradeAck, }, // 0x00e6 - {0, 3, NULL, }, // 0x00e7 + {0, 3, nullptr, }, // 0x00e7 {0, 8, clif_parse_TradeAddItem, }, // 0x00e8 - {0, 19, NULL, }, // 0x00e9 - {0, 5, NULL, }, // 0x00ea + {0, 19, nullptr, }, // 0x00e9 + {0, 5, nullptr, }, // 0x00ea {0, 2, clif_parse_TradeOk, }, // 0x00eb - {0, 3, NULL, }, // 0x00ec + {0, 3, nullptr, }, // 0x00ec {0, 2, clif_parse_TradeCansel, }, // 0x00ed - {0, 2, NULL, }, // 0x00ee + {0, 2, nullptr, }, // 0x00ee {0, 2, clif_parse_TradeCommit, }, // 0x00ef - {0, 3, NULL, }, // 0x00f0 - {0, 2, NULL, }, // 0x00f1 - {0, 6, NULL, }, // 0x00f2 + {0, 3, nullptr, }, // 0x00f0 + {0, 2, nullptr, }, // 0x00f1 + {0, 6, nullptr, }, // 0x00f2 {-1, 8, clif_parse_MoveToKafra, }, // 0x00f3 - {0, 21, NULL, }, // 0x00f4 + {0, 21, nullptr, }, // 0x00f4 {-1, 8, clif_parse_MoveFromKafra, }, // 0x00f5 - {0, 8, NULL, }, // 0x00f6 + {0, 8, nullptr, }, // 0x00f6 {0, 2, clif_parse_CloseKafra, }, // 0x00f7 - {0, 2, NULL, }, // 0x00f8 + {0, 2, nullptr, }, // 0x00f8 {2000, 26, clif_parse_CreateParty, }, // 0x00f9 - {0, 3, NULL, }, // 0x00fa - {0, VAR,NULL, }, // 0x00fb + {0, 3, nullptr, }, // 0x00fa + {0, VAR,nullptr, }, // 0x00fb {2000, 6, clif_parse_PartyInvite, }, // 0x00fc - {0, 27, NULL, }, // 0x00fd - {0, 30, NULL, }, // 0x00fe + {0, 27, nullptr, }, // 0x00fd + {0, 30, nullptr, }, // 0x00fe {0, 10, clif_parse_ReplyPartyInvite, }, // 0x00ff {0, 2, clif_parse_LeaveParty, }, // 0x0100 - {0, 6, NULL, }, // 0x0101 + {0, 6, nullptr, }, // 0x0101 {0, 6, clif_parse_PartyChangeOption, }, // 0x0102 {0, 30, clif_parse_RemovePartyMember, }, // 0x0103 - {0, 79, NULL, }, // 0x0104 - {0, 31, NULL, }, // 0x0105 - {0, 10, NULL, }, // 0x0106 - {0, 10, NULL, }, // 0x0107 + {0, 79, nullptr, }, // 0x0104 + {0, 31, nullptr, }, // 0x0105 + {0, 10, nullptr, }, // 0x0106 + {0, 10, nullptr, }, // 0x0107 {300, VAR,clif_parse_PartyMessage, }, // 0x0108 - {0, VAR,NULL, }, // 0x0109 - {0, 4, NULL, }, // 0x010a - {0, 6, NULL, }, // 0x010b - {0, 6, NULL, }, // 0x010c - {0, 2, NULL, }, // 0x010d - {0, 11, NULL, }, // 0x010e - {0, VAR,NULL, }, // 0x010f - {0, 10, NULL, }, // 0x0110 - {0, 39, NULL, }, // 0x0111 + {0, VAR,nullptr, }, // 0x0109 + {0, 4, nullptr, }, // 0x010a + {0, 6, nullptr, }, // 0x010b + {0, 6, nullptr, }, // 0x010c + {0, 2, nullptr, }, // 0x010d + {0, 11, nullptr, }, // 0x010e + {0, VAR,nullptr, }, // 0x010f + {0, 10, nullptr, }, // 0x0110 + {0, 39, nullptr, }, // 0x0111 {-1, 4, clif_parse_SkillUp, }, // 0x0112 - {0, 10, NULL, }, // 0x0113 - {0, 31, NULL, }, // 0x0114 - {0, 35, NULL, }, // 0x0115 - {0, 10, NULL, }, // 0x0116 - {0, 18, NULL, }, // 0x0117 + {0, 10, nullptr, }, // 0x0113 + {0, 31, nullptr, }, // 0x0114 + {0, 35, nullptr, }, // 0x0115 + {0, 10, nullptr, }, // 0x0116 + {0, 18, nullptr, }, // 0x0117 {0, 2, clif_parse_StopAttack, }, // 0x0118 - {0, 13, NULL, }, // 0x0119 - {0, 15, NULL, }, // 0x011a - {0, 20, NULL, }, // 0x011b - {0, 68, NULL, }, // 0x011c - {0, 2, NULL, }, // 0x011d - {0, 3, NULL, }, // 0x011e - {0, 16, NULL, }, // 0x011f - {0, 6, NULL, }, // 0x0120 - {0, 14, NULL, }, // 0x0121 - {0, VAR,NULL, }, // 0x0122 - {0, VAR,NULL, }, // 0x0123 - {0, 21, NULL, }, // 0x0124 - {0, 8, NULL, }, // 0x0125 - {0, 8, NULL, }, // 0x0126 - {0, 8, NULL, }, // 0x0127 - {0, 8, NULL, }, // 0x0128 - {0, 8, NULL, }, // 0x0129 - {0, 2, NULL, }, // 0x012a - {0, 2, NULL, }, // 0x012b - {0, 3, NULL, }, // 0x012c - {0, 4, NULL, }, // 0x012d - {0, 2, NULL, }, // 0x012e - {0, VAR,NULL, }, // 0x012f - {0, 6, NULL, }, // 0x0130 - {0, 86, NULL, }, // 0x0131 - {0, 6, NULL, }, // 0x0132 - {0, VAR,NULL, }, // 0x0133 - {0, VAR,NULL, }, // 0x0134 - {0, 7, NULL, }, // 0x0135 - {0, VAR,NULL, }, // 0x0136 - {0, 6, NULL, }, // 0x0137 - {0, 3, NULL, }, // 0x0138 - {0, 16, NULL, }, // 0x0139 - {0, 4, NULL, }, // 0x013a - {0, 4, NULL, }, // 0x013b - {0, 4, NULL, }, // 0x013c - {0, 6, NULL, }, // 0x013d - {0, 24, NULL, }, // 0x013e - {0, 26, NULL, }, // 0x013f - {0, 22, NULL, }, // 0x0140 - {0, 14, NULL, }, // 0x0141 - {0, 6, NULL, }, // 0x0142 + {0, 13, nullptr, }, // 0x0119 + {0, 15, nullptr, }, // 0x011a + {0, 20, nullptr, }, // 0x011b + {0, 68, nullptr, }, // 0x011c + {0, 2, nullptr, }, // 0x011d + {0, 3, nullptr, }, // 0x011e + {0, 16, nullptr, }, // 0x011f + {0, 6, nullptr, }, // 0x0120 + {0, 14, nullptr, }, // 0x0121 + {0, VAR,nullptr, }, // 0x0122 + {0, VAR,nullptr, }, // 0x0123 + {0, 21, nullptr, }, // 0x0124 + {0, 8, nullptr, }, // 0x0125 + {0, 8, nullptr, }, // 0x0126 + {0, 8, nullptr, }, // 0x0127 + {0, 8, nullptr, }, // 0x0128 + {0, 8, nullptr, }, // 0x0129 + {0, 2, nullptr, }, // 0x012a + {0, 2, nullptr, }, // 0x012b + {0, 3, nullptr, }, // 0x012c + {0, 4, nullptr, }, // 0x012d + {0, 2, nullptr, }, // 0x012e + {0, VAR,nullptr, }, // 0x012f + {0, 6, nullptr, }, // 0x0130 + {0, 86, nullptr, }, // 0x0131 + {0, 6, nullptr, }, // 0x0132 + {0, VAR,nullptr, }, // 0x0133 + {0, VAR,nullptr, }, // 0x0134 + {0, 7, nullptr, }, // 0x0135 + {0, VAR,nullptr, }, // 0x0136 + {0, 6, nullptr, }, // 0x0137 + {0, 3, nullptr, }, // 0x0138 + {0, 16, nullptr, }, // 0x0139 + {0, 4, nullptr, }, // 0x013a + {0, 4, nullptr, }, // 0x013b + {0, 4, nullptr, }, // 0x013c + {0, 6, nullptr, }, // 0x013d + {0, 24, nullptr, }, // 0x013e + {0, 26, nullptr, }, // 0x013f + {0, 22, nullptr, }, // 0x0140 + {0, 14, nullptr, }, // 0x0141 + {0, 6, nullptr, }, // 0x0142 {300, 10, clif_parse_NpcAmountInput, }, // 0x0143 - {0, 23, NULL, }, // 0x0144 - {0, 19, NULL, }, // 0x0145 + {0, 23, nullptr, }, // 0x0144 + {0, 19, nullptr, }, // 0x0145 {300, 6, clif_parse_NpcCloseClicked, }, // 0x0146 - {0, 39, NULL, }, // 0x0147 - {0, 8, NULL, }, // 0x0148 - {0, 9, NULL, }, // 0x0149 - {0, 6, NULL, }, // 0x014a - {0, 27, NULL, }, // 0x014b - {0, VAR,NULL, }, // 0x014c - {0, 2, NULL, }, // 0x014d - {0, 6, NULL, }, // 0x014e - {0, 6, NULL, }, // 0x014f - {0, 110,NULL, }, // 0x0150 - {0, 6, NULL, }, // 0x0151 - {0, VAR,NULL, }, // 0x0152 - {0, VAR,NULL, }, // 0x0153 - {0, VAR,NULL, }, // 0x0154 - {0, VAR,NULL, }, // 0x0155 - {0, VAR,NULL, }, // 0x0156 - {0, 6, NULL, }, // 0x0157 - {0, VAR,NULL, }, // 0x0158 - {0, 54, NULL, }, // 0x0159 - {0, 66, NULL, }, // 0x015a - {0, 54, NULL, }, // 0x015b - {0, 90, NULL, }, // 0x015c - {0, 42, NULL, }, // 0x015d - {0, 6, NULL, }, // 0x015e - {0, 42, NULL, }, // 0x015f - {0, VAR,NULL, }, // 0x0160 - {0, VAR,NULL, }, // 0x0161 - {0, VAR,NULL, }, // 0x0162 - {0, VAR,NULL, }, // 0x0163 - {0, VAR,NULL, }, // 0x0164 - {0, 30, NULL, }, // 0x0165 - {0, VAR,NULL, }, // 0x0166 - {0, 3, NULL, }, // 0x0167 - {0, 14, NULL, }, // 0x0168 - {0, 3, NULL, }, // 0x0169 - {0, 30, NULL, }, // 0x016a - {0, 10, NULL, }, // 0x016b - {0, 43, NULL, }, // 0x016c - {0, 14, NULL, }, // 0x016d - {0, 186,NULL, }, // 0x016e - {0, 182,NULL, }, // 0x016f - {0, 14, NULL, }, // 0x0170 - {0, 30, NULL, }, // 0x0171 - {0, 10, NULL, }, // 0x0172 - {0, 3, NULL, }, // 0x0173 - {0, VAR,NULL, }, // 0x0174 - {0, 6, NULL, }, // 0x0175 - {0, 106,NULL, }, // 0x0176 - {0, VAR,NULL, }, // 0x0177 - {0, 4, NULL, }, // 0x0178 - {0, 5, NULL, }, // 0x0179 - {0, 4, NULL, }, // 0x017a - {0, VAR,NULL, }, // 0x017b - {0, 6, NULL, }, // 0x017c - {0, 7, NULL, }, // 0x017d - {0, VAR,NULL, }, // 0x017e - {0, VAR,NULL, }, // 0x017f - {0, 6, NULL, }, // 0x0180 - {0, 3, NULL, }, // 0x0181 - {0, 106,NULL, }, // 0x0182 - {0, 10, NULL, }, // 0x0183 - {0, 10, NULL, }, // 0x0184 - {0, 34, NULL, }, // 0x0185 - {0, 0, NULL, }, // 0x0186 - {0, 6, NULL, }, // 0x0187 - {0, 8, NULL, }, // 0x0188 - {0, 4, NULL, }, // 0x0189 + {0, 39, nullptr, }, // 0x0147 + {0, 8, nullptr, }, // 0x0148 + {0, 9, nullptr, }, // 0x0149 + {0, 6, nullptr, }, // 0x014a + {0, 27, nullptr, }, // 0x014b + {0, VAR,nullptr, }, // 0x014c + {0, 2, nullptr, }, // 0x014d + {0, 6, nullptr, }, // 0x014e + {0, 6, nullptr, }, // 0x014f + {0, 110,nullptr, }, // 0x0150 + {0, 6, nullptr, }, // 0x0151 + {0, VAR,nullptr, }, // 0x0152 + {0, VAR,nullptr, }, // 0x0153 + {0, VAR,nullptr, }, // 0x0154 + {0, VAR,nullptr, }, // 0x0155 + {0, VAR,nullptr, }, // 0x0156 + {0, 6, nullptr, }, // 0x0157 + {0, VAR,nullptr, }, // 0x0158 + {0, 54, nullptr, }, // 0x0159 + {0, 66, nullptr, }, // 0x015a + {0, 54, nullptr, }, // 0x015b + {0, 90, nullptr, }, // 0x015c + {0, 42, nullptr, }, // 0x015d + {0, 6, nullptr, }, // 0x015e + {0, 42, nullptr, }, // 0x015f + {0, VAR,nullptr, }, // 0x0160 + {0, VAR,nullptr, }, // 0x0161 + {0, VAR,nullptr, }, // 0x0162 + {0, VAR,nullptr, }, // 0x0163 + {0, VAR,nullptr, }, // 0x0164 + {0, 30, nullptr, }, // 0x0165 + {0, VAR,nullptr, }, // 0x0166 + {0, 3, nullptr, }, // 0x0167 + {0, 14, nullptr, }, // 0x0168 + {0, 3, nullptr, }, // 0x0169 + {0, 30, nullptr, }, // 0x016a + {0, 10, nullptr, }, // 0x016b + {0, 43, nullptr, }, // 0x016c + {0, 14, nullptr, }, // 0x016d + {0, 186,nullptr, }, // 0x016e + {0, 182,nullptr, }, // 0x016f + {0, 14, nullptr, }, // 0x0170 + {0, 30, nullptr, }, // 0x0171 + {0, 10, nullptr, }, // 0x0172 + {0, 3, nullptr, }, // 0x0173 + {0, VAR,nullptr, }, // 0x0174 + {0, 6, nullptr, }, // 0x0175 + {0, 106,nullptr, }, // 0x0176 + {0, VAR,nullptr, }, // 0x0177 + {0, 4, nullptr, }, // 0x0178 + {0, 5, nullptr, }, // 0x0179 + {0, 4, nullptr, }, // 0x017a + {0, VAR,nullptr, }, // 0x017b + {0, 6, nullptr, }, // 0x017c + {0, 7, nullptr, }, // 0x017d + {0, VAR,nullptr, }, // 0x017e + {0, VAR,nullptr, }, // 0x017f + {0, 6, nullptr, }, // 0x0180 + {0, 3, nullptr, }, // 0x0181 + {0, 106,nullptr, }, // 0x0182 + {0, 10, nullptr, }, // 0x0183 + {0, 10, nullptr, }, // 0x0184 + {0, 34, nullptr, }, // 0x0185 + {0, 0, nullptr, }, // 0x0186 + {0, 6, nullptr, }, // 0x0187 + {0, 8, nullptr, }, // 0x0188 + {0, 4, nullptr, }, // 0x0189 {0, 4, clif_parse_QuitGame, }, // 0x018a - {0, 4, NULL, }, // 0x018b - {0, 29, NULL, }, // 0x018c - {0, VAR,NULL, }, // 0x018d - {0, 10, NULL, }, // 0x018e - {0, 6, NULL, }, // 0x018f - {0, 90, NULL, }, // 0x0190 - {0, 86, NULL, }, // 0x0191 - {0, 24, NULL, }, // 0x0192 - {0, 6, NULL, }, // 0x0193 - {0, 30, NULL, }, // 0x0194 - {0, 102,NULL, }, // 0x0195 - {0, 9, NULL, }, // 0x0196 - {0, 4, NULL, }, // 0x0197 - {0, 8, NULL, }, // 0x0198 - {0, 4, NULL, }, // 0x0199 - {0, 14, NULL, }, // 0x019a - {0, 10, NULL, }, // 0x019b - {0, VAR,NULL, }, // 0x019c - {300, 6, NULL, }, // 0x019d - {0, 2, NULL, }, // 0x019e - {0, 6, NULL, }, // 0x019f - {0, 3, NULL, }, // 0x01a0 - {0, 3, NULL, }, // 0x01a1 - {0, 35, NULL, }, // 0x01a2 - {0, 5, NULL, }, // 0x01a3 - {0, 11, NULL, }, // 0x01a4 - {0, 26, NULL, }, // 0x01a5 - {0, VAR,NULL, }, // 0x01a6 - {0, 4, NULL, }, // 0x01a7 - {0, 4, NULL, }, // 0x01a8 - {0, 6, NULL, }, // 0x01a9 - {0, 10, NULL, }, // 0x01aa - {0, 12, NULL, }, // 0x01ab - {0, 6, NULL, }, // 0x01ac - {0, VAR,NULL, }, // 0x01ad - {0, 4, NULL, }, // 0x01ae - {0, 4, NULL, }, // 0x01af - {0, 11, NULL, }, // 0x01b0 - {0, 7, NULL, }, // 0x01b1 - {0, VAR,NULL, }, // 0x01b2 - {0, 67, NULL, }, // 0x01b3 - {0, 12, NULL, }, // 0x01b4 - {0, 18, NULL, }, // 0x01b5 - {0, 114,NULL, }, // 0x01b6 - {0, 6, NULL, }, // 0x01b7 - {0, 3, NULL, }, // 0x01b8 - {0, 6, NULL, }, // 0x01b9 - {0, 26, NULL, }, // 0x01ba - {0, 26, NULL, }, // 0x01bb - {0, 26, NULL, }, // 0x01bc - {0, 26, NULL, }, // 0x01bd - {0, 2, NULL, }, // 0x01be - {0, 3, NULL, }, // 0x01bf - {0, 2, NULL, }, // 0x01c0 - {0, 14, NULL, }, // 0x01c1 - {0, 10, NULL, }, // 0x01c2 - {0, VAR,NULL, }, // 0x01c3 - {0, 22, NULL, }, // 0x01c4 - {0, 22, NULL, }, // 0x01c5 - {0, 4, NULL, }, // 0x01c6 - {0, 2, NULL, }, // 0x01c7 - {0, 13, NULL, }, // 0x01c8 - {0, 97, NULL, }, // 0x01c9 - {0, 0, NULL, }, // 0x01ca - {0, 9, NULL, }, // 0x01cb - {0, 9, NULL, }, // 0x01cc - {0, 30, NULL, }, // 0x01cd - {0, 6, NULL, }, // 0x01ce - {0, 28, NULL, }, // 0x01cf - {0, 8, NULL, }, // 0x01d0 - {0, 14, NULL, }, // 0x01d1 - {0, 10, NULL, }, // 0x01d2 - {0, 35, NULL, }, // 0x01d3 - {0, 6, NULL, }, // 0x01d4 + {0, 4, nullptr, }, // 0x018b + {0, 29, nullptr, }, // 0x018c + {0, VAR,nullptr, }, // 0x018d + {0, 10, nullptr, }, // 0x018e + {0, 6, nullptr, }, // 0x018f + {0, 90, nullptr, }, // 0x0190 + {0, 86, nullptr, }, // 0x0191 + {0, 24, nullptr, }, // 0x0192 + {0, 6, nullptr, }, // 0x0193 + {0, 30, nullptr, }, // 0x0194 + {0, 102,nullptr, }, // 0x0195 + {0, 9, nullptr, }, // 0x0196 + {0, 4, nullptr, }, // 0x0197 + {0, 8, nullptr, }, // 0x0198 + {0, 4, nullptr, }, // 0x0199 + {0, 14, nullptr, }, // 0x019a + {0, 10, nullptr, }, // 0x019b + {0, VAR,nullptr, }, // 0x019c + {300, 6, nullptr, }, // 0x019d + {0, 2, nullptr, }, // 0x019e + {0, 6, nullptr, }, // 0x019f + {0, 3, nullptr, }, // 0x01a0 + {0, 3, nullptr, }, // 0x01a1 + {0, 35, nullptr, }, // 0x01a2 + {0, 5, nullptr, }, // 0x01a3 + {0, 11, nullptr, }, // 0x01a4 + {0, 26, nullptr, }, // 0x01a5 + {0, VAR,nullptr, }, // 0x01a6 + {0, 4, nullptr, }, // 0x01a7 + {0, 4, nullptr, }, // 0x01a8 + {0, 6, nullptr, }, // 0x01a9 + {0, 10, nullptr, }, // 0x01aa + {0, 12, nullptr, }, // 0x01ab + {0, 6, nullptr, }, // 0x01ac + {0, VAR,nullptr, }, // 0x01ad + {0, 4, nullptr, }, // 0x01ae + {0, 4, nullptr, }, // 0x01af + {0, 11, nullptr, }, // 0x01b0 + {0, 7, nullptr, }, // 0x01b1 + {0, VAR,nullptr, }, // 0x01b2 + {0, 67, nullptr, }, // 0x01b3 + {0, 12, nullptr, }, // 0x01b4 + {0, 18, nullptr, }, // 0x01b5 + {0, 114,nullptr, }, // 0x01b6 + {0, 6, nullptr, }, // 0x01b7 + {0, 3, nullptr, }, // 0x01b8 + {0, 6, nullptr, }, // 0x01b9 + {0, 26, nullptr, }, // 0x01ba + {0, 26, nullptr, }, // 0x01bb + {0, 26, nullptr, }, // 0x01bc + {0, 26, nullptr, }, // 0x01bd + {0, 2, nullptr, }, // 0x01be + {0, 3, nullptr, }, // 0x01bf + {0, 2, nullptr, }, // 0x01c0 + {0, 14, nullptr, }, // 0x01c1 + {0, 10, nullptr, }, // 0x01c2 + {0, VAR,nullptr, }, // 0x01c3 + {0, 22, nullptr, }, // 0x01c4 + {0, 22, nullptr, }, // 0x01c5 + {0, 4, nullptr, }, // 0x01c6 + {0, 2, nullptr, }, // 0x01c7 + {0, 13, nullptr, }, // 0x01c8 + {0, 97, nullptr, }, // 0x01c9 + {0, 0, nullptr, }, // 0x01ca + {0, 9, nullptr, }, // 0x01cb + {0, 9, nullptr, }, // 0x01cc + {0, 30, nullptr, }, // 0x01cd + {0, 6, nullptr, }, // 0x01ce + {0, 28, nullptr, }, // 0x01cf + {0, 8, nullptr, }, // 0x01d0 + {0, 14, nullptr, }, // 0x01d1 + {0, 10, nullptr, }, // 0x01d2 + {0, 35, nullptr, }, // 0x01d3 + {0, 6, nullptr, }, // 0x01d4 {300, VAR,clif_parse_NpcStringInput, }, // 0x01d5 - set to -1 - {0, 4, NULL, }, // 0x01d6 - {0, 11, NULL, }, // 0x01d7 - {0, 54, NULL, }, // 0x01d8 - {0, 53, NULL, }, // 0x01d9 - {0, 60, NULL, }, // 0x01da - {0, 2, NULL, }, // 0x01db - {0, VAR,NULL, }, // 0x01dc - {0, 47, NULL, }, // 0x01dd - {0, 33, NULL, }, // 0x01de - {0, 6, NULL, }, // 0x01df - {0, 30, NULL, }, // 0x01e0 - {0, 8, NULL, }, // 0x01e1 - {0, 34, NULL, }, // 0x01e2 - {0, 14, NULL, }, // 0x01e3 - {0, 2, NULL, }, // 0x01e4 - {0, 6, NULL, }, // 0x01e5 - {0, 26, NULL, }, // 0x01e6 - {0, 2, NULL, }, // 0x01e7 - {0, 28, NULL, }, // 0x01e8 - {0, 81, NULL, }, // 0x01e9 - {0, 6, NULL, }, // 0x01ea - {0, 10, NULL, }, // 0x01eb - {0, 26, NULL, }, // 0x01ec - {0, 2, NULL, }, // 0x01ed - {0, VAR,NULL, }, // 0x01ee - {0, VAR,NULL, }, // 0x01ef - {0, VAR,NULL, }, // 0x01f0 - {0, VAR,NULL, }, // 0x01f1 - {0, 20, NULL, }, // 0x01f2 - {0, 10, NULL, }, // 0x01f3 - {0, 32, NULL, }, // 0x01f4 - {0, 9, NULL, }, // 0x01f5 - {0, 34, NULL, }, // 0x01f6 - {0, 14, NULL, }, // 0x01f7 - {0, 2, NULL, }, // 0x01f8 - {0, 6, NULL, }, // 0x01f9 - {0, 48, NULL, }, // 0x01fa - {0, 56, NULL, }, // 0x01fb - {0, VAR,NULL, }, // 0x01fc - {0, 4, NULL, }, // 0x01fd - {0, 5, NULL, }, // 0x01fe - {0, 10, NULL, }, // 0x01ff - {0, 26, NULL, }, // 0x0200 - {0, VAR,NULL, }, // 0x0201 - {0, 26, NULL, }, // 0x0202 - {0, 10, NULL, }, // 0x0203 - {0, 18, NULL, }, // 0x0204 - {0, 26, NULL, }, // 0x0205 - {0, 11, NULL, }, // 0x0206 - {0, 34, NULL, }, // 0x0207 - {0, 14, NULL, }, // 0x0208 - {0, 36, NULL, }, // 0x0209 - {0, 10, NULL, }, // 0x020a - {0, 19, NULL, }, // 0x020b - {0, 10, NULL, }, // 0x020c - {0, VAR,NULL, }, // 0x020d - {0, 24, NULL, }, // 0x020e - {0, 0, NULL, }, // 0x020f - {0, 0, NULL, }, // 0x0210 - {0, 0, NULL, }, // 0x0211 - {0, 0, NULL, }, // 0x0212 - {0, 0, NULL, }, // 0x0213 - {0, 0, NULL, }, // 0x0214 - {0, 0, NULL, }, // 0x0215 - {0, 0, NULL, }, // 0x0216 - {0, 0, NULL, }, // 0x0217 - {0, 0, NULL, }, // 0x0218 - {0, 0, NULL, }, // 0x0219 - {0, 0, NULL, }, // 0x021a - {0, 0, NULL, }, // 0x021b - {0, 0, NULL, }, // 0x021c - {0, 0, NULL, }, // 0x021d - {0, 0, NULL, }, // 0x021e - {0, 0, NULL, }, // 0x021f + {0, 4, nullptr, }, // 0x01d6 + {0, 11, nullptr, }, // 0x01d7 + {0, 54, nullptr, }, // 0x01d8 + {0, 53, nullptr, }, // 0x01d9 + {0, 60, nullptr, }, // 0x01da + {0, 2, nullptr, }, // 0x01db + {0, VAR,nullptr, }, // 0x01dc + {0, 47, nullptr, }, // 0x01dd + {0, 33, nullptr, }, // 0x01de + {0, 6, nullptr, }, // 0x01df + {0, 30, nullptr, }, // 0x01e0 + {0, 8, nullptr, }, // 0x01e1 + {0, 34, nullptr, }, // 0x01e2 + {0, 14, nullptr, }, // 0x01e3 + {0, 2, nullptr, }, // 0x01e4 + {0, 6, nullptr, }, // 0x01e5 + {0, 26, nullptr, }, // 0x01e6 + {0, 2, nullptr, }, // 0x01e7 + {0, 28, nullptr, }, // 0x01e8 + {0, 81, nullptr, }, // 0x01e9 + {0, 6, nullptr, }, // 0x01ea + {0, 10, nullptr, }, // 0x01eb + {0, 26, nullptr, }, // 0x01ec + {0, 2, nullptr, }, // 0x01ed + {0, VAR,nullptr, }, // 0x01ee + {0, VAR,nullptr, }, // 0x01ef + {0, VAR,nullptr, }, // 0x01f0 + {0, VAR,nullptr, }, // 0x01f1 + {0, 20, nullptr, }, // 0x01f2 + {0, 10, nullptr, }, // 0x01f3 + {0, 32, nullptr, }, // 0x01f4 + {0, 9, nullptr, }, // 0x01f5 + {0, 34, nullptr, }, // 0x01f6 + {0, 14, nullptr, }, // 0x01f7 + {0, 2, nullptr, }, // 0x01f8 + {0, 6, nullptr, }, // 0x01f9 + {0, 48, nullptr, }, // 0x01fa + {0, 56, nullptr, }, // 0x01fb + {0, VAR,nullptr, }, // 0x01fc + {0, 4, nullptr, }, // 0x01fd + {0, 5, nullptr, }, // 0x01fe + {0, 10, nullptr, }, // 0x01ff + {0, 26, nullptr, }, // 0x0200 + {0, VAR,nullptr, }, // 0x0201 + {0, 26, nullptr, }, // 0x0202 + {0, 10, nullptr, }, // 0x0203 + {0, 18, nullptr, }, // 0x0204 + {0, 26, nullptr, }, // 0x0205 + {0, 11, nullptr, }, // 0x0206 + {0, 34, nullptr, }, // 0x0207 + {0, 14, nullptr, }, // 0x0208 + {0, 36, nullptr, }, // 0x0209 + {0, 10, nullptr, }, // 0x020a + {0, 19, nullptr, }, // 0x020b + {0, 10, nullptr, }, // 0x020c + {0, VAR,nullptr, }, // 0x020d + {0, 24, nullptr, }, // 0x020e + {0, 0, nullptr, }, // 0x020f + {0, 0, nullptr, }, // 0x0210 + {0, 0, nullptr, }, // 0x0211 + {0, 0, nullptr, }, // 0x0212 + {0, 0, nullptr, }, // 0x0213 + {0, 0, nullptr, }, // 0x0214 + {0, 0, nullptr, }, // 0x0215 + {0, 0, nullptr, }, // 0x0216 + {0, 0, nullptr, }, // 0x0217 + {0, 0, nullptr, }, // 0x0218 + {0, 0, nullptr, }, // 0x0219 + {0, 0, nullptr, }, // 0x021a + {0, 0, nullptr, }, // 0x021b + {0, 0, nullptr, }, // 0x021c + {0, 0, nullptr, }, // 0x021d + {0, 0, nullptr, }, // 0x021e + {0, 0, nullptr, }, // 0x021f }; // Checks for packet flooding diff --git a/src/map/clif.t.hpp b/src/map/clif.t.hpp index ba9a187..0a3737a 100644 --- a/src/map/clif.t.hpp +++ b/src/map/clif.t.hpp @@ -600,7 +600,7 @@ struct IOff0 static IOff0 from(uint16_t i) { return IOff0{i}; } static IteratorPair<ValueIterator<IOff0>> iter() - { return {IOff0::from(0), IOff0::from(MAX_INVENTORY)}; }; + { return {IOff0::from(0), IOff0::from(MAX_INVENTORY)}; } friend uint16_t convert_for_printf(IOff0 i0) { return i0.index; } IOff0& operator ++() { ++index; return *this; } @@ -624,7 +624,7 @@ struct SOff0 static SOff0 from(uint16_t i) { return SOff0{i}; } static IteratorPair<ValueIterator<SOff0>> iter() - { return {SOff0::from(0), SOff0::from(MAX_STORAGE)}; }; + { return {SOff0::from(0), SOff0::from(MAX_STORAGE)}; } friend uint16_t convert_for_printf(SOff0 s0) { return s0.index; } SOff0& operator ++() { ++index; return *this; } @@ -648,7 +648,7 @@ struct IOff2 static IOff2 from(uint16_t i) { return IOff2{static_cast<uint16_t>(i + 2)}; } static IteratorPair<ValueIterator<IOff2>> iter() - { return {IOff2::from(0), IOff2::from(MAX_INVENTORY)}; }; + { return {IOff2::from(0), IOff2::from(MAX_INVENTORY)}; } IOff2& operator ++() { ++index; return *this; } friend bool operator == (IOff2 l, IOff2 r) { return l.index == r.index; } @@ -672,7 +672,7 @@ struct SOff1 static SOff1 from(uint16_t i) { return SOff1{static_cast<uint16_t>(i + 1)}; } static IteratorPair<ValueIterator<SOff1>> iter() - { return {SOff1::from(0), SOff1::from(MAX_STORAGE)}; }; + { return {SOff1::from(0), SOff1::from(MAX_STORAGE)}; } SOff1& operator ++() { ++index; return *this; } friend bool operator == (SOff1 l, SOff1 r) { return l.index == r.index; } diff --git a/src/map/intif.cpp b/src/map/intif.cpp index 543ec0b..4dbd5f7 100644 --- a/src/map/intif.cpp +++ b/src/map/intif.cpp @@ -202,7 +202,7 @@ void intif_party_addmember(PartyId party_id, AccountId account_id) dumb_ptr<map_session_data> sd; sd = map_id2sd(account_to_block(account_id)); - if (sd != NULL) + if (sd != nullptr) { Packet_Fixed<0x3022> fixed_22; fixed_22.party_id = party_id; @@ -246,7 +246,7 @@ void intif_party_changemap(dumb_ptr<map_session_data> sd, int online) if (!char_session) return; - if (sd != NULL) + if (sd != nullptr) { Packet_Fixed<0x3025> fixed_25; fixed_25.party_id = sd->status.party_id; @@ -304,7 +304,7 @@ int intif_parse_WisMessage(Session *, const Packet_Head<0x3801>& head, AString& to); } sd = map_nick2sd(to); // Searching destination player - if (sd != NULL && sd->status_key.name == to) + if (sd != nullptr && sd->status_key.name == to) { // exactly same name (inter-server have checked the name before) { @@ -333,7 +333,7 @@ int intif_parse_WisEnd(Session *, const Packet_Fixed<0x3802>& fixed) PRINTF("intif_parse_wisend: player: %s, flag: %d\n"_fmt, name, flag); sd = map_nick2sd(name); - if (sd != NULL) + if (sd != nullptr) clif_wis_end(sd->sess, flag); return 0; @@ -366,7 +366,7 @@ static int intif_parse_AccountReg(Session *, const Packet_Head<0x3804>& head, const std::vector<Packet_Repeat<0x3804>>& repeat) { dumb_ptr<map_session_data> sd = map_id2sd(account_to_block(head.account_id)); - if (sd == NULL) + if (sd == nullptr) return 1; size_t jlim = std::min(ACCOUNT_REG_NUM, repeat.size()); @@ -388,7 +388,7 @@ int intif_parse_LoadStorage(Session *, const Packet_Payload<0x3810>& payload) dumb_ptr<map_session_data> sd; sd = map_id2sd(account_to_block(payload.account_id)); - if (sd == NULL) + if (sd == nullptr) { if (battle_config.error_log) PRINTF("intif_parse_LoadStorage: user not found %d\n"_fmt, @@ -541,7 +541,7 @@ RecvResult intif_parse(Session *s, uint16_t packet_id) if (rv != RecvResult::Complete) return rv; - clif_GMmessage(NULL, mes, 0); + clif_GMmessage(nullptr, mes, 0); break; } case 0x3801: diff --git a/src/map/itemdb.cpp b/src/map/itemdb.cpp index c88a201..67b6d21 100644 --- a/src/map/itemdb.cpp +++ b/src/map/itemdb.cpp @@ -62,7 +62,7 @@ struct item_data *itemdb_searchname(XString str_) ItemName str = stringish<ItemName>(str_); if (XString(str) != str_) return nullptr; - struct item_data *item = NULL; + struct item_data *item = nullptr; for (auto& pair : item_db) itemdb_searchname_sub(&pair.second, str, &item); return item; @@ -222,8 +222,8 @@ bool itemdb_readdb(ZString filename) id->value_sell = id->value_buy / 2; } - id->use_script = NULL; - id->equip_script = NULL; + id->use_script = nullptr; + id->equip_script = nullptr; if (!tail_part) continue; diff --git a/src/map/magic-expr.cpp b/src/map/magic-expr.cpp index 1e5c829..d54bbee 100644 --- a/src/map/magic-expr.cpp +++ b/src/map/magic-expr.cpp @@ -302,8 +302,8 @@ int fun_add(dumb_ptr<env_t>, val_t *result, Slice<val_t> args) make_area(&args[0]); make_area(&args[1]); RESULTAREA = area_union(ARGAREA(0), ARGAREA(1)); - ARGAREA(0) = NULL; - ARGAREA(1) = NULL; + ARGAREA(0) = nullptr; + ARGAREA(1) = nullptr; result->ty = TYPE::AREA; } else @@ -830,7 +830,7 @@ int magic_find_item(Slice<val_t> args, int index, Item *item_, int *stackable) static int fun_count_item(dumb_ptr<env_t>, val_t *result, Slice<val_t> args) { - dumb_ptr<map_session_data> chr = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : NULL; + dumb_ptr<map_session_data> chr = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : nullptr; int stackable; Item item; @@ -846,7 +846,7 @@ int fun_count_item(dumb_ptr<env_t>, val_t *result, Slice<val_t> args) static int fun_is_equipped(dumb_ptr<env_t>, val_t *result, Slice<val_t> args) { - dumb_ptr<map_session_data> chr = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : NULL; + dumb_ptr<map_session_data> chr = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : nullptr; int stackable; Item item; bool retval = false; @@ -935,7 +935,7 @@ int fun_npc(dumb_ptr<env_t>, val_t *result, Slice<val_t> args) { NpcName name = stringish<NpcName>(ARGSTR(0)); RESULTENTITY = npc_name2id(name); - return RESULTENTITY == NULL; + return RESULTENTITY == nullptr; } static @@ -943,7 +943,7 @@ int fun_pc(dumb_ptr<env_t>, val_t *result, Slice<val_t> args) { CharName name = stringish<CharName>(ARGSTR(0)); RESULTENTITY = map_nick2sd(name); - return RESULTENTITY == NULL; + return RESULTENTITY == nullptr; } static @@ -1141,7 +1141,7 @@ int fun_is_exterior(dumb_ptr<env_t>, val_t *result, Slice<val_t> args) static int fun_contains_string(dumb_ptr<env_t>, val_t *result, Slice<val_t> args) { - RESULTINT = NULL != strstr(ARGSTR(0).c_str(), ARGSTR(1).c_str()); + RESULTINT = nullptr != strstr(ARGSTR(0).c_str(), ARGSTR(1).c_str()); return 0; } @@ -1150,7 +1150,7 @@ int fun_strstr(dumb_ptr<env_t>, val_t *result, Slice<val_t> args) { const char *offset = strstr(ARGSTR(0).c_str(), ARGSTR(1).c_str()); RESULTINT = offset - ARGSTR(0).c_str(); - return offset == NULL; + return offset == nullptr; } static @@ -1281,7 +1281,7 @@ int fun_dir_towards(dumb_ptr<env_t>, val_t *result, Slice<val_t> args) static int fun_extract_healer_xp(dumb_ptr<env_t>, val_t *result, Slice<val_t> args) { - dumb_ptr<map_session_data> sd = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : NULL; + dumb_ptr<map_session_data> sd = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : nullptr; if (!sd) RESULTINT = 0; @@ -1428,7 +1428,7 @@ dumb_ptr<area_t> eval_area(dumb_ptr<env_t> env, e_area_t& expr_) if (eval_location(env, &area->a.a_loc, &expr->a.a_loc)) { area.delete_(); - return NULL; + return nullptr; } else return area; @@ -1451,7 +1451,7 @@ dumb_ptr<area_t> eval_area(dumb_ptr<env_t> env, e_area_t& expr_) free_area(area->a.a_union[i]); } area.delete_(); - return NULL; + return nullptr; } area->size = area->a.a_union[0]->size + area->a.a_union[1]->size; return area; @@ -1481,7 +1481,7 @@ dumb_ptr<area_t> eval_area(dumb_ptr<env_t> env, e_area_t& expr_) area.delete_(); magic_clear_var(&width); magic_clear_var(&height); - return NULL; + return nullptr; } } @@ -1515,7 +1515,7 @@ dumb_ptr<area_t> eval_area(dumb_ptr<env_t> env, e_area_t& expr_) magic_clear_var(&width); magic_clear_var(&depth); magic_clear_var(&dir); - return NULL; + return nullptr; } } @@ -1523,7 +1523,7 @@ dumb_ptr<area_t> eval_area(dumb_ptr<env_t> env, e_area_t& expr_) FPRINTF(stderr, "INTERNAL ERROR: Unknown area type %d\n"_fmt, area->ty); area.delete_(); - return NULL; + return nullptr; } } diff --git a/src/map/magic-expr.hpp b/src/map/magic-expr.hpp index c5c63a5..c3e994b 100644 --- a/src/map/magic-expr.hpp +++ b/src/map/magic-expr.hpp @@ -57,7 +57,7 @@ struct fun_t /** * Retrieves a function by name * @param name The name to look up - * @return A function of that name, or NULL. + * @return A function of that name, or nullptr. */ fun_t *magic_get_fun(ZString name); diff --git a/src/map/magic-interpreter-base.cpp b/src/map/magic-interpreter-base.cpp index 2cc83b4..cf14ae0 100644 --- a/src/map/magic-interpreter-base.cpp +++ b/src/map/magic-interpreter-base.cpp @@ -85,7 +85,7 @@ void set_spell SETTER(dumb_ptr<spell_t>, TYPE::SPELL, v_spell) #pragma GCC diagnostic pop magic_conf_t magic_conf; /* Global magic conf */ -env_t magic_default_env = { &magic_conf, NULL }; +env_t magic_default_env = { &magic_conf, nullptr }; AString magic_find_invocation(XString spellname) { @@ -102,7 +102,7 @@ dumb_ptr<spell_t> magic_find_spell(XString invocation) if (it != magic_conf.spells_by_invocation.end()) return it->second; - return NULL; + return nullptr; } /* -------------------------------------------------------------------------------- */ @@ -125,7 +125,7 @@ dumb_ptr<teleport_anchor_t> magic_find_anchor(XString name) if (it != magic_conf.anchors_by_invocation.end()) return it->second; - return NULL; + return nullptr; } /* -------------------------------------------------------------------------------- */ @@ -201,11 +201,11 @@ dumb_ptr<env_t> spell_create_env(magic_conf_t *conf, dumb_ptr<spell_t> spell, static void free_components(dumb_ptr<component_t> *component_holder) { - if (*component_holder == NULL) + if (*component_holder == nullptr) return; free_components(&(*component_holder)->next); (*component_holder).delete_(); - *component_holder = NULL; + *component_holder = nullptr; } void magic_add_component(dumb_ptr<component_t> *component_holder, ItemNameId id, int count) @@ -213,10 +213,10 @@ void magic_add_component(dumb_ptr<component_t> *component_holder, ItemNameId id, if (count <= 0) return; - if (*component_holder == NULL) + if (*component_holder == nullptr) { auto component = dumb_ptr<component_t>::make(); - component->next = NULL; + component->next = nullptr; component->item_id = id; component->count = count; *component_holder = component; @@ -238,7 +238,7 @@ void magic_add_component(dumb_ptr<component_t> *component_holder, ItemNameId id, static void copy_components(dumb_ptr<component_t> *component_holder, dumb_ptr<component_t> component) { - if (component == NULL) + if (component == nullptr) return; magic_add_component(component_holder, component->item_id, component->count); @@ -314,14 +314,14 @@ effect_set_t *spellguard_check_sub(spellguard_check_t *check, dumb_ptr<env_t> env, int *near_miss) { - if (guard == NULL) - return NULL; + if (guard == nullptr) + return nullptr; switch (guard->ty) { case SPELLGUARD::CONDITION: if (!magic_eval_int(env, guard->s.s_condition)) - return NULL; + return nullptr; break; case SPELLGUARD::COMPONENTS: @@ -337,8 +337,8 @@ effect_set_t *spellguard_check_sub(spellguard_check_t *check, spellguard_check_t altcheck = *check; effect_set_t *retval; - altcheck.components = NULL; - altcheck.catalysts = NULL; + altcheck.components = nullptr; + altcheck.catalysts = nullptr; copy_components(&altcheck.catalysts, check->catalysts); copy_components(&altcheck.components, check->components); @@ -367,12 +367,12 @@ effect_set_t *spellguard_check_sub(spellguard_check_t *check, if (spellguard_can_satisfy(check, caster, env, near_miss)) return &guard->s.s_effect; else - return NULL; + return nullptr; default: FPRINTF(stderr, "Unexpected spellguard type %d\n"_fmt, guard->ty); - return NULL; + return nullptr; } return spellguard_check_sub(check, guard->next, caster, env, near_miss); @@ -385,8 +385,8 @@ effect_set_t *check_spellguard(dumb_ptr<spellguard_t> guard, { spellguard_check_t check; effect_set_t *retval; - check.catalysts = NULL; - check.components = NULL; + check.catalysts = nullptr; + check.components = nullptr; check.mana = 0; check.casttime = interval_t::zero(); @@ -478,7 +478,7 @@ dumb_ptr<invocation> spell_clone_effect(dumb_ptr<invocation> base) // since this is the only call site, it is expanded here //*retval = *base; - retval->next_invocation = NULL; + retval->next_invocation = nullptr; retval->flags = INVOCATION_FLAG::ZERO; dumb_ptr<env_t> env = retval->env = clone_env(base->env); retval->spell = base->spell; @@ -491,12 +491,12 @@ dumb_ptr<invocation> spell_clone_effect(dumb_ptr<invocation> base) // huh? retval->current_effect = base->trigger_effect; retval->trigger_effect = base->trigger_effect; - retval->end_effect = NULL; - // retval->status_change_refs = NULL; + retval->end_effect = nullptr; + // retval->status_change_refs = nullptr; retval->bl_id = BlockId(); - retval->bl_prev = NULL; - retval->bl_next = NULL; + retval->bl_prev = nullptr; + retval->bl_next = nullptr; retval->bl_m = base->bl_m; retval->bl_x = base->bl_x; retval->bl_y = base->bl_y; @@ -517,7 +517,7 @@ void spell_bind(dumb_ptr<map_session_data> subject, dumb_ptr<invocation> invocat if (bool(invocation->flags & INVOCATION_FLAG::BOUND) || invocation->subject || invocation->next_invocation) { - int *i = NULL; + int *i = nullptr; FPRINTF(stderr, "[magic] INTERNAL ERROR: Attempt to re-bind spell invocation `%s'\n"_fmt, invocation->spell->name); @@ -545,7 +545,7 @@ int spell_unbind(dumb_ptr<map_session_data> subject, dumb_ptr<invocation> invoca *seeker = invocation_->next_invocation; invocation_->flags &= ~INVOCATION_FLAG::BOUND; - invocation_->next_invocation = NULL; + invocation_->next_invocation = nullptr; invocation_->subject = BlockId(); return 0; diff --git a/src/map/magic-interpreter-base.hpp b/src/map/magic-interpreter-base.hpp index 7d75049..d569434 100644 --- a/src/map/magic-interpreter-base.hpp +++ b/src/map/magic-interpreter-base.hpp @@ -32,7 +32,7 @@ extern magic_conf_t magic_conf; /* Global magic conf */ extern env_t magic_default_env; /* Fake default environment */ /** - * Adds a component selection to a component holder (which may initially be NULL) + * Adds a component selection to a component holder (which may initially be nullptr) */ void magic_add_component(dumb_ptr<component_t> *component_holder, ItemNameId id, int count); diff --git a/src/map/magic-interpreter.hpp b/src/map/magic-interpreter.hpp index cf0991e..d8a8d9c 100644 --- a/src/map/magic-interpreter.hpp +++ b/src/map/magic-interpreter.hpp @@ -394,8 +394,8 @@ struct invocation : block_list int script_pos; /* Script position; if nonzero, resume the script we were running. */ dumb_ptr<effect_t> current_effect; - dumb_ptr<effect_t> trigger_effect; /* If non-NULL, this is used to spawn a cloned effect based on the same environment */ - dumb_ptr<effect_t> end_effect; /* If non-NULL, this is executed when the spell terminates naturally, e.g. when all status changes have run out or all delays are over. */ + dumb_ptr<effect_t> trigger_effect; /* If non-nullptr, this is used to spawn a cloned effect based on the same environment */ + dumb_ptr<effect_t> end_effect; /* If non-nullptr, this is executed when the spell terminates naturally, e.g. when all status changes have run out or all delays are over. */ /* Status change references: for status change updates, keep track of whom we updated where */ std::vector<status_change_ref_t> status_change_refv; diff --git a/src/map/magic-stmt.cpp b/src/map/magic-stmt.cpp index 2cfb43e..2fbe556 100644 --- a/src/map/magic-stmt.cpp +++ b/src/map/magic-stmt.cpp @@ -228,7 +228,7 @@ void try_to_finish_invocation(dumb_ptr<invocation> invocation) { clear_stack(invocation); invocation->current_effect = invocation->end_effect; - invocation->end_effect = NULL; + invocation->end_effect = nullptr; spell_execute(invocation); } else @@ -341,7 +341,7 @@ static int op_instaheal(dumb_ptr<env_t> env, Slice<val_t> args) { dumb_ptr<block_list> caster = (env->VAR(VAR_CASTER).ty == TYPE::ENTITY) - ? map_id2bl(wrap<BlockId>(static_cast<uint32_t>(env->VAR(VAR_CASTER).v.v_int))) : NULL; + ? map_id2bl(wrap<BlockId>(static_cast<uint32_t>(env->VAR(VAR_CASTER).v.v_int))) : nullptr; dumb_ptr<block_list> subject = ARGENTITY(0); if (!caster) caster = subject; @@ -704,7 +704,7 @@ int op_spawn(dumb_ptr<env_t>, Slice<val_t> args) interval_t monster_lifetime = static_cast<interval_t>(ARGINT(5)); int i; - dumb_ptr<map_session_data> owner = NULL; + dumb_ptr<map_session_data> owner = nullptr; if (monster_attitude == MonsterAttitude::SERVANT && owner_e->bl_type == BL::PC) owner = owner_e->is_player(); @@ -847,7 +847,7 @@ int op_emote(dumb_ptr<env_t>, Slice<val_t> args) static int op_set_script_variable(dumb_ptr<env_t>, Slice<val_t> args) { - dumb_ptr<map_session_data> c = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : NULL; + dumb_ptr<map_session_data> c = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : nullptr; VarName varname = stringish<VarName>(ARGSTR(1)); int array_index = 0; @@ -862,7 +862,7 @@ int op_set_script_variable(dumb_ptr<env_t>, Slice<val_t> args) static int op_set_script_str(dumb_ptr<env_t>, Slice<val_t> args) { - dumb_ptr<map_session_data> c = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : NULL; + dumb_ptr<map_session_data> c = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : nullptr; VarName varname = stringish<VarName>(ARGSTR(1)); int array_index = 0; @@ -877,7 +877,7 @@ int op_set_script_str(dumb_ptr<env_t>, Slice<val_t> args) static int op_set_hair_colour(dumb_ptr<env_t>, Slice<val_t> args) { - dumb_ptr<map_session_data> c = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : NULL; + dumb_ptr<map_session_data> c = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : nullptr; if (!c) return 1; @@ -890,7 +890,7 @@ int op_set_hair_colour(dumb_ptr<env_t>, Slice<val_t> args) static int op_set_hair_style(dumb_ptr<env_t>, Slice<val_t> args) { - dumb_ptr<map_session_data> c = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : NULL; + dumb_ptr<map_session_data> c = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : nullptr; if (!c) return 1; @@ -908,10 +908,10 @@ int op_drop_item_for (dumb_ptr<env_t>, Slice<val_t> args) location_t *loc = &ARGLOCATION(0); int count = ARGINT(2); interval_t interval = static_cast<interval_t>(ARGINT(3)); - dumb_ptr<map_session_data> c = ((args.size() > 4) && (ENTITY_TYPE(4) == BL::PC)) ? ARGPC(4) : NULL; + dumb_ptr<map_session_data> c = ((args.size() > 4) && (ENTITY_TYPE(4) == BL::PC)) ? ARGPC(4) : nullptr; interval_t delay = (args.size() > 5) ? static_cast<interval_t>(ARGINT(5)) : interval_t::zero(); interval_t delaytime[3] = { delay, delay, delay }; - dumb_ptr<map_session_data> owners[3] = { c, NULL, NULL }; + dumb_ptr<map_session_data> owners[3] = { c, nullptr, nullptr }; GET_ARG_ITEM(1, item, stackable); @@ -929,7 +929,7 @@ int op_drop_item_for (dumb_ptr<env_t>, Slice<val_t> args) static int op_gain_exp(dumb_ptr<env_t>, Slice<val_t> args) { - dumb_ptr<map_session_data> c = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : NULL; + dumb_ptr<map_session_data> c = (ENTITY_TYPE(0) == BL::PC) ? ARGPC(0) : nullptr; if (!c) return 1; @@ -1015,7 +1015,7 @@ static dumb_ptr<effect_t> return_to_stack(dumb_ptr<invocation> invocation_) { if (!invocation_->stack_size) - return NULL; + return nullptr; else { cont_activation_record_t *ar = @@ -1091,7 +1091,7 @@ dumb_ptr<effect_t> return_to_stack(dumb_ptr<invocation> invocation_) FPRINTF(stderr, "[magic] INTERNAL ERROR: While executing spell `%s': stack corruption\n"_fmt, invocation_->spell->name); - return NULL; + return nullptr; } } } @@ -1108,7 +1108,7 @@ cont_activation_record_t *add_stack_entry(dumb_ptr<invocation> invocation_, "[magic] Execution stack size exceeded in spell `%s'; truncating effect\n"_fmt, invocation_->spell->name); invocation_->stack_size--; - return NULL; + return nullptr; } ar->ty = ty; @@ -1417,11 +1417,11 @@ interval_t spell_run(dumb_ptr<invocation> invocation_, int allow_delete) case EFFECT::ABORT: invocation_->flags |= INVOCATION_FLAG::ABORTED; - invocation_->end_effect = NULL; + invocation_->end_effect = nullptr; FALLTHROUGH; case EFFECT::END: clear_stack(invocation_); - next = NULL; + next = nullptr; break; case EFFECT::ASSIGN: diff --git a/src/map/magic-stmt.hpp b/src/map/magic-stmt.hpp index 97fdf1f..745b9b5 100644 --- a/src/map/magic-stmt.hpp +++ b/src/map/magic-stmt.hpp @@ -40,7 +40,7 @@ struct op_t /** * Retrieves an operation by name * @param name The name to look up - * @return An operation of that name, or NULL, and a function index + * @return An operation of that name, or nullptr, and a function index */ op_t *magic_get_op(ZString name); diff --git a/src/map/magic-v2.cpp b/src/map/magic-v2.cpp index ba43cb9..a287519 100644 --- a/src/map/magic-v2.cpp +++ b/src/map/magic-v2.cpp @@ -116,7 +116,7 @@ namespace magic_v2 if (it != const_defm.end()) return &it->second; - return NULL; + return nullptr; } static dumb_ptr<effect_t> new_effect(EFFECT ty) diff --git a/src/map/magic.cpp b/src/map/magic.cpp index 2cfa1e4..ff4a278 100644 --- a/src/map/magic.cpp +++ b/src/map/magic.cpp @@ -97,11 +97,11 @@ int magic_message(dumb_ptr<map_session_data> caster, XString source_invocation) if (bool(spell->flags & SPELL_FLAG::NONMAGIC) || (power >= 1)) effects = spell_trigger(spell, caster, env, &near_miss); else - effects = NULL; + effects = nullptr; #ifdef DEBUG FPRINTF(stderr, "Found spell `%s', triggered = %d\n"_fmt, spell_, - effects != NULL); + effects != nullptr); #endif MAP_LOG_PC(caster, "CAST %s %s"_fmt, diff --git a/src/map/map.cpp b/src/map/map.cpp index 28d618b..97523b0 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -189,12 +189,12 @@ struct block_list bl_head; */ int map_addblock(dumb_ptr<block_list> bl) { - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_prev) { if (battle_config.error_log) - PRINTF("map_addblock error : bl->bl_prev!=NULL\n"_fmt); + PRINTF("map_addblock error : bl->bl_prev!=nullptr\n"_fmt); return 0; } @@ -234,7 +234,7 @@ int map_addblock(dumb_ptr<block_list> bl) */ int map_delblock(dumb_ptr<block_list> bl) { - nullpo_ret(bl); + nullpo_retz(bl); // 既にblocklistから抜けている if (!bl->bl_prev) @@ -243,7 +243,7 @@ int map_delblock(dumb_ptr<block_list> bl) { // prevがNULLでnextがNULLでないのは有ってはならない if (battle_config.error_log) - PRINTF("map_delblock error : bl->bl_next!=NULL\n"_fmt); + PRINTF("map_delblock error : bl->bl_next!=nullptr\n"_fmt); } return 0; } @@ -269,8 +269,8 @@ int map_delblock(dumb_ptr<block_list> bl) { bl->bl_prev->bl_next = bl->bl_next; } - bl->bl_next = NULL; - bl->bl_prev = NULL; + bl->bl_next = nullptr; + bl->bl_prev = nullptr; return 0; } @@ -282,7 +282,7 @@ int map_delblock(dumb_ptr<block_list> bl) int map_count_oncell(map_local *m, int x, int y) { int bx, by; - dumb_ptr<block_list> bl = NULL; + dumb_ptr<block_list> bl = nullptr; int count = 0; if (x < 0 || y < 0 || (x >= m->xs) || (y >= m->ys)) @@ -606,7 +606,7 @@ void map_delobject(BlockId id, BL type) assert (id < MAX_FLOORITEM); dumb_ptr<block_list> obj = object[id._value]; - if (obj == NULL) + if (obj == nullptr) return; map_delobjectnofree(id, type); @@ -666,7 +666,7 @@ void map_clearflooritem_timer(TimerData *tid, tick_t, BlockId id) dumb_ptr<flooritem_data> fitem = obj->is_item(); if (!tid) fitem->cleartimer.cancel(); - clif_clearflooritem(fitem, 0); + clif_clearflooritem(fitem, nullptr); map_delobject(fitem->bl_id, BL::ITEM); } @@ -702,7 +702,7 @@ BlockId map_addflooritem_any(Item *item_data, int amount, dumb_ptr<map_session_data> *owners, interval_t *owner_protection, interval_t lifetime, int dispersal) { - dumb_ptr<flooritem_data> fitem = NULL; + dumb_ptr<flooritem_data> fitem = nullptr; nullpo_retr(BlockId(), item_data); auto xy = map_searchrandfreecell(m, x, y, dispersal); @@ -711,7 +711,7 @@ BlockId map_addflooritem_any(Item *item_data, int amount, fitem.new_(); fitem->bl_type = BL::ITEM; - fitem->bl_prev = fitem->bl_next = NULL; + fitem->bl_prev = fitem->bl_next = nullptr; fitem->bl_m = m; fitem->bl_x = xy.first; fitem->bl_y = xy.second; @@ -789,7 +789,7 @@ BlockId map_addflooritem(Item *item_data, int amount, void map_addchariddb(CharId charid, CharName name) { struct charid2nick *p = charid_db.search(charid); - if (p == NULL) + if (p == nullptr) p = charid_db.init(charid); p->nick = name; @@ -901,7 +901,7 @@ dumb_ptr<map_session_data> map_id2sd(BlockId id) bl=numdb_search(id_db,id); if (bl && bl->bl_type==BL::PC) return (struct map_session_data*)bl; - return NULL; + return nullptr; */ for (io::FD i : iter_fds()) { @@ -916,7 +916,7 @@ dumb_ptr<map_session_data> map_id2sd(BlockId id) } } - return NULL; + return nullptr; } /*========================================== @@ -927,7 +927,7 @@ CharName map_charid2nick(CharId id) { struct charid2nick *p = charid_db.search(id); - if (p == NULL) + if (p == nullptr) return CharName(); if (p->req_id != 0) return CharName(); @@ -949,7 +949,7 @@ dumb_ptr<map_session_data> map_get_session(io::FD i) return dumb_ptr<map_session_data>(d); } - return NULL; + return nullptr; } static @@ -962,7 +962,7 @@ dumb_ptr<map_session_data> map_get_session_forward(int start) return d; } - return NULL; + return nullptr; } static @@ -975,7 +975,7 @@ dumb_ptr<map_session_data> map_get_session_backward(int start) return d; } - return NULL; + return nullptr; } dumb_ptr<map_session_data> map_get_first_session(void) @@ -1001,7 +1001,7 @@ dumb_ptr<map_session_data> map_get_prev_session(dumb_ptr<map_session_data> d) /*========================================== * Search session data from a nick name * (without sensitive case if necessary) - * return map_session_data pointer or NULL + * return map_session_data pointer or nullptr *------------------------------------------ */ dumb_ptr<map_session_data> map_nick2sd(CharName nick) @@ -1020,7 +1020,7 @@ dumb_ptr<map_session_data> map_nick2sd(CharName nick) } } } - return NULL; + return nullptr; } /*========================================== @@ -1030,7 +1030,7 @@ dumb_ptr<map_session_data> map_nick2sd(CharName nick) */ dumb_ptr<block_list> map_id2bl(BlockId id) { - dumb_ptr<block_list> bl = NULL; + dumb_ptr<block_list> bl = nullptr; if (id < MAX_FLOORITEM) bl = object[id._value]; else @@ -1049,7 +1049,7 @@ int map_addnpc(map_local *m, dumb_ptr<npc_data> nd) if (!m) return -1; for (i = 0; i < m->npc_num && i < MAX_NPC_PER_MAP; i++) - if (m->npc[i] == NULL) + if (m->npc[i] == nullptr) break; if (i == MAX_NPC_PER_MAP) { @@ -1062,7 +1062,7 @@ int map_addnpc(map_local *m, dumb_ptr<npc_data> nd) m->npc_num++; } - nullpo_ret(nd); + nullpo_retz(nd); m->npc[i] = nd; nd->n = i; @@ -1083,7 +1083,7 @@ void map_removenpc(void) map_local *m = static_cast<map_local *>(mitp.second.get()); for (int i = 0; i < m->npc_num && i < MAX_NPC_PER_MAP; i++) { - if (m->npc[i] != NULL) + if (m->npc[i] != nullptr) { clif_clearchar(m->npc[i], BeingRemoveWhy::QUIT); map_delblock(m->npc[i]); @@ -1108,7 +1108,7 @@ void map_removenpc(void) map_local *map_mapname2mapid(MapName name) { map_abstract *md = maps_db.get(name); - if (md == NULL || md->gat == NULL) + if (md == nullptr || md->gat == nullptr) return nullptr; return static_cast<map_local *>(md); } @@ -1120,7 +1120,7 @@ map_local *map_mapname2mapid(MapName name) int map_mapname2ipport(MapName name, IP4Address *ip, int *port) { map_abstract *md = maps_db.get(name); - if (md == NULL || md->gat) + if (md == nullptr || md->gat) return -1; map_remote *mdos = static_cast<map_remote *>(md); *ip = mdos->ip; @@ -1229,12 +1229,12 @@ void map_setcell(map_local *m, int x, int y, MapCell t) int map_setipport(MapName name, IP4Address ip, int port) { map_abstract *md = maps_db.get(name); - if (md == NULL) + if (md == nullptr) { // not exist -> add new data auto mdos = make_unique<map_remote>(); mdos->name_ = name; - mdos->gat = NULL; + mdos->gat = nullptr; mdos->ip = ip; mdos->port = port; maps_db.put(mdos->name_, std::move(mdos)); @@ -1397,7 +1397,7 @@ void map_close_logfile(void) "gzip", "-f", filename.c_str(), - NULL + nullptr }; char **argv = const_cast<char **>(args); @@ -1408,7 +1408,7 @@ void map_close_logfile(void) execvp("gzip", argv); _exit(1); } - wait(NULL); + wait(nullptr); } } @@ -1435,7 +1435,7 @@ void map_set_logfile(AString filename) struct timeval tv; map_logfile_name = std::move(filename); - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); map_start_logfile(tv.tv_sec >> LOGFILE_SECONDS_PER_CHUNK_SHIFT); @@ -1466,7 +1466,7 @@ void map_log(XString line) static bool map_config_read(ZString cfgName) { - struct hostent *h = NULL; + struct hostent *h = nullptr; io::ReadFile in(cfgName); if (!in.is_open()) @@ -1503,7 +1503,7 @@ bool map_config_read(ZString cfgName) { h = gethostbyname(w2.c_str()); IP4Address w2ip; - if (h != NULL) + if (h != nullptr) { w2ip = IP4Address({ static_cast<uint8_t>(h->h_addr[0]), @@ -1529,7 +1529,7 @@ bool map_config_read(ZString cfgName) { h = gethostbyname(w2.c_str()); IP4Address w2ip; - if (h != NULL) + if (h != nullptr) { w2ip = IP4Address({ static_cast<uint8_t>(h->h_addr[0]), diff --git a/src/map/map.hpp b/src/map/map.hpp index 8fc752b..aa2d97a 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -509,7 +509,7 @@ struct BlockLists struct map_abstract { MapName name_; - // gat is NULL for map_remote and non-NULL or map_local + // gat is nullptr for map_remote and non-nullptr or map_local std::unique_ptr<MapCell[]> gat; virtual ~map_abstract() {} diff --git a/src/map/mob.cpp b/src/map/mob.cpp index 01a1029..166031f 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -132,8 +132,8 @@ void mob_spawn_dataset(dumb_ptr<mob_data> md, MobName mobname, Species mob_class else md->name = mobname; - md->bl_prev = NULL; - md->bl_next = NULL; + md->bl_prev = nullptr; + md->bl_next = nullptr; md->n = 0; md->mob_class = mob_class; md->bl_id = npc_get_new_npc_id(); @@ -400,7 +400,7 @@ BlockId mob_once_spawn(dumb_ptr<map_session_data> sd, MobName mobname, Species mob_class, int amount, NpcEvent event) { - dumb_ptr<mob_data> md = NULL; + dumb_ptr<mob_data> md = nullptr; map_local *m; int count; @@ -555,7 +555,7 @@ int mob_get_equip(Species mob_class) // mob equip [Valaris] static int mob_can_move(dumb_ptr<mob_data> md) { - nullpo_ret(md); + nullpo_retz(md); if (md->canmove_tick > gettick() || (bool(md->opt1) && md->opt1 != Opt1::_stone6)) @@ -593,7 +593,7 @@ int mob_walk(dumb_ptr<mob_data> md, tick_t tick, unsigned char data) int moveblock; int x, y, dx, dy; - nullpo_ret(md); + nullpo_retz(md); md->state.state = MS::IDLE; if (md->walkpath.path_pos >= md->walkpath.path_len @@ -688,14 +688,14 @@ int mob_walk(dumb_ptr<mob_data> md, tick_t tick, unsigned char data) static int mob_check_attack(dumb_ptr<mob_data> md) { - dumb_ptr<block_list> tbl = NULL; - dumb_ptr<map_session_data> tsd = NULL; - dumb_ptr<mob_data> tmd = NULL; + dumb_ptr<block_list> tbl = nullptr; + dumb_ptr<map_session_data> tsd = nullptr; + dumb_ptr<mob_data> tmd = nullptr; MobMode mode; int range; - nullpo_ret(md); + nullpo_retz(md); md->min_chase = 13; md->state.state = MS::IDLE; @@ -707,7 +707,7 @@ int mob_check_attack(dumb_ptr<mob_data> md) if (bool(md->opt1)) return 0; - if ((tbl = map_id2bl(md->target_id)) == NULL) + if ((tbl = map_id2bl(md->target_id)) == nullptr) { md->target_id = BlockId(); md->state.attackable = false; @@ -724,7 +724,7 @@ int mob_check_attack(dumb_ptr<mob_data> md) if (tsd) { if (pc_isdead(tsd) || tsd->invincible_timer - || pc_isinvisible(tsd) || md->bl_m != tbl->bl_m || tbl->bl_prev == NULL + || pc_isinvisible(tsd) || md->bl_m != tbl->bl_m || tbl->bl_prev == nullptr || distance(md->bl_x, md->bl_y, tbl->bl_x, tbl->bl_y) >= 13) { md->target_id = BlockId(); @@ -734,7 +734,7 @@ int mob_check_attack(dumb_ptr<mob_data> md) } if (tmd) { - if (md->bl_m != tbl->bl_m || tbl->bl_prev == NULL + if (md->bl_m != tbl->bl_m || tbl->bl_prev == nullptr || distance(md->bl_x, md->bl_y, tbl->bl_x, tbl->bl_y) >= 13) { md->target_id = BlockId(); @@ -790,11 +790,11 @@ void mob_ancillary_attack(dumb_ptr<block_list> bl, static int mob_attack(dumb_ptr<mob_data> md, tick_t tick) { - dumb_ptr<block_list> tbl = NULL; + dumb_ptr<block_list> tbl = nullptr; - nullpo_ret(md); + nullpo_retz(md); - if ((tbl = map_id2bl(md->target_id)) == NULL) + if ((tbl = map_id2bl(md->target_id)) == nullptr) return 0; if (!mob_check_attack(md)) @@ -851,7 +851,7 @@ void mob_stopattacked(dumb_ptr<map_session_data> sd, BlockId id) static int mob_changestate(dumb_ptr<mob_data> md, MS state, bool type) { - nullpo_ret(md); + nullpo_retz(md); md->timer.cancel(); md->state.state = state; @@ -926,7 +926,7 @@ void mob_timer(TimerData *, tick_t tick, BlockId id, unsigned char data) dumb_ptr<mob_data> md; dumb_ptr<block_list> bl; bl = map_id2bl(id); - if (bl == NULL) + if (bl == nullptr) { //攻撃してきた敵がもういないのは正常のようだ return; } @@ -936,7 +936,7 @@ void mob_timer(TimerData *, tick_t tick, BlockId id, unsigned char data) md = bl->is_mob(); - if (md->bl_prev == NULL || md->state.state == MS::DEAD) + if (md->bl_prev == nullptr || md->state.state == MS::DEAD) return; MapBlockLock lock; @@ -966,7 +966,7 @@ int mob_walktoxy_sub(dumb_ptr<mob_data> md) { struct walkpath_data wpd; - nullpo_ret(md); + nullpo_retz(md); if (path_search(&wpd, md->bl_m, md->bl_x, md->bl_y, md->to_x, md->to_y, md->state.walk_easy)) @@ -989,7 +989,7 @@ int mob_walktoxy(dumb_ptr<mob_data> md, int x, int y, int easy) { struct walkpath_data wpd; - nullpo_ret(md); + nullpo_retz(md); if (md->state.state == MS::WALK && path_search(&wpd, md->bl_m, md->bl_x, md->bl_y, x, y, easy)) @@ -1030,7 +1030,7 @@ int mob_setdelayspawn(BlockId id) dumb_ptr<mob_data> md; dumb_ptr<block_list> bl; - if ((bl = map_id2bl(id)) == NULL) + if ((bl = map_id2bl(id)) == nullptr) return -1; if (!bl || bl->bl_type == BL::NUL || bl->bl_type != BL::MOB) @@ -1089,7 +1089,7 @@ int mob_spawn(BlockId id) return -1; md->last_spawntime = tick; - if (md->bl_prev != NULL) + if (md->bl_prev != nullptr) { map_delblock(md); } @@ -1219,7 +1219,7 @@ int mob_stopattack(dumb_ptr<mob_data> md) */ int mob_stop_walking(dumb_ptr<mob_data> md, int type) { - nullpo_ret(md); + nullpo_retz(md); if (md->state.state == MS::WALK || md->state.state == MS::IDLE) { @@ -1272,8 +1272,8 @@ int mob_can_reach(dumb_ptr<mob_data> md, dumb_ptr<block_list> bl, int range) struct walkpath_data wpd; int i; - nullpo_ret(md); - nullpo_ret(bl); + nullpo_retz(md); + nullpo_retz(bl); dx = abs(bl->bl_x - md->bl_x); dy = abs(bl->bl_y - md->bl_y); @@ -1329,8 +1329,8 @@ int mob_target(dumb_ptr<mob_data> md, dumb_ptr<block_list> bl, int dist) eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; MobMode mode; - nullpo_ret(md); - nullpo_ret(bl); + nullpo_retz(md); + nullpo_retz(bl); sc_data = battle_get_sc_data(bl); Option *option = battle_get_option(bl); @@ -1357,14 +1357,14 @@ int mob_target(dumb_ptr<mob_data> md, dumb_ptr<block_list> bl, int dist) // Coercion is exerted if it is MVPMOB. if (bool(mode & MobMode::BOSS) - || (option != NULL + || (option != nullptr || race == Race::_insect || race == Race::_demon)) { if (bl->bl_type == BL::PC) { sd = bl->is_player(); - nullpo_ret(sd); + nullpo_retz(sd); if (sd->invincible_timer || pc_isinvisible(sd)) return 0; if (!bool(mode & MobMode::BOSS) && race != Race::_insect && race != Race::_demon @@ -1392,8 +1392,8 @@ static void mob_ai_sub_hard_activesearch(dumb_ptr<block_list> bl, dumb_ptr<mob_data> smd, int *pcc) { - dumb_ptr<map_session_data> tsd = NULL; - dumb_ptr<mob_data> tmd = NULL; + dumb_ptr<map_session_data> tsd = nullptr; + dumb_ptr<mob_data> tmd = nullptr; MobMode mode; int dist; @@ -1544,14 +1544,14 @@ void mob_ai_sub_hard_linksearch(dumb_ptr<block_list> bl, dumb_ptr<mob_data> md, static int mob_ai_sub_hard_slavemob(dumb_ptr<mob_data> md, tick_t tick) { - dumb_ptr<mob_data> mmd = NULL; + dumb_ptr<mob_data> mmd = nullptr; dumb_ptr<block_list> bl; MobMode mode; int old_dist; - nullpo_ret(md); + nullpo_retz(md); - if ((bl = map_id2bl(md->master_id)) != NULL) + if ((bl = map_id2bl(md->master_id)) != nullptr) mmd = bl->is_mob(); mode = get_mob_db(md->mob_class).mode; @@ -1646,7 +1646,7 @@ int mob_ai_sub_hard_slavemob(dumb_ptr<mob_data> md, tick_t tick) && (!md->target_id || !md->state.attackable)) { dumb_ptr<map_session_data> sd = map_id2sd(mmd->target_id); - if (sd != NULL && !pc_isdead(sd) && !sd->invincible_timer + if (sd != nullptr && !pc_isdead(sd) && !sd->invincible_timer && !pc_isinvisible(sd)) { @@ -1676,7 +1676,7 @@ int mob_ai_sub_hard_slavemob(dumb_ptr<mob_data> md, tick_t tick) static int mob_unlocktarget(dumb_ptr<mob_data> md, tick_t tick) { - nullpo_ret(md); + nullpo_retz(md); md->target_id = BlockId(); md->state.attackable = false; @@ -1694,7 +1694,7 @@ int mob_randomwalk(dumb_ptr<mob_data> md, tick_t tick) { const int retrycount = 20; - nullpo_ret(md); + nullpo_retz(md); interval_t speed = battle_get_speed(md); if (md->next_walktime < tick) @@ -1749,9 +1749,9 @@ int mob_randomwalk(dumb_ptr<mob_data> md, tick_t tick) static void mob_ai_sub_hard(dumb_ptr<block_list> bl, tick_t tick) { - dumb_ptr<mob_data> md, tmd = NULL; - dumb_ptr<map_session_data> tsd = NULL; - dumb_ptr<block_list> tbl = NULL; + dumb_ptr<mob_data> md, tmd = nullptr; + dumb_ptr<map_session_data> tsd = nullptr; + dumb_ptr<block_list> tbl = nullptr; dumb_ptr<flooritem_data> fitem; int i, dx, dy, ret, dist; int attack_type = 0; @@ -1764,7 +1764,7 @@ void mob_ai_sub_hard(dumb_ptr<block_list> bl, tick_t tick) return; md->last_thinktime = tick; - if (md->skilltimer || md->bl_prev == NULL) + if (md->skilltimer || md->bl_prev == nullptr) { // Under a skill aria and death if (tick > md->next_walktime + MIN_MOBTHINKTIME) @@ -1808,12 +1808,12 @@ void mob_ai_sub_hard(dumb_ptr<block_list> bl, tick_t tick) || (bool(mode & MobMode::AGGRESSIVE) && random_::chance({25, 100})))) { dumb_ptr<block_list> abl = map_id2bl(md->attacked_id); - dumb_ptr<map_session_data> asd = NULL; + dumb_ptr<map_session_data> asd = nullptr; if (abl) { if (abl->bl_type == BL::PC) asd = abl->is_player(); - if (asd == NULL || md->bl_m != abl->bl_m || abl->bl_prev == NULL + if (asd == nullptr || md->bl_m != abl->bl_m || abl->bl_prev == nullptr || asd->invincible_timer || pc_isinvisible(asd) || (dist = distance(md->bl_x, md->bl_y, abl->bl_x, abl->bl_y)) >= 32 @@ -1885,7 +1885,7 @@ void mob_ai_sub_hard(dumb_ptr<block_list> bl, tick_t tick) tmd = tbl->is_mob(); if (tsd || tmd) { - if (tbl->bl_m != md->bl_m || tbl->bl_prev == NULL + if (tbl->bl_m != md->bl_m || tbl->bl_prev == nullptr || (dist = distance(md->bl_x, md->bl_y, tbl->bl_x, tbl->bl_y)) >= md->min_chase) @@ -1974,7 +1974,7 @@ void mob_ai_sub_hard(dumb_ptr<block_list> bl, tick_t tick) } else { // ルートモンスター処理 - if (tbl == NULL || tbl->bl_type != BL::ITEM || tbl->bl_m != md->bl_m + if (tbl == nullptr || tbl->bl_type != BL::ITEM || tbl->bl_m != md->bl_m || (dist = distance(md->bl_x, md->bl_y, tbl->bl_x, tbl->bl_y)) >= md->min_chase @@ -2105,7 +2105,7 @@ void mob_ai_sub_lazy(dumb_ptr<block_list> bl, tick_t tick) return; md->last_thinktime = tick; - if (md->bl_prev == NULL || md->skilltimer) + if (md->bl_prev == nullptr || md->skilltimer) { if (tick > md->next_walktime + MIN_MOBTHINKTIME * 10) md->next_walktime = tick; @@ -2254,7 +2254,7 @@ int mob_delete(dumb_ptr<mob_data> md) { nullpo_retr(1, md); - if (md->bl_prev == NULL) + if (md->bl_prev == nullptr) return 1; mob_changestate(md, MS::DEAD, 0); clif_clearchar(md, BeingRemoveWhy::DEAD); @@ -2268,7 +2268,7 @@ int mob_catch_delete(dumb_ptr<mob_data> md, BeingRemoveWhy type) { nullpo_retr(1, md); - if (md->bl_prev == NULL) + if (md->bl_prev == nullptr) return 1; mob_changestate(md, MS::DEAD, 0); clif_clearchar(md, type); @@ -2301,7 +2301,7 @@ void mob_deleteslave_sub(dumb_ptr<block_list> bl, BlockId id) md = bl->is_mob(); if (md->master_id && md->master_id == id) - mob_damage(NULL, md, md->hp, 1); + mob_damage(nullptr, md, md->hp, 1); } /*========================================== @@ -2310,7 +2310,7 @@ void mob_deleteslave_sub(dumb_ptr<block_list> bl, BlockId id) */ int mob_deleteslave(dumb_ptr<mob_data> md) { - nullpo_ret(md); + nullpo_retz(md); map_foreachinarea(std::bind(mob_deleteslave_sub, ph::_1, md->bl_id), md->bl_m, @@ -2335,12 +2335,12 @@ double damage_bonus_factor[DAMAGE_BONUS_COUNT + 1] = int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage, int type) { - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; int max_hp; tick_t tick = gettick(); - dumb_ptr<map_session_data> mvp_sd = NULL, second_sd = NULL, third_sd = NULL; + dumb_ptr<map_session_data> mvp_sd = nullptr, second_sd = nullptr, third_sd = nullptr; - nullpo_ret(md); //srcはNULLで呼ばれる場合もあるので、他でチェック + nullpo_retz(md); //srcはNULLで呼ばれる場合もあるので、他でチェック if (src && src->bl_id == md->master_id && bool(md->mode & MobMode::TURNS_AGAINST_BAD_MASTER)) @@ -2360,7 +2360,7 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage, mvp_sd = sd; } - if (md->bl_prev == NULL) + if (md->bl_prev == nullptr) { if (battle_config.error_log == 1) PRINTF("mob_damage : BlockError!!\n"_fmt); @@ -2369,7 +2369,7 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage, if (md->state.state == MS::DEAD || md->hp <= 0) { - if (md->bl_prev != NULL) + if (md->bl_prev != nullptr) { mob_changestate(md, MS::DEAD, 0); // It is skill at the time of death. @@ -2395,7 +2395,7 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage, if (!(type & 2)) { - if (sd != NULL) + if (sd != nullptr) { for (mob_data::DmgLogEntry& dle : md->dmglogv) { @@ -2430,7 +2430,7 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage, damage); } - nullpo_ret(md2); + nullpo_retz(md2); for (mob_data::DmgLogEntry& dle : md->dmglogv) { if (dle.id == md2->master_id) @@ -2501,7 +2501,7 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage, { dumb_ptr<map_session_data> tmpsdi = map_id2sd(dle.id); int tmpdmg = dle.dmg; - if (tmpsdi == NULL) + if (tmpsdi == nullptr) continue; if (tmpsdi->bl_m != md->bl_m || pc_isdead(tmpsdi)) continue; @@ -2668,9 +2668,9 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage, // SCRIPT実行 if (md->npc_event) { - if (sd == NULL) + if (sd == nullptr) { - if (mvp_sd != NULL) + if (mvp_sd != nullptr) sd = mvp_sd; else { @@ -2711,7 +2711,7 @@ int mob_heal(dumb_ptr<mob_data> md, int heal) { int max_hp = battle_get_max_hp(md); - nullpo_ret(md); + nullpo_retz(md); md->hp += heal; if (max_hp < md->hp) @@ -2758,9 +2758,9 @@ int mob_warp(dumb_ptr<mob_data> md, map_local *m, int x, int y, BeingRemoveWhy t { int i = 0, xs = 0, ys = 0, bx = x, by = y; - nullpo_ret(md); + nullpo_retz(md); - if (md->bl_prev == NULL) + if (md->bl_prev == nullptr) return 0; if (m == nullptr) @@ -2859,7 +2859,7 @@ int mob_countslave(dumb_ptr<mob_data> md) { int c = 0; - nullpo_ret(md); + nullpo_retz(md); map_foreachinarea(std::bind(mob_countslave_sub, ph::_1, md->bl_id, &c), md->bl_m, @@ -2878,8 +2878,8 @@ int mob_summonslave(dumb_ptr<mob_data> md2, int *value_, int amount, int flag) dumb_ptr<mob_data> md; int bx, by, count = 0, a = amount; - nullpo_ret(md2); - nullpo_ret(value_); + nullpo_retz(md2); + nullpo_retz(value_); bx = md2->bl_x; by = md2->bl_y; @@ -2922,8 +2922,8 @@ int mob_summonslave(dumb_ptr<mob_data> md2, int *value_, int amount, int flag) } mob_spawn_dataset(md, JAPANESE_NAME, mob_class); - md->bl_prev = NULL; - md->bl_next = NULL; + md->bl_prev = nullptr; + md->bl_next = nullptr; md->bl_m = m; md->bl_x = x; md->bl_y = y; @@ -2987,7 +2987,7 @@ int mob_counttargeted(dumb_ptr<mob_data> md, dumb_ptr<block_list> src, { int c = 0; - nullpo_ret(md); + nullpo_retz(md); map_foreachinarea(std::bind(mob_counttargeted_sub, ph::_1, md->bl_id, &c, src, target_lv), md->bl_m, @@ -3007,19 +3007,19 @@ int mob_counttargeted(dumb_ptr<mob_data> md, dumb_ptr<block_list> src, */ void mobskill_castend_id(TimerData *, tick_t tick, BlockId id) { - dumb_ptr<mob_data> md = NULL; + dumb_ptr<mob_data> md = nullptr; dumb_ptr<block_list> bl; dumb_ptr<block_list> mbl; int range; - if ((mbl = map_id2bl(id)) == NULL) //詠唱したMobがもういないというのは良くある正常処理 + if ((mbl = map_id2bl(id)) == nullptr) //詠唱したMobがもういないというのは良くある正常処理 return; - if ((md = mbl->is_mob()) == NULL) + if ((md = mbl->is_mob()) == nullptr) { PRINTF("mobskill_castend_id nullpo mbl->bl_id:%d\n"_fmt, mbl->bl_id); return; } - if (md->bl_type != BL::MOB || md->bl_prev == NULL) + if (md->bl_type != BL::MOB || md->bl_prev == nullptr) return; if (bool(md->opt1)) @@ -3028,7 +3028,7 @@ void mobskill_castend_id(TimerData *, tick_t tick, BlockId id) if (md->skillid != SkillID::NPC_EMOTION) md->last_thinktime = tick + battle_get_adelay(md); - if ((bl = map_id2bl(md->skilltarget)) == NULL || bl->bl_prev == NULL) + if ((bl = map_id2bl(md->skilltarget)) == nullptr || bl->bl_prev == nullptr) { //スキルターゲットが存在しない return; } @@ -3073,18 +3073,18 @@ void mobskill_castend_id(TimerData *, tick_t tick, BlockId id) */ void mobskill_castend_pos(TimerData *, tick_t tick, BlockId id) { - dumb_ptr<mob_data> md = NULL; + dumb_ptr<mob_data> md = nullptr; dumb_ptr<block_list> bl; int range; //mobskill_castend_id同様詠唱したMobが詠唱完了時にもういないというのはありそうなのでnullpoから除外 - if ((bl = map_id2bl(id)) == NULL) + if ((bl = map_id2bl(id)) == nullptr) return; md = bl->is_mob(); nullpo_retv(md); - if (md->bl_type != BL::MOB || md->bl_prev == NULL) + if (md->bl_type != BL::MOB || md->bl_prev == nullptr) return; if (bool(md->opt1)) @@ -3115,13 +3115,13 @@ int mobskill_use_id(dumb_ptr<mob_data> md, dumb_ptr<block_list> target, SkillID skill_id; int skill_lv; - nullpo_ret(md); + nullpo_retz(md); ms = &skill_idx; - if (target == NULL && (target = map_id2bl(md->target_id)) == NULL) + if (target == nullptr && (target = map_id2bl(md->target_id)) == nullptr) return 0; - if (target->bl_prev == NULL || md->bl_prev == NULL) + if (target->bl_prev == nullptr || md->bl_prev == nullptr) return 0; skill_id = ms->skill_id; @@ -3190,10 +3190,10 @@ int mobskill_use_pos(dumb_ptr<mob_data> md, struct block_list bl; int skill_lv; - nullpo_ret(md); + nullpo_retz(md); ms = &skill_idx; - if (md->bl_prev == NULL) + if (md->bl_prev == nullptr) return 0; SkillID skill_id = ms->skill_id; @@ -3257,7 +3257,7 @@ int mobskill_use(dumb_ptr<mob_data> md, tick_t tick, { int max_hp; - nullpo_ret(md); + nullpo_retz(md); std::vector<mob_skill>& ms = get_mob_db(md->mob_class).skills; max_hp = battle_get_max_hp(md); @@ -3312,7 +3312,7 @@ int mobskill_use(dumb_ptr<mob_data> md, tick_t tick, if (skill_get_inf(msii.skill_id) & 2) { // 場所指定 - dumb_ptr<block_list> bl = NULL; + dumb_ptr<block_list> bl = nullptr; int x = 0, y = 0; { if (msii.target == MobSkillTarget::MST_TARGET) @@ -3334,7 +3334,7 @@ int mobskill_use(dumb_ptr<mob_data> md, tick_t tick, else { { - dumb_ptr<block_list> bl = NULL; + dumb_ptr<block_list> bl = nullptr; if (msii.target == MobSkillTarget::MST_TARGET) bl = map_id2bl(md->target_id); else @@ -3358,7 +3358,7 @@ int mobskill_use(dumb_ptr<mob_data> md, tick_t tick, */ int mobskill_event(dumb_ptr<mob_data> md, BF flag) { - nullpo_ret(md); + nullpo_retz(md); if (flag == BF::NEGATIVE_1 && mobskill_use(md, gettick(), MobSkillCondition::ANY)) diff --git a/src/map/npc.cpp b/src/map/npc.cpp index 7d2b8da..275b41d 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -123,7 +123,7 @@ void npc_enable_sub(dumb_ptr<block_list> bl, dumb_ptr<npc_data> nd) int npc_enable(NpcName name, bool flag) { dumb_ptr<npc_data> nd = npc_name2id(name); - if (nd == NULL) + if (nd == nullptr) { PRINTF("npc_enable(%s, %s) failed.\n"_fmt, name, flag ? "true"_s : "false"_s); return 0; @@ -172,7 +172,7 @@ dumb_ptr<npc_data> npc_name2id(NpcName name) */ int npc_event_dequeue(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); sd->npc_id = BlockId(); @@ -195,7 +195,7 @@ int npc_delete(dumb_ptr<npc_data> nd) { nullpo_retr(1, nd); - if (nd->bl_prev == NULL) + if (nd->bl_prev == nullptr) return 1; clif_clearchar(nd, BeingRemoveWhy::DEAD); @@ -209,7 +209,7 @@ void npc_timer_event(NpcEvent eventname) dumb_ptr<npc_data_script> nd; // int xs,ys; - if ((ev == NULL || (nd = ev->nd) == NULL)) + if ((ev == nullptr || (nd = ev->nd) == nullptr)) { PRINTF("npc_event: event not found [%s]\n"_fmt, eventname); @@ -330,7 +330,7 @@ static void npc_timerevent(TimerData *, tick_t tick, BlockId id, interval_t data) { dumb_ptr<npc_data_script> nd = map_id2bl(id)->is_npc()->is_script(); - assert (nd != NULL); + assert (nd != nullptr); assert (nd->npc_subtype == NpcSubtype::SCRIPT); assert (nd->scr.next_event != nd->scr.timer_eventv.end()); @@ -466,15 +466,15 @@ int npc_event(dumb_ptr<map_session_data> sd, NpcEvent eventname, dumb_ptr<npc_data_script> nd; int xs, ys; - if (sd == NULL) + if (sd == nullptr) { PRINTF("npc_event nullpo?\n"_fmt); } - if (ev == NULL && eventname.label == stringish<ScriptLabel>("OnTouch"_s)) + if (ev == nullptr && eventname.label == stringish<ScriptLabel>("OnTouch"_s)) return 1; - if (ev == NULL || (nd = ev->nd) == NULL) + if (ev == nullptr || (nd = ev->nd) == nullptr) { if (mob_kill) { @@ -635,11 +635,11 @@ int npc_checknear(dumb_ptr<map_session_data> sd, BlockId id) { dumb_ptr<npc_data> nd; - nullpo_ret(sd); + nullpo_retz(sd); nd = map_id_is_npc(id); // this actually happens - if (nd == NULL) + if (nd == nullptr) return 1; if (nd->bl_type != BL::NPC) return 1; @@ -846,7 +846,7 @@ int npc_buylist(dumb_ptr<map_session_data> sd, const ItemNameId& item_l_id = item_list[i].name_id; struct item_data *item_data; - if ((item_data = itemdb_exists(item_l_id)) != NULL) + if ((item_data = itemdb_exists(item_l_id)) != nullptr) { int amount = item_l_count; Item item_tmp {}; @@ -1027,7 +1027,7 @@ int npc_parse_warp(XString w1, XString, NpcName w3, XString w4) nd->bl_id = npc_get_new_npc_id(); nd->n = map_addnpc(m, nd); - nd->bl_prev = nd->bl_next = NULL; + nd->bl_prev = nd->bl_next = nullptr; nd->bl_m = m; nd->bl_x = x; nd->bl_y = y; @@ -1088,7 +1088,7 @@ bool extract(XString xs, npc_item_list *itv) goto return_true; id = itemdb_searchname(name_or_id.rstrip()); - if (id == NULL) + if (id == nullptr) return false; itv->nameid = id->nameid; goto return_true; @@ -1096,7 +1096,7 @@ bool extract(XString xs, npc_item_list *itv) return_true: if (itv->value < 0) { - if (id == NULL) + if (id == nullptr) id = itemdb_search(itv->nameid); itv->value = id->value_buy * abs(itv->value); } @@ -1145,7 +1145,7 @@ int npc_parse_shop(XString w1, XString, NpcName w3, ZString w4a) return 1; } - nd->bl_prev = nd->bl_next = NULL; + nd->bl_prev = nd->bl_next = nullptr; nd->bl_m = m; nd->bl_x = x; nd->bl_y = y; @@ -1200,7 +1200,7 @@ int npc_parse_script(XString w1, XString w2, NpcName w3, ZString w4, int xs = 0, ys = 0; // [Valaris] thanks to fov Species npc_class; MapName mapname; - std::unique_ptr<const ScriptBuffer> script = NULL; + std::unique_ptr<const ScriptBuffer> script = nullptr; dumb_ptr<npc_data_script> nd; int evflag = 0; @@ -1257,7 +1257,7 @@ int npc_parse_script(XString w1, XString w2, NpcName w3, ZString w4, srcbuf += '\n'; } script = parse_script(AString(srcbuf), startline, false); - if (script == NULL) + if (script == nullptr) // script parse error? return 1; } @@ -1327,7 +1327,7 @@ int npc_parse_script(XString w1, XString w2, NpcName w3, ZString w4, nd->name = w3; } - nd->bl_prev = nd->bl_next = NULL; + nd->bl_prev = nd->bl_next = nullptr; nd->bl_m = m; nd->bl_x = x; nd->bl_y = y; @@ -1452,7 +1452,7 @@ int npc_parse_function(XString, XString, XString w3, ZString, srcbuf += '\n'; } std::unique_ptr<const ScriptBuffer> script = parse_script(AString(srcbuf), startline, false); - if (script == NULL) + if (script == nullptr) { // script parse error? return 1; @@ -1500,8 +1500,8 @@ int npc_parse_mob(XString w1, XString, MobName w3, ZString w4) { md.new_(); - md->bl_prev = NULL; - md->bl_next = NULL; + md->bl_prev = nullptr; + md->bl_next = nullptr; md->bl_m = m; md->bl_x = x; md->bl_y = y; diff --git a/src/map/npc.hpp b/src/map/npc.hpp index 2c91dbd..f8ae650 100644 --- a/src/map/npc.hpp +++ b/src/map/npc.hpp @@ -63,7 +63,7 @@ BlockId npc_get_new_npc_id(void); /** * Spawns and installs a talk-only NPC * - * \param message The message to speak. If message is NULL, the NPC will not do anything at all. + * \param message The message to speak. If message is nullptr, the NPC will not do anything at all. */ dumb_ptr<npc_data> npc_spawn_text(map_local *m, int x, int y, Species class_, NpcName name, AString message); diff --git a/src/map/party.cpp b/src/map/party.cpp index 24ce66a..61df355 100644 --- a/src/map/party.cpp +++ b/src/map/party.cpp @@ -96,7 +96,7 @@ PartyPair party_searchname(PartyName str) /* Process a party creation request. */ int party_create(dumb_ptr<map_session_data> sd, PartyName name) { - nullpo_ret(sd); + nullpo_retz(sd); name = stringish<PartyName>(name.strip()); @@ -155,7 +155,7 @@ void party_request_info(PartyId party_id) static int party_check_member(PartyPair p) { - nullpo_ret(p); + nullpo_retz(p); for (io::FD i : iter_fds()) { @@ -177,7 +177,7 @@ int party_check_member(PartyPair p) else { // I can prove it was already zeroed - // p->member[j].sd = NULL; // 同垢別キャラだった + // p->member[j].sd = nullptr; // 同垢別キャラだった } } } @@ -217,7 +217,7 @@ int party_recv_info(const PartyPair sp) { int i; - nullpo_ret(sp); + nullpo_retz(sp); PartyPair p = party_search(sp.party_id); if (!p) @@ -234,8 +234,8 @@ int party_recv_info(const PartyPair sp) for (i = 0; i < MAX_PARTY; i++) { // sdの設定 dumb_ptr<map_session_data> sd = map_id2sd(account_to_block(p->member[i].account_id)); - p->member[i].sd = (sd != NULL - && sd->status.party_id == p.party_id) ? sd.operator->() : NULL; + p->member[i].sd = (sd != nullptr + && sd->status.party_id == p.party_id) ? sd.operator->() : nullptr; } clif_party_info(p, nullptr); @@ -244,7 +244,7 @@ int party_recv_info(const PartyPair sp) { // 設定情報の送信 // dumb_ptr<map_session_data> sd = map_id2sd(p->member[i].account_id); dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(p->member[i].sd); - if (sd != NULL && sd->party_sended == 0) + if (sd != nullptr && sd->party_sended == 0) { clif_party_option(p, sd, 0x100); sd->party_sended = 1; @@ -262,7 +262,7 @@ int party_invite(dumb_ptr<map_session_data> sd, AccountId account_id) int i; int full = 1; /* Indicates whether or not there's room for one more. */ - nullpo_ret(sd); + nullpo_retz(sd); if (!tsd || !p || !tsd->sess) return 0; @@ -321,7 +321,7 @@ int party_invite(dumb_ptr<map_session_data> sd, AccountId account_id) /* Process response to party invitation. */ int party_reply_invite(dumb_ptr<map_session_data> sd, AccountId account_id, int flag) { - nullpo_ret(sd); + nullpo_retz(sd); /* There is no pending invitation. */ if (!sd->party_invite || !sd->party_invite_account) @@ -341,7 +341,7 @@ int party_reply_invite(dumb_ptr<map_session_data> sd, AccountId account_id, int else { /* This is the player who sent the invitation. */ - dumb_ptr<map_session_data> tsd = NULL; + dumb_ptr<map_session_data> tsd = nullptr; sd->party_invite = PartyId(); sd->party_invite_account = AccountId(); @@ -358,7 +358,7 @@ int party_member_added(PartyId party_id, AccountId account_id, int flag) dumb_ptr<map_session_data> sd = map_id2sd(account_to_block(account_id)), sd2; PartyPair p = party_search(party_id); - if (sd == NULL) + if (sd == nullptr) { if (flag == 0) { @@ -382,7 +382,7 @@ int party_member_added(PartyId party_id, AccountId account_id, int flag) if (flag == 1) { // 失敗 - if (sd2 != NULL) + if (sd2 != nullptr) clif_party_inviteack(sd2, sd->status_key.name, 0); return 0; } @@ -391,7 +391,7 @@ int party_member_added(PartyId party_id, AccountId account_id, int flag) sd->party_sended = 0; sd->status.party_id = party_id; - if (sd2 != NULL) + if (sd2 != nullptr) clif_party_inviteack(sd2, sd->status_key.name, 2); // いちおう競合確認 @@ -408,7 +408,7 @@ int party_removemember(dumb_ptr<map_session_data> sd, AccountId account_id) PartyPair p; int i; - nullpo_ret(sd); + nullpo_retz(sd); if (!(p = party_search(sd->status.party_id))) return 0; @@ -439,7 +439,7 @@ int party_leave(dumb_ptr<map_session_data> sd) PartyPair p; int i; - nullpo_ret(sd); + nullpo_retz(sd); if (!(p = party_search(sd->status.party_id))) return 0; @@ -468,10 +468,10 @@ int party_member_leaved(PartyId party_id, AccountId account_id, CharName name) { clif_party_leaved(p, sd, account_id, name, 0x00); p->member[i].account_id = AccountId(); - p->member[i].sd = NULL; + p->member[i].sd = nullptr; } } - if (sd != NULL && sd->status.party_id == party_id) + if (sd != nullptr && sd->status.party_id == party_id) { sd->status.party_id = PartyId(); sd->party_sended = 0; @@ -489,7 +489,7 @@ int party_broken(PartyId party_id) for (i = 0; i < MAX_PARTY; i++) { - if (p->member[i].sd != NULL) + if (p->member[i].sd != nullptr) { clif_party_leaved(p, dumb_ptr<map_session_data>(p->member[i].sd), p->member[i].account_id, p->member[i].name, @@ -507,7 +507,7 @@ int party_changeoption(dumb_ptr<map_session_data> sd, int exp, int item) { PartyPair p; - nullpo_ret(sd); + nullpo_retz(sd); if (!sd->status.party_id || !(p = party_search(sd->status.party_id))) @@ -545,7 +545,7 @@ void party_recv_movemap(PartyId party_id, AccountId account_id, MapName mapname, for (i = 0; i < MAX_PARTY; i++) { PartyMember *m = &p->member[i]; - if (m == NULL) + if (m == nullptr) { PRINTF("party_recv_movemap nullpo?\n"_fmt); return; @@ -569,8 +569,8 @@ void party_recv_movemap(PartyId party_id, AccountId account_id, MapName mapname, for (i = 0; i < MAX_PARTY; i++) { // sd再設定 dumb_ptr<map_session_data> sd = map_id2sd(account_to_block(p->member[i].account_id)); - p->member[i].sd = (sd != NULL - && sd->status.party_id == p.party_id) ? sd.operator->() : NULL; + p->member[i].sd = (sd != nullptr + && sd->status.party_id == p.party_id) ? sd.operator->() : nullptr; } party_send_xy_clear(p); // 座標再通知要請 @@ -583,7 +583,7 @@ int party_send_movemap(dumb_ptr<map_session_data> sd) { PartyPair p; - nullpo_ret(sd); + nullpo_retz(sd); if (!sd->status.party_id) return 0; @@ -615,7 +615,7 @@ int party_send_logout(dumb_ptr<map_session_data> sd) { PartyPair p; - nullpo_ret(sd); + nullpo_retz(sd); if (sd->status.party_id) intif_party_changemap(sd, 0); @@ -626,7 +626,7 @@ int party_send_logout(dumb_ptr<map_session_data> sd) int i; for (i = 0; i < MAX_PARTY; i++) if (dumb_ptr<map_session_data>(p->member[i].sd) == sd) - p->member[i].sd = NULL; + p->member[i].sd = nullptr; } return 0; @@ -669,7 +669,7 @@ void party_send_xyhp_timer_sub(PartyPair p) for (i = 0; i < MAX_PARTY; i++) { dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(p->member[i].sd); - if (sd != NULL) + if (sd != nullptr) { // 座標通知 if (sd->party_x != sd->bl_x || sd->party_y != sd->bl_y) @@ -711,7 +711,7 @@ void party_send_xy_clear(PartyPair p) for (i = 0; i < MAX_PARTY; i++) { dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(p->member[i].sd); - if (sd != NULL) + if (sd != nullptr) { sd->party_x = -1; sd->party_y = -1; @@ -741,12 +741,12 @@ int party_exp_share(PartyPair p, map_local *mapid, int base_exp, int job_exp) dumb_ptr<map_session_data> sd; int i, c; - nullpo_ret(p); + nullpo_retz(p); for (i = c = 0; i < MAX_PARTY; i++) { sd = dumb_ptr<map_session_data>(p->member[i].sd); - if (sd != NULL && sd->bl_m == mapid) + if (sd != nullptr && sd->bl_m == mapid) c++; } if (c == 0) @@ -754,7 +754,7 @@ int party_exp_share(PartyPair p, map_local *mapid, int base_exp, int job_exp) for (i = 0; i < MAX_PARTY; i++) { sd = dumb_ptr<map_session_data>(p->member[i].sd); - if (sd != NULL && sd->bl_m == mapid) + if (sd != nullptr && sd->bl_m == mapid) pc_gainexp_reason(sd, base_exp / c + 1, job_exp / c + 1, PC_GAINEXP_REASON::SHARING); } @@ -786,7 +786,7 @@ void party_foreachsamemap(std::function<void(dumb_ptr<block_list>)> func, for (i = 0; i < MAX_PARTY; i++) { PartyMember *m = &p->member[i]; - if (m->sd != NULL) + if (m->sd != nullptr) { if (sd->bl_m != m->sd->bl_m) continue; diff --git a/src/map/path.cpp b/src/map/path.cpp index fb423e7..432d9cf 100644 --- a/src/map/path.cpp +++ b/src/map/path.cpp @@ -59,7 +59,7 @@ void push_heap_path(int *heap, struct tmp_path *tp, int index) { int i, h; - if (heap == NULL || tp == NULL) + if (heap == nullptr || tp == nullptr) { PRINTF("push_heap_path nullpo\n"_fmt); return; @@ -145,7 +145,7 @@ int calc_cost(struct tmp_path *p, int x1, int y1) { int xd, yd; - nullpo_ret(p); + nullpo_retz(p); xd = x1 - p->x; if (xd < 0) @@ -166,8 +166,8 @@ int add_path(int *heap, struct tmp_path *tp, int x, int y, int dist, { int i; - nullpo_ret(heap); - nullpo_ret(tp); + nullpo_retz(heap); + nullpo_retz(tp); i = calc_index(x, y); @@ -211,7 +211,7 @@ int add_path(int *heap, struct tmp_path *tp, int x, int y, int dist, static bool can_place(struct map_local *m, int x, int y) { - nullpo_ret(m); + nullpo_retz(m); return !bool(read_gatp(m, x, y) & MapCell::UNWALKABLE); } @@ -223,7 +223,7 @@ bool can_place(struct map_local *m, int x, int y) static int can_move(struct map_local *m, int x0, int y0, int x1, int y1) { - nullpo_ret(m); + nullpo_retz(m); if (x0 - x1 < -1 || x0 - x1 > 1 || y0 - y1 < -1 || y0 - y1 > 1) return 0; @@ -250,7 +250,7 @@ int path_search(struct walkpath_data *wpd, map_local *m, int x0, int y0, int x1, int i, rp, x, y; int dx, dy; - nullpo_ret(wpd); + nullpo_retz(wpd); assert (m->gat); map_local *md = m; diff --git a/src/map/pc.cpp b/src/map/pc.cpp index d37a7ff..48afffc 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -281,7 +281,7 @@ GmLevel pc_isGM(dumb_ptr<map_session_data> sd) int pc_iskiller(dumb_ptr<map_session_data> src, dumb_ptr<map_session_data> target) { - nullpo_ret(src); + nullpo_retz(src); if (src->bl_type != BL::PC) return 0; @@ -319,13 +319,13 @@ void pc_invincible_timer(TimerData *, tick_t, BlockId id) { dumb_ptr<map_session_data> sd = map_id2sd(id); - assert (sd != NULL); + assert (sd != nullptr); assert (sd->bl_type == BL::PC); } int pc_setinvincibletimer(dumb_ptr<map_session_data> sd, interval_t val) { - nullpo_ret(sd); + nullpo_retz(sd); sd->invincible_timer = Timer(gettick() + val, std::bind(pc_invincible_timer, ph::_1, ph::_2, @@ -335,7 +335,7 @@ int pc_setinvincibletimer(dumb_ptr<map_session_data> sd, interval_t val) int pc_delinvincibletimer(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); sd->invincible_timer.cancel(); return 0; @@ -343,7 +343,7 @@ int pc_delinvincibletimer(dumb_ptr<map_session_data> sd) int pc_setrestartvalue(dumb_ptr<map_session_data> sd, int type) { - nullpo_ret(sd); + nullpo_retz(sd); { if (battle_config.restart_hp_rate < 50) @@ -475,7 +475,7 @@ void pc_makesavestatus(dumb_ptr<map_session_data> sd) int pc_setnewpc(dumb_ptr<map_session_data> sd, AccountId account_id, CharId char_id, int login_id1, uint32_t client_tick, SEX sex) { - nullpo_ret(sd); + nullpo_retz(sd); // TODO this is the primary surface sd->bl_id = account_to_block(account_id); @@ -512,7 +512,7 @@ EPOS pc_equippoint(dumb_ptr<map_session_data> sd, IOff0 n) static int pc_setinventorydata(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); for (IOff0 i : IOff0::iter()) { @@ -525,7 +525,7 @@ int pc_setinventorydata(dumb_ptr<map_session_data> sd) static int pc_calcweapontype(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); if (sd->weapontype1 != ItemLook::NONE && sd->weapontype2 == ItemLook::NONE) @@ -568,7 +568,7 @@ int pc_calcweapontype(dumb_ptr<map_session_data> sd) static int pc_setequipindex(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); for (EQUIP i : EQUIPs) sd->equip_index_maybe[i] = IOff0::from(-1); @@ -620,7 +620,7 @@ int pc_isequip(dumb_ptr<map_session_data> sd, IOff0 n) eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; //転生や養子の場合の元の職業を算出する - nullpo_ret(sd); + nullpo_retz(sd); item = sd->inventory_data[n]; sc_data = battle_get_sc_data(sd); @@ -629,7 +629,7 @@ int pc_isequip(dumb_ptr<map_session_data> sd, IOff0 n) if (gm_all_equipment && pc_isGM(sd).satisfies(gm_all_equipment)) return 1; - if (item == NULL) + if (item == nullptr) return 0; if (item->sex != SEX::NEUTRAL && sd->status.sex != item->sex) return 0; @@ -647,13 +647,13 @@ int pc_isequip(dumb_ptr<map_session_data> sd, IOff0 n) int pc_authok(AccountId id, int login_id2, TimeT connect_until_time, short tmw_version, const CharKey *st_key, const CharData *st_data) { - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; PartyPair p; tick_t tick = gettick(); sd = map_id2sd(account_to_block(id)); - if (sd == NULL) + if (sd == nullptr) return 1; sd->login_id2 = login_id2; @@ -675,7 +675,7 @@ int pc_authok(AccountId id, int login_id2, TimeT connect_until_time, really_memzero_this(&sd->state); // 基本的な初期化 sd->state.connect_new = 1; - sd->bl_prev = sd->bl_next = NULL; + sd->bl_prev = sd->bl_next = nullptr; sd->weapontype1 = sd->weapontype2 = ItemLook::NONE; sd->speed = DEFAULT_WALK_SPEED; @@ -846,7 +846,7 @@ int pc_authfail(AccountId id) dumb_ptr<map_session_data> sd; sd = map_id2sd(account_to_block(id)); - if (sd == NULL) + if (sd == nullptr) return 1; clif_authfail_fd(sd->sess, 0); @@ -859,7 +859,7 @@ int pc_calc_skillpoint(dumb_ptr<map_session_data> sd) { int i, skill_points = 0; - nullpo_ret(sd); + nullpo_retz(sd); for (i = 0; i < skill_pool_skills_size; i++) { int lv = sd->status.skill[skill_pool_skills[i]].lv; @@ -878,7 +878,7 @@ int pc_checkweighticon(dumb_ptr<map_session_data> sd) { int flag = 0; - nullpo_ret(sd); + nullpo_retz(sd); if (sd->weight * 2 >= sd->max_weight && !sd->sc_data[StatusChange::SC_FLYING_BACKPACK].timer) @@ -937,7 +937,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) int aspd_rate, refinedef = 0; int str, dstr, dex; - nullpo_ret(sd); + nullpo_retz(sd); interval_t b_speed = sd->speed; b_max_hp = sd->status.max_hp; @@ -973,7 +973,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) for (IOff0 i : IOff0::iter()) { if (!sd->status.inventory[i].nameid - || sd->inventory_data[i] == NULL) + || sd->inventory_data[i] == nullptr) continue; sd->weight += sd->inventory_data[i]->weight * @@ -1484,7 +1484,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) */ int pc_bonus(dumb_ptr<map_session_data> sd, SP type, int val) { - nullpo_ret(sd); + nullpo_retz(sd); switch (type) { @@ -1749,7 +1749,7 @@ int pc_bonus(dumb_ptr<map_session_data> sd, SP type, int val) */ int pc_bonus2(dumb_ptr<map_session_data> sd, SP type, int type2, int val) { - nullpo_ret(sd); + nullpo_retz(sd); switch (type) { @@ -1794,7 +1794,7 @@ int pc_bonus2(dumb_ptr<map_session_data> sd, SP type, int type2, int val) */ int pc_skill(dumb_ptr<map_session_data> sd, SkillID id, int level, int flag) { - nullpo_ret(sd); + nullpo_retz(sd); if (level > MAX_SKILL_LEVEL) { @@ -1852,7 +1852,7 @@ int pc_inventoryblank(dumb_ptr<map_session_data> sd) { int b = 0; - nullpo_ret(sd); + nullpo_retz(sd); for (IOff0 i : IOff0::iter()) { @@ -1869,7 +1869,7 @@ int pc_inventoryblank(dumb_ptr<map_session_data> sd) */ int pc_payzeny(dumb_ptr<map_session_data> sd, int zeny) { - nullpo_ret(sd); + nullpo_retz(sd); double z = sd->status.zeny; if (sd->status.zeny < zeny || z - zeny > MAX_ZENY) @@ -1886,7 +1886,7 @@ int pc_payzeny(dumb_ptr<map_session_data> sd, int zeny) */ int pc_getzeny(dumb_ptr<map_session_data> sd, int zeny) { - nullpo_ret(sd); + nullpo_retz(sd); double z = sd->status.zeny; if (z + zeny > MAX_ZENY) @@ -1922,7 +1922,7 @@ int pc_count_all_items(dumb_ptr<map_session_data> player, ItemNameId item_id) { int count = 0; - nullpo_ret(player); + nullpo_retz(player); for (IOff0 i : IOff0::iter()) { @@ -1935,7 +1935,7 @@ int pc_count_all_items(dumb_ptr<map_session_data> player, ItemNameId item_id) int pc_remove_items(dumb_ptr<map_session_data> player, ItemNameId item_id, int count) { - nullpo_ret(player); + nullpo_retz(player); for (IOff0 i : IOff0::iter()) { @@ -2034,7 +2034,7 @@ int pc_delitem(dumb_ptr<map_session_data> sd, IOff0 n, int amount, int type) if (!sd->status.inventory[n].nameid || amount <= 0 || sd->status.inventory[n].amount < amount - || sd->inventory_data[n] == NULL) + || sd->inventory_data[n] == nullptr) return 1; sd->status.inventory[n].amount -= amount; @@ -2044,7 +2044,7 @@ int pc_delitem(dumb_ptr<map_session_data> sd, IOff0 n, int amount, int type) if (bool(sd->status.inventory[n].equip)) pc_unequipitem(sd, n, CalcStatus::NOW); sd->status.inventory[n] = Item{}; - sd->inventory_data[n] = NULL; + sd->inventory_data[n] = nullptr; } if (!(type & 1)) clif_delitem(sd, n, amount); @@ -2079,7 +2079,7 @@ int pc_dropitem(dumb_ptr<map_session_data> sd, IOff0 n, int amount) return 1; map_addflooritem(&sd->status.inventory[n], amount, sd->bl_m, sd->bl_x, sd->bl_y, - NULL, NULL, NULL); + nullptr, nullptr, nullptr); pc_delitem(sd, n, amount, 0); return 0; @@ -2134,8 +2134,8 @@ int pc_takeitem(dumb_ptr<map_session_data> sd, dumb_ptr<flooritem_data> fitem) tick_t tick = gettick(); int can_take; - nullpo_ret(sd); - nullpo_ret(fitem); + nullpo_retz(sd); + nullpo_retz(fitem); /* Sometimes the owners reported to us are buggy: */ @@ -2191,12 +2191,12 @@ int pc_isUseitem(dumb_ptr<map_session_data> sd, IOff0 n) struct item_data *item; ItemNameId nameid; - nullpo_ret(sd); + nullpo_retz(sd); item = sd->inventory_data[n]; nameid = sd->status.inventory[n].nameid; - if (item == NULL) + if (item == nullptr) return 0; if (itemdb_type(nameid) != ItemType::USE) return 0; @@ -2252,7 +2252,7 @@ int pc_setpos(dumb_ptr<map_session_data> sd, { MapName mapname_; - nullpo_ret(sd); + nullpo_retz(sd); if (sd->trade_partner) // 取引を中断する trade_tradecancel(sd); @@ -2325,7 +2325,7 @@ int pc_setpos(dumb_ptr<map_session_data> sd, while (bool(read_gatp(m, x, y) & MapCell::UNWALKABLE)); } - if (sd->mapname_ && sd->bl_prev != NULL) + if (sd->mapname_ && sd->bl_prev != nullptr) { clif_clearchar(sd, clrtype); map_delblock(sd); @@ -2356,7 +2356,7 @@ int pc_randomwarp(dumb_ptr<map_session_data> sd, BeingRemoveWhy type) { int x, y, i = 0; - nullpo_ret(sd); + nullpo_retz(sd); map_local *m = sd->bl_m; @@ -2386,7 +2386,7 @@ int pc_can_reach(dumb_ptr<map_session_data> sd, int x, int y) { struct walkpath_data wpd; - nullpo_ret(sd); + nullpo_retz(sd); if (sd->bl_x == x && sd->bl_y == y) // 同じマス return 1; @@ -2430,7 +2430,7 @@ void pc_walk(TimerData *, tick_t tick, BlockId id, unsigned char data) int x, y, dx, dy; sd = map_id2sd(id); - if (sd == NULL) + if (sd == nullptr) return; if (sd->walkpath.path_pos >= sd->walkpath.path_len @@ -2571,7 +2571,7 @@ int pc_walktoxy_sub(dumb_ptr<map_session_data> sd) int pc_walktoxy(dumb_ptr<map_session_data> sd, int x, int y) { - nullpo_ret(sd); + nullpo_retz(sd); sd->to_x = x; sd->to_y = y; @@ -2599,7 +2599,7 @@ int pc_walktoxy(dumb_ptr<map_session_data> sd, int x, int y) */ int pc_stop_walking(dumb_ptr<map_session_data> sd, int type) { - nullpo_ret(sd); + nullpo_retz(sd); sd->walktimer.cancel(); @@ -2638,7 +2638,7 @@ int pc_movepos(dumb_ptr<map_session_data> sd, int dst_x, int dst_y) struct walkpath_data wpd; - nullpo_ret(sd); + nullpo_retz(sd); if (path_search(&wpd, sd->bl_m, sd->bl_x, sd->bl_y, dst_x, dst_y, 0)) return 1; @@ -2702,7 +2702,7 @@ int pc_movepos(dumb_ptr<map_session_data> sd, int dst_x, int dst_y) */ int pc_checkskill(dumb_ptr<map_session_data> sd, SkillID skill_id) { - if (sd == NULL) + if (sd == nullptr) return 0; return sd->status.skill[skill_id].lv; @@ -2738,14 +2738,14 @@ void pc_attack_timer(TimerData *, tick_t tick, BlockId id) int dist, range; sd = map_id2sd(id); - if (sd == NULL) + if (sd == nullptr) return; - if (sd->bl_prev == NULL) + if (sd->bl_prev == nullptr) return; bl = map_id2bl(sd->attacktarget); - if (bl == NULL || bl->bl_prev == NULL) + if (bl == nullptr || bl->bl_prev == nullptr) return; if (bl->bl_type == BL::PC && pc_isdead(bl->is_player())) @@ -2761,7 +2761,7 @@ void pc_attack_timer(TimerData *, tick_t tick, BlockId id) return; Option *opt = battle_get_option(bl); - if (opt != NULL && bool(*opt & Option::REAL_ANY_HIDE)) + if (opt != nullptr && bool(*opt & Option::REAL_ANY_HIDE)) return; if (!battle_config.skill_delay_attack_enable) @@ -2841,10 +2841,10 @@ int pc_attack(dumb_ptr<map_session_data> sd, BlockId target_id, int type) { dumb_ptr<block_list> bl; - nullpo_ret(sd); + nullpo_retz(sd); bl = map_id2bl(target_id); - if (bl == NULL) + if (bl == nullptr) return 1; if (bl->bl_type == BL::NPC) @@ -2882,7 +2882,7 @@ int pc_attack(dumb_ptr<map_session_data> sd, BlockId target_id, int type) */ int pc_stopattack(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); sd->attacktimer.cancel(); @@ -2897,7 +2897,7 @@ int pc_checkbaselevelup(dumb_ptr<map_session_data> sd) { int next = pc_nextbaseexp(sd); - nullpo_ret(sd); + nullpo_retz(sd); if (sd->status.base_exp >= next && next > 0) { @@ -2952,7 +2952,7 @@ int pc_checkjoblevelup(dumb_ptr<map_session_data> sd) { int next = pc_nextjobexp(sd); - nullpo_ret(sd); + nullpo_retz(sd); if (sd->status.job_exp >= next && next > 0) { @@ -2987,9 +2987,9 @@ int pc_checkjoblevelup(dumb_ptr<map_session_data> sd) int pc_gainexp_reason(dumb_ptr<map_session_data> sd, int base_exp, int job_exp, PC_GAINEXP_REASON reason) { - nullpo_ret(sd); + nullpo_retz(sd); - if (sd->bl_prev == NULL || pc_isdead(sd)) + if (sd->bl_prev == nullptr || pc_isdead(sd)) return 0; earray<LString, PC_GAINEXP_REASON, PC_GAINEXP_REASON::COUNT> reasons //= @@ -3065,7 +3065,7 @@ int pc_gainexp_reason(dumb_ptr<map_session_data> sd, int base_exp, int job_exp, int pc_extract_healer_exp(dumb_ptr<map_session_data> sd, int max) { int amount; - nullpo_ret(sd); + nullpo_retz(sd); amount = sd->heal_xp; if (max < amount) @@ -3081,7 +3081,7 @@ int pc_extract_healer_exp(dumb_ptr<map_session_data> sd, int max) */ int pc_nextbaseexp(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); if (sd->status.base_level >= MAX_LEVEL || sd->status.base_level <= 0) return 0; @@ -3109,7 +3109,7 @@ int pc_nextjobexp(dumb_ptr<map_session_data> sd) */ int pc_nextbaseafter(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); if (sd->status.base_level >= MAX_LEVEL || sd->status.base_level <= 0) return 0; @@ -3123,7 +3123,7 @@ int pc_nextbaseafter(dumb_ptr<map_session_data> sd) */ int pc_nextjobafter(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); if (sd->status.job_level >= MAX_LEVEL || sd->status.job_level <= 0) return 0; @@ -3157,7 +3157,7 @@ int pc_statusup(dumb_ptr<map_session_data> sd, SP type) { int need, val = 0; - nullpo_ret(sd); + nullpo_retz(sd); if (SP::STR <= type && type <= SP::LUK) val = sd->status.attrs[sp_to_attr(type)]; @@ -3193,7 +3193,7 @@ int pc_statusup(dumb_ptr<map_session_data> sd, SP type) */ int pc_statusup2(dumb_ptr<map_session_data> sd, SP type, int val) { - nullpo_ret(sd); + nullpo_retz(sd); if (type < SP::STR || type > SP::LUK) { @@ -3220,7 +3220,7 @@ int pc_statusup2(dumb_ptr<map_session_data> sd, SP type, int val) */ int pc_skillup(dumb_ptr<map_session_data> sd, SkillID skill_num) { - nullpo_ret(sd); + nullpo_retz(sd); if (sd->status.skill[skill_num].lv && sd->status.skill_point >= sd->status.skill[skill_num].lv @@ -3247,7 +3247,7 @@ int pc_skillup(dumb_ptr<map_session_data> sd, SkillID skill_num) */ int pc_resetlvl(dumb_ptr<map_session_data> sd, int type) { - nullpo_ret(sd); + nullpo_retz(sd); for (SkillID i : erange(SkillID(1), MAX_SKILL)) { @@ -3336,7 +3336,7 @@ int pc_resetlvl(dumb_ptr<map_session_data> sd, int type) int pc_resetstate(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); sd->status.status_point = stat_p[sd->status.base_level - 1]; @@ -3362,7 +3362,7 @@ int pc_resetskill(dumb_ptr<map_session_data> sd) { int skill; - nullpo_ret(sd); + nullpo_retz(sd); sd->status.skill_point += pc_calc_skillpoint(sd); @@ -3387,7 +3387,7 @@ int pc_resetskill(dumb_ptr<map_session_data> sd) int pc_damage(dumb_ptr<block_list> src, dumb_ptr<map_session_data> sd, int damage) { - nullpo_ret(sd); + nullpo_retz(sd); // 既に死んでいたら無効 if (pc_isdead(sd)) @@ -3564,7 +3564,7 @@ int pc_readparam(dumb_ptr<map_session_data> sd, SP type) { int val = 0; - nullpo_ret(sd); + nullpo_retz(sd); switch (type) { @@ -3640,7 +3640,7 @@ int pc_setparam(dumb_ptr<map_session_data> sd, SP type, int val) { int i = 0, up_level = 50; - nullpo_ret(sd); + nullpo_retz(sd); switch (type) { @@ -3759,7 +3759,7 @@ int pc_setparam(dumb_ptr<map_session_data> sd, SP type, int val) */ int pc_heal(dumb_ptr<map_session_data> sd, int hp, int sp) { - nullpo_ret(sd); + nullpo_retz(sd); if (pc_checkoverhp(sd)) { @@ -3780,7 +3780,7 @@ int pc_heal(dumb_ptr<map_session_data> sd, int hp, int sp) if (sd->status.hp <= 0) { sd->status.hp = 0; - pc_damage(NULL, sd, 1); + pc_damage(nullptr, sd, 1); hp = 0; } sd->status.sp += sp; @@ -3878,7 +3878,7 @@ int pc_itemheal(dumb_ptr<map_session_data> sd, int hp, int sp) static int pc_itemheal_effect(dumb_ptr<map_session_data> sd, int hp, int sp) { - nullpo_ret(sd); + nullpo_retz(sd); if (pc_checkoverhp(sd)) { @@ -3908,7 +3908,7 @@ int pc_itemheal_effect(dumb_ptr<map_session_data> sd, int hp, int sp) if (sd->status.hp <= 0) { sd->status.hp = 0; - pc_damage(NULL, sd, 1); + pc_damage(nullptr, sd, 1); hp = 0; } sd->status.sp += sp; @@ -3928,7 +3928,7 @@ int pc_itemheal_effect(dumb_ptr<map_session_data> sd, int hp, int sp) */ int pc_percentheal(dumb_ptr<map_session_data> sd, int hp, int sp) { - nullpo_ret(sd); + nullpo_retz(sd); if (pc_checkoverhp(sd)) { @@ -3949,7 +3949,7 @@ int pc_percentheal(dumb_ptr<map_session_data> sd, int hp, int sp) else if (hp <= -100) { sd->status.hp = 0; - pc_damage(NULL, sd, 1); + pc_damage(nullptr, sd, 1); } else { @@ -3959,7 +3959,7 @@ int pc_percentheal(dumb_ptr<map_session_data> sd, int hp, int sp) if (sd->status.hp <= 0) { sd->status.hp = 0; - pc_damage(NULL, sd, 1); + pc_damage(nullptr, sd, 1); hp = 0; } } @@ -4002,7 +4002,7 @@ int pc_percentheal(dumb_ptr<map_session_data> sd, int hp, int sp) */ int pc_changelook(dumb_ptr<map_session_data> sd, LOOK type, int val) { - nullpo_ret(sd); + nullpo_retz(sd); switch (type) { @@ -4044,7 +4044,7 @@ int pc_changelook(dumb_ptr<map_session_data> sd, LOOK type, int val) */ int pc_setoption(dumb_ptr<map_session_data> sd, Option type) { - nullpo_ret(sd); + nullpo_retz(sd); sd->status.option = type; clif_changeoption(sd); @@ -4059,7 +4059,7 @@ int pc_setoption(dumb_ptr<map_session_data> sd, Option type) */ int pc_readreg(dumb_ptr<map_session_data> sd, SIR reg) { - nullpo_ret(sd); + nullpo_retz(sd); return sd->regm.get(reg); } @@ -4115,7 +4115,7 @@ int pc_readglobalreg(dumb_ptr<map_session_data> sd, VarName reg) { int i; - nullpo_ret(sd); + nullpo_retz(sd); assert (sd->status.global_reg_num < GLOBAL_REG_NUM); for (i = 0; i < sd->status.global_reg_num; i++) @@ -4135,7 +4135,7 @@ int pc_setglobalreg(dumb_ptr<map_session_data> sd, VarName reg, int val) { int i; - nullpo_ret(sd); + nullpo_retz(sd); //PC_DIE_COUNTERがスクリプトなどで変更された時の処理 if (reg == stringish<VarName>("PC_DIE_COUNTER"_s) && sd->die_counter != val) @@ -4188,7 +4188,7 @@ int pc_readaccountreg(dumb_ptr<map_session_data> sd, VarName reg) { int i; - nullpo_ret(sd); + nullpo_retz(sd); assert (sd->status.account_reg_num < ACCOUNT_REG_NUM); for (i = 0; i < sd->status.account_reg_num; i++) @@ -4208,7 +4208,7 @@ int pc_setaccountreg(dumb_ptr<map_session_data> sd, VarName reg, int val) { int i; - nullpo_ret(sd); + nullpo_retz(sd); if (val == 0) { @@ -4257,7 +4257,7 @@ int pc_readaccountreg2(dumb_ptr<map_session_data> sd, VarName reg) { int i; - nullpo_ret(sd); + nullpo_retz(sd); for (i = 0; i < sd->status.account_reg2_num; i++) { @@ -4325,7 +4325,7 @@ static void pc_eventtimer(TimerData *, tick_t, BlockId id, NpcEvent data) { dumb_ptr<map_session_data> sd = map_id2sd(id); - assert (sd != NULL); + assert (sd != nullptr); npc_event(sd, data, 0); } @@ -4338,7 +4338,7 @@ int pc_addeventtimer(dumb_ptr<map_session_data> sd, interval_t tick, NpcEvent na { int i; - nullpo_ret(sd); + nullpo_retz(sd); for (i = 0; i < MAX_EVENTTIMER; i++) if (!sd->eventtimer[i]) @@ -4361,7 +4361,7 @@ int pc_addeventtimer(dumb_ptr<map_session_data> sd, interval_t tick, NpcEvent na */ int pc_cleareventtimer(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); for (int i = 0; i < MAX_EVENTTIMER; i++) sd->eventtimer[i].cancel(); @@ -4398,7 +4398,7 @@ int pc_equipitem(dumb_ptr<map_session_data> sd, IOff0 n, EPOS) struct item_data *id; //ソス]ソスソスソスソスソス{ソスqソスフ場合ソスフ鯉ソスソスフ職ソスニゑソスソスZソスoソスソスソスソス - nullpo_ret(sd); + nullpo_retz(sd); if (!n.ok()) { @@ -4540,7 +4540,7 @@ int pc_equipitem(dumb_ptr<map_session_data> sd, IOff0 n, EPOS) */ int pc_unequipitem(dumb_ptr<map_session_data> sd, IOff0 n, CalcStatus type) { - nullpo_ret(sd); + nullpo_retz(sd); // -- moonsoul (if player is berserk then cannot unequip) // @@ -4629,7 +4629,7 @@ int pc_checkitem(dumb_ptr<map_session_data> sd) { int calc_flag = 0; - nullpo_ret(sd); + nullpo_retz(sd); IOff0 j = IOff0::from(0); for (IOff0 i : IOff0::iter()) @@ -4646,7 +4646,7 @@ int pc_checkitem(dumb_ptr<map_session_data> sd) for (IOff0 k = j; k != IOff0::from(MAX_INVENTORY); ++k) { sd->status.inventory[k] = Item{}; - sd->inventory_data[k] = NULL; + sd->inventory_data[k] = nullptr; } for (IOff0 i : IOff0::iter()) @@ -4669,7 +4669,7 @@ int pc_checkitem(dumb_ptr<map_session_data> sd) int pc_checkoverhp(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); if (sd->status.hp == sd->status.max_hp) return 1; @@ -4685,7 +4685,7 @@ int pc_checkoverhp(dumb_ptr<map_session_data> sd) int pc_checkoversp(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); if (sd->status.sp == sd->status.max_sp) return 1; @@ -4722,9 +4722,9 @@ void pc_calc_pvprank_sub(dumb_ptr<block_list> bl, dumb_ptr<map_session_data> sd2 */ int pc_calc_pvprank(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); map_local *m = sd->bl_m; - nullpo_ret(m); + nullpo_retz(m); if (!(m->flag.get(MapFlag::PVP))) return 0; @@ -4743,12 +4743,12 @@ int pc_calc_pvprank(dumb_ptr<map_session_data> sd) */ void pc_calc_pvprank_timer(TimerData *, tick_t, BlockId id) { - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; if (battle_config.pk_mode) // disable pvp ranking if pk_mode on [Valaris] return; sd = map_id2sd(id); - if (sd == NULL) + if (sd == nullptr) return; sd->pvp_timer.cancel(); if (pc_calc_pvprank(sd) > 0) @@ -4764,7 +4764,7 @@ void pc_calc_pvprank_timer(TimerData *, tick_t, BlockId id) static CharId pc_ismarried(dumb_ptr<map_session_data> sd) { - if (sd == NULL) + if (sd == nullptr) return CharId(); if (sd->status.partner_id) return sd->status.partner_id; @@ -4778,7 +4778,7 @@ CharId pc_ismarried(dumb_ptr<map_session_data> sd) */ int pc_marriage(dumb_ptr<map_session_data> sd, dumb_ptr<map_session_data> dstsd) { - if (sd == NULL || dstsd == NULL || sd->status.partner_id + if (sd == nullptr || dstsd == nullptr || sd->status.partner_id || dstsd->status.partner_id) return -1; sd->status.partner_id = dstsd->status_key.char_id; @@ -4792,13 +4792,13 @@ int pc_marriage(dumb_ptr<map_session_data> sd, dumb_ptr<map_session_data> dstsd) */ int pc_divorce(dumb_ptr<map_session_data> sd) { - dumb_ptr<map_session_data> p_sd = NULL; - if (sd == NULL || !pc_ismarried(sd)) + dumb_ptr<map_session_data> p_sd = nullptr; + if (sd == nullptr || !pc_ismarried(sd)) return -1; // If both are on map server we don't need to bother the char server if ((p_sd = - map_nick2sd(map_charid2nick(sd->status.partner_id))) != NULL) + map_nick2sd(map_charid2nick(sd->status.partner_id))) != nullptr) { if (p_sd->status.partner_id != sd->status_key.char_id || sd->status.partner_id != p_sd->status_key.char_id) @@ -4828,17 +4828,17 @@ int pc_divorce(dumb_ptr<map_session_data> sd) */ dumb_ptr<map_session_data> pc_get_partner(dumb_ptr<map_session_data> sd) { - dumb_ptr<map_session_data> p_sd = NULL; - if (sd == NULL || !pc_ismarried(sd)) - return NULL; + dumb_ptr<map_session_data> p_sd = nullptr; + if (sd == nullptr || !pc_ismarried(sd)) + return nullptr; CharName nick = map_charid2nick(sd->status.partner_id); if (!nick.to__actual()) - return NULL; + return nullptr; - if ((p_sd = map_nick2sd(nick)) == NULL) - return NULL; + if ((p_sd = map_nick2sd(nick)) == nullptr) + return nullptr; return p_sd; } @@ -4889,7 +4889,7 @@ int pc_natural_heal_hp(dumb_ptr<map_session_data> sd) int bhp; int bonus; - nullpo_ret(sd); + nullpo_retz(sd); if (pc_checkoverhp(sd)) { @@ -4961,7 +4961,7 @@ int pc_natural_heal_sp(dumb_ptr<map_session_data> sd) int bsp; int bonus; - nullpo_ret(sd); + nullpo_retz(sd); if (pc_checkoversp(sd)) { diff --git a/src/map/script.cpp b/src/map/script.cpp index 73ddea7..b9d90ea 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -986,7 +986,7 @@ void get_val(dumb_ptr<map_session_data> sd, struct script_data *data) { if (data->type == ByteCode::PARAM_) { - if (sd == NULL) + if (sd == nullptr) PRINTF("get_val error param SP::%d\n"_fmt, data->u.reg.sp()); data->type = ByteCode::INT; if (sd) @@ -1001,7 +1001,7 @@ void get_val(dumb_ptr<map_session_data> sd, struct script_data *data) if (prefix != '$') { - if (sd == NULL) + if (sd == nullptr) PRINTF("get_val error name?:%s\n"_fmt, name); } if (postfix == '$') @@ -1664,7 +1664,7 @@ void builtin_percentheal(ScriptState *st) static void builtin_input(ScriptState *st) { - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; script_data& scrd = AARGO2(2); ByteCode type = scrd.type; assert (type == ByteCode::VARIABLE); @@ -1741,7 +1741,7 @@ void builtin_if (ScriptState *st) static void builtin_set(ScriptState *st) { - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; SIR reg = AARGO2(2).u.reg; if (AARGO2(2).type == ByteCode::PARAM_) { @@ -1782,7 +1782,7 @@ void builtin_set(ScriptState *st) static void builtin_setarray(ScriptState *st) { - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; assert (AARGO2(2).type == ByteCode::VARIABLE); SIR reg = AARGO2(2).u.reg; ZString name = variable_names.outtern(reg.base()); @@ -1813,7 +1813,7 @@ void builtin_setarray(ScriptState *st) static void builtin_cleararray(ScriptState *st) { - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; assert (AARGO2(2).type == ByteCode::VARIABLE); SIR reg = AARGO2(2).u.reg; ZString name = variable_names.outtern(reg.base()); @@ -1939,7 +1939,7 @@ void builtin_countitem(ScriptState *st) { ZString name = ZString(conv_str(st, data)); struct item_data *item_data = itemdb_searchname(name); - if (item_data != NULL) + if (item_data != nullptr) nameid = item_data->nameid; } else @@ -2027,7 +2027,7 @@ void builtin_getitem(ScriptState *st) { ZString name = ZString(conv_str(st, data)); struct item_data *item_data = itemdb_searchname(name); - if (item_data != NULL) + if (item_data != nullptr) nameid = item_data->nameid; } else @@ -2045,7 +2045,7 @@ void builtin_getitem(ScriptState *st) item_tmp.nameid = nameid; if (HARGO2(5)) //アイテムを指定したIDに渡す sd = map_id2sd(wrap<BlockId>(conv_num(st, &AARGO2(5)))); - if (sd == NULL) //アイテムを渡す相手がいなかったらお帰り + if (sd == nullptr) //アイテムを渡す相手がいなかったらお帰り return; PickupFail flag; if ((flag = pc_additem(sd, &item_tmp, amount)) != PickupFail::OKAY) @@ -2053,7 +2053,7 @@ void builtin_getitem(ScriptState *st) clif_additem(sd, IOff0::from(0), 0, flag); map_addflooritem(&item_tmp, amount, sd->bl_m, sd->bl_x, sd->bl_y, - NULL, NULL, NULL); + nullptr, nullptr, nullptr); } } @@ -2102,7 +2102,7 @@ void builtin_makeitem(ScriptState *st) Item item_tmp {}; item_tmp.nameid = nameid; - map_addflooritem(&item_tmp, amount, m, x, y, NULL, NULL, NULL); + map_addflooritem(&item_tmp, amount, m, x, y, nullptr, nullptr, nullptr); } } @@ -2177,7 +2177,7 @@ void builtin_readparam(ScriptState *st) else sd = script_rid2sd(st); - if (sd == NULL) + if (sd == nullptr) { push_int(st->stack, ByteCode::INT, -1); return; @@ -2202,7 +2202,7 @@ void builtin_getcharid(ScriptState *st) sd = map_nick2sd(stringish<CharName>(ZString(conv_str(st, &AARGO2(3))))); else sd = script_rid2sd(st); - if (sd == NULL) + if (sd == nullptr) { push_int(st->stack, ByteCode::INT, -1); return; @@ -2295,9 +2295,9 @@ void builtin_getequipid(ScriptState *st) struct item_data *item; sd = script_rid2sd(st); - if (sd == NULL) + if (sd == nullptr) { - PRINTF("getequipid: sd == NULL\n"_fmt); + PRINTF("getequipid: sd == nullptr\n"_fmt); return; } num = conv_num(st, &AARGO2(2)); @@ -3040,7 +3040,7 @@ void builtin_getareadropitem_sub_anddelete(dumb_ptr<block_list> bl, ItemNameId i if (drop->item_data.nameid == item) { (*amount) += drop->item_data.amount; - clif_clearflooritem(drop, 0); + clif_clearflooritem(drop, nullptr); map_delobject(drop->bl_id, drop->bl_type); } } @@ -3200,7 +3200,7 @@ void builtin_resetstatus(ScriptState *st) static void builtin_changesex(ScriptState *st) { - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; sd = script_rid2sd(st); chrif_char_ask_name(AccountId(), sd->status_key.name, 5, HumanTimeDiff()); // type: 5 - changesex @@ -3215,7 +3215,7 @@ static void builtin_attachrid(ScriptState *st) { st->rid = wrap<BlockId>(conv_num(st, &AARGO2(2))); - push_int(st->stack, ByteCode::INT, (map_id2sd(st->rid) != NULL)); + push_int(st->stack, ByteCode::INT, (map_id2sd(st->rid) != nullptr)); } /*========================================== @@ -3236,7 +3236,7 @@ static void builtin_isloggedin(ScriptState *st) { push_int(st->stack, ByteCode::INT, - map_id2sd(wrap<BlockId>(conv_num(st, &AARGO2(2)))) != NULL); + map_id2sd(wrap<BlockId>(conv_num(st, &AARGO2(2)))) != nullptr); } static @@ -3436,7 +3436,7 @@ void builtin_marriage(ScriptState *st) dumb_ptr<map_session_data> sd = script_rid2sd(st); dumb_ptr<map_session_data> p_sd = map_nick2sd(partner); - if (sd == NULL || p_sd == NULL || pc_marriage(sd, p_sd) < 0) + if (sd == nullptr || p_sd == nullptr || pc_marriage(sd, p_sd) < 0) { push_int(st->stack, ByteCode::INT, 0); return; @@ -3453,7 +3453,7 @@ void builtin_divorce(ScriptState *st) sd->npc_flags.divorce = 1; - if (sd == NULL || pc_divorce(sd) < 0) + if (sd == nullptr || pc_divorce(sd) < 0) { push_int(st->stack, ByteCode::INT, 0); return; @@ -3643,7 +3643,7 @@ void builtin_misceffect(ScriptState *st) int type; BlockId id; CharName name; - dumb_ptr<block_list> bl = NULL; + dumb_ptr<block_list> bl = nullptr; type = conv_num(st, &AARGO2(2)); @@ -3690,7 +3690,7 @@ void builtin_specialeffect(ScriptState *st) { dumb_ptr<block_list> bl = map_id2bl(st->oid); - if (bl == NULL) + if (bl == nullptr) return; clif_specialeffect(bl, @@ -3705,7 +3705,7 @@ void builtin_specialeffect2(ScriptState *st) { dumb_ptr<map_session_data> sd = script_rid2sd(st); - if (sd == NULL) + if (sd == nullptr) return; clif_specialeffect(sd, @@ -3725,7 +3725,7 @@ void builtin_nude(ScriptState *st) { dumb_ptr<map_session_data> sd = script_rid2sd(st); - if (sd == NULL) + if (sd == nullptr) return; for (EQUIP i : EQUIPs) @@ -3747,7 +3747,7 @@ static void builtin_unequipbyid(ScriptState *st) { dumb_ptr<map_session_data> sd = script_rid2sd(st); - if (sd == NULL) + if (sd == nullptr) return; EQUIP slot_id = EQUIP(conv_num(st, &AARGO2(2))); @@ -3791,7 +3791,7 @@ static void builtin_npcwarp(ScriptState *st) { int x, y; - dumb_ptr<npc_data> nd = NULL; + dumb_ptr<npc_data> nd = nullptr; x = conv_num(st, &AARGO2(2)); y = conv_num(st, &AARGO2(3)); @@ -3833,7 +3833,7 @@ void builtin_message(ScriptState *st) ZString msg = ZString(conv_str(st, &AARGO2(3))); dumb_ptr<map_session_data> pl_sd = map_nick2sd(player); - if (pl_sd == NULL) + if (pl_sd == nullptr) return; clif_displaymessage(pl_sd->sess, msg); @@ -4773,7 +4773,7 @@ int run_script_l(ScriptPointer sp, BlockId rid, BlockId oid, dumb_ptr<map_session_data> sd = map_id2sd(rid); const ScriptBuffer *rootscript = sp.code; int i; - if (sp.code == NULL || sp.pos >> 24) + if (sp.code == nullptr || sp.pos >> 24) return -1; if (sd && !sd->npc_stackbuf.empty() && sd->npc_scriptroot == rootscript) diff --git a/src/map/skill-pools.cpp b/src/map/skill-pools.cpp index bab89a1..3e9639a 100644 --- a/src/map/skill-pools.cpp +++ b/src/map/skill-pools.cpp @@ -62,7 +62,7 @@ int skill_pool(dumb_ptr<map_session_data> sd, SkillID *skills) int skill_pool_size(dumb_ptr<map_session_data> sd) { - return skill_pool(sd, NULL); + return skill_pool(sd, nullptr); } int skill_pool_max(dumb_ptr<map_session_data> sd) diff --git a/src/map/skill.cpp b/src/map/skill.cpp index ad8e2e7..e8ad878 100644 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -170,16 +170,16 @@ int skill_get_castnodex(SkillID id, int lv) int skill_additional_effect(dumb_ptr<block_list> src, dumb_ptr<block_list> bl, SkillID skillid, int skilllv) { - dumb_ptr<map_session_data> sd = NULL; - dumb_ptr<mob_data> md = NULL; + dumb_ptr<map_session_data> sd = nullptr; + dumb_ptr<mob_data> md = nullptr; int luk; int sc_def_mdef, sc_def_vit, sc_def_int, sc_def_luk; int sc_def_phys_shield_spell; - nullpo_ret(src); - nullpo_ret(bl); + nullpo_retz(src); + nullpo_retz(bl); if (skilllv < 0) return 0; @@ -257,16 +257,16 @@ int skill_attack(BF attack_type, dumb_ptr<block_list> src, eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; int type, lv, damage; - nullpo_ret(src); - nullpo_ret(dsrc); - nullpo_ret(bl); + nullpo_retz(src); + nullpo_retz(dsrc); + nullpo_retz(bl); sc_data = battle_get_sc_data(bl); //何もしない判定ここから if (dsrc->bl_m != bl->bl_m) //対象が同じマップにいなければ何もしない return 0; - if (src->bl_prev == NULL || dsrc->bl_prev == NULL || bl->bl_prev == NULL) //prevよくわからない※ + if (src->bl_prev == nullptr || dsrc->bl_prev == nullptr || bl->bl_prev == nullptr) //prevよくわからない※ return 0; if (src->bl_type == BL::PC && pc_isdead(src->is_player())) //術者?がPCですでに死んでいたら何もしない return 0; @@ -305,7 +305,7 @@ int skill_attack(BF attack_type, dumb_ptr<block_list> src, battle_damage(src, bl, damage, 0); /* ダメージがあるなら追加効果判定 */ - if (bl->bl_prev != NULL) + if (bl->bl_prev != nullptr) { dumb_ptr<map_session_data> sd = bl->is_player(); if (bl->bl_type != BL::PC || !pc_isdead(sd)) @@ -403,7 +403,7 @@ int skill_castend_damage_id(dumb_ptr<block_list> src, dumb_ptr<block_list> bl, SkillID skillid, int skilllv, tick_t tick, BCT flag) { - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; nullpo_retr(1, src); nullpo_retr(1, bl); @@ -413,7 +413,7 @@ int skill_castend_damage_id(dumb_ptr<block_list> src, dumb_ptr<block_list> bl, if (sd && pc_isdead(sd)) return 1; - if (bl->bl_prev == NULL) + if (bl->bl_prev == nullptr) return 1; if (bl->bl_type == BL::PC && pc_isdead(bl->is_player())) return 1; @@ -498,10 +498,10 @@ int skill_castend_damage_id(dumb_ptr<block_list> src, dumb_ptr<block_list> bl, int skill_castend_nodamage_id(dumb_ptr<block_list> src, dumb_ptr<block_list> bl, SkillID skillid, int skilllv) { - dumb_ptr<map_session_data> sd = NULL; - dumb_ptr<map_session_data> dstsd = NULL; - dumb_ptr<mob_data> md = NULL; - dumb_ptr<mob_data> dstmd = NULL; + dumb_ptr<map_session_data> sd = nullptr; + dumb_ptr<map_session_data> dstsd = nullptr; + dumb_ptr<mob_data> md = nullptr; + dumb_ptr<mob_data> dstmd = nullptr; int sc_def_vit, sc_def_mdef, strip_fix; nullpo_retr(1, src); @@ -536,7 +536,7 @@ int skill_castend_nodamage_id(dumb_ptr<block_list> src, dumb_ptr<block_list> bl, if (strip_fix < 0) strip_fix = 0; - if (bl == NULL || bl->bl_prev == NULL) + if (bl == nullptr || bl->bl_prev == nullptr) return 1; if (sd && pc_isdead(sd)) return 1; @@ -651,7 +651,7 @@ interval_t skill_delayfix(dumb_ptr<block_list> bl, interval_t interval) */ int skill_castcancel(dumb_ptr<block_list> bl, int) { - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type == BL::PC) { @@ -688,7 +688,7 @@ int skill_status_change_active(dumb_ptr<block_list> bl, StatusChange type) { eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; - nullpo_ret(bl); + nullpo_retz(bl); if (bl->bl_type != BL::PC && bl->bl_type != BL::MOB) { if (battle_config.error_log) @@ -806,7 +806,7 @@ int skill_update_heal_animation(dumb_ptr<map_session_data> sd) { const Opt2 mask = Opt2::_heal; - nullpo_ret(sd); + nullpo_retz(sd); bool wis_active = bool(sd->opt2 & mask); bool is_active = sd->quick_regeneration_hp.amount > 0; @@ -828,11 +828,11 @@ int skill_update_heal_animation(dumb_ptr<map_session_data> sd) void skill_status_change_timer(TimerData *tid, tick_t tick, BlockId id, StatusChange type) { dumb_ptr<block_list> bl; - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; //short *sc_count; //使ってない? - if ((bl = map_id2bl(id)) == NULL) + if ((bl = map_id2bl(id)) == nullptr) return; //該当IDがすでに消滅しているというのはいかにもありそうなのでスルーしてみる sc_data = battle_get_sc_data(bl); @@ -929,7 +929,7 @@ int skill_status_effect(dumb_ptr<block_list> bl, StatusChange type, int val1, interval_t tick, BlockId spell_invocation) { - dumb_ptr<map_session_data> sd = NULL; + dumb_ptr<map_session_data> sd = nullptr; eptr<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data; short *sc_count; Option *option; @@ -940,20 +940,20 @@ int skill_status_effect(dumb_ptr<block_list> bl, StatusChange type, SP updateflag = SP::ZERO; int scdef = 0; - nullpo_ret(bl); + nullpo_retz(bl); sc_data = battle_get_sc_data(bl); if (not sc_data) return 0; sc_count = battle_get_sc_count(bl); - nullpo_ret(sc_count); + nullpo_retz(sc_count); option = battle_get_option(bl); - nullpo_ret(option); + nullpo_retz(option); opt1 = battle_get_opt1(bl); - nullpo_ret(opt1); + nullpo_retz(opt1); opt2 = battle_get_opt2(bl); - nullpo_ret(opt2); + nullpo_retz(opt2); opt3 = battle_get_opt3(bl); - nullpo_ret(opt3); + nullpo_retz(opt3); switch (type) { @@ -1111,20 +1111,20 @@ int skill_status_change_clear(dumb_ptr<block_list> bl, int type) Opt2 *opt2; Opt3 *opt3; - nullpo_ret(bl); + nullpo_retz(bl); sc_data = battle_get_sc_data(bl); if (not sc_data) return 0; sc_count = battle_get_sc_count(bl); - nullpo_ret(sc_count); + nullpo_retz(sc_count); option = battle_get_option(bl); - nullpo_ret(option); + nullpo_retz(option); opt1 = battle_get_opt1(bl); - nullpo_ret(opt1); + nullpo_retz(opt1); opt2 = battle_get_opt2(bl); - nullpo_ret(opt2); + nullpo_retz(opt2); opt3 = battle_get_opt3(bl); - nullpo_ret(opt3); + nullpo_retz(opt3); if (*sc_count == 0) return 0; diff --git a/src/map/storage.cpp b/src/map/storage.cpp index 88db8c4..b063250 100644 --- a/src/map/storage.cpp +++ b/src/map/storage.cpp @@ -47,7 +47,7 @@ void do_final_storage(void) Storage *account2storage(AccountId account_id) { Storage *stor = storage_db.search(account_id); - if (stor == NULL) + if (stor == nullptr) { stor = storage_db.init(account_id); stor->account_id = account_id; @@ -73,13 +73,13 @@ void storage_delete(AccountId account_id) */ int storage_storageopen(dumb_ptr<map_session_data> sd) { - nullpo_ret(sd); + nullpo_retz(sd); if (sd->state.storage_open) return 1; //Already open? Storage *stor = storage_db.search(sd->status_key.account_id); - if (stor == NULL) + if (stor == nullptr) { //Request storage. intif_request_storage(sd->status_key.account_id); return 1; @@ -177,9 +177,9 @@ int storage_storageadd(dumb_ptr<map_session_data> sd, IOff0 index, int amount) { Storage *stor; - nullpo_ret(sd); + nullpo_retz(sd); stor = account2storage2(sd->status_key.account_id); - nullpo_ret(stor); + nullpo_retz(stor); if ((stor->storage_amount > MAX_STORAGE) || !stor->storage_status) return 0; // storage full / storage closed @@ -213,9 +213,9 @@ int storage_storageget(dumb_ptr<map_session_data> sd, SOff0 index, int amount) Storage *stor; PickupFail flag; - nullpo_ret(sd); + nullpo_retz(sd); stor = account2storage2(sd->status_key.account_id); - nullpo_ret(stor); + nullpo_retz(stor); if (!index.ok()) return 0; @@ -242,9 +242,9 @@ int storage_storageclose(dumb_ptr<map_session_data> sd) { Storage *stor; - nullpo_ret(sd); + nullpo_retz(sd); stor = account2storage2(sd->status_key.account_id); - nullpo_ret(stor); + nullpo_retz(stor); clif_storageclose(sd); if (stor->storage_status) @@ -274,7 +274,7 @@ int storage_storage_quit(dumb_ptr<map_session_data> sd) { Storage *stor; - nullpo_ret(sd); + nullpo_retz(sd); stor = account2storage2(sd->status_key.account_id); if (stor) diff --git a/src/map/trade.cpp b/src/map/trade.cpp index 7a4913a..c21fd27 100644 --- a/src/map/trade.cpp +++ b/src/map/trade.cpp @@ -44,7 +44,7 @@ void trade_traderequest(dumb_ptr<map_session_data> sd, BlockId target_id) nullpo_retv(sd); - if ((target_sd = map_id2sd(target_id)) != NULL) + if ((target_sd = map_id2sd(target_id)) != nullptr) { if (!battle_config.invite_request_check) { @@ -97,7 +97,7 @@ void trade_tradeack(dumb_ptr<map_session_data> sd, int type) dumb_ptr<map_session_data> target_sd; nullpo_retv(sd); - if ((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != NULL) + if ((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != nullptr) { clif_tradestart(target_sd, type); clif_tradestart(sd, type); @@ -134,7 +134,7 @@ void trade_tradeadditem(dumb_ptr<map_session_data> sd, IOff2 index, int amount) nullpo_retv(sd); - if (((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != NULL) + if (((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != nullptr) && (sd->deal_locked < 1)) { if (!index.ok()) @@ -153,7 +153,7 @@ void trade_tradeadditem(dumb_ptr<map_session_data> sd, IOff2 index, int amount) for (IOff0 i : IOff0::iter()) { if (!target_sd->status.inventory[i].nameid - && target_sd->inventory_data[i] == NULL) + && target_sd->inventory_data[i] == nullptr) free_++; } for (trade_i = 0; trade_i < TRADE_MAX; trade_i++) @@ -169,7 +169,7 @@ void trade_tradeadditem(dumb_ptr<map_session_data> sd, IOff2 index, int amount) { if (target_sd->status.inventory[i].nameid == sd->status.inventory[index.unshift()].nameid - && target_sd->inventory_data[i] != NULL) + && target_sd->inventory_data[i] != nullptr) { id = target_sd->inventory_data[i]; if (id->type != ItemType::WEAPON @@ -225,7 +225,7 @@ void trade_tradeadditem(dumb_ptr<map_session_data> sd, IOff2 index, int amount) if (target_sd->status.inventory[i].nameid == sd->status. inventory[sd->deal_item_index[trade_i].unshift()].nameid - && target_sd->inventory_data[i] != NULL) + && target_sd->inventory_data[i] != nullptr) { id = target_sd->inventory_data[i]; if (id->type != ItemType::WEAPON @@ -272,7 +272,7 @@ void trade_tradeok(dumb_ptr<map_session_data> sd) } - if ((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != NULL) + if ((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != nullptr) { sd->deal_locked = 1; clif_tradeitemok(sd, IOff2::from(0), 0, 0); @@ -292,7 +292,7 @@ void trade_tradecancel(dumb_ptr<map_session_data> sd) nullpo_retv(sd); - if ((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != NULL) + if ((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != nullptr) { for (trade_i = 0; trade_i < TRADE_MAX; trade_i++) { //give items back (only virtual) @@ -347,7 +347,7 @@ void trade_tradecommit(dumb_ptr<map_session_data> sd) nullpo_retv(sd); - if ((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != NULL) + if ((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != nullptr) { MAP_LOG_PC(sd, " TRADECOMMIT WITH %d GIVE %d GET %d"_fmt, target_sd->status_key.char_id, sd->deal_zeny, @@ -451,7 +451,7 @@ void trade_verifyzeny(dumb_ptr<map_session_data> sd) nullpo_retv(sd); - if ((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != NULL) + if ((target_sd = map_id2sd(account_to_block(sd->trade_partner))) != nullptr) { if (sd->deal_zeny > sd->status.zeny) { diff --git a/src/mmo/core.cpp b/src/mmo/core.cpp index 21aa5f7..431c0db 100644 --- a/src/mmo/core.cpp +++ b/src/mmo/core.cpp @@ -73,7 +73,7 @@ bool runflag = true; static void chld_proc(int) { - wait(NULL); + wait(nullptr); } static void sig_proc(int) @@ -122,6 +122,7 @@ int main(int argc, char **argv) // Signal to create coredumps by system when necessary (crash) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wold-style-cast" +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" compat_signal(SIGSEGV, SIG_DFL); compat_signal(SIGBUS, SIG_DFL); compat_signal(SIGTRAP, SIG_DFL); diff --git a/src/mmo/extract_test.cpp b/src/mmo/extract_test.cpp index 126cb14..18d7771 100644 --- a/src/mmo/extract_test.cpp +++ b/src/mmo/extract_test.cpp @@ -26,6 +26,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + TEST(extract, record_int) { int x, y, z; diff --git a/src/mmo/human_time_diff_test.cpp b/src/mmo/human_time_diff_test.cpp index d036537..3ace280 100644 --- a/src/mmo/human_time_diff_test.cpp +++ b/src/mmo/human_time_diff_test.cpp @@ -22,6 +22,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + // a sequence of [-+]?[0-9]+([ay]|m|[jd]|h|mn|s) TEST(humantimediff, single) diff --git a/src/mmo/utils.cpp b/src/mmo/utils.cpp index 30f60b1..2199c33 100644 --- a/src/mmo/utils.cpp +++ b/src/mmo/utils.cpp @@ -96,7 +96,7 @@ void stamp_time(timestamp_seconds_buffer& out, const TimeT *t) void stamp_time(timestamp_milliseconds_buffer& out) { struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); struct tm when = TimeT(tv.tv_sec); char buf[24]; strftime(buf, 20, "%Y-%m-%d %H:%M:%S", &when); diff --git a/src/mmo/utils.hpp b/src/mmo/utils.hpp index ddfbca6..f8e84fe 100644 --- a/src/mmo/utils.hpp +++ b/src/mmo/utils.hpp @@ -84,7 +84,7 @@ struct TimeT : Comparable TimeT now() { // poisoned, but this is still in header-land - return time(NULL); + return time(nullptr); } bool error() const @@ -103,12 +103,6 @@ long long convert_for_printf(TimeT t) return t.value; } -inline -long long& convert_for_scanf(TimeT& t) -{ - return t.value; -} - // 2038 problem inline __attribute__((warn_unused_result)) bool native_to_network(Little32 *net, TimeT nat) diff --git a/src/monitor/main.cpp b/src/monitor/main.cpp index f3db1b6..da03f60 100644 --- a/src/monitor/main.cpp +++ b/src/monitor/main.cpp @@ -129,7 +129,7 @@ bool read_config(ZString filename) static pid_t start_process(ZString exec) { - const char *args[2] = {exec.c_str(), NULL}; + const char *args[2] = {exec.c_str(), nullptr}; pid_t pid = fork(); if (pid == -1) { @@ -161,6 +161,7 @@ void stop_process(int sig) kill(pid_char, sig); #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wold-style-cast" +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" signal(sig, SIG_DFL); #pragma GCC diagnostic pop raise(sig); @@ -236,7 +237,7 @@ int main(int argc, char *argv[]) FPRINTF(stderr, "[%s] forked map server: %lu\n"_fmt, timestamp, static_cast<unsigned long>(pid_map)); } - pid_t dead = wait(NULL); + pid_t dead = wait(nullptr); if (dead == -1) { perror("Failed to wait for child"); diff --git a/src/net/ip_test.cpp b/src/net/ip_test.cpp index 3c4d2ef..9058804 100644 --- a/src/net/ip_test.cpp +++ b/src/net/ip_test.cpp @@ -27,6 +27,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + #define CB(X) (std::integral_constant<bool, (X)>::value) TEST(ip4addr, cmp) { diff --git a/src/net/socket.cpp b/src/net/socket.cpp index 54f9822..6e523de 100644 --- a/src/net/socket.cpp +++ b/src/net/socket.cpp @@ -431,7 +431,7 @@ void do_sendrecv(interval_t next_ms) timeout.tv_sec = next_s.count(); timeout.tv_usec = next_us.count(); } - if (io::FD_Set::select(fd_max, &rfd, &wfd, NULL, &timeout) <= 0) + if (io::FD_Set::select(fd_max, &rfd, &wfd, nullptr, &timeout) <= 0) return; for (io::FD i : iter_fds()) { diff --git a/src/net/timer.cpp b/src/net/timer.cpp index a85b8be..64077c6 100644 --- a/src/net/timer.cpp +++ b/src/net/timer.cpp @@ -74,7 +74,7 @@ tick_t milli_clock::now(void) noexcept struct timeval tval; // BUG: This will cause strange behavior if the system clock is changed! // it should be reimplemented in terms of clock_gettime(CLOCK_MONOTONIC, ) - gettimeofday(&tval, NULL); + gettimeofday(&tval, nullptr); return gettick_cache = tick_t(std::chrono::seconds(tval.tv_sec) + std::chrono::duration_cast<std::chrono::milliseconds>( std::chrono::microseconds(tval.tv_usec))); diff --git a/src/poison.hpp b/src/poison.hpp index 53694c4..2b53e15 100644 --- a/src/poison.hpp +++ b/src/poison.hpp @@ -76,13 +76,12 @@ # pragma GCC poison open_memstream # pragma GCC poison open_wmemstream -// *scanf %ms is done very carefully. -//#pragma GCC poison scanf -//#pragma GCC poison fscanf -//#pragma GCC poison sscanf -//#pragma GCC poison vscanf -//#pragma GCC poison vsscanf -//#pragma GCC poison vfscanf +# pragma GCC poison scanf +# pragma GCC poison fscanf +# pragma GCC poison sscanf +# pragma GCC poison vscanf +# pragma GCC poison vsscanf +# pragma GCC poison vfscanf # pragma GCC poison getcwd # pragma GCC poison get_current_dir_name diff --git a/src/range/slice_test.cpp b/src/range/slice_test.cpp index f59bf84..a58cc78 100644 --- a/src/range/slice_test.cpp +++ b/src/range/slice_test.cpp @@ -22,6 +22,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + TEST(slice, slice) { int init[] = {1, 2, 3, 4, 5}; diff --git a/src/sexpr/lexer_test.cpp b/src/sexpr/lexer_test.cpp index d356f49..936e92a 100644 --- a/src/sexpr/lexer_test.cpp +++ b/src/sexpr/lexer_test.cpp @@ -24,6 +24,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + static io::FD string_pipe(ZString sz) { diff --git a/src/sexpr/parser_test.cpp b/src/sexpr/parser_test.cpp index 0be333b..e37b78f 100644 --- a/src/sexpr/parser_test.cpp +++ b/src/sexpr/parser_test.cpp @@ -22,6 +22,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + static io::FD string_pipe(ZString sz) { diff --git a/src/strings/astring.cpp b/src/strings/astring.cpp index 15d172b..9811f17 100644 --- a/src/strings/astring.cpp +++ b/src/strings/astring.cpp @@ -219,27 +219,4 @@ namespace strings out = AString(buffer, buffer + len); return len; } - - AStringConverter::AStringConverter(AString& s) - : out(s), mid(nullptr) - {} - - AStringConverter::~AStringConverter() - { - if (mid) - { - out = ZString(really_construct_from_a_pointer, mid, nullptr); - free(mid); - } - } - - char **AStringConverter::operator &() - { - return ∣ - } - - AStringConverter convert_for_scanf(AString& s) - { - return AStringConverter(s); - } } // namespace strings diff --git a/src/strings/astring.hpp b/src/strings/astring.hpp index e936c4c..9e9adc2 100644 --- a/src/strings/astring.hpp +++ b/src/strings/astring.hpp @@ -76,21 +76,6 @@ namespace strings __attribute__((format(printf, 2, 0))) int do_vprint(AString& out, const char *fmt, va_list ap); - - class AStringConverter - { - AString& out; - char *mid; - public: - AStringConverter(AString& s); - // this usually gets elided, but multi dtor calls are fine anyway - AStringConverter(const AStringConverter&) = default; - AStringConverter& operator = (const AStringConverter&) = delete; - ~AStringConverter(); - char **operator &(); - }; - - AStringConverter convert_for_scanf(AString& s); } // namespace strings # include "astring.tcc" diff --git a/src/strings/base_test.cpp b/src/strings/base_test.cpp index c630b5c..cab47be 100644 --- a/src/strings/base_test.cpp +++ b/src/strings/base_test.cpp @@ -27,6 +27,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + using namespace strings; struct _test : VString<1> {}; diff --git a/src/strings/literal.cpp b/src/strings/literal.cpp index 65c00f6..506b79b 100644 --- a/src/strings/literal.cpp +++ b/src/strings/literal.cpp @@ -49,10 +49,4 @@ namespace strings { return zs.c_str(); } - - __attribute__((format(scanf, 2, 0))) - int do_vscan(LString in, const char *fmt, va_list ap) - { - return vsscanf(in.c_str(), fmt, ap); - } } // namespace strings diff --git a/src/strings/literal.hpp b/src/strings/literal.hpp index 6d84ebd..001dc46 100644 --- a/src/strings/literal.hpp +++ b/src/strings/literal.hpp @@ -62,9 +62,6 @@ namespace strings // Actually, it might now. const char *decay_for_printf(const LString& zs); - __attribute__((format(scanf, 2, 0))) - int do_vscan(LString in, const char *fmt, va_list ap); - inline LString operator "" _s(const char *s, size_t) { diff --git a/src/strings/rstring.cpp b/src/strings/rstring.cpp index 6ffe79c..c2ca64b 100644 --- a/src/strings/rstring.cpp +++ b/src/strings/rstring.cpp @@ -58,7 +58,7 @@ namespace strings { // order important for self-assign r.owned->count++; - // owned can be NULL from ctors + // owned can be nullptr from ctors // TODO do ctors *properly* (requires gcc 4.7 to stay sane) if (owned && !owned->count--) ::operator delete(owned); diff --git a/src/strings/strings2_test.cpp b/src/strings/strings2_test.cpp index 8a7ee66..23f09fd 100644 --- a/src/strings/strings2_test.cpp +++ b/src/strings/strings2_test.cpp @@ -23,6 +23,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + TEST(StringTests, traits2) { ZString print_non = "\t\e"_s; diff --git a/src/strings/strings_test.cpp b/src/strings/strings_test.cpp index b76bde5..df4c2c3 100644 --- a/src/strings/strings_test.cpp +++ b/src/strings/strings_test.cpp @@ -25,6 +25,9 @@ #include "../poison.hpp" + +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" + template<typename T> class StringTest : public ::testing::Test { diff --git a/src/strings/zstring.cpp b/src/strings/zstring.cpp index dd17e66..94535d0 100644 --- a/src/strings/zstring.cpp +++ b/src/strings/zstring.cpp @@ -74,10 +74,4 @@ namespace strings { return zs.c_str(); } - - __attribute__((format(scanf, 2, 0))) - int do_vscan(ZString in, const char *fmt, va_list ap) - { - return vsscanf(in.c_str(), fmt, ap); - } } // namespace strings diff --git a/src/strings/zstring.hpp b/src/strings/zstring.hpp index e4cd1fd..a0dda2c 100644 --- a/src/strings/zstring.hpp +++ b/src/strings/zstring.hpp @@ -59,9 +59,6 @@ namespace strings // Nope, it doesn't, since there's a template // Actually, it might now. const char *decay_for_printf(const ZString& zs); - - __attribute__((format(scanf, 2, 0))) - int do_vscan(ZString in, const char *fmt, va_list ap); } // namespace strings # include "zstring.tcc" diff --git a/src/warnings.hpp b/src/warnings.hpp index 0b2358a..6c291da 100644 --- a/src/warnings.hpp +++ b/src/warnings.hpp @@ -27,6 +27,7 @@ // GCC 4.6 (incomplete due to bugs) // GCC 4.7 (for few minor workarounds) // GCC 4.8 (zarro boogs found) +// GCC 4.9 (zarro boogs found) // clang 3.1 (may ICE later) // clang 3.2 (with a few major workarounds) @@ -112,6 +113,11 @@ # define EG48(sw) static_assert('E', sw "only for gcc 4.8+"); # define XG48(sw) static_assert('X', sw "only for gcc 4.8+"); +# define IG49(sw) static_assert('I', sw "only for gcc 4.9+"); +# define WG49(sw) static_assert('W', sw "only for gcc 4.9+"); +# define EG49(sw) static_assert('E', sw "only for gcc 4.9+"); +# define XG49(sw) static_assert('X', sw "only for gcc 4.9+"); + # define I47(sw) I(sw) # define W47(sw) W(sw) # define E47(sw) E(sw) @@ -122,6 +128,11 @@ # define E48(sw) E(sw) # define X48(sw) X(sw) +# define I49(sw) I(sw) +# define W49(sw) W(sw) +# define E49(sw) E(sw) +# define X49(sw) X(sw) + #else // warnings specific to clang @@ -181,6 +192,27 @@ # define E48(sw) static_assert('E', sw "only for gcc 4.8+ or clang"); # define X48(sw) static_assert('X', sw "only for gcc 4.8+ or clang"); # endif // __GNUC_MINOR__ +# if __GNUC_MINOR__ >= 9 +# define IG49(sw) IG(sw) +# define WG49(sw) WG(sw) +# define EG49(sw) EG(sw) +# define XG49(sw) XG(sw) + +# define I49(sw) IG(sw) +# define W49(sw) WG(sw) +# define E49(sw) EG(sw) +# define X49(sw) XG(sw) +# else +# define IG49(sw) static_assert('I', sw "only for gcc 4.9+"); +# define WG49(sw) static_assert('W', sw "only for gcc 4.9+"); +# define EG49(sw) static_assert('E', sw "only for gcc 4.9+"); +# define XG49(sw) static_assert('X', sw "only for gcc 4.9+"); + +# define I49(sw) static_assert('I', sw "only for gcc 4.9+ or clang"); +# define W49(sw) static_assert('W', sw "only for gcc 4.9+ or clang"); +# define E49(sw) static_assert('E', sw "only for gcc 4.9+ or clang"); +# define X49(sw) static_assert('X', sw "only for gcc 4.9+ or clang"); +# endif // __GNUC_MINOR__ # endif // __GNUC__ #endif // __clang__ @@ -232,7 +264,7 @@ static_assert('E', "-Wc++1y-extensions not in GCC"); #endif /// Warn about pointer casts which increase alignment -X("-Wcast-align") +E("-Wcast-align") /// Warn about casts which discard qualifiers E("-Wcast-qual") @@ -248,6 +280,9 @@ EG("-Wclobbered") /// C++ comments spanning more than one physical line E("-Wcomment") +/// Warn for conditionally-supported constructs +EG49("-Wconditionally-supported") + // A fixable difference between c++11 and c++14 #ifdef __clang__ # if __has_warning("-Wconstexpr-not-const") @@ -272,7 +307,7 @@ E("-Wconversion-null") WG("-Wcoverage-mismatch") /// -XC("-Wcovered-switch-default") +EC("-Wcovered-switch-default") /// Warn when a #warning directive is encountered WG("-Wcpp") @@ -281,6 +316,13 @@ WG("-Wcpp") /// private E("-Wctor-dtor-privacy") +/// Warn about __TIME__, __DATE__ and __TIMESTAMP__ +/// usage +EG49("-Wdate-time") + +/// Warn when deleting a pointer to incomplete type +EG49("-Wdelete-incomplete") + /// Warn about deleting polymorphic objects with non- /// virtual destructors E47("-Wdelete-non-virtual-dtor") @@ -487,7 +529,7 @@ E("-Wnon-virtual-dtor") E("-Wnonnull") /// -XC("-Wnull-conversion") +EC("-Wnull-conversion") /// Warn if a C-style cast is used in a program E("-Wold-style-cast") @@ -495,6 +537,10 @@ E("-Wold-style-cast") /// Warn about overflow in arithmetic expressions W("-Woverflow") +/// Warn if a simd directive is overridden by the +/// vectorizer cost model +EG49("-Wopenmp-simd") + /// Warn if a string is longer than the maximum /// portable length specified by the standard //X("-Woverlength-strings") @@ -523,7 +569,7 @@ E("-Wparentheses") // lots of minor extensions are used IG48("-Wpedantic") // a bit too noisy -XC("-Wpedantic") +EC("-Wpedantic") /// Warn when converting the type of pointers to /// member functions @@ -563,7 +609,7 @@ X("-Wsign-compare") /// Warn when overload promotes from unsigned to /// signed -X("-Wsign-promo") +E("-Wsign-promo") /// This switch lacks documentation WG48("-Wsizeof-pointer-memaccess") @@ -585,15 +631,15 @@ X("-Wstrict-overflow") /// Warn about enumerated switches, with no default, /// missing a case -X("-Wswitch") +I("-Wswitch") /// Warn about enumerated switches missing a /// "default:" statement -X("-Wswitch-default") +I("-Wswitch-default") /// Warn about all enumerated switches missing a /// specific case -X("-Wswitch-enum") +I("-Wswitch-enum") /// Warn when __sync_fetch_and_nand and /// __sync_nand_and_fetch built-in functions are used @@ -695,7 +741,7 @@ E("-Wwrite-strings") /// Warn when a literal '0' is used as null /// pointer -XG47("-Wzero-as-null-pointer-constant") +EG47("-Wzero-as-null-pointer-constant") // clean up after myself |