summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.cpp1397
-rw-r--r--src/map/battle.cpp27
-rw-r--r--src/map/chrif.cpp122
-rw-r--r--src/map/clif.cpp94
-rw-r--r--src/map/grfio.cpp8
-rw-r--r--src/map/intif.cpp38
-rw-r--r--src/map/itemdb.cpp6
-rw-r--r--src/map/magic-expr.cpp210
-rw-r--r--src/map/magic-expr.hpp4
-rw-r--r--src/map/magic-interpreter-base.cpp6
-rw-r--r--src/map/magic-stmt.cpp116
-rw-r--r--src/map/magic-v2.cpp330
-rw-r--r--src/map/magic.cpp6
-rw-r--r--src/map/map.cpp122
-rw-r--r--src/map/map.hpp4
-rw-r--r--src/map/map.t.hpp2
-rw-r--r--src/map/mapflag.cpp64
-rw-r--r--src/map/mob.cpp82
-rw-r--r--src/map/mob.hpp6
-rw-r--r--src/map/npc.cpp135
-rw-r--r--src/map/party.cpp12
-rw-r--r--src/map/path.cpp4
-rw-r--r--src/map/pc.cpp136
-rw-r--r--src/map/script.cpp590
-rw-r--r--src/map/skill-pools.cpp6
-rw-r--r--src/map/skill.cpp96
-rw-r--r--src/map/skill.hpp4
-rw-r--r--src/map/tmw.cpp12
-rw-r--r--src/map/trade.cpp8
29 files changed, 1811 insertions, 1836 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index 240df8b..f721aaa 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -121,11 +121,11 @@ void atcommand_config_write(ZString cfgName)
if (!out.is_open())
{
- FPRINTF(stderr, "Failed to write atcommand config: %s\n", cfgName);
+ FPRINTF(stderr, "Failed to write atcommand config: %s\n"_fmt, cfgName);
return;
}
- FPRINTF(out, "// Generated by %s\n", CURRENT_VERSION_STRING);
+ FPRINTF(out, "// Generated by %s\n"_fmt, CURRENT_VERSION_STRING);
for (const auto& pair : atcommand_info)
{
// This XString is really a ZString, but not declared as one
@@ -137,7 +137,7 @@ void atcommand_config_write(ZString cfgName)
"\n"
"// %s\n"
"// Usage: @%s %s\n"
- "%s: %d\n",
+ "%s: %d\n"_fmt,
info.help,
cmd, info.args,
cmd, info.level);
@@ -198,8 +198,8 @@ void log_atcommand(dumb_ptr<map_session_data> sd, ZString cmd)
stamp_time(tmpstr);
MapName map = (sd->bl_m
? sd->bl_m->name_
- : stringish<MapName>("undefined.gat"));
- FPRINTF(*fp, "[%s] %s(%d,%d) %s(%d) : %s\n",
+ : stringish<MapName>("undefined.gat"_s));
+ FPRINTF(*fp, "[%s] %s(%d,%d) %s(%d) : %s\n"_fmt,
tmpstr,
map, sd->bl_x, sd->bl_y,
sd->status_key.name, sd->status_key.account_id,
@@ -225,7 +225,7 @@ io::AppendFile *get_gm_log()
return gm_logfile.get();
last_logfile_nr = logfile_nr;
- AString fullname = STRPRINTF("%s.%04d-%02d",
+ AString fullname = STRPRINTF("%s.%04d-%02d"_fmt,
gm_log, year, month);
if (gm_logfile)
@@ -259,14 +259,14 @@ bool is_atcommand(Session *s, dumb_ptr<map_session_data> sd,
gmlvl = pc_isGM(sd);
if (battle_config.atcommand_gm_only != 0 && !gmlvl)
{
- AString output = STRPRINTF("GM command is level 0, but this server disables level 0 commands: %s",
+ AString output = STRPRINTF("GM command is level 0, but this server disables level 0 commands: %s"_fmt,
AString(command));
clif_displaymessage(s, output);
return true;
}
if (!info)
{
- AString output = STRPRINTF("GM command not found: %s",
+ AString output = STRPRINTF("GM command not found: %s"_fmt,
AString(command));
clif_displaymessage(s, output);
return true;
@@ -274,7 +274,7 @@ bool is_atcommand(Session *s, dumb_ptr<map_session_data> sd,
}
if (info->level > gmlvl)
{
- AString output = STRPRINTF("GM command is level %d, but you are level %d: %s",
+ AString output = STRPRINTF("GM command is level %d, but you are level %d: %s"_fmt,
info->level, gmlvl,
AString(command));
clif_displaymessage(s, output);
@@ -292,17 +292,17 @@ bool is_atcommand(Session *s, dumb_ptr<map_session_data> sd,
log_atcommand(sd, message);
break;
case ATCE::USAGE:
- clif_displaymessage(s, "Command failed: usage error");
- clif_displaymessage(s, STRPRINTF("Usage: %s %s", AString(command), info->args));
+ clif_displaymessage(s, "Command failed: usage error"_s);
+ clif_displaymessage(s, STRPRINTF("Usage: %s %s"_fmt, AString(command), info->args));
break;
case ATCE::EXIST:
- clif_displaymessage(s, "Command failed: something does not exist (or already exists)");
+ clif_displaymessage(s, "Command failed: something does not exist (or already exists)"_s);
break;
case ATCE::RANGE:
- clif_displaymessage(s, "Command failed: value out of range");
+ clif_displaymessage(s, "Command failed: value out of range"_s);
break;
case ATCE::PERM:
- clif_displaymessage(s, "Command failed: permission denied");
+ clif_displaymessage(s, "Command failed: permission denied"_s);
break;
default:
abort();
@@ -347,7 +347,7 @@ bool atcommand_config_read(ZString cfgName)
io::ReadFile in(cfgName);
if (!in.is_open())
{
- PRINTF("At commands configuration file not found: %s\n", cfgName);
+ PRINTF("At commands configuration file not found: %s\n"_fmt, cfgName);
return false;
}
@@ -361,7 +361,7 @@ bool atcommand_config_read(ZString cfgName)
ZString w2;
if (!config_split(line, &w1, &w2))
{
- PRINTF("Bad config line: %s\n", line);
+ PRINTF("Bad config line: %s\n"_fmt, line);
rv = false;
continue;
}
@@ -374,11 +374,11 @@ bool atcommand_config_read(ZString cfgName)
else if (p->level < 0)
p->level = 0;
}
- else if (w1 == "import")
+ else if (w1 == "import"_s)
rv &= atcommand_config_read(w2);
else
{
- PRINTF("%s: bad line: %s\n", cfgName, line);
+ PRINTF("%s: bad line: %s\n"_fmt, cfgName, line);
rv = false;
}
}
@@ -391,7 +391,7 @@ bool atcommand_config_read(ZString cfgName)
static
void atc_do_help(Session *s, const char *cmd, const AtCommandInfo& info)
{
- auto msg = STRPRINTF("\u2007\u2007%d: @%s %s", info.level, cmd, info.args);
+ auto msg = STRPRINTF("\u2007\u2007%d: @%s %s"_fmt, info.level, cmd, info.args);
// manually padding because *space*
size_t ll = 1;
if (info.level >= 10)
@@ -407,9 +407,9 @@ ATCE atcommand_help(Session *s, dumb_ptr<map_session_data>,
{
if (!message)
{
- clif_displaymessage(s, "There is too much help to display it all at once");
- clif_displaymessage(s, "Try @help <@command> or @help <category> or @help <level[-level]>");
- clif_displaymessage(s, "Right now the only category is 'all'");
+ clif_displaymessage(s, "There is too much help to display it all at once"_s);
+ clif_displaymessage(s, "Try @help <@command> or @help <category> or @help <level[-level]>"_s);
+ clif_displaymessage(s, "Right now the only category is 'all'"_s);
return ATCE::OKAY;
}
@@ -419,14 +419,14 @@ ATCE atcommand_help(Session *s, dumb_ptr<map_session_data>,
const AtCommandInfo *info = atcommand_info.search(cmd);
if (!info)
return ATCE::EXIST;
- clif_displaymessage(s, STRPRINTF("Usage: @%s %s", cmd, info->args));
+ clif_displaymessage(s, STRPRINTF("Usage: @%s %s"_fmt, cmd, info->args));
clif_displaymessage(s, info->help);
return ATCE::OKAY;
}
- if (message == "all")
+ if (message == "all"_s)
{
- clif_displaymessage(s, "Synopses of GM commands in category 'all':");
+ clif_displaymessage(s, "Synopses of GM commands in category 'all':"_s);
for (const auto& pair : atcommand_info)
{
const char *cmd = &*pair.first.begin();
@@ -444,7 +444,7 @@ ATCE atcommand_help(Session *s, dumb_ptr<map_session_data>,
if (low < 0 || high > 100 || low >= high)
return ATCE::RANGE;
- clif_displaymessage(s, STRPRINTF("Synopses of GM commands in level [%d, %d):", low, high));
+ clif_displaymessage(s, STRPRINTF("Synopses of GM commands in level [%d, %d):"_fmt, low, high));
for (const auto& pair : atcommand_info)
{
const char *cmd = &*pair.first.begin();
@@ -467,25 +467,25 @@ ATCE atcommand_setup(Session *s, dumb_ptr<map_session_data> sd,
level--;
AString buf;
- buf = STRPRINTF("-255 %s", character);
+ buf = STRPRINTF("-255 %s"_fmt, character);
atcommand_character_baselevel(s, sd, buf);
- buf = STRPRINTF("%d %s", level, character);
+ buf = STRPRINTF("%d %s"_fmt, level, character);
atcommand_character_baselevel(s, sd, buf);
// Emote skill
- buf = STRPRINTF("1 1 %s", character);
+ buf = STRPRINTF("1 1 %s"_fmt, character);
atcommand_skill_learn(s, sd, buf);
// Trade skill
- buf = STRPRINTF("2 1 %s", character);
+ buf = STRPRINTF("2 1 %s"_fmt, character);
atcommand_skill_learn(s, sd, buf);
// Party skill
- STRPRINTF("2 2 %s", character);
+ STRPRINTF("2 2 %s"_fmt, character);
atcommand_skill_learn(s, sd, buf);
- STRPRINTF("018-1.gat 24 98 %s", character);
+ STRPRINTF("018-1.gat 24 98 %s"_fmt, character);
atcommand_charwarp(s, sd, buf);
return ATCE::OKAY;
@@ -520,42 +520,42 @@ ATCE atcommand_charwarp(Session *s, dumb_ptr<map_session_data> sd,
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp someone to this map.");
+ "You are not authorised to warp someone to this map."_s);
return ATCE::PERM;
}
if (pl_sd->bl_m && pl_sd->bl_m->flag.get(MapFlag::NOWARP)
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp this player from its actual map.");
+ "You are not authorised to warp this player from its actual map."_s);
return ATCE::PERM;
}
if (pc_setpos(pl_sd, map_name, x, y, BeingRemoveWhy::WARPED) == 0)
{
- clif_displaymessage(pl_sd->sess, "Warped.");
- clif_displaymessage(s, "Player warped (message sends to player too).");
+ clif_displaymessage(pl_sd->sess, "Warped."_s);
+ clif_displaymessage(s, "Player warped (message sends to player too)."_s);
}
else
{
- clif_displaymessage(s, "Map not found.");
+ clif_displaymessage(s, "Map not found."_s);
return ATCE::EXIST;
}
}
else
{
- clif_displaymessage(s, "Coordinates out of range.");
+ clif_displaymessage(s, "Coordinates out of range."_s);
return ATCE::RANGE;
}
}
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -573,7 +573,7 @@ ATCE atcommand_warp(Session *s, dumb_ptr<map_session_data> sd,
|| !extract(message, record<' ', 1>(&map_name, &x, &y)))
{
clif_displaymessage(s,
- "Please, enter a map (usage: @warp <mapname> <x> <y>).");
+ "Please, enter a map (usage: @warp <mapname> <x> <y>)."_s);
return ATCE::USAGE;
}
@@ -589,27 +589,27 @@ ATCE atcommand_warp(Session *s, dumb_ptr<map_session_data> sd,
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp you to this map.");
+ "You are not authorised to warp you to this map."_s);
return ATCE::PERM;
}
if (sd->bl_m && sd->bl_m->flag.get(MapFlag::NOWARP)
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp you from your actual map.");
+ "You are not authorised to warp you from your actual map."_s);
return ATCE::PERM;
}
if (pc_setpos(sd, map_name, x, y, BeingRemoveWhy::WARPED) == 0)
- clif_displaymessage(s, "Warped.");
+ clif_displaymessage(s, "Warped."_s);
else
{
- clif_displaymessage(s, "Map not found.");
+ clif_displaymessage(s, "Map not found."_s);
return ATCE::EXIST;
}
}
else
{
- clif_displaymessage(s, "Coordinates out of range.");
+ clif_displaymessage(s, "Coordinates out of range."_s);
return ATCE::RANGE;
}
@@ -630,14 +630,14 @@ ATCE atcommand_where(Session *s, dumb_ptr<map_session_data> sd,
&& (pc_isGM(pl_sd) > pc_isGM(sd))))
{
// you can look only lower or same level
- AString output = STRPRINTF("%s: %s (%d,%d)",
+ AString output = STRPRINTF("%s: %s (%d,%d)"_fmt,
pl_sd->status_key.name,
pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y);
clif_displaymessage(s, output);
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -653,7 +653,7 @@ ATCE atcommand_goto(Session *s, dumb_ptr<map_session_data> sd,
if (!asplit(message, &character))
{
clif_displaymessage(s,
- "Please, enter a player name (usage: @jumpto/@warpto/@goto <char name>).");
+ "Please, enter a player name (usage: @jumpto/@warpto/@goto <char name>)."_s);
return ATCE::USAGE;
}
@@ -664,23 +664,23 @@ ATCE atcommand_goto(Session *s, dumb_ptr<map_session_data> sd,
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp you to the map of this player.");
+ "You are not authorised to warp you to the map of this player."_s);
return ATCE::PERM;
}
if (sd->bl_m && sd->bl_m->flag.get(MapFlag::NOWARP)
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp you from your actual map.");
+ "You are not authorised to warp you from your actual map."_s);
return ATCE::PERM;
}
pc_setpos(sd, pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y, BeingRemoveWhy::WARPED);
- AString output = STRPRINTF("Jump to %s", character);
+ AString output = STRPRINTF("Jump to %s"_fmt, character);
clif_displaymessage(s, output);
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -705,23 +705,23 @@ ATCE atcommand_jump(Session *s, dumb_ptr<map_session_data> sd,
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp you to your actual map.");
+ "You are not authorised to warp you to your actual map."_s);
return ATCE::PERM;
}
if (sd->bl_m && sd->bl_m->flag.get(MapFlag::NOWARP)
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp you from your actual map.");
+ "You are not authorised to warp you from your actual map."_s);
return ATCE::PERM;
}
pc_setpos(sd, sd->mapname_, x, y, BeingRemoveWhy::WARPED);
- AString output = STRPRINTF("Jump to %d %d", x, y);
+ AString output = STRPRINTF("Jump to %d %d"_fmt, x, y);
clif_displaymessage(s, output);
}
else
{
- clif_displaymessage(s, "Coordinates out of range.");
+ clif_displaymessage(s, "Coordinates out of range."_s);
return ATCE::RANGE;
}
@@ -761,12 +761,12 @@ ATCE atcommand_who(Session *s, dumb_ptr<map_session_data> sd,
AString output;
if (pl_GM_level > 0)
output = STRPRINTF(
- "Name: %s (GM:%d) | Location: %s %d %d",
+ "Name: %s (GM:%d) | Location: %s %d %d"_fmt,
pl_sd->status_key.name, pl_GM_level,
pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y);
else
output = STRPRINTF(
- "Name: %s | Location: %s %d %d",
+ "Name: %s | Location: %s %d %d"_fmt,
pl_sd->status_key.name, pl_sd->mapname_,
pl_sd->bl_x, pl_sd->bl_y);
clif_displaymessage(s, output);
@@ -777,12 +777,12 @@ ATCE atcommand_who(Session *s, dumb_ptr<map_session_data> sd,
}
if (count == 0)
- clif_displaymessage(s, "No player found.");
+ clif_displaymessage(s, "No player found."_s);
else if (count == 1)
- clif_displaymessage(s, "1 player found.");
+ clif_displaymessage(s, "1 player found."_s);
else
{
- AString output = STRPRINTF("%d players found.", count);
+ AString output = STRPRINTF("%d players found."_fmt, count);
clif_displaymessage(s, output);
}
@@ -822,11 +822,11 @@ ATCE atcommand_whogroup(Session *s, dumb_ptr<map_session_data> sd,
{
// search with no case sensitive
p = party_search(pl_sd->status.party_id);
- PartyName temp0 = p ? p->name : stringish<PartyName>("None");
+ PartyName temp0 = p ? p->name : stringish<PartyName>("None"_s);
AString output;
if (pl_GM_level > 0)
output = STRPRINTF(
- "Name: %s (GM:%d) | Party: '%s'",
+ "Name: %s (GM:%d) | Party: '%s'"_fmt,
pl_sd->status_key.name, pl_GM_level, temp0);
clif_displaymessage(s, output);
count++;
@@ -836,12 +836,12 @@ ATCE atcommand_whogroup(Session *s, dumb_ptr<map_session_data> sd,
}
if (count == 0)
- clif_displaymessage(s, "No player found.");
+ clif_displaymessage(s, "No player found."_s);
else if (count == 1)
- clif_displaymessage(s, "1 player found.");
+ clif_displaymessage(s, "1 player found."_s);
else
{
- AString output = STRPRINTF("%d players found.", count);
+ AString output = STRPRINTF("%d players found."_fmt, count);
clif_displaymessage(s, output);
}
@@ -886,12 +886,12 @@ ATCE atcommand_whomap(Session *s, dumb_ptr<map_session_data> sd,
AString output;
if (pl_GM_level > 0)
output = STRPRINTF(
- "Name: %s (GM:%d) | Location: %s %d %d",
+ "Name: %s (GM:%d) | Location: %s %d %d"_fmt,
pl_sd->status_key.name, pl_GM_level,
pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y);
else
output = STRPRINTF(
- "Name: %s | Location: %s %d %d",
+ "Name: %s | Location: %s %d %d"_fmt,
pl_sd->status_key.name, pl_sd->mapname_,
pl_sd->bl_x, pl_sd->bl_y);
clif_displaymessage(s, output);
@@ -901,7 +901,7 @@ ATCE atcommand_whomap(Session *s, dumb_ptr<map_session_data> sd,
}
}
- AString output = STRPRINTF("%d players found in map '%s'.",
+ AString output = STRPRINTF("%d players found in map '%s'."_fmt,
count, map_id->name_);
clif_displaymessage(s, output);
@@ -945,13 +945,13 @@ ATCE atcommand_whomapgroup(Session *s, dumb_ptr<map_session_data> sd,
if (pl_sd->bl_m == map_id)
{
p = party_search(pl_sd->status.party_id);
- PartyName temp0 = p ? p->name : stringish<PartyName>("None");
+ PartyName temp0 = p ? p->name : stringish<PartyName>("None"_s);
AString output;
if (pl_GM_level > 0)
- output = STRPRINTF("Name: %s (GM:%d) | Party: '%s'",
+ output = STRPRINTF("Name: %s (GM:%d) | Party: '%s'"_fmt,
pl_sd->status_key.name, pl_GM_level, temp0);
else
- output = STRPRINTF("Name: %s | Party: '%s'",
+ output = STRPRINTF("Name: %s | Party: '%s'"_fmt,
pl_sd->status_key.name, temp0);
clif_displaymessage(s, output);
count++;
@@ -962,12 +962,12 @@ ATCE atcommand_whomapgroup(Session *s, dumb_ptr<map_session_data> sd,
AString output;
if (count == 0)
- output = STRPRINTF("No player found in map '%s'.", map_id->name_);
+ output = STRPRINTF("No player found in map '%s'."_fmt, map_id->name_);
else if (count == 1)
- output = STRPRINTF("1 player found in map '%s'.", map_id->name_);
+ output = STRPRINTF("1 player found in map '%s'."_fmt, map_id->name_);
else
{
- output = STRPRINTF("%d players found in map '%s'.", count, map_id->name_);
+ output = STRPRINTF("%d players found in map '%s'."_fmt, count, map_id->name_);
}
clif_displaymessage(s, output);
@@ -1010,20 +1010,20 @@ ATCE atcommand_whogm(Session *s, dumb_ptr<map_session_data> sd,
// search with no case sensitive
AString output;
output = STRPRINTF(
- "Name: %s (GM:%d) | Location: %s %d %d",
+ "Name: %s (GM:%d) | Location: %s %d %d"_fmt,
pl_sd->status_key.name, pl_GM_level,
pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y);
clif_displaymessage(s, output);
output = STRPRINTF(
- " BLvl: %d | Job: %s (Lvl: %d)",
+ " BLvl: %d | Job: %s (Lvl: %d)"_fmt,
pl_sd->status.base_level,
- "Novice/Human",
+ "Novice/Human"_s,
pl_sd->status.job_level);
clif_displaymessage(s, output);
p = party_search(pl_sd->status.party_id);
- PartyName temp0 = p ? p->name : stringish<PartyName>("None");
+ PartyName temp0 = p ? p->name : stringish<PartyName>("None"_s);
output = STRPRINTF(
- " Party: '%s'",
+ " Party: '%s'"_fmt,
temp0);
clif_displaymessage(s, output);
count++;
@@ -1034,12 +1034,12 @@ ATCE atcommand_whogm(Session *s, dumb_ptr<map_session_data> sd,
}
if (count == 0)
- clif_displaymessage(s, "No GM found.");
+ clif_displaymessage(s, "No GM found."_s);
else if (count == 1)
- clif_displaymessage(s, "1 GM found.");
+ clif_displaymessage(s, "1 GM found."_s);
else
{
- AString output = STRPRINTF("%d GMs found.", count);
+ AString output = STRPRINTF("%d GMs found."_fmt, count);
clif_displaymessage(s, output);
}
@@ -1053,7 +1053,7 @@ ATCE atcommand_save(Session *s, dumb_ptr<map_session_data> sd,
pc_setsavepoint(sd, sd->mapname_, sd->bl_x, sd->bl_y);
pc_makesavestatus(sd);
chrif_save(sd);
- clif_displaymessage(s, "Character data respawn point saved.");
+ clif_displaymessage(s, "Character data respawn point saved."_s);
return ATCE::OKAY;
}
@@ -1067,14 +1067,14 @@ ATCE atcommand_load(Session *s, dumb_ptr<map_session_data> sd,
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp you to your save map.");
+ "You are not authorised to warp you to your save map."_s);
return ATCE::PERM;
}
if (sd->bl_m && sd->bl_m->flag.get(MapFlag::NOWARP)
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp you from your actual map.");
+ "You are not authorised to warp you from your actual map."_s);
return ATCE::PERM;
}
@@ -1089,7 +1089,7 @@ ATCE atcommand_load(Session *s, dumb_ptr<map_session_data> sd,
pc_setpos(sd, sd->status.save_point.map_, sd->status.save_point.x,
sd->status.save_point.y, BeingRemoveWhy::GONE);
}
- clif_displaymessage(s, "Warping to respawn point.");
+ clif_displaymessage(s, "Warping to respawn point."_s);
return ATCE::OKAY;
}
@@ -1101,7 +1101,7 @@ ATCE atcommand_speed(Session *s, dumb_ptr<map_session_data> sd,
if (!message)
{
AString output = STRPRINTF(
- "Please, enter a speed value (usage: @speed <%d-%d>).",
+ "Please, enter a speed value (usage: @speed <%d-%d>)."_fmt,
static_cast<uint32_t>(MIN_WALK_SPEED.count()),
static_cast<uint32_t>(MAX_WALK_SPEED.count()));
clif_displaymessage(s, output);
@@ -1115,12 +1115,12 @@ ATCE atcommand_speed(Session *s, dumb_ptr<map_session_data> sd,
//sd->walktimer = x;
//この文を追加 by れ
clif_updatestatus(sd, SP::SPEED);
- clif_displaymessage(s, "Speed changed.");
+ clif_displaymessage(s, "Speed changed."_s);
}
else
{
AString output = STRPRINTF(
- "Please, enter a valid speed value (usage: @speed <%d-%d>).",
+ "Please, enter a valid speed value (usage: @speed <%d-%d>)."_fmt,
static_cast<uint32_t>(MIN_WALK_SPEED.count()),
static_cast<uint32_t>(MAX_WALK_SPEED.count()));
clif_displaymessage(s, output);
@@ -1138,14 +1138,14 @@ ATCE atcommand_storage(Session *s, dumb_ptr<map_session_data> sd,
if (sd->state.storage_open)
{
- clif_displaymessage(s, "msg_table[250]");
+ clif_displaymessage(s, "msg_table[250]"_s);
return ATCE::EXIST;
}
if ((stor = account2storage2(sd->status_key.account_id)) != NULL
&& stor->storage_status == 1)
{
- clif_displaymessage(s, "msg_table[250]");
+ clif_displaymessage(s, "msg_table[250]"_s);
return ATCE::EXIST;
}
@@ -1171,7 +1171,7 @@ ATCE atcommand_option(Session *s, dumb_ptr<map_session_data> sd,
clif_changeoption(sd);
pc_calcstatus(sd, 0);
- clif_displaymessage(s, "Options changed.");
+ clif_displaymessage(s, "Options changed."_s);
return ATCE::OKAY;
}
@@ -1183,12 +1183,12 @@ ATCE atcommand_hide(Session *s, dumb_ptr<map_session_data> sd,
if (bool(sd->status.option & Option::HIDE))
{
sd->status.option &= ~Option::HIDE;
- clif_displaymessage(s, "Invisible: Off.");
+ clif_displaymessage(s, "Invisible: Off."_s);
}
else
{
sd->status.option |= Option::HIDE;
- clif_displaymessage(s, "Invisible: On.");
+ clif_displaymessage(s, "Invisible: On."_s);
}
clif_changeoption(sd);
@@ -1200,7 +1200,7 @@ ATCE atcommand_die(Session *s, dumb_ptr<map_session_data> sd,
ZString)
{
pc_damage(NULL, sd, sd->status.hp + 1);
- clif_displaymessage(s, "A pity! You've died.");
+ clif_displaymessage(s, "A pity! You've died."_s);
return ATCE::OKAY;
}
@@ -1221,17 +1221,17 @@ ATCE atcommand_kill(Session *s, dumb_ptr<map_session_data> sd,
{
// you can kill only lower or same level
pc_damage(NULL, pl_sd, pl_sd->status.hp + 1);
- clif_displaymessage(s, "Character killed.");
+ clif_displaymessage(s, "Character killed."_s);
}
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -1250,7 +1250,7 @@ ATCE atcommand_alive(Session *s, dumb_ptr<map_session_data> sd,
clif_updatestatus(sd, SP::HP);
clif_updatestatus(sd, SP::SP);
clif_resurrection(sd, 1);
- clif_displaymessage(s, "You've been revived! It's a miracle!");
+ clif_displaymessage(s, "You've been revived! It's a miracle!"_s);
return ATCE::OKAY;
}
@@ -1304,13 +1304,13 @@ ATCE atcommand_heal(Session *s, dumb_ptr<map_session_data> sd,
{
pc_heal(sd, hp, sp);
if (hp >= 0 && sp >= 0)
- clif_displaymessage(s, "HP, SP recovered.");
+ clif_displaymessage(s, "HP, SP recovered."_s);
else
- clif_displaymessage(s, "HP or/and SP modified.");
+ clif_displaymessage(s, "HP or/and SP modified."_s);
}
else
{
- clif_displaymessage(s, "HP and SP are already with the good value.");
+ clif_displaymessage(s, "HP and SP are already with the good value."_s);
return ATCE::RANGE;
}
@@ -1329,7 +1329,7 @@ ATCE atcommand_item(Session *s, dumb_ptr<map_session_data> sd,
if (!extract(message, record<' ', 1>(&item_name, &number)))
{
clif_displaymessage(s,
- "Please, enter an item name/id (usage: @item <item name or ID> [quantity]).");
+ "Please, enter an item name/id (usage: @item <item name or ID> [quantity])."_s);
return ATCE::USAGE;
}
@@ -1363,11 +1363,11 @@ ATCE atcommand_item(Session *s, dumb_ptr<map_session_data> sd,
!= PickupFail::OKAY)
clif_additem(sd, 0, 0, flag);
}
- clif_displaymessage(s, "Item created.");
+ clif_displaymessage(s, "Item created."_s);
}
else
{
- clif_displaymessage(s, "Invalid item ID or name.");
+ clif_displaymessage(s, "Invalid item ID or name."_s);
return ATCE::EXIST;
}
@@ -1386,7 +1386,7 @@ ATCE atcommand_itemreset(Session *s, dumb_ptr<map_session_data> sd,
&& sd->status.inventory[i].equip == EPOS::ZERO)
pc_delitem(sd, i, sd->status.inventory[i].amount, 0);
}
- clif_displaymessage(s, "All of your items have been removed.");
+ clif_displaymessage(s, "All of your items have been removed."_s);
return ATCE::OKAY;
}
@@ -1409,7 +1409,7 @@ ATCE atcommand_baselevelup(Session *s, dumb_ptr<map_session_data> sd,
if (!extract(message, &level) || !level)
{
clif_displaymessage(s,
- "Please, enter a level adjustement (usage: @blvl <number of levels>).");
+ "Please, enter a level adjustement (usage: @blvl <number of levels>)."_s);
return ATCE::USAGE;
}
@@ -1417,7 +1417,7 @@ ATCE atcommand_baselevelup(Session *s, dumb_ptr<map_session_data> sd,
{
if (sd->status.base_level == battle_config.maximum_level)
{
- clif_displaymessage(s, "Base level can't go any higher.");
+ clif_displaymessage(s, "Base level can't go any higher."_s);
return ATCE::RANGE;
}
if (level > battle_config.maximum_level || level > (battle_config.maximum_level - sd->status.base_level))
@@ -1432,13 +1432,13 @@ ATCE atcommand_baselevelup(Session *s, dumb_ptr<map_session_data> sd,
pc_calcstatus(sd, 0);
pc_heal(sd, sd->status.max_hp, sd->status.max_sp);
clif_misceffect(sd, 0);
- clif_displaymessage(s, "Base level raised.");
+ clif_displaymessage(s, "Base level raised."_s);
}
else
{
if (sd->status.base_level == 1)
{
- clif_displaymessage(s, "Base level can't go any lower.");
+ clif_displaymessage(s, "Base level can't go any lower."_s);
return ATCE::USAGE;
}
if (level < -battle_config.maximum_level || level < (1 - sd->status.base_level))
@@ -1458,7 +1458,7 @@ ATCE atcommand_baselevelup(Session *s, dumb_ptr<map_session_data> sd,
clif_updatestatus(sd, SP::BASELEVEL);
clif_updatestatus(sd, SP::NEXTBASEEXP);
pc_calcstatus(sd, 0);
- clif_displaymessage(s, "Base level lowered.");
+ clif_displaymessage(s, "Base level lowered."_s);
}
return ATCE::OKAY;
@@ -1481,7 +1481,7 @@ ATCE atcommand_joblevelup(Session *s, dumb_ptr<map_session_data> sd,
{
if (sd->status.job_level == up_level)
{
- clif_displaymessage(s, "Job level can't go any higher.");
+ clif_displaymessage(s, "Job level can't go any higher."_s);
return ATCE::RANGE;
}
if (level > up_level || level > (up_level - sd->status.job_level))
@@ -1494,13 +1494,13 @@ ATCE atcommand_joblevelup(Session *s, dumb_ptr<map_session_data> sd,
clif_updatestatus(sd, SP::SKILLPOINT);
pc_calcstatus(sd, 0);
clif_misceffect(sd, 1);
- clif_displaymessage(s, "Job level raised.");
+ clif_displaymessage(s, "Job level raised."_s);
}
else
{
if (sd->status.job_level == 1)
{
- clif_displaymessage(s, "Job level can't go any lower.");
+ clif_displaymessage(s, "Job level can't go any lower."_s);
return ATCE::RANGE;
}
if (level < -up_level || level < (1 - sd->status.job_level))
@@ -1518,7 +1518,7 @@ ATCE atcommand_joblevelup(Session *s, dumb_ptr<map_session_data> sd,
}
// to add: remove status points from skills
pc_calcstatus(sd, 0);
- clif_displaymessage(s, "Job level lowered.");
+ clif_displaymessage(s, "Job level lowered."_s);
}
return ATCE::OKAY;
@@ -1534,7 +1534,7 @@ ATCE atcommand_gm(Session *s, dumb_ptr<map_session_data> sd,
if (pc_isGM(sd))
{
// a GM can not use this function. only a normal player (become gm is not for gm!)
- clif_displaymessage(s, "You already have some GM powers.");
+ clif_displaymessage(s, "You already have some GM powers."_s);
return ATCE::PERM;
}
else
@@ -1550,7 +1550,7 @@ ATCE atcommand_pvpoff(Session *s, dumb_ptr<map_session_data> sd,
if (battle_config.pk_mode)
{
//disable command if server is in PK mode [Valaris]
- clif_displaymessage(s, "This option cannot be used in PK Mode.");
+ clif_displaymessage(s, "This option cannot be used in PK Mode."_s);
return ATCE::EXIST;
}
@@ -1571,11 +1571,11 @@ ATCE atcommand_pvpoff(Session *s, dumb_ptr<map_session_data> sd,
}
}
}
- clif_displaymessage(s, "PvP: Off.");
+ clif_displaymessage(s, "PvP: Off."_s);
}
else
{
- clif_displaymessage(s, "PvP is already Off.");
+ clif_displaymessage(s, "PvP is already Off."_s);
return ATCE::EXIST;
}
@@ -1589,7 +1589,7 @@ ATCE atcommand_pvpon(Session *s, dumb_ptr<map_session_data> sd,
if (battle_config.pk_mode)
{
//disable command if server is in PK mode [Valaris]
- clif_displaymessage(s, "This option cannot be used in PK Mode.");
+ clif_displaymessage(s, "This option cannot be used in PK Mode."_s);
return ATCE::EXIST;
}
@@ -1614,11 +1614,11 @@ ATCE atcommand_pvpon(Session *s, dumb_ptr<map_session_data> sd,
}
}
}
- clif_displaymessage(s, "PvP: On.");
+ clif_displaymessage(s, "PvP: On."_s);
}
else
{
- clif_displaymessage(s, "PvP is already On.");
+ clif_displaymessage(s, "PvP is already On."_s);
return ATCE::EXIST;
}
@@ -1642,7 +1642,7 @@ ATCE atcommand_model(Session *s, dumb_ptr<map_session_data> sd,
pc_changelook(sd, LOOK::HAIR, hair_style);
pc_changelook(sd, LOOK::HAIR_COLOR, hair_color);
pc_changelook(sd, LOOK::CLOTHES_COLOR, cloth_color);
- clif_displaymessage(s, "Appearence changed.");
+ clif_displaymessage(s, "Appearence changed."_s);
}
}
else
@@ -1664,7 +1664,7 @@ ATCE atcommand_dye(Session *s, dumb_ptr<map_session_data> sd,
{
{
pc_changelook(sd, LOOK::CLOTHES_COLOR, cloth_color);
- clif_displaymessage(s, "Appearence changed.");
+ clif_displaymessage(s, "Appearence changed."_s);
}
}
else
@@ -1686,7 +1686,7 @@ ATCE atcommand_hair_style(Session *s, dumb_ptr<map_session_data> sd,
{
{
pc_changelook(sd, LOOK::HAIR, hair_style);
- clif_displaymessage(s, "Appearence changed.");
+ clif_displaymessage(s, "Appearence changed."_s);
}
}
else
@@ -1708,7 +1708,7 @@ ATCE atcommand_hair_color(Session *s, dumb_ptr<map_session_data> sd,
{
{
pc_changelook(sd, LOOK::HAIR_COLOR, hair_color);
- clif_displaymessage(s, "Appearence changed.");
+ clif_displaymessage(s, "Appearence changed."_s);
}
}
else
@@ -1749,7 +1749,7 @@ ATCE atcommand_spawn(Session *s, dumb_ptr<map_session_data> sd,
number = battle_config.atcommand_spawn_quantity_limit;
if (battle_config.etc_log)
- PRINTF("@spawn monster='%s' id=%d count=%d (%d,%d)\n",
+ PRINTF("@spawn monster='%s' id=%d count=%d (%d,%d)\n"_fmt,
monster, mob_id, number, x, y);
count = 0;
@@ -1778,16 +1778,16 @@ ATCE atcommand_spawn(Session *s, dumb_ptr<map_session_data> sd,
if (count != 0)
if (number == count)
- clif_displaymessage(s, "All monster summoned!");
+ clif_displaymessage(s, "All monster summoned!"_s);
else
{
- AString output = STRPRINTF("%d monster(s) summoned!",
+ AString output = STRPRINTF("%d monster(s) summoned!"_fmt,
count);
clif_displaymessage(s, output);
}
else
{
- clif_displaymessage(s, "Invalid monster ID or name.");
+ clif_displaymessage(s, "Invalid monster ID or name."_s);
return ATCE::EXIST;
}
@@ -1813,7 +1813,7 @@ void atcommand_killmonster_sub(Session *s, dumb_ptr<map_session_data> sd,
map_id->xs, map_id->ys,
BL::MOB);
- clif_displaymessage(s, "All monsters killed!");
+ clif_displaymessage(s, "All monsters killed!"_s);
}
static
@@ -1830,7 +1830,7 @@ void atlist_nearby_sub(dumb_ptr<block_list> bl, Session *s)
{
nullpo_retv(bl);
- AString buf = STRPRINTF(" - \"%s\"",
+ AString buf = STRPRINTF(" - \"%s\""_fmt,
bl->is_player()->status_key.name);
clif_displaymessage(s, buf);
}
@@ -1839,7 +1839,7 @@ static
ATCE atcommand_list_nearby(Session *s, dumb_ptr<map_session_data> sd,
ZString)
{
- clif_displaymessage(s, "Nearby players:");
+ clif_displaymessage(s, "Nearby players:"_s);
map_foreachinarea(std::bind(atlist_nearby_sub, ph::_1, s),
sd->bl_m,
sd->bl_x - 1, sd->bl_y - 1,
@@ -1867,7 +1867,7 @@ ATCE atcommand_gat(Session *s, dumb_ptr<map_session_data> sd,
for (y = 2; y >= -2; y--)
{
AString output = STRPRINTF(
- "%s (x= %d, y= %d) %02X %02X %02X %02X %02X",
+ "%s (x= %d, y= %d) %02X %02X %02X %02X %02X"_fmt,
sd->bl_m->name_, sd->bl_x - 2, sd->bl_y + y,
map_getcell(sd->bl_m, sd->bl_x - 2, sd->bl_y + y),
map_getcell(sd->bl_m, sd->bl_x - 1, sd->bl_y + y),
@@ -1916,7 +1916,7 @@ ATCE atcommand_statuspoint(Session *s, dumb_ptr<map_session_data> sd,
{
sd->status.status_point = new_status_point;
clif_updatestatus(sd, SP::STATUSPOINT);
- clif_displaymessage(s, "Number of status points changed!");
+ clif_displaymessage(s, "Number of status points changed!"_s);
}
else
return ATCE::RANGE;
@@ -1945,7 +1945,7 @@ ATCE atcommand_skillpoint(Session *s, dumb_ptr<map_session_data> sd,
{
sd->status.skill_point = new_skill_point;
clif_updatestatus(sd, SP::SKILLPOINT);
- clif_displaymessage(s, "Number of skill points changed!");
+ clif_displaymessage(s, "Number of skill points changed!"_s);
}
else
return ATCE::RANGE;
@@ -1974,7 +1974,7 @@ ATCE atcommand_zeny(Session *s, dumb_ptr<map_session_data> sd,
{
sd->status.zeny = new_zeny;
clif_updatestatus(sd, SP::ZENY);
- clif_displaymessage(s, "Number of zenys changed!");
+ clif_displaymessage(s, "Number of zenys changed!"_s);
}
else
return ATCE::RANGE;
@@ -2006,7 +2006,7 @@ ATCE atcommand_param(Session *s, dumb_ptr<map_session_data> sd,
clif_updatestatus(sd, attr_to_sp(attr));
clif_updatestatus(sd, attr_to_usp(attr));
pc_calcstatus(sd, 0);
- clif_displaymessage(s, "Stat changed.");
+ clif_displaymessage(s, "Stat changed."_s);
}
else
return ATCE::RANGE;
@@ -2047,7 +2047,7 @@ ATCE atcommand_all_stats(Session *s, dumb_ptr<map_session_data> sd,
if (count > 0)
// if at least 1 stat modified
- clif_displaymessage(s, "All stats changed!");
+ clif_displaymessage(s, "All stats changed!"_s);
else
return ATCE::RANGE;
@@ -2073,29 +2073,29 @@ ATCE atcommand_recall(Session *s, dumb_ptr<map_session_data> sd,
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp somenone to your actual map.");
+ "You are not authorised to warp somenone to your actual map."_s);
return ATCE::PERM;
}
if (pl_sd->bl_m && pl_sd->bl_m->flag.get(MapFlag::NOWARP)
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp this player from its actual map.");
+ "You are not authorised to warp this player from its actual map."_s);
return ATCE::PERM;
}
pc_setpos(pl_sd, sd->mapname_, sd->bl_x, sd->bl_y, BeingRemoveWhy::QUIT);
- AString output = STRPRINTF("%s recalled!", character);
+ AString output = STRPRINTF("%s recalled!"_fmt, character);
clif_displaymessage(s, output);
}
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -2121,11 +2121,11 @@ ATCE atcommand_revive(Session *s, dumb_ptr<map_session_data> sd,
clif_updatestatus(pl_sd, SP::HP);
clif_updatestatus(pl_sd, SP::SP);
clif_resurrection(pl_sd, 1);
- clif_displaymessage(s, "Character revived.");
+ clif_displaymessage(s, "Character revived."_s);
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -2145,38 +2145,38 @@ ATCE atcommand_character_stats(Session *s, dumb_ptr<map_session_data>,
if (pl_sd != NULL)
{
AString output;
- output = STRPRINTF("'%s' stats:", pl_sd->status_key.name);
+ output = STRPRINTF("'%s' stats:"_fmt, pl_sd->status_key.name);
clif_displaymessage(s, output);
- output = STRPRINTF("Base Level - %d", pl_sd->status.base_level),
+ output = STRPRINTF("Base Level - %d"_fmt, pl_sd->status.base_level),
clif_displaymessage(s, output);
- output = STRPRINTF("Job - Novice/Human (level %d)", pl_sd->status.job_level);
+ output = STRPRINTF("Job - Novice/Human (level %d)"_fmt, pl_sd->status.job_level);
clif_displaymessage(s, output);
- output = STRPRINTF("Hp - %d", pl_sd->status.hp);
+ output = STRPRINTF("Hp - %d"_fmt, pl_sd->status.hp);
clif_displaymessage(s, output);
- output = STRPRINTF("MaxHp - %d", pl_sd->status.max_hp);
+ output = STRPRINTF("MaxHp - %d"_fmt, pl_sd->status.max_hp);
clif_displaymessage(s, output);
- output = STRPRINTF("Sp - %d", pl_sd->status.sp);
+ output = STRPRINTF("Sp - %d"_fmt, pl_sd->status.sp);
clif_displaymessage(s, output);
- output = STRPRINTF("MaxSp - %d", pl_sd->status.max_sp);
+ output = STRPRINTF("MaxSp - %d"_fmt, pl_sd->status.max_sp);
clif_displaymessage(s, output);
- output = STRPRINTF("Str - %3d", pl_sd->status.attrs[ATTR::STR]);
+ output = STRPRINTF("Str - %3d"_fmt, pl_sd->status.attrs[ATTR::STR]);
clif_displaymessage(s, output);
- output = STRPRINTF("Agi - %3d", pl_sd->status.attrs[ATTR::AGI]);
+ output = STRPRINTF("Agi - %3d"_fmt, pl_sd->status.attrs[ATTR::AGI]);
clif_displaymessage(s, output);
- output = STRPRINTF("Vit - %3d", pl_sd->status.attrs[ATTR::VIT]);
+ output = STRPRINTF("Vit - %3d"_fmt, pl_sd->status.attrs[ATTR::VIT]);
clif_displaymessage(s, output);
- output = STRPRINTF("Int - %3d", pl_sd->status.attrs[ATTR::INT]);
+ output = STRPRINTF("Int - %3d"_fmt, pl_sd->status.attrs[ATTR::INT]);
clif_displaymessage(s, output);
- output = STRPRINTF("Dex - %3d", pl_sd->status.attrs[ATTR::DEX]);
+ output = STRPRINTF("Dex - %3d"_fmt, pl_sd->status.attrs[ATTR::DEX]);
clif_displaymessage(s, output);
- output = STRPRINTF("Luk - %3d", pl_sd->status.attrs[ATTR::LUK]);
+ output = STRPRINTF("Luk - %3d"_fmt, pl_sd->status.attrs[ATTR::LUK]);
clif_displaymessage(s, output);
- output = STRPRINTF("Zeny - %d", pl_sd->status.zeny);
+ output = STRPRINTF("Zeny - %d"_fmt, pl_sd->status.zeny);
clif_displaymessage(s, output);
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -2200,19 +2200,19 @@ ATCE atcommand_character_stats_all(Session *s, dumb_ptr<map_session_data>,
{
AString gmlevel;
if (pc_isGM(pl_sd) > 0)
- gmlevel = STRPRINTF("| GM Lvl: %d", pc_isGM(pl_sd));
+ gmlevel = STRPRINTF("| GM Lvl: %d"_fmt, pc_isGM(pl_sd));
else
- gmlevel = " ";
+ gmlevel = " "_s;
AString output;
output = STRPRINTF(
- "Name: %s | BLvl: %d | Job: Novice/Human (Lvl: %d) | HP: %d/%d | SP: %d/%d",
+ "Name: %s | BLvl: %d | Job: Novice/Human (Lvl: %d) | HP: %d/%d | SP: %d/%d"_fmt,
pl_sd->status_key.name, pl_sd->status.base_level,
pl_sd->status.job_level,
pl_sd->status.hp, pl_sd->status.max_hp,
pl_sd->status.sp, pl_sd->status.max_sp);
clif_displaymessage(s, output);
- output = STRPRINTF("STR: %d | AGI: %d | VIT: %d | INT: %d | DEX: %d | LUK: %d | Zeny: %d %s",
+ output = STRPRINTF("STR: %d | AGI: %d | VIT: %d | INT: %d | DEX: %d | LUK: %d | Zeny: %d %s"_fmt,
pl_sd->status.attrs[ATTR::STR],
pl_sd->status.attrs[ATTR::AGI],
pl_sd->status.attrs[ATTR::VIT],
@@ -2222,18 +2222,18 @@ ATCE atcommand_character_stats_all(Session *s, dumb_ptr<map_session_data>,
pl_sd->status.zeny,
gmlevel);
clif_displaymessage(s, output);
- clif_displaymessage(s, "--------");
+ clif_displaymessage(s, "--------"_s);
count++;
}
}
if (count == 0)
- clif_displaymessage(s, "No player found.");
+ clif_displaymessage(s, "No player found."_s);
else if (count == 1)
- clif_displaymessage(s, "1 player found.");
+ clif_displaymessage(s, "1 player found."_s);
else
{
- AString output = STRPRINTF("%d players found.", count);
+ AString output = STRPRINTF("%d players found."_fmt, count);
clif_displaymessage(s, output);
}
@@ -2263,17 +2263,17 @@ ATCE atcommand_character_option(Session *s, dumb_ptr<map_session_data> sd,
clif_changeoption(pl_sd);
pc_calcstatus(pl_sd, 0);
- clif_displaymessage(s, "Character's options changed.");
+ clif_displaymessage(s, "Character's options changed."_s);
}
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -2292,7 +2292,7 @@ ATCE atcommand_char_change_sex(Session *s, dumb_ptr<map_session_data> sd,
{
chrif_char_ask_name(sd->status_key.account_id, character, 5, HumanTimeDiff());
// type: 5 - changesex
- clif_displaymessage(s, "Character name sends to char-server to ask it.");
+ clif_displaymessage(s, "Character name sends to char-server to ask it."_s);
}
return ATCE::OKAY;
@@ -2310,7 +2310,7 @@ ATCE atcommand_char_block(Session *s, dumb_ptr<map_session_data> sd,
{
chrif_char_ask_name(sd->status_key.account_id, character, 1, HumanTimeDiff());
// type: 1 - block
- clif_displaymessage(s, "Character name sends to char-server to ask it.");
+ clif_displaymessage(s, "Character name sends to char-server to ask it."_s);
}
return ATCE::OKAY;
@@ -2330,7 +2330,7 @@ ATCE atcommand_char_ban(Session *s, dumb_ptr<map_session_data> sd,
{
chrif_char_ask_name(sd->status_key.account_id, character, 2, modif);
// type: 2 - ban
- clif_displaymessage(s, "Character name sends to char-server to ask it.");
+ clif_displaymessage(s, "Character name sends to char-server to ask it."_s);
}
return ATCE::OKAY;
@@ -2349,7 +2349,7 @@ ATCE atcommand_char_unblock(Session *s, dumb_ptr<map_session_data> sd,
// send answer to login server via char-server
chrif_char_ask_name(sd->status_key.account_id, character, 3, HumanTimeDiff());
// type: 3 - unblock
- clif_displaymessage(s, "Character name sends to char-server to ask it.");
+ clif_displaymessage(s, "Character name sends to char-server to ask it."_s);
}
return ATCE::OKAY;
@@ -2368,7 +2368,7 @@ ATCE atcommand_char_unban(Session *s, dumb_ptr<map_session_data> sd,
// send answer to login server via char-server
chrif_char_ask_name(sd->status_key.account_id, character, 4, HumanTimeDiff());
// type: 4 - unban
- clif_displaymessage(s, "Character name sends to char-server to ask it.");
+ clif_displaymessage(s, "Character name sends to char-server to ask it."_s);
}
return ATCE::OKAY;
@@ -2395,7 +2395,7 @@ ATCE atcommand_character_save(Session *s, dumb_ptr<map_session_data> sd,
map_local *m = map_mapname2mapid(map_name);
if (m == nullptr)
{
- clif_displaymessage(s, "Map not found.");
+ clif_displaymessage(s, "Map not found."_s);
return ATCE::EXIST;
}
else
@@ -2404,22 +2404,22 @@ ATCE atcommand_character_save(Session *s, dumb_ptr<map_session_data> sd,
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to set this map as a save map.");
+ "You are not authorised to set this map as a save map."_s);
return ATCE::PERM;
}
pc_setsavepoint(pl_sd, map_name, x, y);
- clif_displaymessage(s, "Character's respawn point changed.");
+ clif_displaymessage(s, "Character's respawn point changed."_s);
}
}
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -2442,10 +2442,10 @@ ATCE atcommand_doom(Session *s, dumb_ptr<map_session_data> sd,
{
// you can doom only lower or same gm level
pc_damage(NULL, pl_sd, pl_sd->status.hp + 1);
- clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement.");
+ clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement."_s);
}
}
- clif_displaymessage(s, "Judgement was made.");
+ clif_displaymessage(s, "Judgement was made."_s);
return ATCE::OKAY;
}
@@ -2466,10 +2466,10 @@ ATCE atcommand_doommap(Session *s, dumb_ptr<map_session_data> sd,
{
// you can doom only lower or same gm level
pc_damage(NULL, pl_sd, pl_sd->status.hp + 1);
- clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement.");
+ clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement."_s);
}
}
- clif_displaymessage(s, "Judgement was made.");
+ clif_displaymessage(s, "Judgement was made."_s);
return ATCE::OKAY;
}
@@ -2485,7 +2485,7 @@ void atcommand_raise_sub(dumb_ptr<map_session_data> sd)
clif_updatestatus(sd, SP::HP);
clif_updatestatus(sd, SP::SP);
clif_resurrection(sd, 1);
- clif_displaymessage(sd->sess, "Mercy has been shown.");
+ clif_displaymessage(sd->sess, "Mercy has been shown."_s);
}
}
@@ -2501,7 +2501,7 @@ ATCE atcommand_raise(Session *s, dumb_ptr<map_session_data>,
dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get()));
atcommand_raise_sub(pl_sd);
}
- clif_displaymessage(s, "Mercy has been granted.");
+ clif_displaymessage(s, "Mercy has been granted."_s);
return ATCE::OKAY;
}
@@ -2520,7 +2520,7 @@ ATCE atcommand_raisemap(Session *s, dumb_ptr<map_session_data> sd,
&& pl_sd->state.auth && sd->bl_m == pl_sd->bl_m)
atcommand_raise_sub(pl_sd);
}
- clif_displaymessage(s, "Mercy has been granted.");
+ clif_displaymessage(s, "Mercy has been granted."_s);
return ATCE::OKAY;
}
@@ -2546,7 +2546,7 @@ ATCE atcommand_character_baselevel(Session *s, dumb_ptr<map_session_data> sd,
{
if (pl_sd->status.base_level == battle_config.maximum_level)
{
- clif_displaymessage(s, "Character's base level can't go any higher.");
+ clif_displaymessage(s, "Character's base level can't go any higher."_s);
return ATCE::RANGE;
}
if (level > battle_config.maximum_level || level > (battle_config.maximum_level - pl_sd->status.base_level))
@@ -2564,13 +2564,13 @@ ATCE atcommand_character_baselevel(Session *s, dumb_ptr<map_session_data> sd,
pc_calcstatus(pl_sd, 0);
pc_heal(pl_sd, pl_sd->status.max_hp, pl_sd->status.max_sp);
clif_misceffect(pl_sd, 0);
- clif_displaymessage(s, "Character's base level raised.");
+ clif_displaymessage(s, "Character's base level raised."_s);
}
else
{
if (pl_sd->status.base_level == 1)
{
- clif_displaymessage(s, "Character's base level can't go any lower.");
+ clif_displaymessage(s, "Character's base level can't go any lower."_s);
return ATCE::RANGE;
}
if (level < -battle_config.maximum_level || level < (1 - pl_sd->status.base_level))
@@ -2592,20 +2592,20 @@ ATCE atcommand_character_baselevel(Session *s, dumb_ptr<map_session_data> sd,
clif_updatestatus(pl_sd, SP::NEXTBASEEXP);
clif_updatestatus(pl_sd, SP::BASEEXP);
pc_calcstatus(pl_sd, 0);
- clif_displaymessage(s, "Character's base level lowered.");
+ clif_displaymessage(s, "Character's base level lowered."_s);
}
// Reset their stat points to prevent extra points from stacking
atcommand_charstreset(s, sd, character.to__actual());
}
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -2635,7 +2635,7 @@ ATCE atcommand_character_joblevel(Session *s, dumb_ptr<map_session_data> sd,
{
if (pl_sd->status.job_level == max_level)
{
- clif_displaymessage(s, "Character's job level can't go any higher.");
+ clif_displaymessage(s, "Character's job level can't go any higher."_s);
return ATCE::RANGE;
}
if (pl_sd->status.job_level + level > max_level)
@@ -2647,13 +2647,13 @@ ATCE atcommand_character_joblevel(Session *s, dumb_ptr<map_session_data> sd,
clif_updatestatus(pl_sd, SP::SKILLPOINT);
pc_calcstatus(pl_sd, 0);
clif_misceffect(pl_sd, 1);
- clif_displaymessage(s, "character's job level raised.");
+ clif_displaymessage(s, "character's job level raised."_s);
}
else
{
if (pl_sd->status.job_level == 1)
{
- clif_displaymessage(s, "Character's job level can't go any lower.");
+ clif_displaymessage(s, "Character's job level can't go any lower."_s);
return ATCE::RANGE;
}
if (pl_sd->status.job_level + level < 1)
@@ -2670,18 +2670,18 @@ ATCE atcommand_character_joblevel(Session *s, dumb_ptr<map_session_data> sd,
}
// to add: remove status points from skills
pc_calcstatus(pl_sd, 0);
- clif_displaymessage(s, "Character's job level lowered.");
+ clif_displaymessage(s, "Character's job level lowered."_s);
}
}
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -2705,13 +2705,13 @@ ATCE atcommand_kick(Session *s, dumb_ptr<map_session_data> sd,
clif_GM_kick(sd, pl_sd, 1);
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -2737,7 +2737,7 @@ ATCE atcommand_kickall(Session *s, dumb_ptr<map_session_data> sd,
}
}
- clif_displaymessage(s, "All players have been kicked!");
+ clif_displaymessage(s, "All players have been kicked!"_s);
return ATCE::OKAY;
}
@@ -2758,23 +2758,23 @@ ATCE atcommand_questskill(Session *s, dumb_ptr<map_session_data> sd,
if (pc_checkskill(sd, skill_id) == 0)
{
pc_skill(sd, skill_id, 1, 0);
- clif_displaymessage(s, "You have learned the skill.");
+ clif_displaymessage(s, "You have learned the skill."_s);
}
else
{
- clif_displaymessage(s, "You already have this quest skill.");
+ clif_displaymessage(s, "You already have this quest skill."_s);
return ATCE::EXIST;
}
}
else
{
- clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill.");
+ clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill."_s);
return ATCE::RANGE;
}
}
else
{
- clif_displaymessage(s, "This skill number doesn't exist.");
+ clif_displaymessage(s, "This skill number doesn't exist."_s);
return ATCE::RANGE;
}
@@ -2801,29 +2801,29 @@ ATCE atcommand_charquestskill(Session *s, dumb_ptr<map_session_data>,
if (pc_checkskill(pl_sd, skill_id) == 0)
{
pc_skill(pl_sd, skill_id, 1, 0);
- clif_displaymessage(s, "This player has learned the skill.");
+ clif_displaymessage(s, "This player has learned the skill."_s);
}
else
{
- clif_displaymessage(s, "This player already has this quest skill.");
+ clif_displaymessage(s, "This player already has this quest skill."_s);
return ATCE::EXIST;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
}
else
{
- clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill.");
+ clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill."_s);
return ATCE::RANGE;
}
}
else
{
- clif_displaymessage(s, "This skill number doesn't exist.");
+ clif_displaymessage(s, "This skill number doesn't exist."_s);
return ATCE::RANGE;
}
@@ -2848,23 +2848,23 @@ ATCE atcommand_lostskill(Session *s, dumb_ptr<map_session_data> sd,
sd->status.skill[skill_id].lv = 0;
sd->status.skill[skill_id].flags = SkillFlags::ZERO;
clif_skillinfoblock(sd);
- clif_displaymessage(s, "You have forgotten the skill.");
+ clif_displaymessage(s, "You have forgotten the skill."_s);
}
else
{
- clif_displaymessage(s, "You don't have this quest skill.");
+ clif_displaymessage(s, "You don't have this quest skill."_s);
return ATCE::EXIST;
}
}
else
{
- clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill.");
+ clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill."_s);
return ATCE::RANGE;
}
}
else
{
- clif_displaymessage(s, "This skill number doesn't exist.");
+ clif_displaymessage(s, "This skill number doesn't exist."_s);
return ATCE::RANGE;
}
@@ -2893,29 +2893,29 @@ ATCE atcommand_charlostskill(Session *s, dumb_ptr<map_session_data>,
pl_sd->status.skill[skill_id].lv = 0;
pl_sd->status.skill[skill_id].flags = SkillFlags::ZERO;
clif_skillinfoblock(pl_sd);
- clif_displaymessage(s, "This player has forgotten the skill.");
+ clif_displaymessage(s, "This player has forgotten the skill."_s);
}
else
{
- clif_displaymessage(s, "This player doesn't have this quest skill.");
+ clif_displaymessage(s, "This player doesn't have this quest skill."_s);
return ATCE::EXIST;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
}
else
{
- clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill.");
+ clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill."_s);
return ATCE::RANGE;
}
}
else
{
- clif_displaymessage(s, "This skill number doesn't exist.");
+ clif_displaymessage(s, "This skill number doesn't exist."_s);
return ATCE::RANGE;
}
@@ -2970,7 +2970,7 @@ ATCE atcommand_idsearch(Session *s, dumb_ptr<map_session_data>,
if (!extract(message, &item_name) || !item_name)
return ATCE::USAGE;
- AString output = STRPRINTF("The reference result of '%s' (name: id):", item_name);
+ AString output = STRPRINTF("The reference result of '%s' (name: id):"_fmt, item_name);
clif_displaymessage(s, output);
match = 0;
for (i = 0; i < 20000; i++)
@@ -2979,11 +2979,11 @@ ATCE atcommand_idsearch(Session *s, dumb_ptr<map_session_data>,
&& item->jname.contains_seq(item_name))
{
match++;
- output = STRPRINTF("%s: %d", item->jname, item->nameid);
+ output = STRPRINTF("%s: %d"_fmt, item->jname, item->nameid);
clif_displaymessage(s, output);
}
}
- output = STRPRINTF("It is %d affair above.", match);
+ output = STRPRINTF("It is %d affair above."_fmt, match);
clif_displaymessage(s, output);
return ATCE::OKAY;
@@ -3006,18 +3006,18 @@ ATCE atcommand_charskreset(Session *s, dumb_ptr<map_session_data> sd,
// you can reset skill points only lower or same gm level
pc_resetskill(pl_sd);
AString output = STRPRINTF(
- "'%s' skill points reseted!", character);
+ "'%s' skill points reseted!"_fmt, character);
clif_displaymessage(s, output);
}
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -3041,19 +3041,19 @@ ATCE atcommand_charstreset(Session *s, dumb_ptr<map_session_data> sd,
// you can reset stats points only lower or same gm level
pc_resetstate(pl_sd);
AString output = STRPRINTF(
- "'%s' stats points reseted!",
+ "'%s' stats points reseted!"_fmt,
character);
clif_displaymessage(s, output);
}
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -3077,23 +3077,23 @@ ATCE atcommand_charreset(Session *s, dumb_ptr<map_session_data> sd,
// you can reset a character only for lower or same GM level
pc_resetstate(pl_sd);
pc_resetskill(pl_sd);
- pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_FLAGS"), 0);
+ pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_FLAGS"_s), 0);
// [Fate] Reset magic quest variables
- pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_EXP"), 0);
+ pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_EXP"_s), 0);
// [Fate] Reset magic experience
AString output = STRPRINTF(
- "'%s' skill and stats points reseted!", character);
+ "'%s' skill and stats points reseted!"_fmt, character);
clif_displaymessage(s, output);
}
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -3157,23 +3157,23 @@ ATCE atcommand_char_wipe(Session *s, dumb_ptr<map_session_data> sd,
pc_calcstatus(pl_sd, 0);
pc_resetstate(pl_sd);
pc_resetskill(pl_sd);
- pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_FLAGS"), 0);
+ pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_FLAGS"_s), 0);
// [Fate] Reset magic quest variables
- pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_EXP"), 0);
+ pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_EXP"_s), 0);
// [Fate] Reset magic experience
- AString output = STRPRINTF("%s: wiped.", character);
+ AString output = STRPRINTF("%s: wiped."_fmt, character);
clif_displaymessage(s, output);
}
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -3201,7 +3201,7 @@ ATCE atcommand_charmodel(Session *s, dumb_ptr<map_session_data>,
pc_changelook(pl_sd, LOOK::HAIR, hair_style);
pc_changelook(pl_sd, LOOK::HAIR_COLOR, hair_color);
pc_changelook(pl_sd, LOOK::CLOTHES_COLOR, cloth_color);
- clif_displaymessage(s, "Appearence changed.");
+ clif_displaymessage(s, "Appearence changed."_s);
}
}
else
@@ -3209,7 +3209,7 @@ ATCE atcommand_charmodel(Session *s, dumb_ptr<map_session_data>,
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -3242,14 +3242,14 @@ ATCE atcommand_charskpoint(Session *s, dumb_ptr<map_session_data>,
{
pl_sd->status.skill_point = new_skill_point;
clif_updatestatus(pl_sd, SP::SKILLPOINT);
- clif_displaymessage(s, "Character's number of skill points changed!");
+ clif_displaymessage(s, "Character's number of skill points changed!"_s);
}
else
return ATCE::RANGE;
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -3282,14 +3282,14 @@ ATCE atcommand_charstpoint(Session *s, dumb_ptr<map_session_data>,
{
pl_sd->status.status_point = new_status_point;
clif_updatestatus(pl_sd, SP::STATUSPOINT);
- clif_displaymessage(s, "Character's number of status points changed!");
+ clif_displaymessage(s, "Character's number of status points changed!"_s);
}
else
return ATCE::RANGE;
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -3320,14 +3320,14 @@ ATCE atcommand_charzeny(Session *s, dumb_ptr<map_session_data>,
{
pl_sd->status.zeny = new_zeny;
clif_updatestatus(pl_sd, SP::ZENY);
- clif_displaymessage(s, "Character's number of zenys changed!");
+ clif_displaymessage(s, "Character's number of zenys changed!"_s);
}
else
return ATCE::RANGE;
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -3344,7 +3344,7 @@ ATCE atcommand_recallall(Session *s, dumb_ptr<map_session_data> sd,
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp somenone to your actual map.");
+ "You are not authorised to warp somenone to your actual map."_s);
return ATCE::PERM;
}
@@ -3369,11 +3369,11 @@ ATCE atcommand_recallall(Session *s, dumb_ptr<map_session_data> sd,
}
}
- clif_displaymessage(s, "All characters recalled!");
+ clif_displaymessage(s, "All characters recalled!"_s);
if (count)
{
AString output = STRPRINTF(
- "Because you are not authorised to warp from some maps, %d player(s) have not been recalled.",
+ "Because you are not authorised to warp from some maps, %d player(s) have not been recalled."_fmt,
count);
clif_displaymessage(s, output);
}
@@ -3396,7 +3396,7 @@ ATCE atcommand_partyrecall(Session *s, dumb_ptr<map_session_data> sd,
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp somenone to your actual map.");
+ "You are not authorised to warp somenone to your actual map."_s);
return ATCE::PERM;
}
@@ -3422,19 +3422,19 @@ ATCE atcommand_partyrecall(Session *s, dumb_ptr<map_session_data> sd,
pc_setpos(pl_sd, sd->mapname_, sd->bl_x, sd->bl_y, BeingRemoveWhy::QUIT);
}
}
- AString output = STRPRINTF("All online characters of the %s party are near you.", p->name);
+ AString output = STRPRINTF("All online characters of the %s party are near you."_fmt, p->name);
clif_displaymessage(s, output);
if (count)
{
output = STRPRINTF(
- "Because you are not authorised to warp from some maps, %d player(s) have not been recalled.",
+ "Because you are not authorised to warp from some maps, %d player(s) have not been recalled."_fmt,
count);
clif_displaymessage(s, output);
}
}
else
{
- clif_displaymessage(s, "Incorrect name or ID, or no one from the party is online.");
+ clif_displaymessage(s, "Incorrect name or ID, or no one from the party is online."_s);
return ATCE::EXIST;
}
@@ -3447,7 +3447,7 @@ ATCE atcommand_mapinfo(Session *s, dumb_ptr<map_session_data> sd,
{
dumb_ptr<npc_data> nd = NULL;
MapName map_name;
- const char *direction = NULL;
+ LString direction = ""_s;
int list = 0;
extract(message, record<' '>(&list, &map_name));
@@ -3462,35 +3462,35 @@ ATCE atcommand_mapinfo(Session *s, dumb_ptr<map_session_data> sd,
if (m_id != nullptr)
return ATCE::EXIST;
- clif_displaymessage(s, "------ Map Info ------");
- AString output = STRPRINTF("Map Name: %s", map_name);
+ clif_displaymessage(s, "------ Map Info ------"_s);
+ AString output = STRPRINTF("Map Name: %s"_fmt, map_name);
clif_displaymessage(s, output);
- output = STRPRINTF("Players In Map: %d", m_id->users);
+ output = STRPRINTF("Players In Map: %d"_fmt, m_id->users);
clif_displaymessage(s, output);
- output = STRPRINTF("NPCs In Map: %d", m_id->npc_num);
+ output = STRPRINTF("NPCs In Map: %d"_fmt, m_id->npc_num);
clif_displaymessage(s, output);
- clif_displaymessage(s, "------ Map Flags ------");
- output = STRPRINTF("Player vs Player: %s | No Party: %s",
- (m_id->flag.get(MapFlag::PVP)) ? "True" : "False",
- (m_id->flag.get(MapFlag::PVP_NOPARTY)) ? "True" : "False");
+ clif_displaymessage(s, "------ Map Flags ------"_s);
+ output = STRPRINTF("Player vs Player: %s | No Party: %s"_fmt,
+ (m_id->flag.get(MapFlag::PVP)) ? "True"_s : "False"_s,
+ (m_id->flag.get(MapFlag::PVP_NOPARTY)) ? "True"_s : "False"_s);
clif_displaymessage(s, output);
- output = STRPRINTF("No Penalty: %s",
- (m_id->flag.get(MapFlag::NOPENALTY)) ? "True" : "False");
+ output = STRPRINTF("No Penalty: %s"_fmt,
+ (m_id->flag.get(MapFlag::NOPENALTY)) ? "True"_s : "False"_s);
clif_displaymessage(s, output);
- output = STRPRINTF("No Return: %s",
- (m_id->flag.get(MapFlag::NORETURN)) ? "True" : "False");
+ output = STRPRINTF("No Return: %s"_fmt,
+ (m_id->flag.get(MapFlag::NORETURN)) ? "True"_s : "False"_s);
clif_displaymessage(s, output);
- output = STRPRINTF("No Save: %s",
- (m_id->flag.get(MapFlag::NOSAVE)) ? "True" : "False");
+ output = STRPRINTF("No Save: %s"_fmt,
+ (m_id->flag.get(MapFlag::NOSAVE)) ? "True"_s : "False"_s);
clif_displaymessage(s, output);
- output = STRPRINTF("Re Save: %s",
- (m_id->flag.get(MapFlag::RESAVE)) ? "True" : "False");
+ output = STRPRINTF("Re Save: %s"_fmt,
+ (m_id->flag.get(MapFlag::RESAVE)) ? "True"_s : "False"_s);
clif_displaymessage(s, output);
- output = STRPRINTF("No Teleport: %s",
- (m_id->flag.get(MapFlag::NOTELEPORT)) ? "True" : "False");
+ output = STRPRINTF("No Teleport: %s"_fmt,
+ (m_id->flag.get(MapFlag::NOTELEPORT)) ? "True"_s : "False"_s);
clif_displaymessage(s, output);
- output = STRPRINTF("No Monster Teleport: %s",
- (m_id->flag.get(MapFlag::MONSTER_NOTELEPORT)) ? "True" : "False");
+ output = STRPRINTF("No Monster Teleport: %s"_fmt,
+ (m_id->flag.get(MapFlag::MONSTER_NOTELEPORT)) ? "True"_s : "False"_s);
clif_displaymessage(s, output);
switch (list)
@@ -3499,7 +3499,7 @@ ATCE atcommand_mapinfo(Session *s, dumb_ptr<map_session_data> sd,
// Do nothing. It's list 0, no additional display.
break;
case 1:
- clif_displaymessage(s, "----- Players in Map -----");
+ clif_displaymessage(s, "----- Players in Map -----"_s);
for (io::FD i : iter_fds())
{
Session *s2 = get_session(i);
@@ -3510,54 +3510,54 @@ ATCE atcommand_mapinfo(Session *s, dumb_ptr<map_session_data> sd,
&& pl_sd->mapname_ == map_name)
{
output = STRPRINTF(
- "Player '%s' (session #%d) | Location: %d,%d",
+ "Player '%s' (session #%d) | Location: %d,%d"_fmt,
pl_sd->status_key.name, s2, pl_sd->bl_x, pl_sd->bl_y);
clif_displaymessage(s, output);
}
}
break;
case 2:
- clif_displaymessage(s, "----- NPCs in Map -----");
+ clif_displaymessage(s, "----- NPCs in Map -----"_s);
for (int i = 0; i < m_id->npc_num;)
{
nd = m_id->npc[i];
switch (nd->dir)
{
case DIR::S:
- direction = "North";
+ direction = "North"_s;
break;
case DIR::SW:
- direction = "North West";
+ direction = "North West"_s;
break;
case DIR::W:
- direction = "West";
+ direction = "West"_s;
break;
case DIR::NW:
- direction = "South West";
+ direction = "South West"_s;
break;
case DIR::N:
- direction = "South";
+ direction = "South"_s;
break;
case DIR::NE:
- direction = "South East";
+ direction = "South East"_s;
break;
case DIR::E:
- direction = "East";
+ direction = "East"_s;
break;
case DIR::SE:
- direction = "North East";
+ direction = "North East"_s;
break;
#if 0
case 9:
- direction = "North";
+ direction = "North"_s;
break;
#endif
default:
- direction = "Unknown";
+ direction = "Unknown"_s;
break;
}
output = STRPRINTF(
- "NPC %d: %s | Direction: %s | Sprite: %d | Location: %d %d",
+ "NPC %d: %s | Direction: %s | Sprite: %d | Location: %d %d"_fmt,
++i, nd->name, direction, nd->npc_class, nd->bl_x,
nd->bl_y);
clif_displaymessage(s, output);
@@ -3566,7 +3566,7 @@ ATCE atcommand_mapinfo(Session *s, dumb_ptr<map_session_data> sd,
default:
// normally impossible to arrive here
clif_displaymessage(s,
- "Please, enter at least a valid list number (usage: @mapinfo <0-2> [map]).");
+ "Please, enter at least a valid list number (usage: @mapinfo <0-2> [map])."_s);
return ATCE::USAGE;
}
@@ -3590,19 +3590,19 @@ ATCE atcommand_partyspy(Session *s, dumb_ptr<map_session_data> sd,
if (sd->partyspy == p->party_id)
{
sd->partyspy = 0;
- AString output = STRPRINTF("No longer spying on the %s party.", p->name);
+ AString output = STRPRINTF("No longer spying on the %s party."_fmt, p->name);
clif_displaymessage(s, output);
}
else
{
sd->partyspy = p->party_id;
- AString output = STRPRINTF("Spying on the %s party.", p->name);
+ AString output = STRPRINTF("Spying on the %s party."_fmt, p->name);
clif_displaymessage(s, output);
}
}
else
{
- clif_displaymessage(s, "Incorrect name or ID, or no one from the party is online.");
+ clif_displaymessage(s, "Incorrect name or ID, or no one from the party is online."_s);
return ATCE::EXIST;
}
@@ -3621,11 +3621,11 @@ ATCE atcommand_enablenpc(Session *s, dumb_ptr<map_session_data>,
if (npc_name2id(NPCname) != NULL)
{
npc_enable(NPCname, 1);
- clif_displaymessage(s, "Npc Enabled.");
+ clif_displaymessage(s, "Npc Enabled."_s);
}
else
{
- clif_displaymessage(s, "This NPC doesn't exist.");
+ clif_displaymessage(s, "This NPC doesn't exist."_s);
return ATCE::EXIST;
}
@@ -3644,11 +3644,11 @@ ATCE atcommand_disablenpc(Session *s, dumb_ptr<map_session_data>,
if (npc_name2id(NPCname) != NULL)
{
npc_enable(NPCname, 0);
- clif_displaymessage(s, "Npc Disabled.");
+ clif_displaymessage(s, "Npc Disabled."_s);
}
else
{
- clif_displaymessage(s, "This NPC doesn't exist.");
+ clif_displaymessage(s, "This NPC doesn't exist."_s);
return ATCE::EXIST;
}
@@ -3661,7 +3661,7 @@ ATCE atcommand_servertime(Session *s, dumb_ptr<map_session_data>,
{
timestamp_seconds_buffer tsbuf;
stamp_time(tsbuf);
- AString temp = STRPRINTF("Server time: %s", tsbuf);
+ AString temp = STRPRINTF("Server time: %s"_fmt, tsbuf);
clif_displaymessage(s, temp);
return ATCE::OKAY;
@@ -3707,37 +3707,37 @@ ATCE atcommand_chardelitem(Session *s, dumb_ptr<map_session_data> sd,
// for next loop
}
AString output = STRPRINTF(
- "%d item(s) removed by a GM.",
+ "%d item(s) removed by a GM."_fmt,
count);
clif_displaymessage(pl_sd->sess, output);
if (number == count)
- output = STRPRINTF("%d item(s) removed from the player.", count);
+ output = STRPRINTF("%d item(s) removed from the player."_fmt, count);
else
- output = STRPRINTF("%d item(s) removed. Player had only %d on %d items.", count, count, number);
+ output = STRPRINTF("%d item(s) removed. Player had only %d on %d items."_fmt, count, count, number);
clif_displaymessage(s, output);
}
else
{
- clif_displaymessage(s, "Character does not have the item.");
+ clif_displaymessage(s, "Character does not have the item."_s);
return ATCE::EXIST;
}
}
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
}
else
{
- clif_displaymessage(s, "Invalid item ID or name.");
+ clif_displaymessage(s, "Invalid item ID or name."_s);
return ATCE::RANGE;
}
@@ -3751,7 +3751,7 @@ ATCE atcommand_broadcast(Session *, dumb_ptr<map_session_data> sd,
if (!message)
return ATCE::USAGE;
- AString output = STRPRINTF("%s : %s", sd->status_key.name, message);
+ AString output = STRPRINTF("%s : %s"_fmt, sd->status_key.name, message);
intif_GMmessage(output);
return ATCE::OKAY;
@@ -3764,7 +3764,7 @@ ATCE atcommand_localbroadcast(Session *, dumb_ptr<map_session_data> sd,
if (!message)
return ATCE::USAGE;
- AString output = STRPRINTF("%s : %s", sd->status_key.name, message);
+ AString output = STRPRINTF("%s : %s"_fmt, sd->status_key.name, message);
clif_GMmessage(sd, output, 1);
@@ -3783,28 +3783,28 @@ ATCE atcommand_email(Session *s, dumb_ptr<map_session_data> sd,
if (!e_mail_check(actual_email))
{
- clif_displaymessage(s, "Invalid actual email. If you have default e-mail, type a@a.com.");
+ clif_displaymessage(s, "Invalid actual email. If you have default e-mail, type a@a.com."_s);
return ATCE::RANGE;
}
else if (!e_mail_check(new_email))
{
- clif_displaymessage(s, "Invalid new email. Please enter a real e-mail.");
+ clif_displaymessage(s, "Invalid new email. Please enter a real e-mail."_s);
return ATCE::RANGE;
}
else if (new_email == DEFAULT_EMAIL)
{
- clif_displaymessage(s, "New email must be a real e-mail.");
+ clif_displaymessage(s, "New email must be a real e-mail."_s);
return ATCE::RANGE;
}
else if (actual_email == new_email)
{
- clif_displaymessage(s, "New email must be different of the actual e-mail.");
+ clif_displaymessage(s, "New email must be different of the actual e-mail."_s);
return ATCE::RANGE;
}
else
{
chrif_changeemail(sd->status_key.account_id, actual_email, new_email);
- clif_displaymessage(s, "Information sended to login-server via char-server.");
+ clif_displaymessage(s, "Information sended to login-server via char-server."_s);
}
return ATCE::OKAY;
@@ -3821,7 +3821,7 @@ ATCE atcommand_effect(Session *s, dumb_ptr<map_session_data> sd,
if (flag <= 0)
{
clif_specialeffect(sd, type, flag);
- clif_displaymessage(s, "Your Effect Has Changed.");
+ clif_displaymessage(s, "Your Effect Has Changed."_s);
}
else
{
@@ -3834,7 +3834,7 @@ ATCE atcommand_effect(Session *s, dumb_ptr<map_session_data> sd,
if (pl_sd && pl_sd->state.auth)
{
clif_specialeffect(pl_sd, type, flag);
- clif_displaymessage(pl_sd->sess, "Your Effect Has Changed.");
+ clif_displaymessage(pl_sd->sess, "Your Effect Has Changed."_s);
}
}
}
@@ -3873,7 +3873,7 @@ ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd,
if (count == 1)
{
AString output = STRPRINTF(
- "------ Items list of '%s' ------",
+ "------ Items list of '%s' ------"_fmt,
pl_sd->status_key.name);
clif_displaymessage(s, output);
}
@@ -3881,35 +3881,35 @@ ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd,
MString equipstr;
if (bool(equip))
{
- equipstr += "| equiped: ";
+ equipstr += "| equiped: "_s;
if (bool(equip & EPOS::GLOVES))
- equipstr += "robe/gargment, ";
+ equipstr += "robe/gargment, "_s;
if (bool(equip & EPOS::CAPE))
- equipstr += "left accessory, ";
+ equipstr += "left accessory, "_s;
if (bool(equip & EPOS::MISC1))
- equipstr += "body/armor, ";
+ equipstr += "body/armor, "_s;
if ((equip & (EPOS::WEAPON | EPOS::SHIELD)) == EPOS::WEAPON)
- equipstr += "right hand, ";
+ equipstr += "right hand, "_s;
if ((equip & (EPOS::WEAPON | EPOS::SHIELD)) == EPOS::SHIELD)
- equipstr += "left hand, ";
+ equipstr += "left hand, "_s;
if ((equip & (EPOS::WEAPON | EPOS::SHIELD)) == (EPOS::WEAPON | EPOS::SHIELD))
- equipstr += "both hands, ";
+ equipstr += "both hands, "_s;
if (bool(equip & EPOS::SHOES))
- equipstr += "feet, ";
+ equipstr += "feet, "_s;
if (bool(equip & EPOS::MISC2))
- equipstr += "right accessory, ";
+ equipstr += "right accessory, "_s;
if ((equip & (EPOS::TORSO | EPOS::HAT | EPOS::LEGS)) == EPOS::LEGS)
- equipstr += "lower head, ";
+ equipstr += "lower head, "_s;
if ((equip & (EPOS::TORSO | EPOS::HAT | EPOS::LEGS)) == EPOS::HAT)
- equipstr += "top head, ";
+ equipstr += "top head, "_s;
if ((equip & (EPOS::TORSO | EPOS::HAT | EPOS::LEGS)) == (EPOS::HAT | EPOS::LEGS))
- equipstr += "lower/top head, ";
+ equipstr += "lower/top head, "_s;
if ((equip & (EPOS::TORSO | EPOS::HAT | EPOS::LEGS)) == EPOS::TORSO)
- equipstr += "mid head, ";
+ equipstr += "mid head, "_s;
if ((equip & (EPOS::TORSO | EPOS::HAT | EPOS::LEGS)) == (EPOS::TORSO | EPOS::LEGS))
- equipstr += "lower/mid head, ";
+ equipstr += "lower/mid head, "_s;
if ((equip & (EPOS::TORSO | EPOS::HAT | EPOS::LEGS)) == (EPOS::TORSO | EPOS::HAT | EPOS::LEGS))
- equipstr += "lower/mid/top head, ";
+ equipstr += "lower/mid/top head, "_s;
// remove final ', '
equipstr.pop_back(2);
}
@@ -3918,7 +3918,7 @@ ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd,
AString output;
if (true)
- output = STRPRINTF("%d %s (%s, id: %d) %s",
+ output = STRPRINTF("%d %s (%s, id: %d) %s"_fmt,
pl_sd->status.inventory[i].amount,
item_data->name, item_data->jname,
pl_sd->status.inventory[i].nameid,
@@ -3929,24 +3929,24 @@ ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd,
}
}
if (count == 0)
- clif_displaymessage(s, "No item found on this player.");
+ clif_displaymessage(s, "No item found on this player."_s);
else
{
AString output = STRPRINTF(
- "%d item(s) found in %d kind(s) of items.",
+ "%d item(s) found in %d kind(s) of items."_fmt,
counter, count);
clif_displaymessage(s, output);
}
}
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -3986,13 +3986,13 @@ ATCE atcommand_character_storage_list(Session *s, dumb_ptr<map_session_data> sd,
if (count == 1)
{
AString output = STRPRINTF(
- "------ Storage items list of '%s' ------",
+ "------ Storage items list of '%s' ------"_fmt,
pl_sd->status_key.name);
clif_displaymessage(s, output);
}
AString output;
if (true)
- output = STRPRINTF("%d %s (%s, id: %d)",
+ output = STRPRINTF("%d %s (%s, id: %d)"_fmt,
stor->storage_[i].amount,
item_data->name, item_data->jname,
stor->storage_[i].nameid);
@@ -4001,30 +4001,30 @@ ATCE atcommand_character_storage_list(Session *s, dumb_ptr<map_session_data> sd,
}
if (count == 0)
clif_displaymessage(s,
- "No item found in the storage of this player.");
+ "No item found in the storage of this player."_s);
else
{
AString output = STRPRINTF(
- "%d item(s) found in %d kind(s) of items.",
+ "%d item(s) found in %d kind(s) of items."_fmt,
counter, count);
clif_displaymessage(s, output);
}
}
else
{
- clif_displaymessage(s, "This player has no storage.");
+ clif_displaymessage(s, "This player has no storage."_s);
return ATCE::OKAY;
}
}
else
{
- clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player.");
+ clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s);
return ATCE::PERM;
}
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -4038,9 +4038,9 @@ ATCE atcommand_killer(Session *s, dumb_ptr<map_session_data> sd,
sd->special_state.killer = !sd->special_state.killer;
if (sd->special_state.killer)
- clif_displaymessage(s, "You be a killa...");
+ clif_displaymessage(s, "You be a killa..."_s);
else
- clif_displaymessage(s, "You gonna be own3d...");
+ clif_displaymessage(s, "You gonna be own3d..."_s);
return ATCE::OKAY;
}
@@ -4062,13 +4062,13 @@ ATCE atcommand_charkiller(Session *s, dumb_ptr<map_session_data>,
if (pl_sd->special_state.killer)
{
- clif_displaymessage(s, "The player is now a killer");
- clif_displaymessage(pl_sd->sess, "You are now a killer");
+ clif_displaymessage(s, "The player is now a killer"_s);
+ clif_displaymessage(pl_sd->sess, "You are now a killer"_s);
}
else
{
- clif_displaymessage(s, "The player is no longer a killer");
- clif_displaymessage(pl_sd->sess, "You are no longer a killer");
+ clif_displaymessage(s, "The player is no longer a killer"_s);
+ clif_displaymessage(pl_sd->sess, "You are no longer a killer"_s);
}
return ATCE::OKAY;
@@ -4081,9 +4081,9 @@ ATCE atcommand_killable(Session *s, dumb_ptr<map_session_data> sd,
sd->special_state.killable = !sd->special_state.killable;
if (sd->special_state.killable)
- clif_displaymessage(s, "You gonna be own3d...");
+ clif_displaymessage(s, "You gonna be own3d..."_s);
else
- clif_displaymessage(s, "You be a killa...");
+ clif_displaymessage(s, "You be a killa..."_s);
return ATCE::OKAY;
}
@@ -4104,9 +4104,9 @@ ATCE atcommand_charkillable(Session *s, dumb_ptr<map_session_data>,
pl_sd->special_state.killable = !pl_sd->special_state.killable;
if (pl_sd->special_state.killable)
- clif_displaymessage(s, "The player is now killable");
+ clif_displaymessage(s, "The player is now killable"_s);
else
- clif_displaymessage(s, "The player is no longer killable");
+ clif_displaymessage(s, "The player is no longer killable"_s);
return ATCE::OKAY;
}
@@ -4146,17 +4146,17 @@ ATCE atcommand_addwarp(Session *s, dumb_ptr<map_session_data> sd,
if (!extract(message, record<' '>(&mapname, &x, &y)))
return ATCE::USAGE;
- AString w1 = STRPRINTF("%s,%d,%d", sd->mapname_, sd->bl_x, sd->bl_y);
- AString w3 = STRPRINTF("%s%d%d%d%d", mapname, sd->bl_x, sd->bl_y, x, y);
- AString w4 = STRPRINTF("1,1,%s.gat,%d,%d", mapname, x, y);
+ AString w1 = STRPRINTF("%s,%d,%d"_fmt, sd->mapname_, sd->bl_x, sd->bl_y);
+ AString w3 = STRPRINTF("%s%d%d%d%d"_fmt, mapname, sd->bl_x, sd->bl_y, x, y);
+ AString w4 = STRPRINTF("1,1,%s.gat,%d,%d"_fmt, mapname, x, y);
NpcName w3name = stringish<NpcName>(w3);
- int ret = npc_parse_warp(w1, ZString("warp"), w3name, w4);
+ int ret = npc_parse_warp(w1, "warp"_s, w3name, w4);
if (ret)
// warp failed
return ATCE::RANGE;
- AString output = STRPRINTF("New warp NPC => %s", w3);
+ AString output = STRPRINTF("New warp NPC => %s"_fmt, w3);
clif_displaymessage(s, output);
return ATCE::OKAY;
@@ -4177,7 +4177,7 @@ ATCE atcommand_chareffect(Session *s, dumb_ptr<map_session_data>,
return ATCE::EXIST;
clif_specialeffect(pl_sd, type, 0);
- clif_displaymessage(s, "Your Effect Has Changed.");
+ clif_displaymessage(s, "Your Effect Has Changed."_s);
return ATCE::OKAY;
}
@@ -4220,9 +4220,8 @@ ATCE atcommand_chardropall(Session *s, dumb_ptr<map_session_data>,
}
}
- clif_displaymessage(pl_sd->sess, "Ever play 52 card pickup?");
- clif_displaymessage(s, "It is done");
- //clif_displaymessage(s, "It is offical.. your a jerk");
+ clif_displaymessage(pl_sd->sess, "Ever play 52 card pickup?"_s);
+ clif_displaymessage(s, "It is official.. you're a jerk."_s);
return ATCE::OKAY;
}
@@ -4240,12 +4239,12 @@ ATCE atcommand_storeall(Session *s, dumb_ptr<map_session_data> sd,
{
case 2:
//Try again
- clif_displaymessage(s, "run this command again..");
+ clif_displaymessage(s, "run this command again.."_s);
return ATCE::OKAY;
case 1:
//Failure
clif_displaymessage(s,
- "You can't open the storage currently.");
+ "You can't open the storage currently."_s);
return ATCE::EXIST;
}
}
@@ -4260,7 +4259,7 @@ ATCE atcommand_storeall(Session *s, dumb_ptr<map_session_data> sd,
}
storage_storageclose(sd);
- clif_displaymessage(s, "It is done");
+ clif_displaymessage(s, "It is done"_s);
return ATCE::OKAY;
}
@@ -4281,8 +4280,8 @@ ATCE atcommand_charstoreall(Session *s, dumb_ptr<map_session_data> sd,
// TODO figure out what the hell this is talking about,
// and especially why it's different from the other one.
clif_displaymessage(s,
- "Had to open the characters storage window...");
- clif_displaymessage(s, "run this command again..");
+ "Had to open the characters storage window..."_s);
+ clif_displaymessage(s, "run this command again.."_s);
return ATCE::OKAY;
}
for (int i = 0; i < MAX_INVENTORY; i++)
@@ -4297,12 +4296,12 @@ ATCE atcommand_charstoreall(Session *s, dumb_ptr<map_session_data> sd,
storage_storageclose(pl_sd);
clif_displaymessage(pl_sd->sess,
- "Everything you own has been put away for safe keeping.");
+ "Everything you own has been put away for safe keeping."_s);
clif_displaymessage(pl_sd->sess,
- "go to the nearest kafka to retrieve it..");
- clif_displaymessage(pl_sd->sess, " -- the management");
+ "go to the nearest kafka to retrieve it.."_s);
+ clif_displaymessage(pl_sd->sess, " -- the management"_s);
- clif_displaymessage(s, "It is done");
+ clif_displaymessage(s, "It is done"_s);
return ATCE::OKAY;
}
@@ -4425,7 +4424,7 @@ ATCE atcommand_adjcmdlvl(Session *s, dumb_ptr<map_session_data>,
if (!extract(message, record<' '>(&newlev, &cmd)))
{
- clif_displaymessage(s, "usage: @adjcmdlvl <lvl> <command>.");
+ clif_displaymessage(s, "usage: @adjcmdlvl <lvl> <command>."_s);
return ATCE::USAGE;
}
@@ -4434,12 +4433,12 @@ ATCE atcommand_adjcmdlvl(Session *s, dumb_ptr<map_session_data>,
if (it)
{
it->level = newlev;
- clif_displaymessage(s, "@command level changed.");
+ clif_displaymessage(s, "@command level changed."_s);
return ATCE::OKAY;
}
}
- clif_displaymessage(s, "@command not found.");
+ clif_displaymessage(s, "@command not found."_s);
return ATCE::EXIST;
}
@@ -4453,7 +4452,7 @@ ATCE atcommand_adjgmlvl(Session *s, dumb_ptr<map_session_data>,
if (!asplit(message, &newlev, &user)
|| newlev < 0 || newlev > 99)
{
- clif_displaymessage(s, "usage: @adjgmlvl <lvl> <user>.");
+ clif_displaymessage(s, "usage: @adjgmlvl <lvl> <user>."_s);
return ATCE::USAGE;
}
@@ -4501,14 +4500,14 @@ constexpr
size_t magic_skills_nr = sizeof(magic_skills) / sizeof(magic_skills[0]);
static
-ZString magic_skill_names[magic_skills_nr] =
+LString magic_skill_names[magic_skills_nr] =
{
- {"magic"},
- {"life"},
- {"war"},
- {"transmute"},
- {"nature"},
- {"astral"},
+ "magic"_s,
+ "life"_s,
+ "war"_s,
+ "transmute"_s,
+ "nature"_s,
+ "astral"_s,
};
static
@@ -4524,7 +4523,7 @@ ATCE atcommand_magic_info(Session *s, dumb_ptr<map_session_data>,
if (pl_sd)
{
AString buf = STRPRINTF(
- "`%s' has the following magic skills:",
+ "`%s' has the following magic skills:"_fmt,
character);
clif_displaymessage(s, buf);
@@ -4532,7 +4531,7 @@ ATCE atcommand_magic_info(Session *s, dumb_ptr<map_session_data>,
{
SkillID sk = magic_skills[i];
buf = STRPRINTF(
- "%d in %s",
+ "%d in %s"_fmt,
pl_sd->status.skill[sk].lv,
magic_skill_names[i]);
if (pl_sd->status.skill[sk].lv)
@@ -4542,7 +4541,7 @@ ATCE atcommand_magic_info(Session *s, dumb_ptr<map_session_data>,
return ATCE::OKAY;
}
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -4563,12 +4562,12 @@ ATCE atcommand_set_magic(Session *s, dumb_ptr<map_session_data>,
if (!asplit(message, &magic_type, &value, &character))
{
clif_displaymessage(s,
- "Usage: @setmagic <school> <value> <char-name>, where <school> is either `magic', one of the school names, or `all'.");
+ "Usage: @setmagic <school> <value> <char-name>, where <school> is either `magic', one of the school names, or `all'."_s);
return ATCE::USAGE;
}
SkillID skill_index = SkillID::NEGATIVE;
- if ("all" == magic_type)
+ if ("all"_s == magic_type)
skill_index = SkillID::ZERO;
else
{
@@ -4585,7 +4584,7 @@ ATCE atcommand_set_magic(Session *s, dumb_ptr<map_session_data>,
if (skill_index == SkillID::NEGATIVE)
{
clif_displaymessage(s,
- "Incorrect school of magic. Use `magic', `nature', `life', `war', `transmute', `ether', or `all'.");
+ "Incorrect school of magic. Use `magic', `nature', `life', `war', `transmute', `ether', or `all'."_s);
return ATCE::RANGE;
}
@@ -4602,7 +4601,7 @@ ATCE atcommand_set_magic(Session *s, dumb_ptr<map_session_data>,
return ATCE::OKAY;
}
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -4664,18 +4663,18 @@ ATCE atcommand_jump_iterate(Session *s, dumb_ptr<map_session_data> sd,
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp you to the map of this player.");
+ "You are not authorised to warp you to the map of this player."_s);
return ATCE::PERM;
}
if (sd->bl_m && sd->bl_m->flag.get(MapFlag::NOWARP)
&& battle_config.any_warp_GM_min_level > pc_isGM(sd))
{
clif_displaymessage(s,
- "You are not authorised to warp you from your actual map.");
+ "You are not authorised to warp you from your actual map."_s);
return ATCE::PERM;
}
pc_setpos(sd, pl_sd->bl_m->name_, pl_sd->bl_x, pl_sd->bl_y, BeingRemoveWhy::WARPED);
- AString output = STRPRINTF("Jump to %s", pl_sd->status_key.name);
+ AString output = STRPRINTF("Jump to %s"_fmt, pl_sd->status_key.name);
clif_displaymessage(s, output);
sd->followtarget = pl_sd->bl_id;
@@ -4702,9 +4701,9 @@ ATCE atcommand_wgm(Session *s, dumb_ptr<map_session_data> sd,
if (tmw_CheckChatSpam(sd, message))
return ATCE::OKAY;
- tmw_GmHackMsg(STRPRINTF("[GM] %s: %s", sd->status_key.name, message));
+ tmw_GmHackMsg(STRPRINTF("[GM] %s: %s"_fmt, sd->status_key.name, message));
if (!pc_isGM(sd))
- clif_displaymessage(s, "Message sent.");
+ clif_displaymessage(s, "Message sent."_s);
return ATCE::OKAY;
}
@@ -4727,19 +4726,19 @@ ATCE atcommand_skillpool_info(Session *s, dumb_ptr<map_session_data>,
int i;
AString buf = STRPRINTF(
- "Active skills %d out of %d for %s:",
+ "Active skills %d out of %d for %s:"_fmt,
pool_skills_nr, skill_pool_max(pl_sd), character);
clif_displaymessage(s, buf);
for (i = 0; i < pool_skills_nr; ++i)
{
- buf = STRPRINTF(" - %s [%d]: power %d",
+ buf = STRPRINTF(" - %s [%d]: power %d"_fmt,
skill_name(pool_skills[i]),
pool_skills[i],
skill_power(pl_sd, pool_skills[i]));
clif_displaymessage(s, buf);
}
- buf = STRPRINTF("Learned skills out of %d for %s:",
+ buf = STRPRINTF("Learned skills out of %d for %s:"_fmt,
skill_pool_skills_size, character);
clif_displaymessage(s, buf);
@@ -4750,7 +4749,7 @@ ATCE atcommand_skillpool_info(Session *s, dumb_ptr<map_session_data>,
if (lvl)
{
- buf = STRPRINTF(" - %s [%d]: lvl %d",
+ buf = STRPRINTF(" - %s [%d]: lvl %d"_fmt,
name, skill_pool_skills[i], lvl);
clif_displaymessage(s, buf);
}
@@ -4759,7 +4758,7 @@ ATCE atcommand_skillpool_info(Session *s, dumb_ptr<map_session_data>,
}
else
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -4775,7 +4774,7 @@ ATCE atcommand_skillpool_focus(Session *s, dumb_ptr<map_session_data>,
if (!asplit(message, &skill, &character))
{
- clif_displaymessage(s, "Usage: @sp-focus <skill-nr> <char_name>");
+ clif_displaymessage(s, "Usage: @sp-focus <skill-nr> <char_name>"_s);
return ATCE::USAGE;
}
@@ -4783,12 +4782,12 @@ ATCE atcommand_skillpool_focus(Session *s, dumb_ptr<map_session_data>,
if (pl_sd != NULL)
{
if (skill_pool_activate(pl_sd, skill))
- clif_displaymessage(s, "Activation failed.");
+ clif_displaymessage(s, "Activation failed."_s);
else
- clif_displaymessage(s, "Activation successful.");
+ clif_displaymessage(s, "Activation successful."_s);
}
else
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::OKAY;
}
@@ -4807,12 +4806,12 @@ ATCE atcommand_skillpool_unfocus(Session *s, dumb_ptr<map_session_data>,
if (pl_sd != NULL)
{
if (skill_pool_deactivate(pl_sd, skill))
- clif_displaymessage(s, "Deactivation failed.");
+ clif_displaymessage(s, "Deactivation failed."_s);
else
- clif_displaymessage(s, "Deactivation successful.");
+ clif_displaymessage(s, "Deactivation successful."_s);
}
else
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::OKAY;
}
@@ -4835,7 +4834,7 @@ ATCE atcommand_skill_learn(Session *s, dumb_ptr<map_session_data>,
clif_skillinfoblock(pl_sd);
}
else
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::OKAY;
}
@@ -4852,7 +4851,7 @@ ATCE atcommand_ipcheck(Session *s, dumb_ptr<map_session_data>,
dumb_ptr<map_session_data> pl_sd = map_nick2sd(character);
if (pl_sd == NULL)
{
- clif_displaymessage(s, "Character not found.");
+ clif_displaymessage(s, "Character not found."_s);
return ATCE::EXIST;
}
@@ -4873,7 +4872,7 @@ ATCE atcommand_ipcheck(Session *s, dumb_ptr<map_session_data>,
if (ip == pl_sd->get_ip())
{
AString output = STRPRINTF(
- "Name: %s | Location: %s %d %d",
+ "Name: %s | Location: %s %d %d"_fmt,
pl_sd->status_key.name, pl_sd->mapname_,
pl_sd->bl_x, pl_sd->bl_y);
clif_displaymessage(s, output);
@@ -4881,7 +4880,7 @@ ATCE atcommand_ipcheck(Session *s, dumb_ptr<map_session_data>,
}
}
- clif_displaymessage(s, "End of list");
+ clif_displaymessage(s, "End of list"_s);
return ATCE::OKAY;
}
@@ -4902,10 +4901,10 @@ ATCE atcommand_doomspot(Session *s, dumb_ptr<map_session_data> sd,
{
// you can doom only lower or same gm level
pc_damage(NULL, pl_sd, pl_sd->status.hp + 1);
- clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement.");
+ clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement."_s);
}
}
- clif_displaymessage(s, "Judgement was made.");
+ clif_displaymessage(s, "Judgement was made."_s);
return ATCE::OKAY;
}
@@ -4915,13 +4914,13 @@ ATCE atcommand_source(Session *s, dumb_ptr<map_session_data>,
ZString)
{
clif_displaymessage(s,
- "This server code consists of Free Software under GPL3&AGPL3");
+ "This server code consists of Free Software under GPL3&AGPL3"_s);
clif_displaymessage(s,
- "This is commit " VERSION_HASH ", also known as " VERSION_FULL);
+ "This is commit " VERSION_HASH ", also known as " VERSION_FULL ""_s);
clif_displaymessage(s,
- "The version is " VERSION_STRING);
+ "The version is " VERSION_STRING ""_s);
clif_displaymessage(s,
- "For source, see " VENDOR_SOURCE);
+ "For source, see " VENDOR_SOURCE ""_s);
return ATCE::OKAY;
}
@@ -4931,424 +4930,424 @@ ATCE atcommand_source(Session *s, dumb_ptr<map_session_data>,
// declared extern above
Map<XString, AtCommandInfo> atcommand_info =
{
- {"help", {"[level[-level]|category|@command]",
+ {"help"_s, {"[level[-level]|category|@command]"_s,
0, atcommand_help,
- "Show help"}},
- {"setup", {"<level> <charname>",
+ "Show help"_s}},
+ {"setup"_s, {"<level> <charname>"_s,
40, atcommand_setup,
- "Safely set a chars levels and warp them to a special place (for TAW)"}},
- {"charwarp", {"<mapname> <x> <y> <charname>",
+ "Safely set a chars levels and warp them to a special place (for TAW)"_s}},
+ {"charwarp"_s, {"<mapname> <x> <y> <charname>"_s,
60, atcommand_charwarp,
- "Warp a character to a point on another map"}},
- {"warp", {"<mapname> [x] [y]",
+ "Warp a character to a point on another map"_s}},
+ {"warp"_s, {"<mapname> [x] [y]"_s,
40, atcommand_warp,
- "Warp yourself to another map"}},
- {"where", {"[charname]",
+ "Warp yourself to another map"_s}},
+ {"where"_s, {"[charname]"_s,
40, atcommand_where,
- "Show location of a character or yourself"}},
- {"goto", {"<charname>",
+ "Show location of a character or yourself"_s}},
+ {"goto"_s, {"<charname>"_s,
40, atcommand_goto,
- "Warp yourself to another character"}},
- {"jump", {"[x] [y]",
+ "Warp yourself to another character"_s}},
+ {"jump"_s, {"[x] [y]"_s,
40, atcommand_jump,
- "Warp yourself within a map"}},
- {"who", {"[subsequence]",
+ "Warp yourself within a map"_s}},
+ {"who"_s, {"[subsequence]"_s,
40, atcommand_who,
- "List matching players online, with location info"}},
- {"whogroup", {"[subsequence]",
+ "List matching players online, with location info"_s}},
+ {"whogroup"_s, {"[subsequence]"_s,
40, atcommand_whogroup,
- "List matching players online, with party info"}},
- {"whomap", {"[mapname]",
+ "List matching players online, with party info"_s}},
+ {"whomap"_s, {"[mapname]"_s,
40, atcommand_whomap,
- "List all players on the map, with location info"}},
- {"whomapgroup", {"[mapname]",
+ "List all players on the map, with location info"_s}},
+ {"whomapgroup"_s, {"[mapname]"_s,
40, atcommand_whomapgroup,
- "List all players on the map, with party info"}},
- {"whogm", {"[subsequence]",
+ "List all players on the map, with party info"_s}},
+ {"whogm"_s, {"[subsequence]"_s,
40, atcommand_whogm,
- "List matching GM players, with location, level, and party info"}},
- {"save", {"",
+ "List matching GM players, with location, level, and party info"_s}},
+ {"save"_s, {""_s,
40, atcommand_save,
- "Set your respawn point to your current location"}},
- {"return", {"",
+ "Set your respawn point to your current location"_s}},
+ {"return"_s, {""_s,
40, atcommand_load,
- "Return to your respawn point"}},
- {"load", {"",
+ "Return to your respawn point"_s}},
+ {"load"_s, {""_s,
40, atcommand_load,
- "Return to your respawn point"}},
- {"speed", {"<rate>",
+ "Return to your respawn point"_s}},
+ {"speed"_s, {"<rate>"_s,
60, atcommand_speed,
- "Set walk rate"}},
- {"storage", {"",
+ "Set walk rate"_s}},
+ {"storage"_s, {""_s,
99, atcommand_storage,
- "Open your storage"}},
- {"option", {"<opt1> [opt2] [option]",
+ "Open your storage"_s}},
+ {"option"_s, {"<opt1> [opt2] [option]"_s,
80, atcommand_option,
- "Set your 'option' status flags"}},
- {"hide", {"",
+ "Set your 'option' status flags"_s}},
+ {"hide"_s, {""_s,
40, atcommand_hide,
- "Toggle invisibility from monsters and certain commands"}},
- {"die", {"",
+ "Toggle invisibility from monsters and certain commands"_s}},
+ {"die"_s, {""_s,
40, atcommand_die,
- "Cause fatal damage to yourself"}},
- {"kill", {"<charname>",
+ "Cause fatal damage to yourself"_s}},
+ {"kill"_s, {"<charname>"_s,
60, atcommand_kill,
- "Cause fatal damage to another player"}},
- {"alive", {"",
+ "Cause fatal damage to another player"_s}},
+ {"alive"_s, {""_s,
60, atcommand_alive,
- "Restore life to yourself"}},
- {"kami", {"<message ...>",
+ "Restore life to yourself"_s}},
+ {"kami"_s, {"<message ...>"_s,
99, atcommand_kami,
- "Send an anonymous broadcast"}},
- {"heal", {"[hp] [sp]",
+ "Send an anonymous broadcast"_s}},
+ {"heal"_s, {"[hp] [sp]"_s,
40, atcommand_heal,
- "Restore or destroy your health"}},
- {"item", {"<item-name-or-id> [count]",
+ "Restore or destroy your health"_s}},
+ {"item"_s, {"<item-name-or-id> [count]"_s,
80, atcommand_item,
- "Summon items out of the void"}},
- {"itemreset", {"",
+ "Summon items out of the void"_s}},
+ {"itemreset"_s, {""_s,
40, atcommand_itemreset,
- "Cast all of your itens into the void (why would you ever want this?)"}},
- {"itemcheck", {"",
+ "Cast all of your itens into the void (why would you ever want this?)"_s}},
+ {"itemcheck"_s, {""_s,
80, atcommand_itemcheck,
- "Perform an internal integrity check on your items"}},
- {"blvl", {"<delta>",
+ "Perform an internal integrity check on your items"_s}},
+ {"blvl"_s, {"<delta>"_s,
60, atcommand_baselevelup,
- "Adjust your level"}},
- {"jlvl", {"<delta>",
+ "Adjust your level"_s}},
+ {"jlvl"_s, {"<delta>"_s,
60, atcommand_joblevelup,
- "Adjust your job level"}},
- {"gm", {"<password>",
+ "Adjust your job level"_s}},
+ {"gm"_s, {"<password>"_s,
100, atcommand_gm,
- "Receive GM powers"}},
- {"pvpoff", {"",
+ "Receive GM powers"_s}},
+ {"pvpoff"_s, {""_s,
60, atcommand_pvpoff,
- "Enable PvP on your map"}},
- {"pvpon", {"",
+ "Enable PvP on your map"_s}},
+ {"pvpon"_s, {""_s,
60, atcommand_pvpon,
- "Disable PvP on your map"}},
- {"model", {"<style> [color] [dye]",
+ "Disable PvP on your map"_s}},
+ {"model"_s, {"<style> [color] [dye]"_s,
99, atcommand_model,
- "Change your hairstyle and hair color"}},
- {"spawn", {"<mob-name-or-id> [count] [x] [y]",
+ "Change your hairstyle and hair color"_s}},
+ {"spawn"_s, {"<mob-name-or-id> [count] [x] [y]"_s,
50, atcommand_spawn,
- "Spawn normal monsters at location."}},
- {"killmonster", {"[map]",
+ "Spawn normal monsters at location."_s}},
+ {"killmonster"_s, {"[map]"_s,
60, atcommand_killmonster,
- "Kill all monsters (with drops)"}},
- {"killmonster2", {"[map]",
+ "Kill all monsters (with drops)"_s}},
+ {"killmonster2"_s, {"[map]"_s,
60, atcommand_killmonster2,
- "Kill all monsters (no drops)"}},
- {"gat", {"",
+ "Kill all monsters (no drops)"_s}},
+ {"gat"_s, {""_s,
99, atcommand_gat,
- "Dump the local walkmap"}},
- {"packet", {"<type> <flag>",
+ "Dump the local walkmap"_s}},
+ {"packet"_s, {"<type> <flag>"_s,
99, atcommand_packet,
- "Force a status change"}},
- {"stpoint", {"<amount>",
+ "Force a status change"_s}},
+ {"stpoint"_s, {"<amount>"_s,
60, atcommand_statuspoint,
- "Increase your stat points"}},
- {"skpoint", {"<amount>",
+ "Increase your stat points"_s}},
+ {"skpoint"_s, {"<amount>"_s,
60, atcommand_skillpoint,
- "Increase your skill points"}},
- {"zeny", {"<amount>",
+ "Increase your skill points"_s}},
+ {"zeny"_s, {"<amount>"_s,
80, atcommand_zeny,
- "Change how much money you have"}},
- {"str", {"<delta>",
+ "Change how much money you have"_s}},
+ {"str"_s, {"<delta>"_s,
60, atcommand_param<ATTR::STR>,
- "Adjust your strength"}},
- {"agi", {"<delta>",
+ "Adjust your strength"_s}},
+ {"agi"_s, {"<delta>"_s,
60, atcommand_param<ATTR::AGI>,
- "Adjust your agility"}},
- {"vit", {"<delta>",
+ "Adjust your agility"_s}},
+ {"vit"_s, {"<delta>"_s,
60, atcommand_param<ATTR::VIT>,
- "Adjust your vitality"}},
- {"int", {"<delta>",
+ "Adjust your vitality"_s}},
+ {"int"_s, {"<delta>"_s,
60, atcommand_param<ATTR::INT>,
- "Adjust your intelligence\0(TODO make this work in real life, I'm lonely)"}},
- {"dex", {"<delta>",
+ "Adjust your intelligence\0(TODO make this work in real life, I'm lonely)"_s}},
+ {"dex"_s, {"<delta>"_s,
60, atcommand_param<ATTR::DEX>,
- "Adjust your dexterity"}},
- {"luk", {"<delta>",
+ "Adjust your dexterity"_s}},
+ {"luk"_s, {"<delta>"_s,
60, atcommand_param<ATTR::LUK>,
- "Adjust your luck"}},
- {"recall", {"<charname>",
+ "Adjust your luck"_s}},
+ {"recall"_s, {"<charname>"_s,
60, atcommand_recall,
- "Warp a player to you"}},
- {"revive", {"<charname>",
+ "Warp a player to you"_s}},
+ {"revive"_s, {"<charname>"_s,
60, atcommand_revive,
- "Restore a player to full health"}},
- {"charstats", {"<charname>",
+ "Restore a player to full health"_s}},
+ {"charstats"_s, {"<charname>"_s,
40, atcommand_character_stats,
- "Show a bunch of stats about a single user"}},
- {"charstatsall", {"",
+ "Show a bunch of stats about a single user"_s}},
+ {"charstatsall"_s, {""_s,
60, atcommand_character_stats_all,
- "Show a bunch of stats about all online users"}},
- {"charoption", {"<opt1> <opt2> <opt3> <charname>",
+ "Show a bunch of stats about all online users"_s}},
+ {"charoption"_s, {"<opt1> <opt2> <opt3> <charname>"_s,
80, atcommand_character_option,
- "Set option flags on another character"}},
- {"charsave", {"<map> <x> <y> <charname>",
+ "Set option flags on another character"_s}},
+ {"charsave"_s, {"<map> <x> <y> <charname>"_s,
60, atcommand_character_save,
- "Set another character's save point"}},
- {"doom", {"",
+ "Set another character's save point"_s}},
+ {"doom"_s, {""_s,
80, atcommand_doom,
- "Kill everyone on the server"}},
- {"doommap", {"",
+ "Kill everyone on the server"_s}},
+ {"doommap"_s, {""_s,
80, atcommand_doommap,
- "Kill everyone on your map"}},
- {"raise", {"",
+ "Kill everyone on your map"_s}},
+ {"raise"_s, {""_s,
80, atcommand_raise,
- "Resurrect all players on the server"}},
- {"raisemap", {"",
+ "Resurrect all players on the server"_s}},
+ {"raisemap"_s, {""_s,
80, atcommand_raisemap,
- "Resurrect all players on your map"}},
- {"charbaselvl", {"<delta> <charname>",
+ "Resurrect all players on your map"_s}},
+ {"charbaselvl"_s, {"<delta> <charname>"_s,
60, atcommand_character_baselevel,
- "Adjust another character's level"}},
- {"charjlvl", {"<delta> <charname>",
+ "Adjust another character's level"_s}},
+ {"charjlvl"_s, {"<delta> <charname>"_s,
60, atcommand_character_joblevel,
- "Adjust another character's job level"}},
- {"kick", {"<charname>",
+ "Adjust another character's job level"_s}},
+ {"kick"_s, {"<charname>"_s,
40, atcommand_kick,
- "Transiently kick a player off the server"}},
- {"kickall", {"",
+ "Transiently kick a player off the server"_s}},
+ {"kickall"_s, {""_s,
99, atcommand_kickall,
- "Transiently kick all players off the server"}},
- {"questskill", {"<skill-id>",
+ "Transiently kick all players off the server"_s}},
+ {"questskill"_s, {"<skill-id>"_s,
99, atcommand_questskill,
- "Give yourself a quest (?) skill"}},
- {"charquestskill", {"<skill-id> <charname>",
+ "Give yourself a quest (?) skill"_s}},
+ {"charquestskill"_s, {"<skill-id> <charname>"_s,
99, atcommand_charquestskill,
- "Give another player a quest (?) skill"}},
- {"lostskill", {"<skill-id>",
+ "Give another player a quest (?) skill"_s}},
+ {"lostskill"_s, {"<skill-id>"_s,
80, atcommand_lostskill,
- "Take away one of your quest (?) skills"}},
- {"charlostskill", {"<skill-id> <charname>",
+ "Take away one of your quest (?) skills"_s}},
+ {"charlostskill"_s, {"<skill-id> <charname>"_s,
99, atcommand_charlostskill,
- "Take away one of another player's quest (?) skills"}},
- {"party", {"<name>",
+ "Take away one of another player's quest (?) skills"_s}},
+ {"party"_s, {"<name>"_s,
99, atcommand_party,
- "Create a new party"}},
- {"mapexit", {"",
+ "Create a new party"_s}},
+ {"mapexit"_s, {""_s,
99, atcommand_mapexit,
- "Try to kill the server kindly"}},
- {"idsearch", {"<item-subseq>",
+ "Try to kill the server kindly"_s}},
+ {"idsearch"_s, {"<item-subseq>"_s,
80, atcommand_idsearch,
- "Search for some items that might match"}},
- {"mapmove", {"<mapname> [x] [y]",
+ "Search for some items that might match"_s}},
+ {"mapmove"_s, {"<mapname> [x] [y]"_s,
40, atcommand_warp,
- "Warp to a different map"}},
- {"broadcast", {"<message ...>",
+ "Warp to a different map"_s}},
+ {"broadcast"_s, {"<message ...>"_s,
40, atcommand_broadcast,
- "Broadcast a message from you"}},
- {"localbroadcast", {"<message ...>",
+ "Broadcast a message from you"_s}},
+ {"localbroadcast"_s, {"<message ...>"_s,
40, atcommand_localbroadcast,
- "Broadcast a message from you locally"}},
- {"recallall", {"",
+ "Broadcast a message from you locally"_s}},
+ {"recallall"_s, {""_s,
80, atcommand_recallall,
- "Warp every online player to your current map"}},
- {"charskreset", {"<charname>",
+ "Warp every online player to your current map"_s}},
+ {"charskreset"_s, {"<charname>"_s,
60, atcommand_charskreset,
- "Reset a player's skill points"}},
- {"charstreset", {"<charname>",
+ "Reset a player's skill points"_s}},
+ {"charstreset"_s, {"<charname>"_s,
60, atcommand_charstreset,
- "Reset a player's stat points"}},
- {"charreset", {"<charname>",
+ "Reset a player's stat points"_s}},
+ {"charreset"_s, {"<charname>"_s,
60, atcommand_charreset,
- "Reset a player's skills, stats, and magic"}},
- {"charmodel", {"<hairstyle> <hair-color> <dye> <charname>",
+ "Reset a player's skills, stats, and magic"_s}},
+ {"charmodel"_s, {"<hairstyle> <hair-color> <dye> <charname>"_s,
99, atcommand_charmodel,
- "Change another character's appearance"}},
- {"charskpoint", {"<amount> <charname>",
+ "Change another character's appearance"_s}},
+ {"charskpoint"_s, {"<amount> <charname>"_s,
60, atcommand_charskpoint,
- "Adjust another player's skill points"}},
- {"charstpoint", {"<amount> <charname>",
+ "Adjust another player's skill points"_s}},
+ {"charstpoint"_s, {"<amount> <charname>"_s,
60, atcommand_charstpoint,
- "Adjust another player's stat points"}},
- {"charzeny", {"<delta> <charname>",
+ "Adjust another player's stat points"_s}},
+ {"charzeny"_s, {"<delta> <charname>"_s,
80, atcommand_charzeny,
- "Adjust another player's money"}},
- {"mapinfo", {"<0-2> [map]",
+ "Adjust another player's money"_s}},
+ {"mapinfo"_s, {"<0-2> [map]"_s,
99, atcommand_mapinfo,
- "Show some stats for the map. 1 also shows players, 2 also shows NPCs"}},
- {"dye", {"<dye>",
+ "Show some stats for the map. 1 also shows players, 2 also shows NPCs"_s}},
+ {"dye"_s, {"<dye>"_s,
40, atcommand_dye,
- "Don't use"}},
- {"ccolor", {"<dye>",
+ "Don't use"_s}},
+ {"ccolor"_s, {"<dye>"_s,
40, atcommand_dye,
- "Don't use"}},
- {"hairstyle", {"<style>",
+ "Don't use"_s}},
+ {"hairstyle"_s, {"<style>"_s,
40, atcommand_hair_style,
- "Change your hairstyle"}},
- {"haircolor", {"<color>",
+ "Change your hairstyle"_s}},
+ {"haircolor"_s, {"<color>"_s,
40, atcommand_hair_color,
- "Change your hair color"}},
- {"allstats", {"[value]",
+ "Change your hair color"_s}},
+ {"allstats"_s, {"[value]"_s,
60, atcommand_all_stats,
- "Adjust all stats by value (or maximum)"}},
- {"charchangesex", {"<charname>",
+ "Adjust all stats by value (or maximum)"_s}},
+ {"charchangesex"_s, {"<charname>"_s,
60, atcommand_char_change_sex,
- "Flip a characters sex and disconnect them"}},
- {"block", {"<charname>",
+ "Flip a characters sex and disconnect them"_s}},
+ {"block"_s, {"<charname>"_s,
60, atcommand_char_block,
- "Permanently block a player's account from the server"}},
- {"unblock", {"<charname>",
+ "Permanently block a player's account from the server"_s}},
+ {"unblock"_s, {"<charname>"_s,
60, atcommand_char_unblock,
- "Remove a permanent block from a player's account"}},
- {"ban", {"<timedelta> <charname>",
+ "Remove a permanent block from a player's account"_s}},
+ {"ban"_s, {"<timedelta> <charname>"_s,
60, atcommand_char_ban,
- "Ban a player's account from the server for a limited time"}},
- {"unban", {"<timedelta> <charname>",
+ "Ban a player's account from the server for a limited time"_s}},
+ {"unban"_s, {"<timedelta> <charname>"_s,
60, atcommand_char_unban,
- "Remove a limited ban from a player's account"}},
- {"partyspy", {"<party-name-or-id>",
+ "Remove a limited ban from a player's account"_s}},
+ {"partyspy"_s, {"<party-name-or-id>"_s,
99, atcommand_partyspy,
- "Listen to all chat within a party"}},
- {"partyrecall", {"<party-name-or-id>",
+ "Listen to all chat within a party"_s}},
+ {"partyrecall"_s, {"<party-name-or-id>"_s,
99, atcommand_partyrecall,
- "Warp all members of a party to you"}},
- {"enablenpc", {"<npc-name>",
+ "Warp all members of a party to you"_s}},
+ {"enablenpc"_s, {"<npc-name>"_s,
80, atcommand_enablenpc,
- "Enable an NPC for visibility"}},
- {"disablenpc", {"<npc-name>",
+ "Enable an NPC for visibility"_s}},
+ {"disablenpc"_s, {"<npc-name>"_s,
80, atcommand_disablenpc,
- "Disable an NPC for visibility"}},
- {"servertime", {"",
+ "Disable an NPC for visibility"_s}},
+ {"servertime"_s, {""_s,
0, atcommand_servertime,
- "Print the server's idea of the current time"}},
- {"chardelitem", {"<item-name-or-id> <count> <charname>",
+ "Print the server's idea of the current time"_s}},
+ {"chardelitem"_s, {"<item-name-or-id> <count> <charname>"_s,
60, atcommand_chardelitem,
- "Delete items from a player's inventory"}},
- {"listnearby", {"",
+ "Delete items from a player's inventory"_s}},
+ {"listnearby"_s, {""_s,
40, atcommand_list_nearby,
- "Print name of all nearby players"}},
- {"email", {"<actual@email> <new@email>",
+ "Print name of all nearby players"_s}},
+ {"email"_s, {"<actual@email> <new@email>"_s,
0, atcommand_email,
- "Changed your account's email"}},
- {"effect", {"<type> <flag>",
+ "Changed your account's email"_s}},
+ {"effect"_s, {"<type> <flag>"_s,
99, atcommand_effect,
- "Apply a special effect to yourself (or everyone! wtf?)"}},
- {"charitemlist", {"<charname>",
+ "Apply a special effect to yourself (or everyone! wtf?)"_s}},
+ {"charitemlist"_s, {"<charname>"_s,
99, atcommand_character_item_list,
- "List a player's items"}},
- {"charstoragelist", {"<charname>",
+ "List a player's items"_s}},
+ {"charstoragelist"_s, {"<charname>"_s,
99, atcommand_character_storage_list,
- "List a player's storage"}},
- {"addwarp", {"<mapname> <x> <y>",
+ "List a player's storage"_s}},
+ {"addwarp"_s, {"<mapname> <x> <y>"_s,
80, atcommand_addwarp,
- "Create a new permanent warp"}},
- {"killer", {"",
+ "Create a new permanent warp"_s}},
+ {"killer"_s, {""_s,
60, atcommand_killer,
- "Toggle whether you are a killer"}},
- {"charkiller", {"<charname>",
+ "Toggle whether you are a killer"_s}},
+ {"charkiller"_s, {"<charname>"_s,
60, atcommand_charkiller,
- "Toggle whether a player is a killer"}},
- {"npcmove", {"<x> <y> <npc-name>",
+ "Toggle whether a player is a killer"_s}},
+ {"npcmove"_s, {"<x> <y> <npc-name>"_s,
80, atcommand_npcmove,
- "Force an NPC to move on the map"}},
- {"killable", {"",
+ "Force an NPC to move on the map"_s}},
+ {"killable"_s, {""_s,
60, atcommand_killable,
- "Toggle whether you are killable"}},
- {"charkillable", {"<charname>",
+ "Toggle whether you are killable"_s}},
+ {"charkillable"_s, {"<charname>"_s,
60, atcommand_charkillable,
- "Toggle whether a player is killable"}},
- {"chareffect", {"<type> <target>",
+ "Toggle whether a player is killable"_s}},
+ {"chareffect"_s, {"<type> <target>"_s,
40, atcommand_chareffect,
- "Apply effect type with arg 0 to a player"}},
- {"dropall", {"",
+ "Apply effect type with arg 0 to a player"_s}},
+ {"dropall"_s, {""_s,
99, atcommand_dropall,
- "Drop all of your items"}},
- {"chardropall", {"<charname>",
+ "Drop all of your items"_s}},
+ {"chardropall"_s, {"<charname>"_s,
60, atcommand_chardropall,
- "Force a player to drop all of their items"}},
- {"storeall", {"",
+ "Force a player to drop all of their items"_s}},
+ {"storeall"_s, {""_s,
60, atcommand_storeall,
- "Store all of your items"}},
- {"charstoreall", {"<charname>",
+ "Store all of your items"_s}},
+ {"charstoreall"_s, {"<charname>"_s,
60, atcommand_charstoreall,
- "Store all of a player's items"}},
- {"rain", {"",
+ "Store all of a player's items"_s}},
+ {"rain"_s, {""_s,
99, atcommand_rain,
- "Enable the rain mapflag"}},
- {"snow", {"",
+ "Enable the rain mapflag"_s}},
+ {"snow"_s, {""_s,
99, atcommand_snow,
- "Enable the snow mapflag"}},
- {"sakura", {"",
+ "Enable the snow mapflag"_s}},
+ {"sakura"_s, {""_s,
99, atcommand_sakura,
- "Enable the sakura mapflag"}},
- {"fog", {"",
+ "Enable the sakura mapflag"_s}},
+ {"fog"_s, {""_s,
99, atcommand_fog,
- "Enable the fog mapflag"}},
- {"leaves", {"",
+ "Enable the fog mapflag"_s}},
+ {"leaves"_s, {""_s,
99, atcommand_leaves,
- "Enable the leaves mapflag"}},
- {"summon", {"<mob-id-or-name>",
+ "Enable the leaves mapflag"_s}},
+ {"summon"_s, {"<mob-id-or-name>"_s,
50, atcommand_summon,
- "Summon a slave monster temporarily"}},
- {"adjgmlvl", {"<level> <cmd>",
+ "Summon a slave monster temporarily"_s}},
+ {"adjgmlvl"_s, {"<level> <cmd>"_s,
99, atcommand_adjgmlvl,
- "Temporarily adjust the GM level of a command"}},
- {"adjcmdlvl", {"<level> <charname>",
+ "Temporarily adjust the GM level of a command"_s}},
+ {"adjcmdlvl"_s, {"<level> <charname>"_s,
99, atcommand_adjcmdlvl,
- "Temporarily adjust the GM level of a player"}},
- {"trade", {"<charname>",
+ "Temporarily adjust the GM level of a player"_s}},
+ {"trade"_s, {"<charname>"_s,
60, atcommand_trade,
- "Initiate trade with a player anywhere"}},
- {"charwipe", {"<charname>",
+ "Initiate trade with a player anywhere"_s}},
+ {"charwipe"_s, {"<charname>"_s,
60, atcommand_char_wipe,
- "Reset a character almost completely"}},
- {"setmagic", {"<school> <value> <charname>",
+ "Reset a character almost completely"_s}},
+ {"setmagic"_s, {"<school> <value> <charname>"_s,
80, atcommand_set_magic,
- "Force magic skill level"}},
- {"magicinfo", {"<charname>",
+ "Force magic skill level"_s}},
+ {"magicinfo"_s, {"<charname>"_s,
80, atcommand_magic_info,
- "Show magic skills of a palyer"}},
- {"log", {"<message ...>",
+ "Show magic skills of a palyer"_s}},
+ {"log"_s, {"<message ...>"_s,
40, atcommand_log,
- "Write something directly to the log"}},
- {"l", {"<message ...>",
+ "Write something directly to the log"_s}},
+ {"l"_s, {"<message ...>"_s,
40, atcommand_log,
- "Write something directly to the log"}},
- {"tee", {"<message ...>",
+ "Write something directly to the log"_s}},
+ {"tee"_s, {"<message ...>"_s,
40, atcommand_tee,
- "Duplicate a message to the log and public chat"}},
- {"t", {"<message ...>",
+ "Duplicate a message to the log and public chat"_s}},
+ {"t"_s, {"<message ...>"_s,
40, atcommand_tee,
- "Duplicate a message to the log and public chat"}},
- {"invisible", {"",
+ "Duplicate a message to the log and public chat"_s}},
+ {"invisible"_s, {""_s,
50, atcommand_invisible,
- "Make yourself invisible to players"}},
- {"visible", {"",
+ "Make yourself invisible to players"_s}},
+ {"visible"_s, {""_s,
50, atcommand_visible,
- "Make yourself visible to players"}},
- {"hugo", {"",
+ "Make yourself visible to players"_s}},
+ {"hugo"_s, {""_s,
60, atcommand_iterate_forward_over_players,
- "Jump to the next player"}},
- {"linus", {"",
+ "Jump to the next player"_s}},
+ {"linus"_s, {""_s,
60, atcommand_iterate_backwards_over_players,
- "Jump to the previous player"}},
- {"sp-info", {"<charname>",
+ "Jump to the previous player"_s}},
+ {"sp-info"_s, {"<charname>"_s,
40, atcommand_skillpool_info,
- "Show info about pool skills"}},
- {"sp-focus", {"<skill-id> <charname>",
+ "Show info about pool skills"_s}},
+ {"sp-focus"_s, {"<skill-id> <charname>"_s,
80, atcommand_skillpool_focus,
- "Focus on a pool skill"}},
- {"sp-unfocus", {"<skill-id> <charname>",
+ "Focus on a pool skill"_s}},
+ {"sp-unfocus"_s, {"<skill-id> <charname>"_s,
80, atcommand_skillpool_unfocus,
- "Unfocus off of a pool skill"}},
- {"skill-learn", {"<skill-id> <level> <charname>",
+ "Unfocus off of a pool skill"_s}},
+ {"skill-learn"_s, {"<skill-id> <level> <charname>"_s,
80, atcommand_skill_learn,
- "Change a skill level"}},
- {"wgm", {"<message ...>",
+ "Change a skill level"_s}},
+ {"wgm"_s, {"<message ...>"_s,
0, atcommand_wgm,
- "Send a message to online GMs"}},
- {"ipcheck", {"<charname>",
+ "Send a message to online GMs"_s}},
+ {"ipcheck"_s, {"<charname>"_s,
60, atcommand_ipcheck,
- "List players on the same IP address"}},
- {"doomspot", {"",
+ "List players on the same IP address"_s}},
+ {"doomspot"_s, {""_s,
60, atcommand_doomspot,
- "Kill all players on the same tile"}},
- {"source", {"",
+ "Kill all players on the same tile"_s}},
+ {"source"_s, {""_s,
0, atcommand_source,
- "Legal information about source code (must be a level 0 command!)"}},
+ "Legal information about source code (must be a level 0 command!)"_s}},
};
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index 8e4d435..f67414f 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -1965,7 +1965,7 @@ struct Damage battle_calc_attack(BF attack_type,
flag);
default:
if (battle_config.error_log)
- PRINTF("battle_calc_attack: unknwon attack type ! %d\n",
+ PRINTF("battle_calc_attack: unknwon attack type ! %d\n"_fmt,
attack_type);
break;
}
@@ -2040,7 +2040,7 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
wd.damage -= reduction;
MAP_LOG_PC(target->is_player(),
- "MAGIC-ABSORB-DMG %d", reduction);
+ "MAGIC-ABSORB-DMG %d"_fmt, reduction);
}
{
@@ -2064,9 +2064,9 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
&& bool(sd->status.inventory[weapon_index].equip & EPOS::WEAPON))
weapon = sd->inventory_data[weapon_index]->nameid;
- MAP_LOG("PC%d %s:%d,%d WPNDMG %s%d %d FOR %d WPN %d",
+ MAP_LOG("PC%d %s:%d,%d WPNDMG %s%d %d FOR %d WPN %d"_fmt,
sd->status_key.char_id, src->bl_m->name_, src->bl_x, src->bl_y,
- (target->bl_type == BL::PC) ? "PC" : "MOB",
+ (target->bl_type == BL::PC) ? "PC"_s : "MOB"_s,
(target->bl_type == BL::PC)
? target->is_player()-> status_key.char_id
: target->bl_id,
@@ -2077,9 +2077,9 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
if (target->bl_type == BL::PC)
{
dumb_ptr<map_session_data> sd2 = target->is_player();
- MAP_LOG("PC%d %s:%d,%d WPNINJURY %s%d %d FOR %d",
+ MAP_LOG("PC%d %s:%d,%d WPNINJURY %s%d %d FOR %d"_fmt,
sd2->status_key.char_id, target->bl_m->name_, target->bl_x, target->bl_y,
- (src->bl_type == BL::PC) ? "PC" : "MOB",
+ (src->bl_type == BL::PC) ? "PC"_s : "MOB"_s,
(src->bl_type == BL::PC)
? src->is_player()->status_key.char_id
: src->bl_id,
@@ -2246,9 +2246,6 @@ int battle_check_target(dumb_ptr<block_list> src, dumb_ptr<block_list> target,
return 0;
}
-//PRINTF("ss:%d src:%d target:%d flag:0x%x %d %d ",ss->bl_id,src->bl_id,target->bl_id,flag,src->bl_type,target->bl_type);
-//PRINTF("p:%d %d g:%d %d\n",s_p,t_p,s_g,t_g);
-
if (ss->bl_type == BL::PC && target->bl_type == BL::PC)
{ // 両方PVPモードなら否定(敵)
if (ss->bl_m->flag.get(MapFlag::PVP)
@@ -2430,17 +2427,17 @@ bool battle_config_read(ZString cfgName)
io::ReadFile in(cfgName);
if (!in.is_open())
{
- PRINTF("file not found: %s\n", cfgName);
+ PRINTF("file not found: %s\n"_fmt, cfgName);
return false;
}
AString line;
while (in.getline(line))
{
-#define BATTLE_CONFIG_VAR(name) {{#name}, &battle_config.name}
+#define BATTLE_CONFIG_VAR(name) {#name##_s, &battle_config.name}
const struct
{
- ZString str;
+ LString str;
int *val;
} data[] =
{
@@ -2550,12 +2547,12 @@ bool battle_config_read(ZString cfgName)
ZString w2;
if (!config_split(line, &w1, &w2))
{
- PRINTF("Bad config line: %s\n", line);
+ PRINTF("Bad config line: %s\n"_fmt, line);
rv = false;
continue;
}
- if (w1 == "import")
+ if (w1 == "import"_s)
{
battle_config_read(w2);
continue;
@@ -2568,7 +2565,7 @@ bool battle_config_read(ZString cfgName)
goto continue_outer;
}
- PRINTF("WARNING: unknown battle conf key: %s\n", AString(w1));
+ PRINTF("WARNING: unknown battle conf key: %s\n"_fmt, AString(w1));
rv = false;
continue_outer:
diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp
index 9a70d63..04e82ca 100644
--- a/src/map/chrif.cpp
+++ b/src/map/chrif.cpp
@@ -209,7 +209,7 @@ int chrif_recvmap(Session *s)
map_setipport(map, ip, port);
}
if (battle_config.etc_log)
- PRINTF("recv map on %s:%d (%d maps)\n",
+ PRINTF("recv map on %s:%d (%d maps)\n"_fmt,
ip, port, j);
return 0;
@@ -270,7 +270,7 @@ int chrif_changemapserverack(Session *s)
if (RFIFOL(s, 6) == 1)
{
if (battle_config.error_log)
- PRINTF("map server change failed.\n");
+ PRINTF("map server change failed.\n"_fmt);
pc_authfail(sd->status_key.account_id);
return 0;
}
@@ -293,21 +293,18 @@ int chrif_connectack(Session *s)
{
if (RFIFOB(s, 2))
{
- PRINTF("Connected to char-server failed %d.\n", RFIFOB(s, 2));
+ PRINTF("Connected to char-server failed %d.\n"_fmt, RFIFOB(s, 2));
exit(1);
}
- PRINTF("Connected to char-server (connection #%d).\n", s);
+ PRINTF("Connected to char-server (connection #%d).\n"_fmt, s);
chrif_state = 1;
chrif_sendmap(s);
- PRINTF("chrif: OnCharIfInit event done. (%d events)\n",
- npc_event_doall(stringish<ScriptLabel>("OnCharIfInit")));
- PRINTF("chrif: OnInterIfInit event done. (%d events)\n",
- npc_event_doall(stringish<ScriptLabel>("OnInterIfInit")));
-
- // <Agit> Run Event [AgitInit]
-// PRINTF("NPC_Event:[OnAgitInit] do (%d) events (Agit Initialize).\n", npc_event_doall("OnAgitInit"));
+ PRINTF("chrif: OnCharIfInit event done. (%d events)\n"_fmt,
+ npc_event_doall(stringish<ScriptLabel>("OnCharIfInit"_s)));
+ PRINTF("chrif: OnInterIfInit event done. (%d events)\n"_fmt,
+ npc_event_doall(stringish<ScriptLabel>("OnInterIfInit"_s)));
return 0;
}
@@ -321,7 +318,7 @@ int chrif_sendmapack(Session *s)
{
if (RFIFOB(s, 2))
{
- PRINTF("chrif : send map list to char server failed %d\n",
+ PRINTF("chrif : send map list to char server failed %d\n"_fmt,
RFIFOB(s, 2));
exit(1);
}
@@ -408,7 +405,7 @@ int chrif_charselectreq(dumb_ptr<map_session_data> sd)
void chrif_changegm(int id, ZString pass)
{
if (battle_config.etc_log)
- PRINTF("chrif_changegm: account: %d, password: '%s'.\n", id, pass);
+ PRINTF("chrif_changegm: account: %d, password: '%s'.\n"_fmt, id, pass);
size_t len = pass.size() + 1;
WFIFOW(char_session, 0) = 0x2b0a;
@@ -426,7 +423,7 @@ void chrif_changeemail(int id, AccountEmail actual_email,
AccountEmail new_email)
{
if (battle_config.etc_log)
- PRINTF("chrif_changeemail: account: %d, actual_email: '%s', new_email: '%s'.\n",
+ PRINTF("chrif_changeemail: account: %d, actual_email: '%s', new_email: '%s'.\n"_fmt,
id, actual_email, new_email);
WFIFOW(char_session, 0) = 0x2b0c;
@@ -456,7 +453,7 @@ void chrif_char_ask_name(int id, CharName character_name, short operation_type,
WFIFOW(char_session, 30) = operation_type; // type of operation
if (operation_type == 2)
WFIFO_STRUCT(char_session, 32, modif);
- PRINTF("chrif : sended 0x2b0e\n");
+ PRINTF("chrif : sended 0x2b0e\n"_fmt);
WFIFOSET(char_session, 44);
}
@@ -487,7 +484,7 @@ int chrif_char_ask_name_answer(Session *s)
{
AString output;
if (RFIFOW(s, 32) == 1) // player not found
- output = STRPRINTF("The player '%s' doesn't exist.",
+ output = STRPRINTF("The player '%s' doesn't exist."_fmt,
player_name);
else
{
@@ -498,18 +495,18 @@ int chrif_char_ask_name_answer(Session *s)
{
case 0: // login-server resquest done
output = STRPRINTF(
- "Login-server has been asked to block the player '%s'.",
+ "Login-server has been asked to block the player '%s'."_fmt,
player_name);
break;
//case 1: // player not found
case 2: // gm level too low
output = STRPRINTF(
- "Your GM level don't authorise you to block the player '%s'.",
+ "Your GM level don't authorise you to block the player '%s'."_fmt,
player_name);
break;
case 3: // login-server offline
output = STRPRINTF(
- "Login-server is offline. Impossible to block the the player '%s'.",
+ "Login-server is offline. Impossible to block the the player '%s'."_fmt,
player_name);
break;
}
@@ -519,18 +516,18 @@ int chrif_char_ask_name_answer(Session *s)
{
case 0: // login-server resquest done
output = STRPRINTF(
- "Login-server has been asked to ban the player '%s'.",
+ "Login-server has been asked to ban the player '%s'."_fmt,
player_name);
break;
//case 1: // player not found
case 2: // gm level too low
output = STRPRINTF(
- "Your GM level don't authorise you to ban the player '%s'.",
+ "Your GM level don't authorise you to ban the player '%s'."_fmt,
player_name);
break;
case 3: // login-server offline
output = STRPRINTF(
- "Login-server is offline. Impossible to ban the the player '%s'.",
+ "Login-server is offline. Impossible to ban the the player '%s'."_fmt,
player_name);
break;
}
@@ -540,18 +537,18 @@ int chrif_char_ask_name_answer(Session *s)
{
case 0: // login-server resquest done
output = STRPRINTF(
- "Login-server has been asked to unblock the player '%s'.",
+ "Login-server has been asked to unblock the player '%s'."_fmt,
player_name);
break;
//case 1: // player not found
case 2: // gm level too low
output = STRPRINTF(
- "Your GM level don't authorise you to unblock the player '%s'.",
+ "Your GM level don't authorise you to unblock the player '%s'."_fmt,
player_name);
break;
case 3: // login-server offline
output = STRPRINTF(
- "Login-server is offline. Impossible to unblock the the player '%s'.",
+ "Login-server is offline. Impossible to unblock the the player '%s'."_fmt,
player_name);
break;
}
@@ -561,18 +558,18 @@ int chrif_char_ask_name_answer(Session *s)
{
case 0: // login-server resquest done
output = STRPRINTF(
- "Login-server has been asked to unban the player '%s'.",
+ "Login-server has been asked to unban the player '%s'."_fmt,
player_name);
break;
//case 1: // player not found
case 2: // gm level too low
output = STRPRINTF(
- "Your GM level don't authorise you to unban the player '%s'.",
+ "Your GM level don't authorise you to unban the player '%s'."_fmt,
player_name);
break;
case 3: // login-server offline
output = STRPRINTF(
- "Login-server is offline. Impossible to unban the the player '%s'.",
+ "Login-server is offline. Impossible to unban the the player '%s'."_fmt,
player_name);
break;
}
@@ -582,18 +579,18 @@ int chrif_char_ask_name_answer(Session *s)
{
case 0: // login-server resquest done
output = STRPRINTF(
- "Login-server has been asked to change the sex of the player '%s'.",
+ "Login-server has been asked to change the sex of the player '%s'."_fmt,
player_name);
break;
//case 1: // player not found
case 2: // gm level too low
output = STRPRINTF(
- "Your GM level don't authorise you to change the sex of the player '%s'.",
+ "Your GM level don't authorise you to change the sex of the player '%s'."_fmt,
player_name);
break;
case 3: // login-server offline
output = STRPRINTF(
- "Login-server is offline. Impossible to change the sex of the the player '%s'.",
+ "Login-server is offline. Impossible to change the sex of the the player '%s'."_fmt,
player_name);
break;
}
@@ -604,7 +601,7 @@ int chrif_char_ask_name_answer(Session *s)
clif_displaymessage(sd->sess, output);
}
else
- PRINTF("chrif_char_ask_name_answer failed - player not online.\n");
+ PRINTF("chrif_char_ask_name_answer failed - player not online.\n"_fmt);
return 0;
}
@@ -625,14 +622,14 @@ void chrif_changedgm(Session *s)
sd = map_id2sd(acc);
if (battle_config.etc_log)
- PRINTF("chrif_changedgm: account: %d, GM level 0 -> %d.\n", acc,
+ PRINTF("chrif_changedgm: account: %d, GM level 0 -> %d.\n"_fmt, acc,
level);
if (sd != NULL)
{
if (level > 0)
- clif_displaymessage(sd->sess, "GM modification success.");
+ clif_displaymessage(sd->sess, "GM modification success."_s);
else
- clif_displaymessage(sd->sess, "Failure of GM modification.");
+ clif_displaymessage(sd->sess, "Failure of GM modification."_s);
}
}
@@ -649,7 +646,7 @@ void chrif_changedsex(Session *s)
acc = RFIFOL(s, 2);
SEX sex = static_cast<SEX>(RFIFOB(s, 6));
if (battle_config.etc_log)
- PRINTF("chrif_changedsex %d.\n", acc);
+ PRINTF("chrif_changedsex %d.\n"_fmt, acc);
sd = map_id2sd(acc);
if (acc > 0)
{
@@ -671,7 +668,7 @@ void chrif_changedsex(Session *s)
sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters
// do same modify in login-server for the account, but no in char-server (it ask again login_id1 to login, and don't remember it)
clif_displaymessage(sd->sess,
- "Your sex has been changed (need disconexion by the server)...");
+ "Your sex has been changed (need disconexion by the server)..."_s);
clif_setwaitclose(sd->sess); // forced to disconnect for the change
}
}
@@ -679,7 +676,7 @@ void chrif_changedsex(Session *s)
{
if (sd != NULL)
{
- PRINTF("chrif_changedsex failed.\n");
+ PRINTF("chrif_changedsex failed.\n"_fmt);
}
}
}
@@ -797,7 +794,7 @@ int chrif_accountdeletion(Session *s)
acc = RFIFOL(s, 2);
if (battle_config.etc_log)
- PRINTF("chrif_accountdeletion %d.\n", acc);
+ PRINTF("chrif_accountdeletion %d.\n"_fmt, acc);
sd = map_id2sd(acc);
if (acc > 0)
{
@@ -805,14 +802,14 @@ int chrif_accountdeletion(Session *s)
{
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,
- "Your account has been deleted (disconnection)...");
+ "Your account has been deleted (disconnection)..."_s);
clif_setwaitclose(sd->sess); // forced to disconnect for the change
}
}
else
{
if (sd != NULL)
- PRINTF("chrif_accountdeletion failed - player not online.\n");
+ PRINTF("chrif_accountdeletion failed - player not online.\n"_fmt);
}
return 0;
@@ -830,7 +827,7 @@ int chrif_accountban(Session *s)
acc = RFIFOL(s, 2);
if (battle_config.etc_log)
- PRINTF("chrif_accountban %d.\n", acc);
+ PRINTF("chrif_accountban %d.\n"_fmt, acc);
sd = map_id2sd(acc);
if (acc > 0)
{
@@ -843,57 +840,58 @@ int chrif_accountban(Session *s)
{ // status or final date of a banishment
case 1: // 0 = Unregistered ID
clif_displaymessage(sd->sess,
- "Your account has 'Unregistered'.");
+ "Your account has 'Unregistered'."_s);
break;
case 2: // 1 = Incorrect Password
clif_displaymessage(sd->sess,
- "Your account has an 'Incorrect Password'...");
+ "Your account has an 'Incorrect Password'..."_s);
break;
case 3: // 2 = This ID is expired
clif_displaymessage(sd->sess,
- "Your account has expired.");
+ "Your account has expired."_s);
break;
case 4: // 3 = Rejected from Server
clif_displaymessage(sd->sess,
- "Your account has been rejected from server.");
+ "Your account has been rejected from server."_s);
break;
case 5: // 4 = You have been blocked by the GM Team
clif_displaymessage(sd->sess,
- "Your account has been blocked by the GM Team.");
+ "Your account has been blocked by the GM Team."_s);
break;
case 6: // 5 = Your Game's EXE file is not the latest version
clif_displaymessage(sd->sess,
- "Your Game's EXE file is not the latest version.");
+ "Your Game's EXE file is not the latest version."_s);
break;
case 7: // 6 = Your are Prohibited to log in until %s
clif_displaymessage(sd->sess,
- "Your account has been prohibited to log in.");
+ "Your account has been prohibited to log in."_s);
break;
case 8: // 7 = Server is jammed due to over populated
clif_displaymessage(sd->sess,
- "Server is jammed due to over populated.");
+ "Server is jammed due to over populated."_s);
break;
case 9: // 8 = No MSG (actually, all states after 9 except 99 are No MSG, use only this)
clif_displaymessage(sd->sess,
- "Your account has not more authorised.");
+ "Your account has not more authorised."_s);
break;
case 100: // 99 = This ID has been totally erased
clif_displaymessage(sd->sess,
- "Your account has been totally erased.");
+ "Your account has been totally erased."_s);
break;
default:
clif_displaymessage(sd->sess,
- "Your account has not more authorised.");
+ "Your account has not more authorised."_s);
break;
}
}
else if (RFIFOB(s, 6) == 1)
{
// 0: change of statut, 1: ban
- TimeT timestamp = static_cast<time_t>(RFIFOL(s, 7)); // status or final date of a banishment
- char tmpstr[] = WITH_TIMESTAMP("Your account has been banished until ");
- REPLACE_TIMESTAMP(tmpstr, timestamp);
- clif_displaymessage(sd->sess, const_(tmpstr));
+ const TimeT timestamp = static_cast<time_t>(RFIFOL(s, 7)); // status or final date of a banishment
+ timestamp_seconds_buffer buffer;
+ stamp_time(buffer, &timestamp);
+ AString tmpstr = STRPRINTF("Your account has been banished until %s"_fmt, buffer);
+ clif_displaymessage(sd->sess, tmpstr);
}
clif_setwaitclose(sd->sess); // forced to disconnect for the change
}
@@ -901,7 +899,7 @@ int chrif_accountban(Session *s)
else
{
if (sd != NULL)
- PRINTF("chrif_accountban failed - player not online.\n");
+ PRINTF("chrif_accountban failed - player not online.\n"_fmt);
}
return 0;
@@ -914,7 +912,7 @@ int chrif_accountban(Session *s)
static
int chrif_recvgmaccounts(Session *s)
{
- PRINTF("From login-server: receiving of %d GM accounts information.\n",
+ PRINTF("From login-server: receiving of %d GM accounts information.\n"_fmt,
pc_read_gm_account(s));
return 0;
@@ -1052,7 +1050,7 @@ void chrif_parse(Session *s)
{
if (s == char_session)
{
- PRINTF("Map-server can't connect to char-server (connection #%d).\n",
+ PRINTF("Map-server can't connect to char-server (connection #%d).\n"_fmt,
s);
char_session = nullptr;
}
@@ -1158,7 +1156,7 @@ void chrif_parse(Session *s)
default:
if (battle_config.error_log)
- PRINTF("chrif_parse : unknown packet %d %d\n", s,
+ PRINTF("chrif_parse : unknown packet %d %d\n"_fmt, s,
RFIFOW(s, 0));
s->eof = 1;
return;
@@ -1211,7 +1209,7 @@ void check_connect_char_server(TimerData *, tick_t)
{
if (!char_session)
{
- PRINTF("Attempt to connect to char-server...\n");
+ PRINTF("Attempt to connect to char-server...\n"_fmt);
chrif_state = 0;
char_session = make_connection(char_ip, char_port);
if (!char_session)
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index a7dcb52..2eae52b 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -464,7 +464,7 @@ int clif_send(const uint8_t *buf, int len, dumb_ptr<block_list> bl, SendWho type
default:
if (battle_config.error_log)
- PRINTF("clif_send まだ作ってないよー\n");
+ PRINTF("clif_send まだ作ってないよー\n"_fmt);
return -1;
}
@@ -1770,7 +1770,7 @@ int clif_updatestatus(dumb_ptr<map_session_data> sd, SP type)
default:
if (battle_config.error_log)
- PRINTF("clif_updatestatus : make %d routine\n",
+ PRINTF("clif_updatestatus : make %d routine\n"_fmt,
type);
return 1;
}
@@ -2557,7 +2557,7 @@ void clif_getareachar(dumb_ptr<block_list> bl, dumb_ptr<map_session_data> sd)
break;
default:
if (battle_config.error_log)
- PRINTF("get area char ??? %d\n",
+ PRINTF("get area char ??? %d\n"_fmt,
bl->bl_type);
break;
}
@@ -3070,8 +3070,6 @@ void clif_party_option(struct party *p, dumb_ptr<map_session_data> sd, int flag)
nullpo_retv(p);
-// if(battle_config.etc_log)
-// PRINTF("clif_party_option: %d %d %d\n",p->exp,p->item,flag);
if (sd == NULL && flag == 0)
{
int i;
@@ -3174,8 +3172,6 @@ int clif_party_xy(struct party *, dumb_ptr<map_session_data> sd)
WBUFW(buf, 6) = sd->bl_x;
WBUFW(buf, 8) = sd->bl_y;
clif_send(buf, clif_parse_func_table[0x107].len, sd, SendWho::PARTY_SAMEMAP_WOS);
-// if(battle_config.etc_log)
-// PRINTF("clif_party_xy %d\n",sd->status_key.account_id);
return 0;
}
@@ -3195,8 +3191,6 @@ int clif_party_hp(struct party *, dumb_ptr<map_session_data> sd)
WBUFW(buf, 8) =
(sd->status.max_hp > 0x7fff) ? 0x7fff : sd->status.max_hp;
clif_send(buf, clif_parse_func_table[0x106].len, sd, SendWho::PARTY_AREA_WOS);
-// if(battle_config.etc_log)
-// PRINTF("clif_party_hp %d\n",sd->status_key.account_id);
return 0;
}
@@ -3374,7 +3368,7 @@ void clif_parse_WantToConnection(Session *s, dumb_ptr<map_session_data> sd)
if (sd)
{
if (battle_config.error_log)
- PRINTF("clif_parse_WantToConnection : invalid request?\n");
+ PRINTF("clif_parse_WantToConnection : invalid request?\n"_fmt);
return;
}
@@ -3394,7 +3388,7 @@ void clif_parse_WantToConnection(Session *s, dumb_ptr<map_session_data> sd)
{
clif_authfail_fd(s, 2); // same id
clif_authfail_fd(old_sd->sess, 2); // same id
- PRINTF("clif_parse_WantToConnection: Double connection for account %d (sessions: #%d (new) and #%d (old)).\n",
+ PRINTF("clif_parse_WantToConnection: Double connection for account %d (sessions: #%d (new) and #%d (old)).\n"_fmt,
account_id, s, old_sd->sess);
}
else
@@ -3623,7 +3617,7 @@ void clif_parse_GetCharNameRequest(Session *s, dumb_ptr<map_session_data> sd)
nullpo_retv(ssd);
if (ssd->state.shroud_active)
- WFIFO_STRING(s, 6, "", 24);
+ WFIFO_STRING(s, 6, ""_s, 24);
else
WFIFO_STRING(s, 6, ssd->status_key.name.to__actual(), 24);
WFIFOSET(s, clif_parse_func_table[0x95].len);
@@ -3645,9 +3639,9 @@ void clif_parse_GetCharNameRequest(Session *s, dumb_ptr<map_session_data> sd)
WFIFOW(s, 0) = 0x195;
WFIFOL(s, 2) = account_id;
WFIFO_STRING(s, 6, party_name, 24);
- WFIFO_STRING(s, 30, "", 24);
- WFIFO_STRING(s, 54, "", 24);
- WFIFO_STRING(s, 78, "", 24); // We send this value twice because the client expects it
+ WFIFO_STRING(s, 30, ""_s, 24);
+ WFIFO_STRING(s, 54, ""_s, 24);
+ WFIFO_STRING(s, 78, ""_s, 24); // We send this value twice because the client expects it
WFIFOSET(s, clif_parse_func_table[0x195].len);
}
@@ -3689,7 +3683,7 @@ void clif_parse_GetCharNameRequest(Session *s, dumb_ptr<map_session_data> sd)
break;
default:
if (battle_config.error_log)
- PRINTF("clif_parse_GetCharNameRequest : bad type %d (%d)\n",
+ PRINTF("clif_parse_GetCharNameRequest : bad type %d (%d)\n"_fmt,
bl->bl_type, account_id);
break;
}
@@ -3710,7 +3704,7 @@ void clif_parse_GlobalMessage(Session *s, dumb_ptr<map_session_data> sd)
AString mbuf = clif_validate_chat(sd, ChatType::Global);
if (!mbuf)
{
- clif_displaymessage(s, "Your message could not be sent.");
+ clif_displaymessage(s, "Your message could not be sent."_s);
return;
}
@@ -3722,7 +3716,7 @@ void clif_parse_GlobalMessage(Session *s, dumb_ptr<map_session_data> sd)
/* Don't send chat that results in an automatic ban. */
if (tmw_CheckChatSpam(sd, mbuf))
{
- clif_displaymessage(s, "Your message could not be sent.");
+ clif_displaymessage(s, "Your message could not be sent."_s);
return;
}
@@ -3975,7 +3969,7 @@ void clif_parse_Wis(Session *s, dumb_ptr<map_session_data> sd)
AString mbuf = clif_validate_chat(sd, ChatType::Whisper);
if (!mbuf)
{
- clif_displaymessage(s, "Your message could not be sent.");
+ clif_displaymessage(s, "Your message could not be sent."_s);
return;
}
@@ -3987,7 +3981,7 @@ void clif_parse_Wis(Session *s, dumb_ptr<map_session_data> sd)
/* Don't send chat that results in an automatic ban. */
if (tmw_CheckChatSpam(sd, mbuf))
{
- clif_displaymessage(s, "Your message could not be sent.");
+ clif_displaymessage(s, "Your message could not be sent."_s);
return;
}
@@ -4006,7 +4000,7 @@ void clif_parse_Wis(Session *s, dumb_ptr<map_session_data> sd)
/* Refuse messages addressed to self. */
if (dstsd->sess == s)
{
- ZString mes = "You cannot page yourself.";
+ ZString mes = "You cannot page yourself."_s;
clif_wis_message(s, wisp_server_name, mes);
}
else
@@ -4079,13 +4073,13 @@ void clif_parse_DropItem(Session *s, dumb_ptr<map_session_data> sd)
}
if (sd->bl_m->flag.get(MapFlag::NO_PLAYER_DROPS))
{
- clif_displaymessage(sd->sess, "Can't drop items here.");
+ clif_displaymessage(sd->sess, "Can't drop items here."_s);
return;
}
if (sd->npc_id != 0
|| sd->opt1 != Opt1::ZERO)
{
- clif_displaymessage(sd->sess, "Can't drop items right now.");
+ clif_displaymessage(sd->sess, "Can't drop items right now."_s);
return;
}
@@ -4572,7 +4566,7 @@ void clif_parse_PartyMessage(Session *s, dumb_ptr<map_session_data> sd)
AString mbuf = clif_validate_chat(sd, ChatType::Party);
if (!mbuf)
{
- clif_displaymessage(s, "Your message could not be sent.");
+ clif_displaymessage(s, "Your message could not be sent."_s);
return;
}
@@ -4582,7 +4576,7 @@ void clif_parse_PartyMessage(Session *s, dumb_ptr<map_session_data> sd)
/* Don't send chat that results in an automatic ban. */
if (tmw_CheckChatSpam(sd, mbuf))
{
- clif_displaymessage(s, "Your message could not be sent.");
+ clif_displaymessage(s, "Your message could not be sent."_s);
return;
}
@@ -5202,7 +5196,7 @@ int clif_check_packet_flood(Session *s, int cmd)
if (sd->packet_flood_in >= battle_config.packet_spam_flood)
{
- PRINTF("packet flood detected from %s [0x%x]\n", sd->status_key.name, cmd);
+ PRINTF("packet flood detected from %s [0x%x]\n"_fmt, sd->status_key.name, cmd);
if (battle_config.packet_spam_kick)
{
s->eof = 1; // Kick
@@ -5219,9 +5213,9 @@ int clif_check_packet_flood(Session *s, int cmd)
}
inline
-void WARN_MALFORMED_MSG(dumb_ptr<map_session_data> sd, const char *msg)
+void WARN_MALFORMED_MSG(dumb_ptr<map_session_data> sd, ZString msg)
{
- PRINTF("clif_validate_chat(): %s (ID %d) sent a malformed message: %s.\n",
+ PRINTF("clif_validate_chat(): %s (ID %d) sent a malformed message: %s.\n"_fmt,
sd->status_key.name, sd->status_key.account_id, msg);
}
/**
@@ -5266,14 +5260,14 @@ AString clif_validate_chat(dumb_ptr<map_session_data> sd, ChatType type)
/* The player just sent the header (2) and length (2) words. */
if (!msg_len)
{
- WARN_MALFORMED_MSG(sd, "no message sent");
+ WARN_MALFORMED_MSG(sd, "no message sent"_s);
return AString();
}
/* The client sent (or claims to have sent) an empty message. */
if (msg_len == min_len)
{
- WARN_MALFORMED_MSG(sd, "empty message");
+ WARN_MALFORMED_MSG(sd, "empty message"_s);
return AString();
}
@@ -5282,7 +5276,7 @@ AString clif_validate_chat(dumb_ptr<map_session_data> sd, ChatType type)
{
/* Disallow malformed messages. */
clif_setwaitclose(s);
- WARN_MALFORMED_MSG(sd, "illegal target name");
+ WARN_MALFORMED_MSG(sd, "illegal target name"_s);
return AString();
}
@@ -5304,18 +5298,18 @@ AString clif_validate_chat(dumb_ptr<map_session_data> sd, ChatType type)
*/
if (buf_len >= battle_config.chat_maxline)
{
- WARN_MALFORMED_MSG(sd, "exceeded maximum message length");
+ WARN_MALFORMED_MSG(sd, "exceeded maximum message length"_s);
return AString();
}
if (type == ChatType::Global)
{
XString p = pbuf;
- if (!(p.startswith(sd->status_key.name.to__actual()) && p.xslice_t(name_len).startswith(" : ")))
+ if (!(p.startswith(sd->status_key.name.to__actual()) && p.xslice_t(name_len).startswith(" : "_s)))
{
/* Disallow malformed/spoofed messages. */
clif_setwaitclose(s);
- WARN_MALFORMED_MSG(sd, "spoofed name/invalid format");
+ WARN_MALFORMED_MSG(sd, "spoofed name/invalid format"_s);
return AString();
}
/* Step beyond the separator. */
@@ -5357,11 +5351,11 @@ void clif_parse(Session *s)
pc_logout(sd);
clif_quitsave(s, sd);
- PRINTF("Player [%s] has logged off your server.\n", sd->status_key.name); // Player logout display [Valaris]
+ PRINTF("Player [%s] has logged off your server.\n"_fmt, sd->status_key.name); // Player logout display [Valaris]
}
else if (sd)
{ // not authentified! (refused by char-server or disconnect before to be authentified)
- PRINTF("Player with account [%d] has logged off your server (not auth account).\n", sd->bl_id); // Player logout display [Yor]
+ PRINTF("Player with account [%d] has logged off your server (not auth account).\n"_fmt, sd->bl_id); // Player logout display [Yor]
map_deliddb(sd); // account_id has been included in the DB before auth answer
}
if (s)
@@ -5436,32 +5430,32 @@ void clif_parse(Session *s)
if (battle_config.error_log)
{
if (s)
- PRINTF("\nclif_parse: session #%d, packet 0x%x, lenght %d\n",
+ PRINTF("\nclif_parse: session #%d, packet 0x%x, lenght %d\n"_fmt,
s, cmd, packet_len);
#ifdef DUMP_UNKNOWN_PACKET
{
int i;
- ZString packet_txt = "save/packet.txt";
- PRINTF("---- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F");
+ ZString packet_txt = "save/packet.txt"_s;
+ PRINTF("---- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F"_fmt);
for (i = 0; i < packet_len; i++)
{
if ((i & 15) == 0)
- PRINTF("\n%04X ", i);
- PRINTF("%02X ", RFIFOB(s, i));
+ PRINTF("\n%04X "_fmt, i);
+ PRINTF("%02X "_fmt, RFIFOB(s, i));
}
if (sd && sd->state.auth)
{
- PRINTF("\nAccount ID %d, character ID %d, player name %s.\n",
+ PRINTF("\nAccount ID %d, character ID %d, player name %s.\n"_fmt,
sd->status_key.account_id, sd->status_key.char_id,
sd->status_key.name);
}
else if (sd) // not authentified! (refused by char-server or disconnect before to be authentified)
- PRINTF("\nAccount ID %d.\n", sd->bl_id);
+ PRINTF("\nAccount ID %d.\n"_fmt, sd->bl_id);
io::AppendFile fp(packet_txt);
if (!fp.is_open())
{
- PRINTF("clif.c: cant write [%s] !!! data is lost !!!\n",
+ PRINTF("clif.c: cant write [%s] !!! data is lost !!!\n"_fmt,
packet_txt);
return;
}
@@ -5472,25 +5466,25 @@ void clif_parse(Session *s)
if (sd && sd->state.auth)
{
FPRINTF(fp,
- "%s\nPlayer with account ID %d (character ID %d, player name %s) sent wrong packet:\n",
+ "%s\nPlayer with account ID %d (character ID %d, player name %s) sent wrong packet:\n"_fmt,
now,
sd->status_key.account_id,
sd->status_key.char_id, sd->status_key.name);
}
else if (sd) // not authentified! (refused by char-server or disconnect before to be authentified)
FPRINTF(fp,
- "%s\nPlayer with account ID %d sent wrong packet:\n",
+ "%s\nPlayer with account ID %d sent wrong packet:\n"_fmt,
now, sd->bl_id);
FPRINTF(fp,
- "\t---- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F");
+ "\t---- 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F"_fmt);
for (i = 0; i < packet_len; i++)
{
if ((i & 15) == 0)
- FPRINTF(fp, "\n\t%04X ", i);
- FPRINTF(fp, "%02X ", RFIFOB(s, i));
+ FPRINTF(fp, "\n\t%04X "_fmt, i);
+ FPRINTF(fp, "%02X "_fmt, RFIFOB(s, i));
}
- FPRINTF(fp, "\n\n");
+ FPRINTF(fp, "\n\n"_fmt);
}
}
#endif
diff --git a/src/map/grfio.cpp b/src/map/grfio.cpp
index c3d1e40..b03456c 100644
--- a/src/map/grfio.cpp
+++ b/src/map/grfio.cpp
@@ -50,7 +50,7 @@ bool load_resnametable(ZString filename)
io::ReadFile in(filename);
if (!in.is_open())
{
- FPRINTF(stderr, "Missing %s\n", filename);
+ FPRINTF(stderr, "Missing %s\n"_fmt, filename);
return false;
}
@@ -63,7 +63,7 @@ bool load_resnametable(ZString filename)
if (!extract(line,
record<'#'>(&key, &value)))
{
- PRINTF("Bad resnametable line: %s\n", line);
+ PRINTF("Bad resnametable line: %s\n"_fmt, line);
rv = false;
continue;
}
@@ -85,7 +85,7 @@ std::vector<uint8_t> grfio_reads(MapName rname)
{
MString lfname_;
// TODO ... instead of here
- lfname_ += "data/";
+ lfname_ += "data/"_s;
lfname_ += grfio_resnametable(rname);
AString lfname = AString(lfname_);
@@ -93,7 +93,7 @@ std::vector<uint8_t> grfio_reads(MapName rname)
int fd = open(lfname.c_str(), O_RDONLY);
if (fd == -1)
{
- FPRINTF(stderr, "Resource %s (file %s) not found\n",
+ FPRINTF(stderr, "Resource %s (file %s) not found\n"_fmt,
rname, lfname);
return {};
}
diff --git a/src/map/intif.cpp b/src/map/intif.cpp
index 2cae2ad..3395974 100644
--- a/src/map/intif.cpp
+++ b/src/map/intif.cpp
@@ -85,7 +85,7 @@ void intif_wis_message(dumb_ptr<map_session_data> sd, CharName nick, ZString mes
WFIFOSET(char_session, WFIFOW(char_session, 2));
if (battle_config.etc_log)
- PRINTF("intif_wis_message from %s to %s)\n",
+ PRINTF("intif_wis_message from %s to %s)\n"_fmt,
sd->status_key.name, nick);
}
@@ -99,7 +99,7 @@ void intif_wis_replay(int id, int flag)
WFIFOSET(char_session, 7);
if (battle_config.etc_log)
- PRINTF("intif_wis_replay: id: %d, flag:%d\n", id, flag);
+ PRINTF("intif_wis_replay: id: %d, flag:%d\n"_fmt, id, flag);
}
// The transmission of GM only Wisp/Page from server to inter-server
@@ -114,7 +114,7 @@ void intif_wis_message_to_gm(CharName Wisp_name, int min_gm_level, ZString mes)
WFIFOSET(char_session, WFIFOW(char_session, 2));
if (battle_config.etc_log)
- PRINTF("intif_wis_message_to_gm: from: '%s', min level: %d, message: '%s'.\n",
+ PRINTF("intif_wis_message_to_gm: from: '%s', min level: %d, message: '%s'.\n"_fmt,
Wisp_name, min_gm_level, mes);
}
@@ -280,7 +280,7 @@ int intif_parse_WisMessage(Session *s)
if (battle_config.etc_log)
{
- PRINTF("intif_parse_wismessage: id: %d, from: %s, to: %s\n",
+ PRINTF("intif_parse_wismessage: id: %d, from: %s, to: %s\n"_fmt,
RFIFOL(s, 4),
from,
to);
@@ -312,7 +312,7 @@ int intif_parse_WisEnd(Session *s)
uint8_t flag = RFIFOB(s, 26);
if (battle_config.etc_log)
// flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
- PRINTF("intif_parse_wisend: player: %s, flag: %d\n",
+ PRINTF("intif_parse_wisend: player: %s, flag: %d\n"_fmt,
name, flag);
sd = map_nick2sd(name);
if (sd != NULL)
@@ -366,7 +366,6 @@ int intif_parse_AccountReg(Session *s)
sd->status.account_reg[j].value = RFIFOL(s, p + 32);
}
sd->status.account_reg_num = j;
-// PRINTF("intif: accountreg\n");
return 0;
}
@@ -382,7 +381,7 @@ int intif_parse_LoadStorage(Session *s)
if (sd == NULL)
{
if (battle_config.error_log)
- PRINTF("intif_parse_LoadStorage: user not found %d\n",
+ PRINTF("intif_parse_LoadStorage: user not found %d\n"_fmt,
RFIFOL(s, 4));
return 1;
}
@@ -390,14 +389,14 @@ int intif_parse_LoadStorage(Session *s)
if (stor->storage_status == 1)
{ // Already open.. lets ignore this update
if (battle_config.error_log)
- PRINTF("intif_parse_LoadStorage: storage received for a client already open (User %d:%d)\n",
+ PRINTF("intif_parse_LoadStorage: storage received for a client already open (User %d:%d)\n"_fmt,
sd->status_key.account_id, sd->status_key.char_id);
return 1;
}
if (stor->dirty)
{ // Already have storage, and it has been modified and not saved yet! Exploit! [Skotlex]
if (battle_config.error_log)
- PRINTF("intif_parse_LoadStorage: received storage for an already modified non-saved storage! (User %d:%d)\n",
+ PRINTF("intif_parse_LoadStorage: received storage for an already modified non-saved storage! (User %d:%d)\n"_fmt,
sd->status_key.account_id, sd->status_key.char_id);
return 1;
}
@@ -405,12 +404,12 @@ int intif_parse_LoadStorage(Session *s)
if (RFIFOW(s, 2) - 8 != sizeof(struct storage))
{
if (battle_config.error_log)
- PRINTF("intif_parse_LoadStorage: data size error %d %zu\n",
+ PRINTF("intif_parse_LoadStorage: data size error %d %zu\n"_fmt,
RFIFOW(s, 2) - 8, sizeof(struct storage));
return 1;
}
if (battle_config.save_log)
- PRINTF("intif_openstorage: %d\n", RFIFOL(s, 4));
+ PRINTF("intif_openstorage: %d\n"_fmt, RFIFOL(s, 4));
RFIFO_STRUCT(s, 8, *stor);
stor->dirty = 0;
stor->storage_status = 1;
@@ -427,7 +426,7 @@ static
void intif_parse_SaveStorage(Session *s)
{
if (battle_config.save_log)
- PRINTF("intif_savestorage: done %d %d\n", RFIFOL(s, 2),
+ PRINTF("intif_savestorage: done %d %d\n"_fmt, RFIFOL(s, 2),
RFIFOB(s, 6));
storage_storage_saved(RFIFOL(s, 2));
}
@@ -437,7 +436,7 @@ static
void intif_parse_PartyCreated(Session *s)
{
if (battle_config.etc_log)
- PRINTF("intif: party created\n");
+ PRINTF("intif: party created\n"_fmt);
int account_id = RFIFOL(s, 2);
int fail = RFIFOB(s, 6);
int party_id = RFIFOL(s, 7);
@@ -452,16 +451,15 @@ void intif_parse_PartyInfo(Session *s)
if (RFIFOW(s, 2) == 8)
{
if (battle_config.error_log)
- PRINTF("intif: party noinfo %d\n", RFIFOL(s, 4));
+ PRINTF("intif: party noinfo %d\n"_fmt, RFIFOL(s, 4));
party_recv_noinfo(RFIFOL(s, 4));
return;
}
-// PRINTF("intif: party info %d\n",RFIFOL(fd,4));
if (RFIFOW(s, 2) != sizeof(struct party) + 4)
{
if (battle_config.error_log)
- PRINTF("intif: party info : data size error %d %d %zu\n",
+ PRINTF("intif: party info : data size error %d %d %zu\n"_fmt,
RFIFOL(s, 4), RFIFOW(s, 2),
sizeof(struct party) + 4);
}
@@ -475,7 +473,7 @@ static
void intif_parse_PartyMemberAdded(Session *s)
{
if (battle_config.etc_log)
- PRINTF("intif: party member added %d %d %d\n", RFIFOL(s, 2),
+ PRINTF("intif: party member added %d %d %d\n"_fmt, RFIFOL(s, 2),
RFIFOL(s, 6), RFIFOB(s, 10));
party_member_added(RFIFOL(s, 2), RFIFOL(s, 6), RFIFOB(s, 10));
}
@@ -496,7 +494,7 @@ void intif_parse_PartyMemberLeaved(Session *s)
int account_id = RFIFOL(s, 6);
CharName name = stringish<CharName>(RFIFO_STRING<24>(s, 10));
if (battle_config.etc_log)
- PRINTF("intif: party member leaved %d %d %s\n",
+ PRINTF("intif: party member leaved %d %d %s\n"_fmt,
party_id, account_id, name);
party_member_leaved(party_id, account_id, name);
}
@@ -553,8 +551,6 @@ int intif_parse(Session *s)
return 2;
packet_len = RFIFOW(s, 2);
}
-// if(battle_config.etc_log)
-// PRINTF("intif_parse %d %x %d %d\n",fd,cmd,packet_len,RFIFOREST(fd));
if (RFIFOREST(s) < packet_len)
{
return 2;
@@ -612,7 +608,7 @@ int intif_parse(Session *s)
break;
default:
if (battle_config.error_log)
- PRINTF("intif_parse : unknown packet %d %x\n", s,
+ PRINTF("intif_parse : unknown packet %d %x\n"_fmt, s,
RFIFOW(s, 0));
return 0;
}
diff --git a/src/map/itemdb.cpp b/src/map/itemdb.cpp
index 4ebb52c..2cc9e49 100644
--- a/src/map/itemdb.cpp
+++ b/src/map/itemdb.cpp
@@ -174,7 +174,7 @@ bool itemdb_readdb(ZString filename)
if (!in.is_open())
{
- PRINTF("can't read %s\n", filename);
+ PRINTF("can't read %s\n"_fmt, filename);
return false;
}
@@ -220,7 +220,7 @@ bool itemdb_readdb(ZString filename)
)
)
{
- PRINTF("%s:%d: error: bad item line: %s\n",
+ PRINTF("%s:%d: error: bad item line: %s\n"_fmt,
filename, lines, line);
rv = false;
continue;
@@ -254,7 +254,7 @@ bool itemdb_readdb(ZString filename)
continue;
id->equip_script = parse_script(tail_part, lines, true);
}
- PRINTF("read %s done (count=%d)\n", filename, ln);
+ PRINTF("read %s done (count=%d)\n"_fmt, filename, ln);
}
return rv;
diff --git a/src/map/magic-expr.cpp b/src/map/magic-expr.cpp
index 42ff3a7..786f870 100644
--- a/src/map/magic-expr.cpp
+++ b/src/map/magic-expr.cpp
@@ -125,38 +125,38 @@ AString show_entity(dumb_ptr<block_list> entity)
case BL::MOB:
return entity->is_mob()->name;
case BL::ITEM:
- assert (0 && "There is no way this code did what it was supposed to do!");
+ assert (0 && "There is no way this code did what it was supposed to do!"_s);
/* Sorry about this one... */
// WTF? item_data is a struct item, not a struct item_data
// return ((struct item_data *) (&entity->is_item()->item_data))->name;
abort();
case BL::SPELL:
- return {"%invocation(ERROR:this-should-not-be-an-entity)"};
+ return "%invocation(ERROR:this-should-not-be-an-entity)"_s;
default:
- return {"%unknown-entity"};
+ return "%unknown-entity"_s;
}
}
static
void stringify(val_t *v, int within_op)
{
- static earray<ZString, DIR, DIR::COUNT> dirs //=
+ static earray<LString, DIR, DIR::COUNT> dirs //=
{{
- {"south"}, {"south-west"},
- {"west"}, {"north-west"},
- {"north"}, {"north-east"},
- {"east"}, {"south-east"},
+ "south"_s, "south-west"_s,
+ "west"_s, "north-west"_s,
+ "north"_s, "north-east"_s,
+ "east"_s, "south-east"_s,
}};
AString buf;
switch (v->ty)
{
case TYPE::UNDEF:
- buf = "UNDEF";
+ buf = "UNDEF"_s;
break;
case TYPE::INT:
- buf = STRPRINTF("%i", v->v.v_int);
+ buf = STRPRINTF("%i"_fmt, v->v.v_int);
break;
case TYPE::STRING:
@@ -171,14 +171,14 @@ void stringify(val_t *v, int within_op)
break;
case TYPE::LOCATION:
- buf = STRPRINTF("<\"%s\", %d, %d>",
+ buf = STRPRINTF("<\"%s\", %d, %d>"_fmt,
v->v.v_location.m->name_,
v->v.v_location.x,
v->v.v_location.y);
break;
case TYPE::AREA:
- buf = "%area";
+ buf = "%area"_s;
free_area(v->v.v_area);
break;
@@ -196,7 +196,7 @@ void stringify(val_t *v, int within_op)
break;
default:
- FPRINTF(stderr, "[magic] INTERNAL ERROR: Cannot stringify %d\n",
+ FPRINTF(stderr, "[magic] INTERNAL ERROR: Cannot stringify %d\n"_fmt,
v->ty);
return;
}
@@ -590,7 +590,7 @@ void magic_area_rect(map_local **m, int *x, int *y, int *width, int *height,
default:
FPRINTF(stderr,
- "Error: Trying to compute area of NE/SE/NW/SW-facing bar");
+ "Error: Trying to compute area of NE/SE/NW/SW-facing bar"_fmt);
*x = tx;
*y = ty;
*width = *height = 1;
@@ -619,7 +619,7 @@ int magic_location_in_area(map_local *m, int x, int y, dumb_ptr<area_t> area)
&& (x < ax + awidth) && (y < ay + aheight));
}
default:
- FPRINTF(stderr, "INTERNAL ERROR: Invalid area\n");
+ FPRINTF(stderr, "INTERNAL ERROR: Invalid area\n"_fmt);
return 0;
}
}
@@ -1034,7 +1034,7 @@ void magic_random_location(location_t *dest, dumb_ptr<area_t> area)
}
default:
- FPRINTF(stderr, "Unknown area type %d\n",
+ FPRINTF(stderr, "Unknown area type %d\n"_fmt,
area->ty);
}
}
@@ -1282,89 +1282,89 @@ int fun_extract_healer_xp(dumb_ptr<env_t>, val_t *result, Slice<val_t> args)
return 0;
}
-#define MAGIC_FUNCTION(name, args, ret, impl) {{name}, {{name}, {args}, ret, impl}}
-#define MAGIC_FUNCTION1(name, args, ret) MAGIC_FUNCTION(#name, args, ret, fun_##name)
-static
+#define MAGIC_FUNCTION(name, args, ret, impl) {name, {name, args, ret, impl}}
+#define MAGIC_FUNCTION1(name, args, ret) MAGIC_FUNCTION(#name##_s, args, ret, fun_##name)
+static // should be LString, but no heterogenous lookup yet
std::map<ZString, fun_t> functions =
{
- MAGIC_FUNCTION("+", "..", '.', fun_add),
- MAGIC_FUNCTION("-", "ii", 'i', fun_sub),
- MAGIC_FUNCTION("*", "ii", 'i', fun_mul),
- MAGIC_FUNCTION("/", "ii", 'i', fun_div),
- MAGIC_FUNCTION("%", "ii", 'i', fun_mod),
- MAGIC_FUNCTION("||", "ii", 'i', fun_or),
- MAGIC_FUNCTION("&&", "ii", 'i', fun_and),
- MAGIC_FUNCTION("<", "..", 'i', fun_lt),
- MAGIC_FUNCTION(">", "..", 'i', fun_gt),
- MAGIC_FUNCTION("<=", "..", 'i', fun_lte),
- MAGIC_FUNCTION(">=", "..", 'i', fun_gte),
- MAGIC_FUNCTION("==", "..", 'i', fun_eq),
- MAGIC_FUNCTION("!=", "..", 'i', fun_ne),
- MAGIC_FUNCTION("|", "..", 'i', fun_bitor),
- MAGIC_FUNCTION("&", "ii", 'i', fun_bitand),
- MAGIC_FUNCTION("^", "ii", 'i', fun_bitxor),
- MAGIC_FUNCTION("<<", "ii", 'i', fun_bitshl),
- MAGIC_FUNCTION(">>", "ii", 'i', fun_bitshr),
- MAGIC_FUNCTION1(not, "i", 'i'),
- MAGIC_FUNCTION1(neg, "i", 'i'),
- MAGIC_FUNCTION1(max, "ii", 'i'),
- MAGIC_FUNCTION1(min, "ii", 'i'),
- MAGIC_FUNCTION1(is_in, "la", 'i'),
- MAGIC_FUNCTION1(if_then_else, "i__", '_'),
- MAGIC_FUNCTION1(skill, "ei", 'i'),
- MAGIC_FUNCTION("str", "e", 'i', fun_get_str),
- MAGIC_FUNCTION("agi", "e", 'i', fun_get_agi),
- MAGIC_FUNCTION("vit", "e", 'i', fun_get_vit),
- MAGIC_FUNCTION("dex", "e", 'i', fun_get_dex),
- MAGIC_FUNCTION("luk", "e", 'i', fun_get_luk),
- MAGIC_FUNCTION("int", "e", 'i', fun_get_int),
- MAGIC_FUNCTION("level", "e", 'i', fun_get_lv),
- MAGIC_FUNCTION("mdef", "e", 'i', fun_get_mdef),
- MAGIC_FUNCTION("def", "e", 'i', fun_get_def),
- MAGIC_FUNCTION("hp", "e", 'i', fun_get_hp),
- MAGIC_FUNCTION("max_hp", "e", 'i', fun_get_max_hp),
- MAGIC_FUNCTION("sp", "e", 'i', fun_get_sp),
- MAGIC_FUNCTION("max_sp", "e", 'i', fun_get_max_sp),
- MAGIC_FUNCTION("dir", "e", 'd', fun_get_dir),
- MAGIC_FUNCTION1(name_of, ".", 's'),
- MAGIC_FUNCTION1(mob_id, "e", 'i'),
- MAGIC_FUNCTION1(location, "e", 'l'),
- MAGIC_FUNCTION1(random, "i", 'i'),
- MAGIC_FUNCTION1(random_dir, "i", 'd'),
- MAGIC_FUNCTION1(hash_entity, "e", 'i'),
- MAGIC_FUNCTION1(is_married, "e", 'i'),
- MAGIC_FUNCTION1(partner, "e", 'e'),
- MAGIC_FUNCTION1(awayfrom, "ldi", 'l'),
- MAGIC_FUNCTION1(failed, "_", 'i'),
- MAGIC_FUNCTION1(pc, "s", 'e'),
- MAGIC_FUNCTION1(npc, "s", 'e'),
- MAGIC_FUNCTION1(distance, "ll", 'i'),
- MAGIC_FUNCTION1(rdistance, "ll", 'i'),
- MAGIC_FUNCTION1(anchor, "s", 'a'),
- MAGIC_FUNCTION("random_location", "a", 'l', fun_pick_location),
- MAGIC_FUNCTION("script_int", "es", 'i', fun_read_script_int),
- MAGIC_FUNCTION("script_str", "es", 's', fun_read_script_str),
- MAGIC_FUNCTION1(rbox, "li", 'a'),
- MAGIC_FUNCTION1(count_item, "e.", 'i'),
- MAGIC_FUNCTION1(line_of_sight, "ll", 'i'),
- MAGIC_FUNCTION1(running_status_update, "ei", 'i'),
- MAGIC_FUNCTION1(status_option, "ei", 'i'),
- MAGIC_FUNCTION1(element, "e", 'i'),
- MAGIC_FUNCTION1(element_level, "e", 'i'),
- MAGIC_FUNCTION1(his_shroud, "e", 'i'),
- MAGIC_FUNCTION1(is_equipped, "e.", 'i'),
- MAGIC_FUNCTION1(is_exterior, "l", 'i'),
- MAGIC_FUNCTION1(contains_string, "ss", 'i'),
- MAGIC_FUNCTION1(strstr, "ss", 'i'),
- MAGIC_FUNCTION1(strlen, "s", 'i'),
- MAGIC_FUNCTION1(substr, "sii", 's'),
- MAGIC_FUNCTION1(sqrt, "i", 'i'),
- MAGIC_FUNCTION1(map_level, "l", 'i'),
- MAGIC_FUNCTION1(map_nr, "l", 'i'),
- MAGIC_FUNCTION1(dir_towards, "lli", 'd'),
- MAGIC_FUNCTION1(is_dead, "e", 'i'),
- MAGIC_FUNCTION1(is_pc, "e", 'i'),
- MAGIC_FUNCTION("extract_healer_experience", "ei", 'i', fun_extract_healer_xp),
+ MAGIC_FUNCTION("+"_s, ".."_s, '.', fun_add),
+ MAGIC_FUNCTION("-"_s, "ii"_s, 'i', fun_sub),
+ MAGIC_FUNCTION("*"_s, "ii"_s, 'i', fun_mul),
+ MAGIC_FUNCTION("/"_s, "ii"_s, 'i', fun_div),
+ MAGIC_FUNCTION("%"_s, "ii"_s, 'i', fun_mod),
+ MAGIC_FUNCTION("||"_s, "ii"_s, 'i', fun_or),
+ MAGIC_FUNCTION("&&"_s, "ii"_s, 'i', fun_and),
+ MAGIC_FUNCTION("<"_s, ".."_s, 'i', fun_lt),
+ MAGIC_FUNCTION(">"_s, ".."_s, 'i', fun_gt),
+ MAGIC_FUNCTION("<="_s, ".."_s, 'i', fun_lte),
+ MAGIC_FUNCTION(">="_s, ".."_s, 'i', fun_gte),
+ MAGIC_FUNCTION("=="_s, ".."_s, 'i', fun_eq),
+ MAGIC_FUNCTION("!="_s, ".."_s, 'i', fun_ne),
+ MAGIC_FUNCTION("|"_s, ".."_s, 'i', fun_bitor),
+ MAGIC_FUNCTION("&"_s, "ii"_s, 'i', fun_bitand),
+ MAGIC_FUNCTION("^"_s, "ii"_s, 'i', fun_bitxor),
+ MAGIC_FUNCTION("<<"_s, "ii"_s, 'i', fun_bitshl),
+ MAGIC_FUNCTION(">>"_s, "ii"_s, 'i', fun_bitshr),
+ MAGIC_FUNCTION1(not, "i"_s, 'i'),
+ MAGIC_FUNCTION1(neg, "i"_s, 'i'),
+ MAGIC_FUNCTION1(max, "ii"_s, 'i'),
+ MAGIC_FUNCTION1(min, "ii"_s, 'i'),
+ MAGIC_FUNCTION1(is_in, "la"_s, 'i'),
+ MAGIC_FUNCTION1(if_then_else, "i__"_s, '_'),
+ MAGIC_FUNCTION1(skill, "ei"_s, 'i'),
+ MAGIC_FUNCTION("str"_s, "e"_s, 'i', fun_get_str),
+ MAGIC_FUNCTION("agi"_s, "e"_s, 'i', fun_get_agi),
+ MAGIC_FUNCTION("vit"_s, "e"_s, 'i', fun_get_vit),
+ MAGIC_FUNCTION("dex"_s, "e"_s, 'i', fun_get_dex),
+ MAGIC_FUNCTION("luk"_s, "e"_s, 'i', fun_get_luk),
+ MAGIC_FUNCTION("int"_s, "e"_s, 'i', fun_get_int),
+ MAGIC_FUNCTION("level"_s, "e"_s, 'i', fun_get_lv),
+ MAGIC_FUNCTION("mdef"_s, "e"_s, 'i', fun_get_mdef),
+ MAGIC_FUNCTION("def"_s, "e"_s, 'i', fun_get_def),
+ MAGIC_FUNCTION("hp"_s, "e"_s, 'i', fun_get_hp),
+ MAGIC_FUNCTION("max_hp"_s, "e"_s, 'i', fun_get_max_hp),
+ MAGIC_FUNCTION("sp"_s, "e"_s, 'i', fun_get_sp),
+ MAGIC_FUNCTION("max_sp"_s, "e"_s, 'i', fun_get_max_sp),
+ MAGIC_FUNCTION("dir"_s, "e"_s, 'd', fun_get_dir),
+ MAGIC_FUNCTION1(name_of, "."_s, 's'),
+ MAGIC_FUNCTION1(mob_id, "e"_s, 'i'),
+ MAGIC_FUNCTION1(location, "e"_s, 'l'),
+ MAGIC_FUNCTION1(random, "i"_s, 'i'),
+ MAGIC_FUNCTION1(random_dir, "i"_s, 'd'),
+ MAGIC_FUNCTION1(hash_entity, "e"_s, 'i'),
+ MAGIC_FUNCTION1(is_married, "e"_s, 'i'),
+ MAGIC_FUNCTION1(partner, "e"_s, 'e'),
+ MAGIC_FUNCTION1(awayfrom, "ldi"_s, 'l'),
+ MAGIC_FUNCTION1(failed, "_"_s, 'i'),
+ MAGIC_FUNCTION1(pc, "s"_s, 'e'),
+ MAGIC_FUNCTION1(npc, "s"_s, 'e'),
+ MAGIC_FUNCTION1(distance, "ll"_s, 'i'),
+ MAGIC_FUNCTION1(rdistance, "ll"_s, 'i'),
+ MAGIC_FUNCTION1(anchor, "s"_s, 'a'),
+ MAGIC_FUNCTION("random_location"_s, "a"_s, 'l', fun_pick_location),
+ MAGIC_FUNCTION("script_int"_s, "es"_s, 'i', fun_read_script_int),
+ MAGIC_FUNCTION("script_str"_s, "es"_s, 's', fun_read_script_str),
+ MAGIC_FUNCTION1(rbox, "li"_s, 'a'),
+ MAGIC_FUNCTION1(count_item, "e."_s, 'i'),
+ MAGIC_FUNCTION1(line_of_sight, "ll"_s, 'i'),
+ MAGIC_FUNCTION1(running_status_update, "ei"_s, 'i'),
+ MAGIC_FUNCTION1(status_option, "ei"_s, 'i'),
+ MAGIC_FUNCTION1(element, "e"_s, 'i'),
+ MAGIC_FUNCTION1(element_level, "e"_s, 'i'),
+ MAGIC_FUNCTION1(his_shroud, "e"_s, 'i'),
+ MAGIC_FUNCTION1(is_equipped, "e."_s, 'i'),
+ MAGIC_FUNCTION1(is_exterior, "l"_s, 'i'),
+ MAGIC_FUNCTION1(contains_string, "ss"_s, 'i'),
+ MAGIC_FUNCTION1(strstr, "ss"_s, 'i'),
+ MAGIC_FUNCTION1(strlen, "s"_s, 'i'),
+ MAGIC_FUNCTION1(substr, "sii"_s, 's'),
+ MAGIC_FUNCTION1(sqrt, "i"_s, 'i'),
+ MAGIC_FUNCTION1(map_level, "l"_s, 'i'),
+ MAGIC_FUNCTION1(map_nr, "l"_s, 'i'),
+ MAGIC_FUNCTION1(dir_towards, "lli"_s, 'd'),
+ MAGIC_FUNCTION1(is_dead, "e"_s, 'i'),
+ MAGIC_FUNCTION1(is_pc, "e"_s, 'i'),
+ MAGIC_FUNCTION("extract_healer_experience"_s, "ei"_s, 'i', fun_extract_healer_xp),
};
fun_t *magic_get_fun(ZString name)
@@ -1512,7 +1512,7 @@ dumb_ptr<area_t> eval_area(dumb_ptr<env_t> env, e_area_t& expr_)
}
default:
- FPRINTF(stderr, "INTERNAL ERROR: Unknown area type %d\n",
+ FPRINTF(stderr, "INTERNAL ERROR: Unknown area type %d\n"_fmt,
area->ty);
area.delete_();
return NULL;
@@ -1573,7 +1573,7 @@ int magic_signature_check(ZString opname, ZString funname, ZString signature,
if (!ty_key)
{
FPRINTF(stderr,
- "[magic-eval]: L%d:%d: Too many arguments (%zu) to %s `%s'\n",
+ "[magic-eval]: L%d:%d: Too many arguments (%zu) to %s `%s'\n"_fmt,
line, column, args.size(), opname, funname);
return 1;
}
@@ -1587,7 +1587,7 @@ int magic_signature_check(ZString opname, ZString funname, ZString signature,
if (ty == TYPE::UNDEF)
{
FPRINTF(stderr,
- "[magic-eval]: L%d:%d: Argument #%d to %s `%s' undefined\n",
+ "[magic-eval]: L%d:%d: Argument #%d to %s `%s' undefined\n"_fmt,
line, column, i + 1, opname, funname);
return 1;
}
@@ -1619,7 +1619,7 @@ int magic_signature_check(ZString opname, ZString funname, ZString signature,
{ /* Coercion failed? */
if (ty != TYPE::FAIL)
FPRINTF(stderr,
- "[magic-eval]: L%d:%d: Argument #%d to %s `%s' of incorrect type (%d)\n",
+ "[magic-eval]: L%d:%d: Argument #%d to %s `%s' of incorrect type (%d)\n"_fmt,
line, column, i + 1, opname, funname,
ty);
return 1;
@@ -1660,7 +1660,7 @@ void magic_eval(dumb_ptr<env_t> env, val_t *dest, dumb_ptr<expr_t> expr)
for (i = 0; i < args_nr; ++i)
magic_eval(env, &arguments[i], expr->e.e_funapp.args[i]);
- if (magic_signature_check("function", f->name, f->signature, Slice<val_t>(arguments, args_nr),
+ if (magic_signature_check("function"_s, f->name, f->signature, Slice<val_t>(arguments, args_nr),
expr->e.e_funapp.line_nr, expr->e.e_funapp.column)
|| f->fun(env, dest, Slice<val_t>(arguments, args_nr)))
dest->ty = TYPE::FAIL;
@@ -1713,7 +1713,7 @@ void magic_eval(dumb_ptr<env_t> env, val_t *dest, dumb_ptr<expr_t> expr)
else
{
FPRINTF(stderr,
- "[magic] Attempt to access field %s on non-spell\n",
+ "[magic] Attempt to access field %s on non-spell\n"_fmt,
env->base_env->varv[id].name);
dest->ty = TYPE::FAIL;
}
@@ -1722,7 +1722,7 @@ void magic_eval(dumb_ptr<env_t> env, val_t *dest, dumb_ptr<expr_t> expr)
default:
FPRINTF(stderr,
- "[magic] INTERNAL ERROR: Unknown expression type %d\n",
+ "[magic] INTERNAL ERROR: Unknown expression type %d\n"_fmt,
expr->ty);
break;
}
@@ -1747,7 +1747,7 @@ AString magic_eval_str(dumb_ptr<env_t> env, dumb_ptr<expr_t> expr)
magic_eval(env, &result, expr);
if (result.ty == TYPE::FAIL || result.ty == TYPE::UNDEF)
- return {"?"};
+ return "?"_s;
stringify(&result, 0);
diff --git a/src/map/magic-expr.hpp b/src/map/magic-expr.hpp
index 58f6596..4d78bab 100644
--- a/src/map/magic-expr.hpp
+++ b/src/map/magic-expr.hpp
@@ -44,8 +44,8 @@
*/
struct fun_t
{
- ZString name;
- ZString signature;
+ LString name;
+ LString signature;
char ret_ty;
int (*fun)(dumb_ptr<env_t> env, val_t *result, Slice<val_t> arga);
};
diff --git a/src/map/magic-interpreter-base.cpp b/src/map/magic-interpreter-base.cpp
index d86f595..c734908 100644
--- a/src/map/magic-interpreter-base.cpp
+++ b/src/map/magic-interpreter-base.cpp
@@ -187,7 +187,7 @@ dumb_ptr<env_t> spell_create_env(magic_conf_t *conf, dumb_ptr<spell_t> spell,
break;
default:
- FPRINTF(stderr, "Unexpected spellarg type %d\n",
+ FPRINTF(stderr, "Unexpected spellarg type %d\n"_fmt,
spell->spellarg_ty);
}
@@ -370,7 +370,7 @@ effect_set_t *spellguard_check_sub(spellguard_check_t *check,
return NULL;
default:
- FPRINTF(stderr, "Unexpected spellguard type %d\n",
+ FPRINTF(stderr, "Unexpected spellguard type %d\n"_fmt,
guard->ty);
return NULL;
}
@@ -519,7 +519,7 @@ void spell_bind(dumb_ptr<map_session_data> subject, dumb_ptr<invocation> invocat
{
int *i = NULL;
FPRINTF(stderr,
- "[magic] INTERNAL ERROR: Attempt to re-bind spell invocation `%s'\n",
+ "[magic] INTERNAL ERROR: Attempt to re-bind spell invocation `%s'\n"_fmt,
invocation->spell->name);
*i = 1;
return;
diff --git a/src/map/magic-stmt.cpp b/src/map/magic-stmt.cpp
index ba99409..ddadf03 100644
--- a/src/map/magic-stmt.cpp
+++ b/src/map/magic-stmt.cpp
@@ -58,19 +58,19 @@ void print_val(val_t *v)
switch (v->ty)
{
case TYPE::UNDEF:
- FPRINTF(stderr, "UNDEF");
+ FPRINTF(stderr, "UNDEF"_fmt);
break;
case TYPE::INT:
- FPRINTF(stderr, "%d", v->v.v_int);
+ FPRINTF(stderr, "%d"_fmt, v->v.v_int);
break;
case TYPE::DIR:
- FPRINTF(stderr, "dir%d", v->v.v_int);
+ FPRINTF(stderr, "dir%d"_fmt, v->v.v_int);
break;
case TYPE::STRING:
- FPRINTF(stderr, "`%s'", v->v.v_string);
+ FPRINTF(stderr, "`%s'"_fmt, v->v.v_string);
break;
default:
- FPRINTF(stderr, "ty%d", v->ty);
+ FPRINTF(stderr, "ty%d"_fmt, v->ty);
break;
}
}
@@ -84,11 +84,11 @@ void dump_env(env_t *env)
val_t *v = &env->vars[i];
val_t *bv = &env->base_env->vars[i];
- FPRINTF(stderr, "%02x %30s ", i, env->base_env->var_name[i]);
+ FPRINTF(stderr, "%02x %30s "_fmt, i, env->base_env->var_name[i]);
print_val(v);
- FPRINTF(stderr, "\t(");
+ FPRINTF(stderr, "\t("_fmt);
print_val(bv);
- FPRINTF(stderr, ")\n");
+ FPRINTF(stderr, ")\n"_fmt);
}
}
#endif
@@ -286,7 +286,7 @@ void magic_unshroud(dumb_ptr<map_session_data> other_char)
other_char->state.shroud_active = 0;
// Now warp the caster out of and back into here to refresh everyone's display
char_update(other_char);
- clif_displaymessage(other_char->sess, "Your shroud has been dispelled!");
+ clif_displaymessage(other_char->sess, "Your shroud has been dispelled!"_s);
// entity_effect(other_char, MAGIC_EFFECT_REVEAL);
}
@@ -304,7 +304,7 @@ dumb_ptr<npc_data> local_spell_effect(map_local *m, int x, int y, int effect,
/* 1 minute should be enough for all interesting spell effects, I hope */
std::chrono::seconds delay = std::chrono::seconds(30);
dumb_ptr<npc_data> effect_npc = npc_spawn_text(m, x, y,
- INVISIBLE_NPC, NpcName(), "?");
+ INVISIBLE_NPC, NpcName(), "?"_s);
int effect_npc_id = effect_npc->bl_id;
entity_effect(effect_npc, effect, tdelay);
@@ -350,7 +350,7 @@ int op_instaheal(dumb_ptr<env_t> env, Slice<val_t> args)
{
dumb_ptr<map_session_data> caster_pc = caster->is_player();
dumb_ptr<map_session_data> subject_pc = subject->is_player();
- MAP_LOG_PC(caster_pc, "SPELLHEAL-INSTA PC%d FOR %d",
+ MAP_LOG_PC(caster_pc, "SPELLHEAL-INSTA PC%d FOR %d"_fmt,
subject_pc->status_key.char_id, ARGINT(1));
}
@@ -770,18 +770,18 @@ int op_spawn(dumb_ptr<env_t>, Slice<val_t> args)
}
static
-const char *get_invocation_name(dumb_ptr<env_t> env)
+ZString get_invocation_name(dumb_ptr<env_t> env)
{
dumb_ptr<invocation> invocation_;
if (env->VAR(VAR_INVOCATION).ty != TYPE::INVOCATION)
- return "?";
+ return "?"_s;
invocation_ = map_id_is_spell(env->VAR(VAR_INVOCATION).v.v_int);
if (invocation_)
- return invocation_->spell->name.c_str();
+ return invocation_->spell->name;
else
- return "??";
+ return "??"_s;
}
static
@@ -824,7 +824,7 @@ int op_injure(dumb_ptr<env_t> env, Slice<val_t> args)
{
dumb_ptr<mob_data> mob = target->is_mob();
- MAP_LOG_PC(caster_pc, "SPELLDMG MOB%d %d FOR %d BY %s",
+ MAP_LOG_PC(caster_pc, "SPELLDMG MOB%d %d FOR %d BY %s"_fmt,
mob->bl_id, mob->mob_class, damage_caused,
get_invocation_name(env));
}
@@ -940,35 +940,35 @@ int op_gain_exp(dumb_ptr<env_t>, Slice<val_t> args)
}
#define MAGIC_OPERATION(name, args, impl) {{name}, {{name}, {args}, impl}}
-#define MAGIC_OPERATION1(name, args) MAGIC_OPERATION(#name, args, op_##name)
+#define MAGIC_OPERATION1(name, args) MAGIC_OPERATION(#name##_s, args, op_##name)
static
std::map<ZString, op_t> operations =
{
- MAGIC_OPERATION1(sfx, ".ii"),
- MAGIC_OPERATION1(instaheal, "eii"),
- MAGIC_OPERATION1(itemheal, "eii"),
- MAGIC_OPERATION1(shroud, "ei"),
- MAGIC_OPERATION("unshroud", "e", op_reveal),
- MAGIC_OPERATION1(message, "es"),
- MAGIC_OPERATION1(messenger_npc, "lissi"),
- MAGIC_OPERATION1(move, "ed"),
- MAGIC_OPERATION1(warp, "el"),
- MAGIC_OPERATION1(banish, "e"),
- MAGIC_OPERATION1(status_change, "eiiiiii"),
- MAGIC_OPERATION1(stop_status_change, "ei"),
- MAGIC_OPERATION1(override_attack, "eiiiiii"),
- MAGIC_OPERATION1(create_item, "e.i"),
- MAGIC_OPERATION1(aggravate, "eie"),
- MAGIC_OPERATION1(spawn, "aeiiii"),
- MAGIC_OPERATION1(injure, "eeii"),
- MAGIC_OPERATION1(emote, "ei"),
- MAGIC_OPERATION1(set_script_variable, "esi"),
- MAGIC_OPERATION1(set_script_str, "ess"),
- MAGIC_OPERATION1(set_hair_colour, "ei"),
- MAGIC_OPERATION1(set_hair_style, "ei"),
- MAGIC_OPERATION("drop_item", "l.ii", op_drop_item_for),
- MAGIC_OPERATION1(drop_item_for, "l.iiei"),
- MAGIC_OPERATION("gain_experience", "eiii", op_gain_exp),
+ MAGIC_OPERATION1(sfx, ".ii"_s),
+ MAGIC_OPERATION1(instaheal, "eii"_s),
+ MAGIC_OPERATION1(itemheal, "eii"_s),
+ MAGIC_OPERATION1(shroud, "ei"_s),
+ MAGIC_OPERATION("unshroud"_s, "e"_s, op_reveal),
+ MAGIC_OPERATION1(message, "es"_s),
+ MAGIC_OPERATION1(messenger_npc, "lissi"_s),
+ MAGIC_OPERATION1(move, "ed"_s),
+ MAGIC_OPERATION1(warp, "el"_s),
+ MAGIC_OPERATION1(banish, "e"_s),
+ MAGIC_OPERATION1(status_change, "eiiiiii"_s),
+ MAGIC_OPERATION1(stop_status_change, "ei"_s),
+ MAGIC_OPERATION1(override_attack, "eiiiiii"_s),
+ MAGIC_OPERATION1(create_item, "e.i"_s),
+ MAGIC_OPERATION1(aggravate, "eie"_s),
+ MAGIC_OPERATION1(spawn, "aeiiii"_s),
+ MAGIC_OPERATION1(injure, "eeii"_s),
+ MAGIC_OPERATION1(emote, "ei"_s),
+ MAGIC_OPERATION1(set_script_variable, "esi"_s),
+ MAGIC_OPERATION1(set_script_str, "ess"_s),
+ MAGIC_OPERATION1(set_hair_colour, "ei"_s),
+ MAGIC_OPERATION1(set_hair_style, "ei"_s),
+ MAGIC_OPERATION("drop_item"_s, "l.ii"_s, op_drop_item_for),
+ MAGIC_OPERATION1(drop_item_for, "l.iiei"_s),
+ MAGIC_OPERATION("gain_experience"_s, "eiii"_s, op_gain_exp),
};
op_t *magic_get_op(ZString name)
@@ -1004,7 +1004,7 @@ void spell_effect_report_termination(int invocation_id, int bl_id,
dumb_ptr<block_list> entity = map_id2bl(bl_id);
if (entity->bl_type == BL::PC)
FPRINTF(stderr,
- "[magic] INTERNAL ERROR: spell-effect-report-termination: tried to terminate on unexpected bl %d, sc %d\n",
+ "[magic] INTERNAL ERROR: spell-effect-report-termination: tried to terminate on unexpected bl %d, sc %d\n"_fmt,
bl_id, sc_id);
return;
}
@@ -1089,7 +1089,7 @@ dumb_ptr<effect_t> return_to_stack(dumb_ptr<invocation> invocation_)
default:
FPRINTF(stderr,
- "[magic] INTERNAL ERROR: While executing spell `%s': stack corruption\n",
+ "[magic] INTERNAL ERROR: While executing spell `%s': stack corruption\n"_fmt,
invocation_->spell->name);
return NULL;
}
@@ -1105,7 +1105,7 @@ cont_activation_record_t *add_stack_entry(dumb_ptr<invocation> invocation_,
if (invocation_->stack_size >= MAX_STACK_SIZE)
{
FPRINTF(stderr,
- "[magic] Execution stack size exceeded in spell `%s'; truncating effect\n",
+ "[magic] Execution stack size exceeded in spell `%s'; truncating effect\n"_fmt,
invocation_->spell->name);
invocation_->stack_size--;
return NULL;
@@ -1221,7 +1221,7 @@ dumb_ptr<effect_t> run_foreach(dumb_ptr<invocation> invocation,
{
magic_clear_var(&area);
FPRINTF(stderr,
- "[magic] Error in spell `%s': FOREACH loop over non-area\n",
+ "[magic] Error in spell `%s': FOREACH loop over non-area\n"_fmt,
invocation->spell->name.c_str());
return return_location;
}
@@ -1271,7 +1271,7 @@ dumb_ptr<effect_t> run_for (dumb_ptr<invocation> invocation,
magic_clear_var(&start);
magic_clear_var(&stop);
FPRINTF(stderr,
- "[magic] Error in spell `%s': FOR loop start or stop point is not an integer\n",
+ "[magic] Error in spell `%s': FOR loop start or stop point is not an integer\n"_fmt,
invocation->spell->name);
return return_location;
}
@@ -1319,9 +1319,9 @@ void print_cfg(int i, effect_t *e)
{
int j;
for (j = 0; j < i; j++)
- PRINTF(" ");
+ PRINTF(" "_fmt);
- PRINTF("%p: ", e);
+ PRINTF("%p: "_fmt, e);
if (!e)
{
@@ -1354,11 +1354,11 @@ void print_cfg(int i, effect_t *e)
case EFFECT::IF:
puts("IF");
for (j = 0; j < i; j++)
- PRINTF(" ");
+ PRINTF(" "_fmt);
puts("THEN");
print_cfg(i + 1, e->e.e_if.true_branch);
for (j = 0; j < i; j++)
- PRINTF(" ");
+ PRINTF(" "_fmt);
puts("ELSE");
print_cfg(i + 1, e->e.e_if.false_branch);
break;
@@ -1395,7 +1395,7 @@ interval_t spell_run(dumb_ptr<invocation> invocation_, int allow_delete)
#define REFRESH_INVOCATION invocation_ = map_id_is_spell(invocation_id); if (!invocation_) return interval_t::zero();
#ifdef DEBUG
- FPRINTF(stderr, "Resuming execution: invocation of `%s'\n",
+ FPRINTF(stderr, "Resuming execution: invocation of `%s'\n"_fmt,
invocation_->spell->name);
print_cfg(1, invocation_->current_effect);
#endif
@@ -1406,7 +1406,7 @@ interval_t spell_run(dumb_ptr<invocation> invocation_, int allow_delete)
int i;
#ifdef DEBUG
- FPRINTF(stderr, "Next step of type %d\n", e->ty);
+ FPRINTF(stderr, "Next step of type %d\n"_fmt, e->ty);
dump_env(invocation_->env);
#endif
@@ -1464,9 +1464,9 @@ interval_t spell_run(dumb_ptr<invocation> invocation_, int allow_delete)
ZString caster_name = (caster ? caster->status_key.name : CharName()).to__actual();
argrec_t arg[3] =
{
- {"@target", env->VAR(VAR_TARGET).ty == TYPE::ENTITY ? 0 : env->VAR(VAR_TARGET).v.v_int},
- {"@caster", invocation_->caster},
- {"@caster_name$", caster_name},
+ {"@target"_s, env->VAR(VAR_TARGET).ty == TYPE::ENTITY ? 0 : env->VAR(VAR_TARGET).v.v_int},
+ {"@caster"_s, invocation_->caster},
+ {"@caster_name$"_s, caster_name},
};
int message_recipient =
env->VAR(VAR_SCRIPTTARGET).ty ==
@@ -1516,7 +1516,7 @@ interval_t spell_run(dumb_ptr<invocation> invocation_, int allow_delete)
for (i = 0; i < e->e.e_op.args_nr; i++)
magic_eval(invocation_->env, &args[i], e->e.e_op.args[i]);
- if (!magic_signature_check("effect", op->name, op->signature,
+ if (!magic_signature_check("effect"_s, op->name, op->signature,
Slice<val_t>(args, e->e.e_op.args_nr),
e->e.e_op.line_nr,
e->e.e_op.column))
@@ -1535,7 +1535,7 @@ interval_t spell_run(dumb_ptr<invocation> invocation_, int allow_delete)
default:
FPRINTF(stderr,
- "[magic] INTERNAL ERROR: Unknown effect %d\n",
+ "[magic] INTERNAL ERROR: Unknown effect %d\n"_fmt,
e->ty);
}
diff --git a/src/map/magic-v2.cpp b/src/map/magic-v2.cpp
index 41d29cd..20abc00 100644
--- a/src/map/magic-v2.cpp
+++ b/src/map/magic-v2.cpp
@@ -61,7 +61,7 @@ namespace magic_v2
if (zid != id)
{
FPRINTF(stderr,
- "[magic-conf] INTERNAL ERROR: Builtin special var %s interned to %d, not %d as it should be!\n",
+ "[magic-conf] INTERNAL ERROR: Builtin special var %s interned to %d, not %d as it should be!\n"_fmt,
name, zid, id);
}
return zid == id;
@@ -72,15 +72,15 @@ namespace magic_v2
{
bool ok = true;
- ok &= INTERN_ASSERT("min_casttime", VAR_MIN_CASTTIME);
- ok &= INTERN_ASSERT("obscure_chance", VAR_OBSCURE_CHANCE);
- ok &= INTERN_ASSERT("caster", VAR_CASTER);
- ok &= INTERN_ASSERT("spellpower", VAR_SPELLPOWER);
- ok &= INTERN_ASSERT("self_spell", VAR_SPELL);
- ok &= INTERN_ASSERT("self_invocation", VAR_INVOCATION);
- ok &= INTERN_ASSERT("target", VAR_TARGET);
- ok &= INTERN_ASSERT("script_target", VAR_SCRIPTTARGET);
- ok &= INTERN_ASSERT("location", VAR_LOCATION);
+ ok &= INTERN_ASSERT("min_casttime"_s, VAR_MIN_CASTTIME);
+ ok &= INTERN_ASSERT("obscure_chance"_s, VAR_OBSCURE_CHANCE);
+ ok &= INTERN_ASSERT("caster"_s, VAR_CASTER);
+ ok &= INTERN_ASSERT("spellpower"_s, VAR_SPELLPOWER);
+ ok &= INTERN_ASSERT("self_spell"_s, VAR_SPELL);
+ ok &= INTERN_ASSERT("self_invocation"_s, VAR_INVOCATION);
+ ok &= INTERN_ASSERT("target"_s, VAR_TARGET);
+ ok &= INTERN_ASSERT("script_target"_s, VAR_SCRIPTTARGET);
+ ok &= INTERN_ASSERT("location"_s, VAR_LOCATION);
return ok;
}
@@ -91,7 +91,7 @@ namespace magic_v2
{
if (!const_defm.insert({name, *val}).second)
{
- span.error(STRPRINTF("Redefinition of constant '%s'", name));
+ span.error(STRPRINTF("Redefinition of constant '%s'"_fmt, name));
return false;
}
return true;
@@ -184,14 +184,14 @@ namespace magic_v2
auto pair1 = magic_conf.spells_by_name.insert({spell->name, spell});
if (!pair1.second)
{
- span.error(STRPRINTF("Attempt to redefine spell '%s'", spell->name));
+ span.error(STRPRINTF("Attempt to redefine spell '%s'"_fmt, spell->name));
return false;
}
auto pair2 = magic_conf.spells_by_invocation.insert({spell->invocation, spell});
if (!pair2.second)
{
- span.error(STRPRINTF("Attempt to redefine spell invocation '%s'", spell->invocation));
+ span.error(STRPRINTF("Attempt to redefine spell invocation '%s'"_fmt, spell->invocation));
magic_conf.spells_by_name.erase(pair1.first);
return false;
}
@@ -203,14 +203,14 @@ namespace magic_v2
auto pair1 = magic_conf.anchors_by_name.insert({anchor->name, anchor});
if (!pair1.second)
{
- span.error(STRPRINTF("Attempt to redefine teleport anchor '%s'", anchor->name));
+ span.error(STRPRINTF("Attempt to redefine teleport anchor '%s'"_fmt, anchor->name));
return false;
}
auto pair2 = magic_conf.anchors_by_invocation.insert({anchor->name, anchor});
if (!pair2.second)
{
- span.error(STRPRINTF("Attempt to redefine anchor invocation '%s'", anchor->invocation));
+ span.error(STRPRINTF("Attempt to redefine anchor invocation '%s'"_fmt, anchor->invocation));
magic_conf.anchors_by_name.erase(pair1.first);
return false;
}
@@ -223,7 +223,7 @@ namespace magic_v2
RString name = proc->name;
if (!procs.insert({name, std::move(*proc)}).second)
{
- span.error("procedure already exists");
+ span.error("procedure already exists"_s);
return false;
}
return true;
@@ -234,7 +234,7 @@ namespace magic_v2
auto pi = procs.find(name);
if (pi == procs.end())
{
- span.error(STRPRINTF("Unknown procedure '%s'", name));
+ span.error(STRPRINTF("Unknown procedure '%s'"_fmt, name));
return false;
}
@@ -242,7 +242,7 @@ namespace magic_v2
if (p->argv.size() != argvp->size())
{
- span.error(STRPRINTF("Procedure %s/%zu invoked with %zu parameters",
+ span.error(STRPRINTF("Procedure %s/%zu invoked with %zu parameters"_fmt,
name, p->argv.size(), argvp->size()));
return false;
}
@@ -259,12 +259,12 @@ namespace magic_v2
op_t *op = magic_get_op(name);
if (!op)
{
- span.error(STRPRINTF("Unknown operation '%s'", name));
+ span.error(STRPRINTF("Unknown operation '%s'"_fmt, name));
return false;
}
if (op->signature.size() != argv.size())
{
- span.error(STRPRINTF("Incorrect number of arguments to operation '%s': Expected %zu, found %zu",
+ span.error(STRPRINTF("Incorrect number of arguments to operation '%s': Expected %zu, found %zu"_fmt,
name, op->signature.size(), argv.size()));
return false;
}
@@ -295,12 +295,12 @@ namespace magic_v2
fun_t *fun = magic_get_fun(name);
if (!fun)
{
- span.error(STRPRINTF("Unknown function '%s'", name));
+ span.error(STRPRINTF("Unknown function '%s'"_fmt, name));
return false;
}
if (fun->signature.size() != argv.size())
{
- span.error(STRPRINTF("Incorrect number of arguments to function '%s': Expected %zu, found %zu",
+ span.error(STRPRINTF("Incorrect number of arguments to function '%s': Expected %zu, found %zu"_fmt,
name, fun->signature.size(), argv.size()));
return false;
}
@@ -362,20 +362,20 @@ namespace magic_v2
return false;
if (s._list[0]._type != sexpr::TOKEN)
return false;
- return s._list[0]._str == "DISABLED";
+ return s._list[0]._str == "DISABLED"_s;
}
static
bool parse_loc(const SExpr& s, e_location_t& loc)
{
if (s._type != sexpr::LIST)
- return fail(s, "loc not list");
+ return fail(s, "loc not list"_s);
if (s._list.size() != 4)
- return fail(s, "loc not 3 args");
+ return fail(s, "loc not 3 args"_s);
if (s._list[0]._type != sexpr::TOKEN)
- return fail(s._list[0], "loc cmd not tok");
- if (s._list[0]._str != "@")
- return fail(s._list[0], "loc cmd not cmd");
+ return fail(s._list[0], "loc cmd not tok"_s);
+ if (s._list[0]._str != "@"_s)
+ return fail(s._list[0], "loc cmd not cmd"_s);
return parse_expression(s._list[1], loc.m)
&& parse_expression(s._list[2], loc.x)
&& parse_expression(s._list[3], loc.y);
@@ -392,7 +392,7 @@ namespace magic_v2
val.ty = TYPE::INT;
val.v.v_int = x._int;
if (val.v.v_int != x._int)
- return fail(x, "integer too large");
+ return fail(x, "integer too large"_s);
out = magic_new_expr(EXPR::VAL);
out->e.e_val = val;
@@ -410,9 +410,11 @@ namespace magic_v2
}
case sexpr::TOKEN:
{
- ZString dirs[8] = {
- ZString("S"), ZString("SW"), ZString("W"), ZString("NW"), ZString("N"), ZString("NE"), ZString("E"), ZString("SE"),
- };
+ earray<LString, DIR, DIR::COUNT> dirs //=
+ {{
+ "S"_s, "SW"_s, "W"_s, "NW"_s,
+ "N"_s, "NE"_s, "E"_s, "SE"_s,
+ }};
auto begin = std::begin(dirs);
auto end = std::end(dirs);
auto it = std::find(begin, end, x._str);
@@ -444,13 +446,13 @@ namespace magic_v2
break;
case sexpr::LIST:
if (x._list.empty())
- return fail(x, "empty list");
+ return fail(x, "empty list"_s);
{
if (x._list[0]._type != sexpr::TOKEN)
- return fail(x._list[0], "op not token");
+ return fail(x._list[0], "op not token"_s);
ZString op = x._list[0]._str;
// area
- if (op == "@")
+ if (op == "@"_s)
{
e_location_t loc;
if (!parse_loc(x, loc))
@@ -460,7 +462,7 @@ namespace magic_v2
out->e.e_area.a.a_loc = loc;
return true;
}
- if (op == "@+")
+ if (op == "@+"_s)
{
e_location_t loc;
dumb_ptr<expr_t> width;
@@ -478,7 +480,7 @@ namespace magic_v2
out->e.e_area.a.a_rect.height = height;
return true;
}
- if (op == "TOWARDS")
+ if (op == "TOWARDS"_s)
{
e_location_t loc;
dumb_ptr<expr_t> dir;
@@ -500,33 +502,33 @@ namespace magic_v2
out->e.e_area.a.a_bar.depth = depth;
return true;
}
- if (op == ".")
+ if (op == "."_s)
{
if (x._list.size() != 3)
- return fail(x, ". not 2");
+ return fail(x, ". not 2"_s);
dumb_ptr<expr_t> expr;
if (!parse_expression(x._list[1], expr))
return false;
if (x._list[2]._type != sexpr::TOKEN)
- return fail(x._list[2], ".elem not name");
+ return fail(x._list[2], ".elem not name"_s);
ZString elem = x._list[2]._str;
out = dot_expr(expr, intern_id(elem));
return true;
}
- static
+ static // TODO LString
std::set<ZString> ops =
{
- "<", ">", "<=", ">=", "==", "!=",
- "+", "-", "*", "%", "/",
- "&", "^", "|", "<<", ">>",
- "&&", "||",
+ "<"_s, ">"_s, "<="_s, ">="_s, "=="_s, "!="_s,
+ "+"_s, "-"_s, "*"_s, "%"_s, "/"_s,
+ "&"_s, "^"_s, "|"_s, "<<"_s, ">>"_s,
+ "&&"_s, "||"_s,
};
// TODO implement unary operators
if (ops.count(op))
{
// operators are n-ary and left-associative
if (x._list.size() < 3)
- return fail(x, "operator not at least 2 args");
+ return fail(x, "operator not at least 2 args"_s);
auto begin = x._list.begin() + 1;
auto end = x._list.end();
if (!parse_expression(*begin, out))
@@ -565,23 +567,23 @@ namespace magic_v2
item_data *item = itemdb_searchname(s._str);
if (!item)
- return fail(s, "no such item");
+ return fail(s, "no such item"_s);
id = item->nameid;
return true;
}
if (s._type != sexpr::LIST)
- return fail(s, "item not string or list");
+ return fail(s, "item not string or list"_s);
if (s._list.size() != 2)
- return fail(s, "item list is not pair");
+ return fail(s, "item list is not pair"_s);
if (s._list[0]._type != sexpr::INT)
- return fail(s._list[0], "item pair first not int");
+ return fail(s._list[0], "item pair first not int"_s);
count = s._list[0]._int;
if (s._list[1]._type != sexpr::STRING)
- return fail(s._list[1], "item pair second not name");
+ return fail(s._list[1], "item pair second not name"_s);
item_data *item = itemdb_searchname(s._list[1]._str);
if (!item)
- return fail(s, "no such item");
+ return fail(s, "no such item"_s);
id = item->nameid;
return true;
}
@@ -590,18 +592,18 @@ namespace magic_v2
bool parse_spellguard(const SExpr& s, dumb_ptr<spellguard_t>& out)
{
if (s._type != sexpr::LIST)
- return fail(s, "not list");
+ return fail(s, "not list"_s);
if (s._list.empty())
- return fail(s, "empty list");
+ return fail(s, "empty list"_s);
if (s._list[0]._type != sexpr::TOKEN)
- return fail(s._list[0], "not token");
+ return fail(s._list[0], "not token"_s);
ZString cmd = s._list[0]._str;
- if (cmd == "OR")
+ if (cmd == "OR"_s)
{
auto begin = s._list.begin() + 1;
auto end = s._list.end();
if (begin == end)
- return fail(s, "missing arguments");
+ return fail(s, "missing arguments"_s);
if (!parse_spellguard(*begin, out))
return false;
++begin;
@@ -617,14 +619,14 @@ namespace magic_v2
}
return true;
}
- if (cmd == "GUARD")
+ if (cmd == "GUARD"_s)
{
auto begin = s._list.begin() + 1;
auto end = s._list.end();
while (is_comment(end[-1]))
--end;
if (begin == end)
- return fail(s, "missing arguments");
+ return fail(s, "missing arguments"_s);
if (!parse_spellguard(end[-1], out))
return false;
--end;
@@ -639,10 +641,10 @@ namespace magic_v2
}
return true;
}
- if (cmd == "REQUIRE")
+ if (cmd == "REQUIRE"_s)
{
if (s._list.size() != 2)
- return fail(s, "not one argument");
+ return fail(s, "not one argument"_s);
dumb_ptr<expr_t> condition;
if (!parse_expression(s._list[1], condition))
return false;
@@ -650,10 +652,10 @@ namespace magic_v2
out->s.s_condition = condition;
return true;
}
- if (cmd == "MANA")
+ if (cmd == "MANA"_s)
{
if (s._list.size() != 2)
- return fail(s, "not one argument");
+ return fail(s, "not one argument"_s);
dumb_ptr<expr_t> mana;
if (!parse_expression(s._list[1], mana))
return false;
@@ -661,10 +663,10 @@ namespace magic_v2
out->s.s_mana = mana;
return true;
}
- if (cmd == "CASTTIME")
+ if (cmd == "CASTTIME"_s)
{
if (s._list.size() != 2)
- return fail(s, "not one argument");
+ return fail(s, "not one argument"_s);
dumb_ptr<expr_t> casttime;
if (!parse_expression(s._list[1], casttime))
return false;
@@ -672,7 +674,7 @@ namespace magic_v2
out->s.s_casttime = casttime;
return true;
}
- if (cmd == "CATALYSTS")
+ if (cmd == "CATALYSTS"_s)
{
dumb_ptr<component_t> items = nullptr;
for (auto it = s._list.begin() + 1, end = s._list.end(); it != end; ++it)
@@ -686,7 +688,7 @@ namespace magic_v2
out->s.s_catalysts = items;
return true;
}
- if (cmd == "COMPONENTS")
+ if (cmd == "COMPONENTS"_s)
{
dumb_ptr<component_t> items = nullptr;
for (auto it = s._list.begin() + 1, end = s._list.end(); it != end; ++it)
@@ -700,7 +702,7 @@ namespace magic_v2
out->s.s_components = items;
return true;
}
- return fail(s._list[0], "unknown guard");
+ return fail(s._list[0], "unknown guard"_s);
}
static
@@ -727,25 +729,25 @@ namespace magic_v2
bool parse_effect(const SExpr& s, dumb_ptr<effect_t>& out)
{
if (s._type != sexpr::LIST)
- return fail(s, "not list");
+ return fail(s, "not list"_s);
if (s._list.empty())
- return fail(s, "empty list");
+ return fail(s, "empty list"_s);
if (s._list[0]._type != sexpr::TOKEN)
- return fail(s._list[0], "not token");
+ return fail(s._list[0], "not token"_s);
ZString cmd = s._list[0]._str;
- if (cmd == "BLOCK")
+ if (cmd == "BLOCK"_s)
{
return build_effect_list(s._list.begin() + 1, s._list.end(), out);
}
- if (cmd == "SET")
+ if (cmd == "SET"_s)
{
if (s._list.size() != 3)
- return fail(s, "not 2 args");
+ return fail(s, "not 2 args"_s);
if (s._list[1]._type != sexpr::TOKEN)
- return fail(s._list[1], "not token");
+ return fail(s._list[1], "not token"_s);
ZString name = s._list[1]._str;
if (find_constant(name))
- return fail(s._list[1], "assigning to constant");
+ return fail(s._list[1], "assigning to constant"_s);
dumb_ptr<expr_t> expr;
if (!parse_expression(s._list[2], expr))
return false;
@@ -755,72 +757,72 @@ namespace magic_v2
out->e.e_assign.expr = expr;
return true;
}
- if (cmd == "SCRIPT")
+ if (cmd == "SCRIPT"_s)
{
if (s._list.size() != 2)
- return fail(s, "not 1 arg");
+ return fail(s, "not 1 arg"_s);
if (s._list[1]._type != sexpr::STRING)
- return fail(s._list[1], "not string");
+ return fail(s._list[1], "not string"_s);
ZString body = s._list[1]._str;
std::unique_ptr<const ScriptBuffer> script = parse_script(body, s._list[1]._span.begin.line, true);
if (!script)
- return fail(s._list[1], "script does not compile");
+ return fail(s._list[1], "script does not compile"_s);
out = new_effect(EFFECT::SCRIPT);
out->e.e_script = dumb_ptr<const ScriptBuffer>(script.release());
return true;
}
- if (cmd == "SKIP")
+ if (cmd == "SKIP"_s)
{
if (s._list.size() != 1)
- return fail(s, "not 0 arg");
+ return fail(s, "not 0 arg"_s);
out = new_effect(EFFECT::SKIP);
return true;
}
- if (cmd == "ABORT")
+ if (cmd == "ABORT"_s)
{
if (s._list.size() != 1)
- return fail(s, "not 0 arg");
+ return fail(s, "not 0 arg"_s);
out = new_effect(EFFECT::ABORT);
return true;
}
- if (cmd == "END")
+ if (cmd == "END"_s)
{
if (s._list.size() != 1)
- return fail(s, "not 0 arg");
+ return fail(s, "not 0 arg"_s);
out = new_effect(EFFECT::END);
return true;
}
- if (cmd == "BREAK")
+ if (cmd == "BREAK"_s)
{
if (s._list.size() != 1)
- return fail(s, "not 0 arg");
+ return fail(s, "not 0 arg"_s);
out = new_effect(EFFECT::BREAK);
return true;
}
- if (cmd == "FOREACH")
+ if (cmd == "FOREACH"_s)
{
if (s._list.size() != 5)
- return fail(s, "not 4 arg");
+ return fail(s, "not 4 arg"_s);
if (s._list[1]._type != sexpr::TOKEN)
- return fail(s._list[1], "foreach type not token");
+ return fail(s._list[1], "foreach type not token"_s);
ZString type = s._list[1]._str;
FOREACH_FILTER filter;
- if (type == "PC")
+ if (type == "PC"_s)
filter = FOREACH_FILTER::PC;
- else if (type == "MOB")
+ else if (type == "MOB"_s)
filter = FOREACH_FILTER::MOB;
- else if (type == "ENTITY")
+ else if (type == "ENTITY"_s)
filter = FOREACH_FILTER::ENTITY;
- else if (type == "SPELL")
+ else if (type == "SPELL"_s)
filter = FOREACH_FILTER::SPELL;
- else if (type == "TARGET")
+ else if (type == "TARGET"_s)
filter = FOREACH_FILTER::TARGET;
- else if (type == "NPC")
+ else if (type == "NPC"_s)
filter = FOREACH_FILTER::NPC;
else
- return fail(s._list[1], "unknown foreach filter");
+ return fail(s._list[1], "unknown foreach filter"_s);
if (s._list[2]._type != sexpr::TOKEN)
- return fail(s._list[2], "foreach var not token");
+ return fail(s._list[2], "foreach var not token"_s);
ZString var = s._list[2]._str;
dumb_ptr<expr_t> area;
dumb_ptr<effect_t> effect;
@@ -835,12 +837,12 @@ namespace magic_v2
out->e.e_foreach.filter = filter;
return true;
}
- if (cmd == "FOR")
+ if (cmd == "FOR"_s)
{
if (s._list.size() != 5)
- return fail(s, "not 4 arg");
+ return fail(s, "not 4 arg"_s);
if (s._list[1]._type != sexpr::TOKEN)
- return fail(s._list[1], "for var not token");
+ return fail(s._list[1], "for var not token"_s);
ZString var = s._list[1]._str;
dumb_ptr<expr_t> low;
dumb_ptr<expr_t> high;
@@ -858,10 +860,10 @@ namespace magic_v2
out->e.e_for.body = effect;
return true;
}
- if (cmd == "IF")
+ if (cmd == "IF"_s)
{
if (s._list.size() != 3 && s._list.size() != 4)
- return fail(s, "not 2 or 3 args");
+ return fail(s, "not 2 or 3 args"_s);
dumb_ptr<expr_t> cond;
dumb_ptr<effect_t> if_true;
dumb_ptr<effect_t> if_false;
@@ -882,10 +884,10 @@ namespace magic_v2
out->e.e_if.false_branch = if_false;
return true;
}
- if (cmd == "WAIT")
+ if (cmd == "WAIT"_s)
{
if (s._list.size() != 2)
- return fail(s, "not 1 arg");
+ return fail(s, "not 1 arg"_s);
dumb_ptr<expr_t> expr;
if (!parse_expression(s._list[1], expr))
return false;
@@ -893,12 +895,12 @@ namespace magic_v2
out->e.e_sleep = expr;
return true;
}
- if (cmd == "CALL")
+ if (cmd == "CALL"_s)
{
if (s._list.size() < 2)
- return fail(s, "call what?");
+ return fail(s, "call what?"_s);
if (s._list[1]._type != sexpr::TOKEN)
- return fail(s._list[1], "call token please");
+ return fail(s._list[1], "call token please"_s);
ZString func = s._list[1]._str;
auto argvp = dumb_ptr<std::vector<dumb_ptr<expr_t>>>::make();
for (auto it = s._list.begin() + 2, end = s._list.end(); it != end; ++it)
@@ -925,16 +927,16 @@ namespace magic_v2
bool parse_spellbody(const SExpr& s, dumb_ptr<spellguard_t>& out)
{
if (s._type != sexpr::LIST)
- return fail(s, "not list");
+ return fail(s, "not list"_s);
if (s._list.empty())
- return fail(s, "empty list");
+ return fail(s, "empty list"_s);
if (s._list[0]._type != sexpr::TOKEN)
- return fail(s._list[0], "not token");
+ return fail(s._list[0], "not token"_s);
ZString cmd = s._list[0]._str;
- if (cmd == "=>")
+ if (cmd == "=>"_s)
{
if (s._list.size() != 3)
- return fail(s, "list does not have exactly 2 arguments");
+ return fail(s, "list does not have exactly 2 arguments"_s);
dumb_ptr<spellguard_t> guard;
if (!parse_spellguard(s._list[1], guard))
return false;
@@ -944,10 +946,10 @@ namespace magic_v2
out = spellguard_implication(guard, body);
return true;
}
- if (cmd == "|")
+ if (cmd == "|"_s)
{
if (s._list.size() == 1)
- return fail(s, "spellbody choice empty");
+ return fail(s, "spellbody choice empty"_s);
auto begin = s._list.begin() + 1;
auto end = s._list.end();
if (!parse_spellbody(*begin, out))
@@ -965,7 +967,7 @@ namespace magic_v2
}
return true;
}
- if (cmd == "EFFECT")
+ if (cmd == "EFFECT"_s)
{
auto begin = s._list.begin() + 1;
auto end = s._list.end();
@@ -978,7 +980,7 @@ namespace magic_v2
--end;
if (end[-1]._type == sexpr::LIST && !end[-1]._list.empty()
&& end[-1]._list[0]._type == sexpr::TOKEN
- && end[-1]._list[0]._str == "ATEND")
+ && end[-1]._list[0]._str == "ATEND"_s)
{
auto atb = end[-1]._list.begin() + 1;
auto ate = end[-1]._list.end();
@@ -995,7 +997,7 @@ namespace magic_v2
}
if (end[-1]._type == sexpr::LIST && !end[-1]._list.empty()
&& end[-1]._list[0]._type == sexpr::TOKEN
- && end[-1]._list[0]._str == "ATTRIGGER")
+ && end[-1]._list[0]._str == "ATTRIGGER"_s)
{
auto atb = end[-1]._list.begin() + 1;
auto ate = end[-1]._list.end();
@@ -1015,20 +1017,20 @@ namespace magic_v2
out->s.s_effect.at_end = atend;
return true;
}
- return fail(s._list[0], "unknown spellbody");
+ return fail(s._list[0], "unknown spellbody"_s);
}
static
bool parse_top_set(const std::vector<SExpr>& in)
{
if (in.size() != 3)
- return fail(in[0], "not 2 arguments");
+ return fail(in[0], "not 2 arguments"_s);
ZString name = in[1]._str;
dumb_ptr<expr_t> expr;
if (!parse_expression(in[2], expr))
return false;
if (find_constant(name))
- return fail(in[1], "assign constant");
+ return fail(in[1], "assign constant"_s);
size_t var_id = intern_id(name);
magic_eval(dumb_ptr<env_t>(&magic_default_env), &magic_conf.varv[var_id].val, expr);
return true;
@@ -1037,9 +1039,9 @@ namespace magic_v2
bool parse_const(io::LineSpan span, const std::vector<SExpr>& in)
{
if (in.size() != 3)
- return fail(in[0], "not 2 arguments");
+ return fail(in[0], "not 2 arguments"_s);
if (in[1]._type != sexpr::TOKEN)
- return fail(in[1], "not token");
+ return fail(in[1], "not token"_s);
ZString name = in[1]._str;
dumb_ptr<expr_t> expr;
if (!parse_expression(in[2], expr))
@@ -1052,13 +1054,13 @@ namespace magic_v2
bool parse_anchor(io::LineSpan span, const std::vector<SExpr>& in)
{
if (in.size() != 4)
- return fail(in[0], "not 3 arguments");
+ return fail(in[0], "not 3 arguments"_s);
auto anchor = dumb_ptr<teleport_anchor_t>::make();
if (in[1]._type != sexpr::TOKEN)
- return fail(in[1], "not token");
+ return fail(in[1], "not token"_s);
anchor->name = in[1]._str;
if (in[2]._type != sexpr::STRING)
- return fail(in[2], "not string");
+ return fail(in[2], "not string"_s);
anchor->invocation = in[2]._str;
dumb_ptr<expr_t> expr;
if (!parse_expression(in[3], expr))
@@ -1070,17 +1072,17 @@ namespace magic_v2
bool parse_proc(io::LineSpan span, const std::vector<SExpr>& in)
{
if (in.size() < 4)
- return fail(in[0], "not at least 3 arguments");
+ return fail(in[0], "not at least 3 arguments"_s);
auto proc = dumb_ptr<proc_t>::make();
if (in[1]._type != sexpr::TOKEN)
- return fail(in[1], "name not token");
+ return fail(in[1], "name not token"_s);
proc->name = in[1]._str;
if (in[2]._type != sexpr::LIST)
- return fail(in[2], "args not list");
+ return fail(in[2], "args not list"_s);
for (const SExpr& arg : in[2]._list)
{
if (arg._type != sexpr::TOKEN)
- return fail(arg, "arg not token");
+ return fail(arg, "arg not token"_s);
proc->argv.push_back(intern_id(arg._str));
}
if (!build_effect_list(in.begin() + 3, in.end(), proc->body))
@@ -1091,37 +1093,37 @@ namespace magic_v2
bool parse_spell(io::LineSpan span, const std::vector<SExpr>& in)
{
if (in.size() < 6)
- return fail(in[0], "not at least 5 arguments");
+ return fail(in[0], "not at least 5 arguments"_s);
if (in[1]._type != sexpr::LIST)
- return fail(in[1], "flags not list");
+ return fail(in[1], "flags not list"_s);
auto spell = dumb_ptr<spell_t>::make();
for (const SExpr& s : in[1]._list)
{
if (s._type != sexpr::TOKEN)
- return fail(s, "flag not token");
+ return fail(s, "flag not token"_s);
SPELL_FLAG flag = SPELL_FLAG::ZERO;
- if (s._str == "LOCAL")
+ if (s._str == "LOCAL"_s)
flag = SPELL_FLAG::LOCAL;
- else if (s._str == "NONMAGIC")
+ else if (s._str == "NONMAGIC"_s)
flag = SPELL_FLAG::NONMAGIC;
- else if (s._str == "SILENT")
+ else if (s._str == "SILENT"_s)
flag = SPELL_FLAG::SILENT;
else
- return fail(s, "unknown flag");
+ return fail(s, "unknown flag"_s);
if (bool(spell->flags & flag))
- return fail(s, "duplicate flag");
+ return fail(s, "duplicate flag"_s);
spell->flags |= flag;
}
if (in[2]._type != sexpr::TOKEN)
- return fail(in[2], "name not token");
+ return fail(in[2], "name not token"_s);
spell->name = in[2]._str;
if (in[3]._type != sexpr::STRING)
- return fail(in[3], "invoc not string");
+ return fail(in[3], "invoc not string"_s);
spell->invocation = in[3]._str;
if (in[4]._type != sexpr::LIST)
- return fail(in[4], "spellarg not list");
+ return fail(in[4], "spellarg not list"_s);
if (in[4]._list.size() == 0)
{
spell->spellarg_ty = SPELLARG::NONE;
@@ -1129,18 +1131,18 @@ namespace magic_v2
else
{
if (in[4]._list.size() != 2)
- return fail(in[4], "spellarg not empty list or pair");
+ return fail(in[4], "spellarg not empty list or pair"_s);
if (in[4]._list[0]._type != sexpr::TOKEN)
- return fail(in[4]._list[0], "spellarg type not token");
+ return fail(in[4]._list[0], "spellarg type not token"_s);
if (in[4]._list[1]._type != sexpr::TOKEN)
- return fail(in[4]._list[1], "spellarg name not token");
+ return fail(in[4]._list[1], "spellarg name not token"_s);
ZString ty = in[4]._list[0]._str;
- if (ty == "PC")
+ if (ty == "PC"_s)
spell->spellarg_ty = SPELLARG::PC;
- else if (ty == "STRING")
+ else if (ty == "STRING"_s)
spell->spellarg_ty = SPELLARG::STRING;
else
- return fail(in[4]._list[0], "unknown spellarg type");
+ return fail(in[4]._list[0], "unknown spellarg type"_s);
ZString an = in[4]._list[1]._str;
spell->arg = intern_id(an);
}
@@ -1148,19 +1150,19 @@ namespace magic_v2
for (;; ++it)
{
if (it == in.end())
- return fail(it[-1], "end of list scanning LET defs");
+ return fail(it[-1], "end of list scanning LET defs"_s);
if (is_comment(*it))
continue;
if (it->_type != sexpr::LIST || it->_list.empty())
break;
- if (it->_list[0]._type != sexpr::TOKEN || it->_list[0]._str != "LET")
+ if (it->_list[0]._type != sexpr::TOKEN || it->_list[0]._str != "LET"_s)
break;
if (it->_list[1]._type != sexpr::TOKEN)
- return fail(it->_list[1], "let name not token");
+ return fail(it->_list[1], "let name not token"_s);
ZString name = it->_list[1]._str;
if (find_constant(name))
- return fail(it->_list[1], "constant exists");
+ return fail(it->_list[1], "constant exists"_s);
dumb_ptr<expr_t> expr;
if (!parse_expression(it->_list[2], expr))
return false;
@@ -1170,7 +1172,7 @@ namespace magic_v2
spell->letdefv.push_back(let);
}
if (it + 1 != in.end())
- return fail(*it, "expected only one body entry besides LET");
+ return fail(*it, "expected only one body entry besides LET"_s);
// formally, 'guard' only refers to the first argument of '=>'
// but internally, spellbodies use the same thing
@@ -1186,23 +1188,23 @@ namespace magic_v2
{
if (vs.empty())
{
- span.error("Empty list at top");
+ span.error("Empty list at top"_s);
return false;
}
if (vs[0]._type != sexpr::TOKEN)
- return fail(vs[0], "top not token");
+ return fail(vs[0], "top not token"_s);
ZString cmd = vs[0]._str;
- if (cmd == "CONST")
+ if (cmd == "CONST"_s)
return parse_const(span, vs);
- if (cmd == "PROCEDURE")
+ if (cmd == "PROCEDURE"_s)
return parse_proc(span, vs);
- if (cmd == "SET")
+ if (cmd == "SET"_s)
return parse_top_set(vs);
- if (cmd == "SPELL")
+ if (cmd == "SPELL"_s)
return parse_spell(span, vs);
- if (cmd == "TELEPORT-ANCHOR")
+ if (cmd == "TELEPORT-ANCHOR"_s)
return parse_anchor(span, vs);
- return fail(vs[0], "Unknown top-level command");
+ return fail(vs[0], "Unknown top-level command"_s);
}
static
@@ -1214,14 +1216,14 @@ namespace magic_v2
if (is_comment(s))
continue;
if (s._type != sexpr::LIST)
- return fail(s, "top-level entity not a list or comment");
+ return fail(s, "top-level entity not a list or comment"_s);
if (!parse_top(s._span, s._list))
return false;
}
// handle low-level errors
if (in.peek() != sexpr::TOK_EOF)
{
- in.span().error("parser gave up before end of file");
+ in.span().error("parser gave up before end of file"_s);
return false;
}
return true;
@@ -1239,7 +1241,7 @@ bool load_magic_file_v2(ZString filename)
bool rv = magic_v2::loop(in);
if (!rv)
{
- in.span().error(STRPRINTF("next token: %s '%s'", sexpr::token_name(in.peek()), in.val_string()));
+ in.span().error(STRPRINTF("next token: %s '%s'"_fmt, sexpr::token_name(in.peek()), in.val_string()));
}
return rv;
}
diff --git a/src/map/magic.cpp b/src/map/magic.cpp
index 9896b26..4ca5c4f 100644
--- a/src/map/magic.cpp
+++ b/src/map/magic.cpp
@@ -98,12 +98,12 @@ int magic_message(dumb_ptr<map_session_data> caster, XString source_invocation)
effects = NULL;
#ifdef DEBUG
- FPRINTF(stderr, "Found spell `%s', triggered = %d\n", spell_,
+ FPRINTF(stderr, "Found spell `%s', triggered = %d\n"_fmt, spell_,
effects != NULL);
#endif
- MAP_LOG_PC(caster, "CAST %s %s",
- spell->name, effects ? "SUCCESS" : "FAILURE");
+ MAP_LOG_PC(caster, "CAST %s %s"_fmt,
+ spell->name, effects ? "SUCCESS"_s : "FAILURE"_s);
if (effects)
{
diff --git a/src/map/map.cpp b/src/map/map.cpp
index b49b225..7c14e9e 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -100,9 +100,9 @@ int first_free_object_id = 0, last_object_id = 0;
interval_t autosave_time = DEFAULT_AUTOSAVE_INTERVAL;
int save_settings = 0xFFFF;
-AString motd_txt = "conf/motd.txt";
+AString motd_txt = "conf/motd.txt"_s;
-CharName wisp_server_name = stringish<CharName>("Server"); // can be modified in char-server configuration file
+CharName wisp_server_name = stringish<CharName>("Server"_s); // can be modified in char-server configuration file
static
void map_delmap(MapName mapname);
@@ -186,7 +186,7 @@ int map_addblock(dumb_ptr<block_list> bl)
if (bl->bl_prev)
{
if (battle_config.error_log)
- PRINTF("map_addblock error : bl->bl_prev!=NULL\n");
+ PRINTF("map_addblock error : bl->bl_prev!=NULL\n"_fmt);
return 0;
}
@@ -235,7 +235,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");
+ PRINTF("map_delblock error : bl->bl_next!=NULL\n"_fmt);
}
return 0;
}
@@ -538,7 +538,7 @@ int map_addobject(dumb_ptr<block_list> bl)
int i;
if (!bl)
{
- PRINTF("map_addobject nullpo?\n");
+ PRINTF("map_addobject nullpo?\n"_fmt);
return 0;
}
if (first_free_object_id < 2 || first_free_object_id >= MAX_FLOORITEM)
@@ -549,7 +549,7 @@ int map_addobject(dumb_ptr<block_list> bl)
if (i >= MAX_FLOORITEM)
{
if (battle_config.error_log)
- PRINTF("no free object id\n");
+ PRINTF("no free object id\n"_fmt);
return 0;
}
first_free_object_id = i;
@@ -573,7 +573,7 @@ int map_delobjectnofree(int id, BL type)
if (object[id]->bl_type != type)
{
- FPRINTF(stderr, "Incorrect type: expected %d, got %d\n",
+ FPRINTF(stderr, "Incorrect type: expected %d, got %d\n"_fmt,
type,
object[id]->bl_type);
abort();
@@ -1052,7 +1052,7 @@ int map_addnpc(map_local *m, dumb_ptr<npc_data> nd)
if (i == MAX_NPC_PER_MAP)
{
if (battle_config.error_log)
- PRINTF("too many NPCs in one map %s\n", m->name_);
+ PRINTF("too many NPCs in one map %s\n"_fmt, m->name_);
return -1;
}
if (i == m->npc_num)
@@ -1096,7 +1096,7 @@ void map_removenpc(void)
}
}
}
- PRINTF("%d NPCs removed.\n", n);
+ PRINTF("%d NPCs removed.\n"_fmt, n);
}
/*==========================================
@@ -1244,7 +1244,7 @@ int map_setipport(MapName name, IP4Address ip, int port)
// local -> check data
if (ip != clif_getip() || port != clif_getport())
{
- PRINTF("from char server : %s -> %s:%d\n",
+ PRINTF("from char server : %s -> %s:%d\n"_fmt,
name, ip, port);
return 1;
}
@@ -1275,7 +1275,7 @@ bool map_readmap(map_local *m, size_t num, MapName fn)
int xs = m->xs = gat_v[0] | gat_v[1] << 8;
int ys = m->ys = gat_v[2] | gat_v[3] << 8;
- PRINTF("\rLoading Maps [%zu/%zu]: %-30s (%i, %i)",
+ PRINTF("\rLoading Maps [%zu/%zu]: %-30s (%i, %i)"_fmt,
num, maps_db.size(),
fn, xs, ys);
fflush(stdout);
@@ -1328,10 +1328,10 @@ bool map_readallmap(void)
}
}
- PRINTF("\rMaps Loaded: %-65zu\n", maps_db.size());
+ PRINTF("\rMaps Loaded: %-65zu\n"_fmt, maps_db.size());
if (maps_removed)
{
- PRINTF("Cowardly refusing to keep going after removing %d maps.\n",
+ PRINTF("Cowardly refusing to keep going after removing %d maps.\n"_fmt,
maps_removed);
return false;
}
@@ -1346,7 +1346,7 @@ bool map_readallmap(void)
static
void map_addmap(MapName mapname)
{
- if (mapname == "clear")
+ if (mapname == "clear"_s)
{
maps_db.clear();
return;
@@ -1366,7 +1366,7 @@ void map_addmap(MapName mapname)
*/
void map_delmap(MapName mapname)
{
- if (mapname == "all")
+ if (mapname == "all"_s)
{
maps_db.clear();
return;
@@ -1389,7 +1389,7 @@ void map_close_logfile(void)
{
if (map_logfile)
{
- AString filename = STRPRINTF("%s.%ld", map_logfile_name, map_logfile_index);
+ AString filename = STRPRINTF("%s.%ld"_fmt, map_logfile_name, map_logfile_index);
const char *args[] =
{
"gzip",
@@ -1416,7 +1416,7 @@ void map_start_logfile(long index)
map_logfile_index = index;
AString filename_buf = STRPRINTF(
- "%s.%ld",
+ "%s.%ld"_fmt,
map_logfile_name,
map_logfile_index);
map_logfile = make_unique<io::AppendFile>(filename_buf);
@@ -1437,7 +1437,7 @@ void map_set_logfile(AString filename)
map_start_logfile(tv.tv_sec >> LOGFILE_SECONDS_PER_CHUNK_SHIFT);
- MAP_LOG("log-start v5");
+ MAP_LOG("log-start v5"_fmt);
}
void map_log(XString line)
@@ -1469,7 +1469,7 @@ bool map_config_read(ZString cfgName)
io::ReadFile in(cfgName);
if (!in.is_open())
{
- PRINTF("Map configuration file not found at: %s\n", cfgName);
+ PRINTF("Map configuration file not found at: %s\n"_fmt, cfgName);
return false;
}
@@ -1483,21 +1483,21 @@ bool map_config_read(ZString cfgName)
ZString w2;
if (!config_split(line, &w1, &w2))
{
- PRINTF("Bad config line: %s\n", line);
+ PRINTF("Bad config line: %s\n"_fmt, line);
rv = false;
continue;
}
- if (w1 == "userid")
+ if (w1 == "userid"_s)
{
AccountName name = stringish<AccountName>(w2);
chrif_setuserid(name);
}
- else if (w1 == "passwd")
+ else if (w1 == "passwd"_s)
{
AccountPass pass = stringish<AccountPass>(w2);
chrif_setpasswd(pass);
}
- else if (w1 == "char_ip")
+ else if (w1 == "char_ip"_s)
{
h = gethostbyname(w2.c_str());
IP4Address w2ip;
@@ -1509,21 +1509,21 @@ bool map_config_read(ZString cfgName)
static_cast<uint8_t>(h->h_addr[2]),
static_cast<uint8_t>(h->h_addr[3]),
});
- PRINTF("Character server IP address : %s -> %s\n",
+ PRINTF("Character server IP address : %s -> %s\n"_fmt,
w2, w2ip);
}
else
{
- PRINTF("Bad IP value: %s\n", line);
+ PRINTF("Bad IP value: %s\n"_fmt, line);
return false;
}
chrif_setip(w2ip);
}
- else if (w1 == "char_port")
+ else if (w1 == "char_port"_s)
{
chrif_setport(atoi(w2.c_str()));
}
- else if (w1 == "map_ip")
+ else if (w1 == "map_ip"_s)
{
h = gethostbyname(w2.c_str());
IP4Address w2ip;
@@ -1535,61 +1535,61 @@ bool map_config_read(ZString cfgName)
static_cast<uint8_t>(h->h_addr[2]),
static_cast<uint8_t>(h->h_addr[3]),
});
- PRINTF("Map server IP address : %s -> %s\n",
+ PRINTF("Map server IP address : %s -> %s\n"_fmt,
w2, w2ip);
}
else
{
- PRINTF("Bad IP value: %s\n", line);
+ PRINTF("Bad IP value: %s\n"_fmt, line);
return false;
}
clif_setip(w2ip);
}
- else if (w1 == "map_port")
+ else if (w1 == "map_port"_s)
{
clif_setport(atoi(w2.c_str()));
}
- else if (w1 == "map")
+ else if (w1 == "map"_s)
{
MapName name = VString<15>(w2);
map_addmap(name);
}
- else if (w1 == "delmap")
+ else if (w1 == "delmap"_s)
{
MapName name = VString<15>(w2);
map_delmap(name);
}
- else if (w1 == "npc")
+ else if (w1 == "npc"_s)
{
npc_addsrcfile(w2);
}
- else if (w1 == "delnpc")
+ else if (w1 == "delnpc"_s)
{
npc_delsrcfile(w2);
}
- else if (w1 == "autosave_time")
+ else if (w1 == "autosave_time"_s)
{
autosave_time = std::chrono::seconds(atoi(w2.c_str()));
if (autosave_time <= interval_t::zero())
autosave_time = DEFAULT_AUTOSAVE_INTERVAL;
}
- else if (w1 == "motd_txt")
+ else if (w1 == "motd_txt"_s)
{
motd_txt = w2;
}
- else if (w1 == "mapreg_txt")
+ else if (w1 == "mapreg_txt"_s)
{
mapreg_txt = w2;
}
- else if (w1 == "gm_log")
+ else if (w1 == "gm_log"_s)
{
gm_log = std::move(w2);
}
- else if (w1 == "log_file")
+ else if (w1 == "log_file"_s)
{
map_set_logfile(w2);
}
- else if (w1 == "import")
+ else if (w1 == "import"_s)
{
rv &= map_config_read(w2);
}
@@ -1664,29 +1664,29 @@ int compare_item(struct item *a, struct item *b)
static
bool map_confs(XString key, ZString value)
{
- if (key == "map_conf")
+ if (key == "map_conf"_s)
return map_config_read(value);
- if (key == "battle_conf")
+ if (key == "battle_conf"_s)
return battle_config_read(value);
- if (key == "atcommand_conf")
+ if (key == "atcommand_conf"_s)
return atcommand_config_read(value);
- if (key == "item_db")
+ if (key == "item_db"_s)
return itemdb_readdb(value);
- if (key == "mob_db")
+ if (key == "mob_db"_s)
return mob_readdb(value);
- if (key == "mob_skill_db")
+ if (key == "mob_skill_db"_s)
return mob_readskilldb(value);
- if (key == "skill_db")
+ if (key == "skill_db"_s)
return skill_readdb(value);
- if (key == "magic_conf")
+ if (key == "magic_conf"_s)
return load_magic_file_v2(value);
- if (key == "resnametable")
+ if (key == "resnametable"_s)
return load_resnametable(value);
- if (key == "const_db")
+ if (key == "const_db"_s)
return read_constdb(value);
- PRINTF("unknown map conf key: %s\n", AString(key));
+ PRINTF("unknown map conf key: %s\n"_fmt, AString(key));
return false;
}
@@ -1705,22 +1705,22 @@ int do_init(Slice<ZString> argv)
ZString argvi = argv.pop_front();
if (argvi.startswith('-'))
{
- if (argvi == "--help")
+ if (argvi == "--help"_s)
{
- PRINTF("Usage: %s [--help] [--version] [--write_atcommand_config outfile] [files...]\n",
+ PRINTF("Usage: %s [--help] [--version] [--write_atcommand_config outfile] [files...]\n"_fmt,
argv0);
exit(0);
}
- else if (argvi == "--version")
+ else if (argvi == "--version"_s)
{
- PRINTF("%s\n", CURRENT_VERSION_STRING);
+ PRINTF("%s\n"_fmt, CURRENT_VERSION_STRING);
exit(0);
}
- else if (argvi == "--write-atcommand-config")
+ else if (argvi == "--write-atcommand-config"_s)
{
if (!argv)
{
- PRINTF("Missing argument\n");
+ PRINTF("Missing argument\n"_fmt);
exit(1);
}
ZString filename = argv.pop_front();
@@ -1729,7 +1729,7 @@ int do_init(Slice<ZString> argv)
}
else
{
- FPRINTF(stderr, "Unknown argument: %s\n", argvi);
+ FPRINTF(stderr, "Unknown argument: %s\n"_fmt, argvi);
runflag = false;
}
}
@@ -1741,7 +1741,7 @@ int do_init(Slice<ZString> argv)
}
if (!loaded_config_yet)
- runflag &= load_config_file("conf/tmwa-map.conf", map_confs);
+ runflag &= load_config_file("conf/tmwa-map.conf"_s, map_confs);
battle_config_check();
runflag &= map_readallmap();
@@ -1758,9 +1758,9 @@ int do_init(Slice<ZString> argv)
npc_event_do_oninit(); // npcのOnInitイベント実行
if (battle_config.pk_mode == 1)
- PRINTF("The server is running in " SGR_BOLD SGR_RED "PK Mode" SGR_RESET "\n");
+ PRINTF("The server is running in " SGR_BOLD SGR_RED "PK Mode" SGR_RESET "\n"_fmt);
- PRINTF("The map-server is " SGR_BOLD SGR_GREEN "ready" SGR_RESET " (Server is listening on the port %d).\n\n",
+ PRINTF("The map-server is " SGR_BOLD SGR_GREEN "ready" SGR_RESET " (Server is listening on the port %d).\n\n"_fmt,
clif_getport());
return 0;
diff --git a/src/map/map.hpp b/src/map/map.hpp
index 0cec5e8..6d945d0 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -91,7 +91,7 @@ struct NpcEvent
friend VString<49> convert_for_printf(NpcEvent ev)
{
- return STRNPRINTF(50, "%s::%s", ev.npc, ev.label);
+ return STRNPRINTF(50, "%s::%s"_fmt, ev.npc, ev.label);
}
};
bool extract(XString str, NpcEvent *ev);
@@ -623,7 +623,7 @@ void map_log(XString line);
# define MAP_LOG_PC(sd, fmt, ...) \
MAP_LOG("PC%d %s:%d,%d " fmt, \
- sd->status_key.char_id, (sd->bl_m ? sd->bl_m->name_ : stringish<MapName>("undefined.gat")), sd->bl_x, sd->bl_y, ## __VA_ARGS__)
+ sd->status_key.char_id, (sd->bl_m ? sd->bl_m->name_ : stringish<MapName>("undefined.gat"_s)), sd->bl_x, sd->bl_y, ## __VA_ARGS__)
// 床アイテム関連
void map_clearflooritem_timer(TimerData *, tick_t, int);
diff --git a/src/map/map.t.hpp b/src/map/map.t.hpp
index b73cbdd..59b6ff4 100644
--- a/src/map/map.t.hpp
+++ b/src/map/map.t.hpp
@@ -103,6 +103,8 @@ enum class NpcSubtype : uint8_t
SHOP,
SCRIPT,
MESSAGE,
+
+ COUNT,
};
enum class mob_stat
diff --git a/src/map/mapflag.cpp b/src/map/mapflag.cpp
index 51af30a..65126d9 100644
--- a/src/map/mapflag.cpp
+++ b/src/map/mapflag.cpp
@@ -40,41 +40,41 @@ bool extract<MapFlag, void, void>(XString str, MapFlag *mf)
{
const struct
{
- ZString str;
+ LString str;
MapFlag id;
} flags[] =
{
- //{ZString("alias"), MapFlag::ALIAS},
- //{ZString("nomemo"), MapFlag::NOMEMO},
- {ZString("noteleport"), MapFlag::NOTELEPORT},
- {ZString("noreturn"), MapFlag::NORETURN},
- {ZString("monster_noteleport"), MapFlag::MONSTER_NOTELEPORT},
- {ZString("nosave"), MapFlag::NOSAVE},
- //{ZString("nobranch"), MapFlag::NOBRANCH},
- {ZString("nopenalty"), MapFlag::NOPENALTY},
- {ZString("pvp"), MapFlag::PVP},
- {ZString("pvp_noparty"), MapFlag::PVP_NOPARTY},
- //{ZString("pvp_noguild"), MapFlag::PVP_NOGUILD},
- //{ZString("pvp_nightmaredrop"), MapFlag::PVP_NIGHTMAREDROP},
- {ZString("pvp_nocalcrank"), MapFlag::PVP_NOCALCRANK},
- //{ZString("gvg"), MapFlag::GVG},
- //{ZString("gvg_noparty"), MapFlag::GVG_NOPARTY},
- //{ZString("nozenypenalty"), MapFlag::NOZENYPENALTY},
- //{ZString("notrade"), MapFlag::NOTRADE},
- //{ZString("noskill"), MapFlag::NOSKILL},
- {ZString("nowarp"), MapFlag::NOWARP},
- {ZString("nowarpto"), MapFlag::NOWARPTO},
- {ZString("nopvp"), MapFlag::NOPVP},
- //{ZString("noicewall"), MapFlag::NOICEWALL},
- {ZString("snow"), MapFlag::SNOW},
- {ZString("fog"), MapFlag::FOG},
- {ZString("sakura"), MapFlag::SAKURA},
- {ZString("leaves"), MapFlag::LEAVES},
- {ZString("rain"), MapFlag::RAIN},
- {ZString("no_player_drops"), MapFlag::NO_PLAYER_DROPS},
- {ZString("town"), MapFlag::TOWN},
- {ZString("outside"), MapFlag::OUTSIDE},
- {ZString("resave"), MapFlag::RESAVE},
+ //{"alias"_s, MapFlag::ALIAS},
+ //{"nomemo"_s, MapFlag::NOMEMO},
+ {"noteleport"_s, MapFlag::NOTELEPORT},
+ {"noreturn"_s, MapFlag::NORETURN},
+ {"monster_noteleport"_s, MapFlag::MONSTER_NOTELEPORT},
+ {"nosave"_s, MapFlag::NOSAVE},
+ //{"nobranch"_s, MapFlag::NOBRANCH},
+ {"nopenalty"_s, MapFlag::NOPENALTY},
+ {"pvp"_s, MapFlag::PVP},
+ {"pvp_noparty"_s, MapFlag::PVP_NOPARTY},
+ //{"pvp_noguild"_s, MapFlag::PVP_NOGUILD},
+ //{"pvp_nightmaredrop"_s, MapFlag::PVP_NIGHTMAREDROP},
+ {"pvp_nocalcrank"_s, MapFlag::PVP_NOCALCRANK},
+ //{"gvg"_s, MapFlag::GVG},
+ //{"gvg_noparty"_s, MapFlag::GVG_NOPARTY},
+ //{"nozenypenalty"_s, MapFlag::NOZENYPENALTY},
+ //{"notrade"_s, MapFlag::NOTRADE},
+ //{"noskill"_s, MapFlag::NOSKILL},
+ {"nowarp"_s, MapFlag::NOWARP},
+ {"nowarpto"_s, MapFlag::NOWARPTO},
+ {"nopvp"_s, MapFlag::NOPVP},
+ //{"noicewall"_s, MapFlag::NOICEWALL},
+ {"snow"_s, MapFlag::SNOW},
+ {"fog"_s, MapFlag::FOG},
+ {"sakura"_s, MapFlag::SAKURA},
+ {"leaves"_s, MapFlag::LEAVES},
+ {"rain"_s, MapFlag::RAIN},
+ {"no_player_drops"_s, MapFlag::NO_PLAYER_DROPS},
+ {"town"_s, MapFlag::TOWN},
+ {"outside"_s, MapFlag::OUTSIDE},
+ {"resave"_s, MapFlag::RESAVE},
};
for (auto& pair : flags)
if (str == pair.str)
diff --git a/src/map/mob.cpp b/src/map/mob.cpp
index a96f829..2bf4ad1 100644
--- a/src/map/mob.cpp
+++ b/src/map/mob.cpp
@@ -322,7 +322,7 @@ int mob_gen_exp(mob_db_ *mob)
* static_cast<double>(battle_config.base_exp_rate) / 100.);
if (xp < 1)
xp = 1;
- PRINTF("Exp for mob '%s' generated: %d\n", mob->name, xp);
+ PRINTF("Exp for mob '%s' generated: %d\n"_fmt, mob->name, xp);
return xp;
}
@@ -417,7 +417,7 @@ int mob_once_spawn(dumb_ptr<map_session_data> sd,
}
else if (x <= 0 || y <= 0)
{
- PRINTF("mob_once_spawn: ??\n");
+ PRINTF("mob_once_spawn: ??\n"_fmt);
}
for (count = 0; count < amount; count++)
@@ -948,7 +948,7 @@ void mob_timer(TimerData *, tick_t tick, int id, unsigned char data)
break;
default:
if (battle_config.error_log == 1)
- PRINTF("mob_timer : %d ?\n",
+ PRINTF("mob_timer : %d ?\n"_fmt,
md->state.state);
break;
}
@@ -1115,8 +1115,6 @@ int mob_spawn(int id)
if (i >= 50)
{
- // if(battle_config.error_log==1)
- // PRINTF("MOB spawn error %d @ %s\n",id,map[md->bl_m].name);
Timer(tick + std::chrono::seconds(5),
std::bind(mob_delayspawn, ph::_1, ph::_2,
id)
@@ -1718,7 +1716,7 @@ int mob_randomwalk(dumb_ptr<mob_data> md, tick_t tick)
if (md->move_fail_count > 1000)
{
if (battle_config.error_log == 1)
- PRINTF("MOB cant move. random spawn %d, mob_class = %d\n",
+ PRINTF("MOB cant move. random spawn %d, mob_class = %d\n"_fmt,
md->bl_id, md->mob_class);
md->move_fail_count = 0;
mob_spawn(md->bl_id);
@@ -2358,12 +2356,10 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage,
mvp_sd = sd;
}
-// if(battle_config.battle_log)
-// PRINTF("mob_damage %d %d %d\n",md->hp,max_hp,damage);
if (md->bl_prev == NULL)
{
if (battle_config.error_log == 1)
- PRINTF("mob_damage : BlockError!!\n");
+ PRINTF("mob_damage : BlockError!!\n"_fmt);
return 0;
}
@@ -2425,7 +2421,7 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage,
if (master_bl && master_bl->bl_type == BL::PC)
{
MAP_LOG_PC(master_bl->is_player(),
- "MOB-TO-MOB-DMG FROM MOB%d %d TO MOB%d %d FOR %d",
+ "MOB-TO-MOB-DMG FROM MOB%d %d TO MOB%d %d FOR %d"_fmt,
md2->bl_id, md2->mob_class, md->bl_id, md->mob_class,
damage);
}
@@ -2461,7 +2457,7 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage,
return 0;
}
- MAP_LOG("MOB%d DEAD", md->bl_id);
+ MAP_LOG("MOB%d DEAD"_fmt, md->bl_id);
// ----- ここから死亡処理 -----
@@ -2742,7 +2738,6 @@ void mob_warpslave_sub(dumb_ptr<block_list> bl, int id, int x, int y)
static
int mob_warpslave(dumb_ptr<mob_data> md, int x, int y)
{
-//PRINTF("warp slave\n");
map_foreachinarea(std::bind(mob_warpslave_sub, ph::_1, md->bl_id, md->bl_x, md->bl_y),
md->bl_m,
x - AREA_SIZE, y - AREA_SIZE,
@@ -2808,7 +2803,7 @@ int mob_warp(dumb_ptr<mob_data> md, map_local *m, int x, int y, BeingRemoveWhy t
else
{
if (battle_config.error_log == 1)
- PRINTF("MOB %d warp failed, mob_class = %d\n", md->bl_id, md->mob_class);
+ PRINTF("MOB %d warp failed, mob_class = %d\n"_fmt, md->bl_id, md->mob_class);
}
md->target_id = 0; // タゲを解除する
@@ -2821,7 +2816,7 @@ int mob_warp(dumb_ptr<mob_data> md, map_local *m, int x, int y, BeingRemoveWhy t
&& i == 1000)
{
if (battle_config.battle_log == 1)
- PRINTF("MOB %d warp to (%d,%d), mob_class = %d\n", md->bl_id, x, y,
+ PRINTF("MOB %d warp to (%d,%d), mob_class = %d\n"_fmt, md->bl_id, x, y,
md->mob_class);
}
@@ -3015,7 +3010,7 @@ void mobskill_castend_id(TimerData *, tick_t tick, int id)
return;
if ((md = mbl->is_mob()) == NULL)
{
- PRINTF("mobskill_castend_id nullpo mbl->bl_id:%d\n", mbl->bl_id);
+ 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)
@@ -3029,7 +3024,6 @@ void mobskill_castend_id(TimerData *, tick_t tick, int id)
if ((bl = map_id2bl(md->skilltarget)) == NULL || bl->bl_prev == NULL)
{ //スキルターゲットが存在しない
- //PRINTF("mobskill_castend_id nullpo\n");//ターゲットがいないときはnullpoじゃなくて普通に終了
return;
}
if (md->bl_m != bl->bl_m)
@@ -3047,7 +3041,7 @@ void mobskill_castend_id(TimerData *, tick_t tick, int id)
md->skilldelayup[md->skillidx - &mob_db[md->mob_class].skills.front()] = tick;
if (battle_config.monster_skill_log == 1)
- PRINTF("MOB skill castend skill=%d, mob_class = %d\n",
+ PRINTF("MOB skill castend skill=%d, mob_class = %d\n"_fmt,
md->skillid, md->mob_class);
mob_stop_walking(md, 0);
@@ -3098,7 +3092,7 @@ void mobskill_castend_pos(TimerData *, tick_t tick, int id)
md->skilldelayup[md->skillidx - &mob_db[md->mob_class].skills.front()] = tick;
if (battle_config.monster_skill_log == 1)
- PRINTF("MOB skill castend skill=%d, mob_class = %d\n",
+ PRINTF("MOB skill castend skill=%d, mob_class = %d\n"_fmt,
md->skillid, md->mob_class);
mob_stop_walking(md, 0);
}
@@ -3148,7 +3142,7 @@ int mobskill_use_id(dumb_ptr<mob_data> md, dumb_ptr<block_list> target,
md->skilldelayup[ms - &mob_db[md->mob_class].skills.front()] = gettick();
if (battle_config.monster_skill_log == 1)
- PRINTF("MOB skill use target_id=%d skill=%d lv=%d cast=%d, mob_class = %d\n",
+ PRINTF("MOB skill use target_id=%d skill=%d lv=%d cast=%d, mob_class = %d\n"_fmt,
target->bl_id, skill_id, skill_lv,
static_cast<uint32_t>(casttime.count()), md->mob_class);
@@ -3219,7 +3213,7 @@ int mobskill_use_pos(dumb_ptr<mob_data> md,
md->state.skillcastcancel = ms->cancel;
if (battle_config.monster_skill_log == 1)
- PRINTF("MOB skill use target_pos= (%d,%d) skill=%d lv=%d cast=%d, mob_class = %d\n",
+ PRINTF("MOB skill use target_pos= (%d,%d) skill=%d lv=%d cast=%d, mob_class = %d\n"_fmt,
skill_x, skill_y, skill_id, skill_lv,
static_cast<uint32_t>(casttime.count()), md->mob_class);
@@ -3384,8 +3378,8 @@ int mob_makedummymobdb(int mob_class)
{
int i;
- SNPRINTF(mob_db[mob_class].name, 24, "mob%d", mob_class);
- SNPRINTF(mob_db[mob_class].jname, 24, "mob%d", mob_class);
+ SNPRINTF(mob_db[mob_class].name, 24, "mob%d"_fmt, mob_class);
+ SNPRINTF(mob_db[mob_class].jname, 24, "mob%d"_fmt, mob_class);
mob_db[mob_class].lv = 1;
mob_db[mob_class].max_hp = 1000;
mob_db[mob_class].max_sp = 1;
@@ -3439,7 +3433,7 @@ bool mob_readdb(ZString filename)
io::ReadFile in(filename);
if (!in.is_open())
{
- PRINTF("Unable to read mob db: %s\n", filename);
+ PRINTF("Unable to read mob db: %s\n"_fmt, filename);
return false;
}
AString line;
@@ -3517,7 +3511,7 @@ bool mob_readdb(ZString filename)
if (!okay || mob_class <= 1000 || mob_class > 2000)
{
- PRINTF("bad mob line: %s\n", line);
+ PRINTF("bad mob line: %s\n"_fmt, line);
rv = false;
continue;
}
@@ -3570,7 +3564,7 @@ bool mob_readdb(ZString filename)
if (mob_db[mob_class].base_exp == 0)
mob_db[mob_class].base_exp = mob_gen_exp(&mob_db[mob_class]);
}
- PRINTF("read %s done\n", filename);
+ PRINTF("read %s done\n"_fmt, filename);
}
return rv;
}
@@ -3580,15 +3574,15 @@ bool extract<MobSkillCondition, void, void>(XString str, MobSkillCondition *msc)
{
const struct
{
- ZString str;
+ LString str;
MobSkillCondition id;
} cond1[] =
{
- {ZString("always"), MobSkillCondition::MSC_ALWAYS},
- {ZString("myhpltmaxrate"), MobSkillCondition::MSC_MYHPLTMAXRATE},
- {ZString("notintown"), MobSkillCondition::MSC_NOTINTOWN},
- {ZString("slavelt"), MobSkillCondition::MSC_SLAVELT},
- {ZString("slavele"), MobSkillCondition::MSC_SLAVELE},
+ {"always"_s, MobSkillCondition::MSC_ALWAYS},
+ {"myhpltmaxrate"_s, MobSkillCondition::MSC_MYHPLTMAXRATE},
+ {"notintown"_s, MobSkillCondition::MSC_NOTINTOWN},
+ {"slavelt"_s, MobSkillCondition::MSC_SLAVELT},
+ {"slavele"_s, MobSkillCondition::MSC_SLAVELE},
};
for (auto& pair : cond1)
if (str == pair.str)
@@ -3604,14 +3598,14 @@ bool extract<MobSkillState, void, void>(XString str, MobSkillState *mss)
{
const struct
{
- ZString str;
+ LString str;
MobSkillState id;
} state[] =
{
- {ZString("any"), MobSkillState::ANY},
- {ZString("idle"), MobSkillState::MSS_IDLE},
- {ZString("walk"), MobSkillState::MSS_WALK},
- {ZString("attack"), MobSkillState::MSS_ATTACK},
+ {"any"_s, MobSkillState::ANY},
+ {"idle"_s, MobSkillState::MSS_IDLE},
+ {"walk"_s, MobSkillState::MSS_WALK},
+ {"attack"_s, MobSkillState::MSS_ATTACK},
};
for (auto& pair : state)
if (str == pair.str)
@@ -3627,12 +3621,12 @@ bool extract<MobSkillTarget, void, void>(XString str, MobSkillTarget *mst)
{
const struct
{
- ZString str;
+ LString str;
MobSkillTarget id;
} target[] =
{
- {ZString("target"), MobSkillTarget::MST_TARGET},
- {ZString("self"), MobSkillTarget::MST_SELF},
+ {"target"_s, MobSkillTarget::MST_TARGET},
+ {"self"_s, MobSkillTarget::MST_SELF},
};
for (auto& pair : target)
if (str == pair.str)
@@ -3650,7 +3644,7 @@ bool mob_readskilldb(ZString filename)
io::ReadFile in(filename);
if (!in.is_open())
{
- PRINTF("can't read %s\n", filename);
+ PRINTF("can't read %s\n"_fmt, filename);
return false;
}
AString line;
@@ -3662,7 +3656,7 @@ bool mob_readskilldb(ZString filename)
continue;
XString blah;
- if (extract(line, record<','>(&mob_id, &blah)) && mob_id > 0 && blah == "clear")
+ if (extract(line, record<','>(&mob_id, &blah)) && mob_id > 0 && blah == "clear"_s)
{
mob_db[mob_id].skills.clear();
continue;
@@ -3699,9 +3693,9 @@ bool mob_readskilldb(ZString filename)
)
)
continue;
- if (cancellable == "yes")
+ if (cancellable == "yes"_s)
msv.cancel = true;
- else if (cancellable == "no")
+ else if (cancellable == "no"_s)
msv.cancel = false;
else
{
@@ -3720,7 +3714,7 @@ bool mob_readskilldb(ZString filename)
mob_db[mob_id].skills.push_back(std::move(msv));
}
- PRINTF("read %s done\n", filename);
+ PRINTF("read %s done\n"_fmt, filename);
}
return rv;
}
diff --git a/src/map/mob.hpp b/src/map/mob.hpp
index e7d81bd..570b5a9 100644
--- a/src/map/mob.hpp
+++ b/src/map/mob.hpp
@@ -34,9 +34,9 @@
# include "map.hpp"
# include "skill.t.hpp"
-# define ENGLISH_NAME stringish<MobName>("--en--")
-# define JAPANESE_NAME stringish<MobName>("--ja--")
-# define MOB_THIS_MAP stringish<MapName>("this")
+# define ENGLISH_NAME stringish<MobName>("--en--"_s)
+# define JAPANESE_NAME stringish<MobName>("--ja--"_s)
+# define MOB_THIS_MAP stringish<MapName>("this"_s)
struct mob_skill
{
diff --git a/src/map/npc.cpp b/src/map/npc.cpp
index 7fe13f1..3cef7c0 100644
--- a/src/map/npc.cpp
+++ b/src/map/npc.cpp
@@ -107,7 +107,7 @@ void npc_enable_sub(dumb_ptr<block_list> bl, dumb_ptr<npc_data> nd)
NpcEvent aname;
aname.npc = nd->name;
- aname.label = stringish<ScriptLabel>("OnTouch");
+ aname.label = stringish<ScriptLabel>("OnTouch"_s);
if (sd->areanpc_id == nd->bl_id)
return;
sd->areanpc_id = nd->bl_id;
@@ -120,7 +120,7 @@ int npc_enable(NpcName name, bool flag)
dumb_ptr<npc_data> nd = npc_name2id(name);
if (nd == NULL)
{
- PRINTF("npc_enable(%s, %s) failed.\n", name, flag ? "true" : "false");
+ PRINTF("npc_enable(%s, %s) failed.\n"_fmt, name, flag ? "true"_s : "false"_s);
return 0;
}
@@ -175,7 +175,7 @@ int npc_event_dequeue(dumb_ptr<map_session_data> sd)
{
if (!pc_addeventtimer(sd, std::chrono::milliseconds(100), sd->eventqueuel.front()))
{
- PRINTF("npc_event_dequeue(): Event timer is full.\n");
+ PRINTF("npc_event_dequeue(): Event timer is full.\n"_fmt);
return 0;
}
@@ -206,7 +206,7 @@ void npc_timer_event(NpcEvent eventname)
if ((ev == NULL || (nd = ev->nd) == NULL))
{
- PRINTF("npc_event: event not found [%s]\n",
+ PRINTF("npc_event: event not found [%s]\n"_fmt,
eventname);
return;
}
@@ -283,19 +283,19 @@ void npc_event_do_clock(TimerData *, tick_t)
ScriptLabel buf;
if (t.tm_min != ev_tm_b.tm_min)
{
- SNPRINTF(buf, 24, "OnMinute%02d", t.tm_min);
+ SNPRINTF(buf, 24, "OnMinute%02d"_fmt, t.tm_min);
npc_event_doall(buf);
- SNPRINTF(buf, 24, "OnClock%02d%02d", t.tm_hour, t.tm_min);
+ SNPRINTF(buf, 24, "OnClock%02d%02d"_fmt, t.tm_hour, t.tm_min);
npc_event_doall(buf);
}
if (t.tm_hour != ev_tm_b.tm_hour)
{
- SNPRINTF(buf, 24, "OnHour%02d", t.tm_hour);
+ SNPRINTF(buf, 24, "OnHour%02d"_fmt, t.tm_hour);
npc_event_doall(buf);
}
if (t.tm_mday != ev_tm_b.tm_mday)
{
- SNPRINTF(buf, 24, "OnDay%02d%02d", t.tm_mon + 1, t.tm_mday);
+ SNPRINTF(buf, 24, "OnDay%02d%02d"_fmt, t.tm_mon + 1, t.tm_mday);
npc_event_doall(buf);
}
ev_tm_b = t;
@@ -307,8 +307,8 @@ void npc_event_do_clock(TimerData *, tick_t)
*/
int npc_event_do_oninit(void)
{
- int c = npc_event_doall(stringish<ScriptLabel>("OnInit"));
- PRINTF("npc: OnInit Event done. (%d npc)\n", c);
+ int c = npc_event_doall(stringish<ScriptLabel>("OnInit"_s));
+ PRINTF("npc: OnInit Event done. (%d npc)\n"_fmt, c);
Timer(gettick() + std::chrono::milliseconds(100),
npc_event_do_clock,
@@ -463,10 +463,10 @@ int npc_event(dumb_ptr<map_session_data> sd, NpcEvent eventname,
if (sd == NULL)
{
- PRINTF("npc_event nullpo?\n");
+ PRINTF("npc_event nullpo?\n"_fmt);
}
- if (ev == NULL && eventname.label == stringish<ScriptLabel>("OnTouch"))
+ if (ev == NULL && eventname.label == stringish<ScriptLabel>("OnTouch"_s))
return 1;
if (ev == NULL || (nd = ev->nd) == NULL)
@@ -480,7 +480,7 @@ int npc_event(dumb_ptr<map_session_data> sd, NpcEvent eventname,
else
{
if (battle_config.error_log)
- PRINTF("npc_event: event not found [%s]\n",
+ PRINTF("npc_event: event not found [%s]\n"_fmt,
eventname);
return 0;
}
@@ -521,7 +521,7 @@ static
void npc_command_sub(NpcEvent key, struct event_data *ev, NpcName npcname, XString command)
{
if (ev->nd->name == npcname
- && key.label.startswith("OnCommand"))
+ && key.label.startswith("OnCommand"_s))
{
XString temp = key.label.xslice_t(9);
@@ -567,7 +567,7 @@ int npc_touch_areanpc(dumb_ptr<map_session_data> sd, map_local *m, int x, int y)
ys = m->npc[i]->is_warp()->warp.ys;
break;
case NpcSubtype::MESSAGE:
- assert (0 && "I'm pretty sure these are never put on a map");
+ assert (0 && "I'm pretty sure these are never put on a map"_s);
xs = 0;
ys = 0;
break;
@@ -589,7 +589,7 @@ int npc_touch_areanpc(dumb_ptr<map_session_data> sd, map_local *m, int x, int y)
if (f)
{
if (battle_config.error_log)
- PRINTF("npc_touch_areanpc : some bug \n");
+ PRINTF("npc_touch_areanpc : some bug \n"_fmt);
}
return 1;
}
@@ -601,13 +601,13 @@ int npc_touch_areanpc(dumb_ptr<map_session_data> sd, map_local *m, int x, int y)
m->npc[i]->is_warp()->warp.x, m->npc[i]->is_warp()->warp.y, BeingRemoveWhy::GONE);
break;
case NpcSubtype::MESSAGE:
- assert (0 && "I'm pretty sure these NPCs are never put on a map.");
+ assert (0 && "I'm pretty sure these NPCs are never put on a map."_s);
break;
case NpcSubtype::SCRIPT:
{
NpcEvent aname;
aname.npc = m->npc[i]->name;
- aname.label = stringish<ScriptLabel>("OnTouch");
+ aname.label = stringish<ScriptLabel>("OnTouch"_s);
if (sd->areanpc_id == m->npc[i]->bl_id)
return 1;
@@ -666,7 +666,7 @@ int npc_click(dumb_ptr<map_session_data> sd, int id)
if (sd->npc_id != 0)
{
if (battle_config.error_log)
- PRINTF("npc_click: npc_id != 0\n");
+ PRINTF("npc_click: npc_id != 0\n"_fmt);
return 1;
}
@@ -751,7 +751,7 @@ int npc_buysellsel(dumb_ptr<map_session_data> sd, int id, int type)
if (nd->npc_subtype != NpcSubtype::SHOP)
{
if (battle_config.error_log)
- PRINTF("no such shop npc : %d\n", id);
+ PRINTF("no such shop npc : %d\n"_fmt, id);
sd->npc_id = 0;
return 1;
}
@@ -927,7 +927,7 @@ void npc_clearsrcfile(void)
*/
void npc_addsrcfile(AString name)
{
- if (name == "clear")
+ if (name == "clear"_s)
{
npc_clearsrcfile();
return;
@@ -942,7 +942,7 @@ void npc_addsrcfile(AString name)
*/
void npc_delsrcfile(XString name)
{
- if (name == "all")
+ if (name == "all"_s)
{
npc_clearsrcfile();
return;
@@ -961,19 +961,19 @@ void npc_delsrcfile(XString name)
static
void register_npc_name(dumb_ptr<npc_data> nd)
{
- ZString types[4] =
- {
- {"WARP"},
- {"SHOP"},
- {"SCRIPT"},
- {"MESSAGE"},
- };
+ earray<LString, NpcSubtype, NpcSubtype::COUNT> types //=
+ {{
+ "WARP"_s,
+ "SHOP"_s,
+ "SCRIPT"_s,
+ "MESSAGE"_s,
+ }};
if (!nd->name)
{
if (nd->npc_subtype == NpcSubtype::MESSAGE)
return;
- PRINTF("WARNING: npc with no name:\n%s @ %s,%d,%d\n",
- types[static_cast<int>(nd->npc_subtype)],
+ PRINTF("WARNING: npc with no name:\n%s @ %s,%d,%d\n"_fmt,
+ types[nd->npc_subtype],
nd->bl_m->name_, nd->bl_x, nd->bl_y);
return;
}
@@ -982,12 +982,12 @@ void register_npc_name(dumb_ptr<npc_data> nd)
if (nd->npc_subtype != NpcSubtype::WARP
|| nd_old->npc_subtype != NpcSubtype::WARP)
{
- PRINTF("WARNING: replacing npc with name: %s\n", nd->name);
- PRINTF("old: %s @ %s,%d,%d\n",
- types[static_cast<int>(nd_old->npc_subtype)],
+ PRINTF("WARNING: replacing npc with name: %s\n"_fmt, nd->name);
+ PRINTF("old: %s @ %s,%d,%d\n"_fmt,
+ types[nd_old->npc_subtype],
nd_old->bl_m->name_, nd_old->bl_x, nd_old->bl_y);
- PRINTF("new: %s @ %s,%d,%d\n",
- types[static_cast<int>(nd->npc_subtype)],
+ PRINTF("new: %s @ %s,%d,%d\n"_fmt,
+ types[nd->npc_subtype],
nd->bl_m->name_, nd->bl_x, nd->bl_y);
}
}
@@ -1009,7 +1009,7 @@ int npc_parse_warp(XString w1, XString, NpcName w3, XString w4)
if (!extract(w1, record<','>(&mapname, &x, &y)) ||
!extract(w4, record<','>(&xs, &ys, &to_mapname, &to_x, &to_y)))
{
- PRINTF("bad warp line : %s\n", w3);
+ PRINTF("bad warp line : %s\n"_fmt, w3);
return 1;
}
@@ -1059,7 +1059,6 @@ int npc_parse_warp(XString w1, XString, NpcName w3, XString w4)
}
}
-// PRINTF("warp npc %s %d read done\n",mapname,nd->bl_id);
npc_warp++;
nd->bl_type = BL::NPC;
nd->npc_subtype = NpcSubtype::WARP;
@@ -1116,7 +1115,7 @@ int npc_parse_shop(XString w1, XString, NpcName w3, ZString w4a)
|| (w4comma = std::find(w4a.begin(), w4a.end(), ',')) == w4a.end()
|| !extract(w4a.xislice_h(w4comma), &npc_class))
{
- PRINTF("bad shop line : %s\n", w3);
+ PRINTF("bad shop line : %s\n"_fmt, w3);
return 1;
}
dir = static_cast<DIR>(dir_);
@@ -1127,8 +1126,8 @@ int npc_parse_shop(XString w1, XString, NpcName w3, ZString w4a)
if (!extract(w4b, vrec<','>(&nd->shop_items)))
{
- PRINTF("bad shop items : %s\n", w3);
- PRINTF(" somewhere --> %s\n", w4b);
+ PRINTF("bad shop items : %s\n"_fmt, w3);
+ PRINTF(" somewhere --> %s\n"_fmt, w4b);
nd->shop_items.clear();
}
@@ -1196,7 +1195,7 @@ int npc_parse_script(XString w1, XString w2, NpcName w3, ZString w4,
dumb_ptr<npc_data_script> nd;
int evflag = 0;
- if (w1 == "-")
+ if (w1 == "-"_s)
{
x = 0;
y = 0;
@@ -1207,16 +1206,16 @@ int npc_parse_script(XString w1, XString w2, NpcName w3, ZString w4,
int dir_; // TODO use enum directly in extract
if (!extract(w1, record<','>(&mapname, &x, &y, &dir_))
|| dir_ < 0 || dir_ >= 8
- || (w2 == "script" && !w4.contains(',')))
+ || (w2 == "script"_s && !w4.contains(',')))
{
- PRINTF("bad script line : %s\n", w3);
+ PRINTF("bad script line : %s\n"_fmt, w3);
return 1;
}
dir = static_cast<DIR>(dir_);
m = map_mapname2mapid(mapname);
}
- if (w2 == "script")
+ if (w2 == "script"_s)
{
// may be empty
MString srcbuf;
@@ -1255,7 +1254,7 @@ int npc_parse_script(XString w1, XString w2, NpcName w3, ZString w4,
}
else
{
- assert(0 && "duplicate() is no longer supported!\n");
+ assert(0 && "duplicate() is no longer supported!\n"_s);
return 0;
}
@@ -1307,7 +1306,7 @@ int npc_parse_script(XString w1, XString w2, NpcName w3, ZString w4,
if (w3.contains(':'))
{
- assert(false && "feature removed");
+ assert(false && "feature removed"_s);
abort();
}
{
@@ -1329,7 +1328,6 @@ int npc_parse_script(XString w1, XString w2, NpcName w3, ZString w4,
nd->opt2 = Opt2::ZERO;
nd->opt3 = Opt3::ZERO;
- //PRINTF("script npc %s %d %d read done\n",mapname,nd->bl_id,nd->class);
npc_script++;
nd->bl_type = BL::NPC;
nd->npc_subtype = NpcSubtype::SCRIPT;
@@ -1361,7 +1359,7 @@ int npc_parse_script(XString w1, XString w2, NpcName w3, ZString w4,
ScriptLabel lname = el.name;
int pos = el.pos;
- if (lname.startswith("On"))
+ if (lname.startswith("On"_s))
{
struct event_data ev {};
ev.nd = nd;
@@ -1380,7 +1378,7 @@ int npc_parse_script(XString w1, XString w2, NpcName w3, ZString w4,
int t_ = 0;
ScriptLabel lname = el.name;
int pos = el.pos;
- if (lname.startswith("OnTimer") && extract(lname.xslice_t(7), &t_) && t_ > 0)
+ if (lname.startswith("OnTimer"_s) && extract(lname.xslice_t(7), &t_) && t_ > 0)
{
interval_t t = static_cast<interval_t>(t_);
@@ -1469,7 +1467,7 @@ int npc_parse_mob(XString w1, XString, MobName w3, ZString w4)
if (!extract(w1, record<',', 3>(&mapname, &x, &y, &xs, &ys)) ||
!extract(w4, record<',', 2>(&mob_class, &num, &delay1_, &delay2_, &eventname)))
{
- PRINTF("bad monster line : %s\n", w3);
+ PRINTF("bad monster line : %s\n"_fmt, w3);
return 1;
}
interval_t delay1 = std::chrono::milliseconds(delay1_);
@@ -1525,7 +1523,6 @@ int npc_parse_mob(XString w1, XString, MobName w3, ZString w4)
npc_mob++;
}
- //PRINTF("warp npc %s %d read done\n",mapname,nd->bl_id);
return 0;
}
@@ -1561,9 +1558,9 @@ int npc_parse_mapflag(XString w1, XString, XString w3, ZString w4)
if (mf == MapFlag::NOSAVE)
{
- if (w4 == "SavePoint")
+ if (w4 == "SavePoint"_s)
{
- m->save.map_ = stringish<MapName>("SavePoint");
+ m->save.map_ = stringish<MapName>("SavePoint"_s);
m->save.x = -1;
m->save.y = -1;
}
@@ -1679,11 +1676,11 @@ bool do_init_npc(void)
io::ReadFile fp(nsl);
if (!fp.is_open())
{
- PRINTF("file not found : %s\n", nsl);
+ PRINTF("file not found : %s\n"_fmt, nsl);
rv = false;
continue;
}
- PRINTF("\rLoading NPCs [%d]: %-54s", npc_id - START_NPC_NUM,
+ PRINTF("\rLoading NPCs [%d]: %-54s"_fmt, npc_id - START_NPC_NUM,
nsl);
int lines = 0;
AString zline;
@@ -1698,7 +1695,7 @@ bool do_init_npc(void)
if (!extract(zline, record<'|', 3>(&w1, &w2, &w3, &w4x)) || !w1 || !w2 || !w3)
{
- FPRINTF(stderr, "%s:%d: Broken script line: %s\n", nsl, lines, zline);
+ FPRINTF(stderr, "%s:%d: Broken script line: %s\n"_fmt, nsl, lines, zline);
rv = false;
continue;
}
@@ -1708,7 +1705,7 @@ bool do_init_npc(void)
}
assert(bool(w4x) == bool(w4z));
- if (w1 != "-" && w1 != "function")
+ if (w1 != "-"_s && w1 != "function"_s)
{
auto comma = std::find(w1.begin(), w1.end(), ',');
MapName mapname = stringish<MapName>(w1.xislice_h(comma));
@@ -1716,24 +1713,24 @@ bool do_init_npc(void)
if (m == nullptr)
{
// "mapname" is not assigned to this server
- FPRINTF(stderr, "%s:%d: Map not found: %s\n", nsl, lines, mapname);
+ FPRINTF(stderr, "%s:%d: Map not found: %s\n"_fmt, nsl, lines, mapname);
rv = false;
continue;
}
}
- if (w2 == "warp")
+ if (w2 == "warp"_s)
{
NpcName npcname = stringish<NpcName>(w3);
npc_parse_warp(w1, w2, npcname, w4z);
}
- else if (w2 == "shop")
+ else if (w2 == "shop"_s)
{
NpcName npcname = stringish<NpcName>(w3);
npc_parse_shop(w1, w2, npcname, w4z);
}
- else if (w2 == "script")
+ else if (w2 == "script"_s)
{
- if (w1 == "function")
+ if (w1 == "function"_s)
{
npc_parse_function(w1, w2, w3, w4z,
w4x, fp, &lines);
@@ -1745,29 +1742,29 @@ bool do_init_npc(void)
w4x, fp, &lines);
}
}
- else if (w2 == "monster")
+ else if (w2 == "monster"_s)
{
MobName mobname = stringish<MobName>(w3);
npc_parse_mob(w1, w2, mobname, w4z);
}
- else if (w2 == "mapflag")
+ else if (w2 == "mapflag"_s)
{
npc_parse_mapflag(w1, w2, w3, w4z);
}
else
{
- PRINTF("odd script line: %s\n", zline);
+ PRINTF("odd script line: %s\n"_fmt, zline);
script_errors++;
}
}
fflush(stdout);
}
- PRINTF("\rNPCs Loaded: %d [Warps:%d Shops:%d Scripts:%d Mobs:%d] %20s\n",
- npc_id - START_NPC_NUM, npc_warp, npc_shop, npc_script, npc_mob, "");
+ PRINTF("\rNPCs Loaded: %d [Warps:%d Shops:%d Scripts:%d Mobs:%d] %20s\n"_fmt,
+ npc_id - START_NPC_NUM, npc_warp, npc_shop, npc_script, npc_mob, ""_s);
if (script_errors)
{
- PRINTF("Cowardly refusing to continue after %d errors\n", script_errors);
+ PRINTF("Cowardly refusing to continue after %d errors\n"_fmt, script_errors);
rv = false;
}
return rv;
diff --git a/src/map/party.cpp b/src/map/party.cpp
index 75c54cf..876e6bb 100644
--- a/src/map/party.cpp
+++ b/src/map/party.cpp
@@ -121,7 +121,7 @@ void party_created(int account_id, int fail, int party_id, PartyName name)
struct party *p = party_db.search(party_id);
if (p != NULL)
{
- PRINTF("party_created(): ID already exists!\n");
+ PRINTF("party_created(): ID already exists!\n"_fmt);
exit(1);
}
@@ -177,7 +177,7 @@ int party_check_member(struct party *p)
{
sd->status.party_id = 0;
if (battle_config.error_log)
- PRINTF("party: check_member %d[%s] is not member\n",
+ PRINTF("party: check_member %d[%s] is not member\n"_fmt,
sd->status_key.account_id, sd->status_key.name);
}
}
@@ -355,7 +355,7 @@ int party_member_added(int party_id, int account_id, int flag)
if (flag == 0)
{
if (battle_config.error_log)
- PRINTF("party: member added error %d is not online\n",
+ PRINTF("party: member added error %d is not online\n"_fmt,
account_id);
intif_party_leave(party_id, account_id); // キャラ側に登録できなかったため脱退要求を出す
}
@@ -367,7 +367,7 @@ int party_member_added(int party_id, int account_id, int flag)
if (p == NULL)
{
- PRINTF("party_member_added: party %d not found.\n", party_id);
+ PRINTF("party_member_added: party %d not found.\n"_fmt, party_id);
intif_party_leave(party_id, account_id);
return 0;
}
@@ -537,7 +537,7 @@ void party_recv_movemap(int party_id, int account_id, MapName mapname,
struct party_member *m = &p->member[i];
if (m == NULL)
{
- PRINTF("party_recv_movemap nullpo?\n");
+ PRINTF("party_recv_movemap nullpo?\n"_fmt);
return;
}
if (m->account_id == account_id)
@@ -551,7 +551,7 @@ void party_recv_movemap(int party_id, int account_id, MapName mapname,
if (i == MAX_PARTY)
{
if (battle_config.error_log)
- PRINTF("party: not found member %d on %d[%s]", account_id,
+ PRINTF("party: not found member %d on %d[%s]"_fmt, account_id,
party_id, p->name);
return;
}
diff --git a/src/map/path.cpp b/src/map/path.cpp
index f0204a4..5b7ea1f 100644
--- a/src/map/path.cpp
+++ b/src/map/path.cpp
@@ -60,7 +60,7 @@ void push_heap_path(int *heap, struct tmp_path *tp, int index)
if (heap == NULL || tp == NULL)
{
- PRINTF("push_heap_path nullpo\n");
+ PRINTF("push_heap_path nullpo\n"_fmt);
return;
}
@@ -90,7 +90,7 @@ void update_heap_path(int *heap, struct tmp_path *tp, int index)
break;
if (h == heap[0])
{
- FPRINTF(stderr, "update_heap_path bug\n");
+ FPRINTF(stderr, "update_heap_path bug\n"_fmt);
exit(1);
}
for (i = (h - 1) / 2;
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 0256eff..eecaece 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -86,7 +86,7 @@ constexpr int MAGIC_SKILL_THRESHOLD = 200;
MAP_LOG_PC(sd, "XP %d %d JOB %d %d %d ZENY %d + %d " suffix, \
sd->status.base_level, sd->status.base_exp, \
sd->status.job_level, sd->status.job_exp, sd->status.skill_point, \
- sd->status.zeny, pc_readaccountreg(sd, stringish<VarName>("BankAccount")))
+ sd->status.zeny, pc_readaccountreg(sd, stringish<VarName>("BankAccount"_s)))
#define MAP_LOG_MAGIC(sd, suffix) \
MAP_LOG_PC(sd, "MAGIC %d %d %d %d %d %d EXP %d %d " suffix, \
@@ -96,8 +96,8 @@ constexpr int MAGIC_SKILL_THRESHOLD = 200;
sd->status.skill[SkillID::TMW_MAGIC_TRANSMUTE].lv, \
sd->status.skill[SkillID::TMW_MAGIC_NATURE].lv, \
sd->status.skill[SkillID::TMW_MAGIC_ETHER].lv, \
- pc_readglobalreg(sd, stringish<VarName>("MAGIC_EXPERIENCE")) & 0xffff, \
- (pc_readglobalreg(sd, stringish<VarName>("MAGIC_EXPERIENCE")) >> 24) & 0xff)
+ pc_readglobalreg(sd, stringish<VarName>("MAGIC_EXPERIENCE"_s)) & 0xffff, \
+ (pc_readglobalreg(sd, stringish<VarName>("MAGIC_EXPERIENCE"_s)) >> 24) & 0xff)
static //const
int max_weight_base_0 = 20000;
@@ -458,7 +458,7 @@ void pc_makesavestatus(dumb_ptr<map_session_data> sd)
if (sd->bl_m->flag.get(MapFlag::NOSAVE))
{
map_local *m = sd->bl_m;
- if (m->save.map_ == "SavePoint")
+ if (m->save.map_ == "SavePoint"_s)
sd->status.last_point = sd->status.save_point;
else
sd->status.last_point = m->save;
@@ -662,9 +662,9 @@ int pc_authok(int id, int login_id2, TimeT connect_until_time,
return 1;
}
- MAP_LOG_STATS(sd, "LOGIN");
- MAP_LOG_XP(sd, "LOGIN");
- MAP_LOG_MAGIC(sd, "LOGIN");
+ MAP_LOG_STATS(sd, "LOGIN"_fmt);
+ MAP_LOG_XP(sd, "LOGIN"_fmt);
+ MAP_LOG_MAGIC(sd, "LOGIN"_fmt);
really_memzero_this(&sd->state);
// 基本的な初期化
@@ -702,7 +702,7 @@ int pc_authok(int id, int login_id2, TimeT connect_until_time,
// The above is no longer accurate now that we use <chrono>, but
// I'm still not reverting this.
// -o11c
- sd->cast_tick = tick; // + pc_readglobalreg (sd, "MAGIC_CAST_TICK");
+ sd->cast_tick = tick; // + pc_readglobalreg (sd, "MAGIC_CAST_TICK"_s);
// アカウント変数の送信要求
intif_request_accountreg(sd);
@@ -725,10 +725,10 @@ int pc_authok(int id, int login_id2, TimeT connect_until_time,
// This would leak information.
// It's better to make it obvious that players can see you.
if (false && bool(old_option & Option::INVISIBILITY))
- is_atcommand(sd->sess, sd, "@invisible", 0);
+ is_atcommand(sd->sess, sd, "@invisible"_s, 0);
if (bool(old_option & Option::HIDE))
- is_atcommand(sd->sess, sd, "@hide", 0);
+ is_atcommand(sd->sess, sd, "@hide"_s, 0);
// atcommand_hide might already send it, but also might not
clif_changeoption(sd);
}
@@ -765,19 +765,19 @@ int pc_authok(int id, int login_id2, TimeT connect_until_time,
map_addchariddb(sd->status_key.char_id, sd->status_key.name);
//スパノビ用死にカウンターのスクリプト変数からの読み出しとsdへのセット
- sd->die_counter = pc_readglobalreg(sd, stringish<VarName>("PC_DIE_COUNTER"));
+ sd->die_counter = pc_readglobalreg(sd, stringish<VarName>("PC_DIE_COUNTER"_s));
// ステータス初期計算など
pc_calcstatus(sd, 1);
if (pc_isGM(sd))
{
- PRINTF("Connection accepted: character '%s' (account: %d; GM level %d).\n",
+ PRINTF("Connection accepted: character '%s' (account: %d; GM level %d).\n"_fmt,
sd->status_key.name, sd->status_key.account_id, pc_isGM(sd));
clif_updatestatus(sd, SP::GM);
}
else
- PRINTF("Connection accepted: Character '%s' (account: %d).\n",
+ PRINTF("Connection accepted: Character '%s' (account: %d).\n"_fmt,
sd->status_key.name, sd->status_key.account_id);
sd->auto_ban_info.in_progress = 0;
@@ -796,11 +796,11 @@ int pc_authok(int id, int login_id2, TimeT connect_until_time,
// message of the limited time of the account
if (connect_until_time)
{
- // don't display if it's unlimited or unknow value
- char tmpstr[] = WITH_TIMESTAMP("Your account time limit is: ");
- REPLACE_TIMESTAMP(tmpstr, connect_until_time);
+ timestamp_seconds_buffer buffer;
+ stamp_time(buffer, &connect_until_time);
+ AString tmpstr = STRPRINTF("Your account time limit is: %s"_fmt, buffer);
- clif_wis_message(sd->sess, wisp_server_name, const_(tmpstr));
+ clif_wis_message(sd->sess, wisp_server_name, tmpstr);
}
pc_calcstatus(sd, 1);
@@ -817,7 +817,7 @@ void pc_show_motd(dumb_ptr<map_session_data> sd)
// If you remove the sending of this message,
// the license does not permit you to publicly use this software.
- clif_displaymessage(sd->sess, "This server is Free Software, for details type @source in chat or use the tmwa-source tool");
+ clif_displaymessage(sd->sess, "This server is Free Software, for details type @source in chat or use the tmwa-source tool"_s);
sd->state.seen_motd = true;
io::ReadFile in(motd_txt);
@@ -1099,8 +1099,8 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first)
{
argrec_t arg[2] =
{
- {"@slotId", static_cast<int>(i)},
- {"@itemId", sd->inventory_data[index]->nameid},
+ {"@slotId"_s, static_cast<int>(i)},
+ {"@itemId"_s, sd->inventory_data[index]->nameid},
};
run_script_l(ScriptPointer(sd->inventory_data[index]->equip_script.get(), 0),
sd->bl_id, 0,
@@ -1113,8 +1113,8 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first)
//二刀流武器以外
argrec_t arg[2] =
{
- {"@slotId", static_cast<int>(i)},
- {"@itemId", sd->inventory_data[index]->nameid},
+ {"@slotId"_s, static_cast<int>(i)},
+ {"@itemId"_s, sd->inventory_data[index]->nameid},
};
sd->watk += sd->inventory_data[index]->atk;
@@ -1128,8 +1128,8 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first)
{
argrec_t arg[2] =
{
- {"@slotId", static_cast<int>(i)},
- {"@itemId", sd->inventory_data[index]->nameid},
+ {"@slotId"_s, static_cast<int>(i)},
+ {"@itemId"_s, sd->inventory_data[index]->nameid},
};
sd->watk += sd->inventory_data[index]->atk;
run_script_l(ScriptPointer(sd->inventory_data[index]->equip_script.get(), 0),
@@ -1155,8 +1155,8 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first)
{ //まだ属性が入っていない
argrec_t arg[2] =
{
- {"@slotId", static_cast<int>(EQUIP::ARROW)},
- {"@itemId", sd->inventory_data[index]->nameid},
+ {"@slotId"_s, static_cast<int>(EQUIP::ARROW)},
+ {"@itemId"_s, sd->inventory_data[index]->nameid},
};
sd->state.lr_flag = 2;
run_script_l(ScriptPointer(sd->inventory_data[index]->equip_script.get(), 0),
@@ -1206,7 +1206,6 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first)
}
dstr = str / 10;
sd->base_atk += str + dstr * dstr + dex / 5 + sd->paramc[ATTR::LUK] / 5;
-//FPRINTF(stderr, "baseatk = %d = x + %d + %d + %d + %d\n", sd->base_atk, str, dstr*dstr, dex/5, sd->paramc[ATTR::LUK]/5);
sd->matk1 += sd->paramc[ATTR::INT] + (sd->paramc[ATTR::INT] / 5) * (sd->paramc[ATTR::INT] / 5);
sd->matk2 += sd->paramc[ATTR::INT] + (sd->paramc[ATTR::INT] / 7) * (sd->paramc[ATTR::INT] / 7);
if (sd->matk1 < sd->matk2)
@@ -1731,7 +1730,7 @@ int pc_bonus(dumb_ptr<map_session_data> sd, SP type, int val)
break;
default:
if (battle_config.error_log)
- PRINTF("pc_bonus: unknown type %d %d !\n",
+ PRINTF("pc_bonus: unknown type %d %d !\n"_fmt,
type, val);
break;
}
@@ -1776,7 +1775,7 @@ int pc_bonus2(dumb_ptr<map_session_data> sd, SP type, int type2, int val)
#endif
default:
if (battle_config.error_log)
- PRINTF("pc_bonus2: unknown type %d %d %d!\n",
+ PRINTF("pc_bonus2: unknown type %d %d %d!\n"_fmt,
type, type2, val);
break;
}
@@ -1794,7 +1793,7 @@ int pc_skill(dumb_ptr<map_session_data> sd, SkillID id, int level, int flag)
if (level > MAX_SKILL_LEVEL)
{
if (battle_config.error_log)
- PRINTF("support card skill only!\n");
+ PRINTF("support card skill only!\n"_fmt);
return 0;
}
if (!flag && (sd->status.skill[id].lv || level == 0))
@@ -1970,7 +1969,7 @@ PickupFail pc_additem(dumb_ptr<map_session_data> sd, struct item *item_data,
struct item_data *data;
int i, w;
- MAP_LOG_PC(sd, "PICKUP %d %d", item_data->nameid, amount);
+ MAP_LOG_PC(sd, "PICKUP %d %d"_fmt, item_data->nameid, amount);
nullpo_retr(PickupFail::BAD_ITEM, sd);
nullpo_retr(PickupFail::BAD_ITEM, item_data);
@@ -2314,7 +2313,7 @@ int pc_setpos(dumb_ptr<map_session_data> sd,
if (x || y)
{
if (battle_config.error_log)
- PRINTF("stacked (%d,%d)\n", x, y);
+ PRINTF("stacked (%d,%d)\n"_fmt, x, y);
}
do
{
@@ -2915,7 +2914,7 @@ int pc_checkbaselevelup(dumb_ptr<map_session_data> sd)
//レベルアップしたのでパーティー情報を更新する
//(公平範囲チェック)
party_send_movemap(sd);
- MAP_LOG_XP(sd, "LEVELUP");
+ MAP_LOG_XP(sd, "LEVELUP"_fmt);
return 1;
}
@@ -2971,7 +2970,7 @@ int pc_checkjoblevelup(dumb_ptr<map_session_data> sd)
clif_updatestatus(sd, SP::SKILLPOINT);
pc_calcstatus(sd, 0);
- MAP_LOG_PC(sd, "SKILLPOINTS-UP %d", sd->status.skill_point);
+ MAP_LOG_PC(sd, "SKILLPOINTS-UP %d"_fmt, sd->status.skill_point);
if (sd->status.job_level < 250
&& sd->status.job_level < sd->status.base_level * 2)
@@ -2992,16 +2991,16 @@ int pc_gainexp_reason(dumb_ptr<map_session_data> sd, int base_exp, int job_exp,
if (sd->bl_prev == NULL || pc_isdead(sd))
return 0;
- earray<const char *, PC_GAINEXP_REASON, PC_GAINEXP_REASON::COUNT> reasons //=
+ earray<LString, PC_GAINEXP_REASON, PC_GAINEXP_REASON::COUNT> reasons //=
{{
- "KILLXP",
- "HEALXP",
- "SCRIPTXP",
- "SHAREXP",
+ "KILLXP"_s,
+ "HEALXP"_s,
+ "SCRIPTXP"_s,
+ "SHAREXP"_s,
/* Insert new types here */
- "UNKNOWNXP"
+ "UNKNOWNXP"_s
}};
- MAP_LOG_PC(sd, "GAINXP %d %d %s", base_exp, job_exp, reasons[reason]);
+ MAP_LOG_PC(sd, "GAINXP %d %d %s"_fmt, base_exp, job_exp, reasons[reason]);
if (!battle_config.multi_level_up && pc_nextbaseafter(sd))
{
@@ -3053,7 +3052,7 @@ int pc_gainexp_reason(dumb_ptr<map_session_data> sd, int base_exp, int job_exp,
if (battle_config.disp_experience)
{
AString output = STRPRINTF(
- "Experienced Gained Base:%d Job:%d",
+ "Experienced Gained Base:%d Job:%d"_fmt,
base_exp, job_exp);
clif_displaymessage(sd->sess, output);
}
@@ -3181,7 +3180,7 @@ int pc_statusup(dumb_ptr<map_session_data> sd, SP type)
pc_calcstatus(sd, 0);
clif_statusupack(sd, type, 1, val);
- MAP_LOG_STATS(sd, "STATUP");
+ MAP_LOG_STATS(sd, "STATUP"_fmt);
return 0;
}
@@ -3208,7 +3207,7 @@ int pc_statusup2(dumb_ptr<map_session_data> sd, SP type, int val)
clif_updatestatus(sd, type);
pc_calcstatus(sd, 0);
clif_statusupack(sd, type, 1, val);
- MAP_LOG_STATS(sd, "STATUP2");
+ MAP_LOG_STATS(sd, "STATUP2"_fmt);
return 0;
}
@@ -3232,7 +3231,7 @@ int pc_skillup(dumb_ptr<map_session_data> sd, SkillID skill_num)
clif_skillup(sd, skill_num);
clif_updatestatus(sd, SP::SKILLPOINT);
clif_skillinfoblock(sd);
- MAP_LOG_PC(sd, "SKILLUP %d %d %d",
+ MAP_LOG_PC(sd, "SKILLUP %d %d %d"_fmt,
skill_num, sd->status.skill[skill_num].lv,
skill_power(sd, skill_num));
}
@@ -3323,7 +3322,7 @@ int pc_resetlvl(dumb_ptr<map_session_data> sd, int type)
clif_skillinfoblock(sd);
pc_calcstatus(sd, 0);
- MAP_LOG_STATS(sd, "STATRESET");
+ MAP_LOG_STATS(sd, "STATRESET"_fmt);
return 0;
}
@@ -3401,17 +3400,17 @@ int pc_damage(dumb_ptr<block_list> src, dumb_ptr<map_session_data> sd,
{
if (src->bl_type == BL::PC)
{
- MAP_LOG_PC(sd, "INJURED-BY PC%d FOR %d",
+ MAP_LOG_PC(sd, "INJURED-BY PC%d FOR %d"_fmt,
src->is_player()->status_key.char_id,
damage);
}
else
{
- MAP_LOG_PC(sd, "INJURED-BY MOB%d FOR %d", src->bl_id, damage);
+ MAP_LOG_PC(sd, "INJURED-BY MOB%d FOR %d"_fmt, src->bl_id, damage);
}
}
else
- MAP_LOG_PC(sd, "INJURED-BY null FOR %d", damage);
+ MAP_LOG_PC(sd, "INJURED-BY null FOR %d"_fmt, damage);
pc_stop_walking(sd, 3);
// 演奏/ダンスの中断
@@ -3437,7 +3436,7 @@ int pc_damage(dumb_ptr<block_list> src, dumb_ptr<map_session_data> sd,
return 0;
}
- MAP_LOG_PC(sd, "DEAD%s", "");
+ MAP_LOG_PC(sd, "DEAD%s"_fmt, ""_s);
// Character is dead!
@@ -3452,7 +3451,7 @@ int pc_damage(dumb_ptr<block_list> src, dumb_ptr<map_session_data> sd,
pc_stop_walking(sd, 0);
skill_castcancel(sd, 0); // 詠唱の中止
clif_clearchar(sd, BeingRemoveWhy::DEAD);
- pc_setglobalreg(sd, stringish<VarName>("PC_DIE_COUNTER"), ++sd->die_counter); //死にカウンター書き込み
+ pc_setglobalreg(sd, stringish<VarName>("PC_DIE_COUNTER"_s), ++sd->die_counter); //死にカウンター書き込み
skill_status_change_clear(sd, 0); // ステータス異常を解除する
clif_updatestatus(sd, SP::HP);
pc_calcstatus(sd, 0);
@@ -3544,14 +3543,14 @@ int pc_damage(dumb_ptr<block_list> src, dumb_ptr<map_session_data> sd,
// [Fate] PK death, trigger scripts
argrec_t arg[3] =
{
- {"@killerrid", src->bl_id},
- {"@victimrid", sd->bl_id},
- {"@victimlvl", sd->status.base_level},
+ {"@killerrid"_s, src->bl_id},
+ {"@victimrid"_s, sd->bl_id},
+ {"@victimlvl"_s, sd->status.base_level},
};
- npc_event_doall_l(stringish<ScriptLabel>("OnPCKilledEvent"), sd->bl_id, arg);
- npc_event_doall_l(stringish<ScriptLabel>("OnPCKillEvent"), src->bl_id, arg);
+ npc_event_doall_l(stringish<ScriptLabel>("OnPCKilledEvent"_s), sd->bl_id, arg);
+ npc_event_doall_l(stringish<ScriptLabel>("OnPCKillEvent"_s), src->bl_id, arg);
}
- npc_event_doall_l(stringish<ScriptLabel>("OnPCDieEvent"), sd->bl_id, nullptr);
+ npc_event_doall_l(stringish<ScriptLabel>("OnPCDieEvent"_s), sd->bl_id, nullptr);
return 0;
}
@@ -3762,9 +3761,6 @@ 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)
{
-// if(battle_config.battle_log)
-// PRINTF("heal %d %d\n",hp,sp);
-
nullpo_ret(sd);
if (pc_checkoverhp(sd))
@@ -4139,7 +4135,7 @@ int pc_setglobalreg(dumb_ptr<map_session_data> sd, VarName reg, int val)
nullpo_ret(sd);
//PC_DIE_COUNTERがスクリプトなどで変更された時の処理
- if (reg == stringish<VarName>("PC_DIE_COUNTER") && sd->die_counter != val)
+ if (reg == stringish<VarName>("PC_DIE_COUNTER"_s) && sd->die_counter != val)
{
sd->die_counter = val;
pc_calcstatus(sd, 0);
@@ -4175,7 +4171,7 @@ int pc_setglobalreg(dumb_ptr<map_session_data> sd, VarName reg, int val)
return 0;
}
if (battle_config.error_log)
- PRINTF("pc_setglobalreg : couldn't set %s (GLOBAL_REG_NUM = %d)\n",
+ PRINTF("pc_setglobalreg : couldn't set %s (GLOBAL_REG_NUM = %d)\n"_fmt,
reg, GLOBAL_REG_NUM);
return 1;
@@ -4244,7 +4240,7 @@ int pc_setaccountreg(dumb_ptr<map_session_data> sd, VarName reg, int val)
return 0;
}
if (battle_config.error_log)
- PRINTF("pc_setaccountreg : couldn't set %s (ACCOUNT_REG_NUM = %d)\n",
+ PRINTF("pc_setaccountreg : couldn't set %s (ACCOUNT_REG_NUM = %d)\n"_fmt,
reg, ACCOUNT_REG_NUM);
return 1;
@@ -4312,7 +4308,7 @@ int pc_setaccountreg2(dumb_ptr<map_session_data> sd, VarName reg, int val)
return 0;
}
if (battle_config.error_log)
- PRINTF("pc_setaccountreg2 : couldn't set %s (ACCOUNT_REG2_NUM = %d)\n",
+ PRINTF("pc_setaccountreg2 : couldn't set %s (ACCOUNT_REG2_NUM = %d)\n"_fmt,
reg, ACCOUNT_REG2_NUM);
return 1;
@@ -4414,7 +4410,7 @@ int pc_equipitem(dumb_ptr<map_session_data> sd, int n, EPOS)
EPOS pos = pc_equippoint(sd, n);
if (battle_config.battle_log)
- PRINTF("equip %d (%d) %x:%x\n",
+ PRINTF("equip %d (%d) %x:%x\n"_fmt,
nameid, n, id->equip, pos);
if (!pc_isequip(sd, n) || pos == EPOS::ZERO)
{
@@ -4546,7 +4542,7 @@ int pc_unequipitem(dumb_ptr<map_session_data> sd, int n, CalcStatus type)
// -- moonsoul (if player is berserk then cannot unequip)
//
if (battle_config.battle_log)
- PRINTF("unequip %d %x:%x\n",
+ PRINTF("unequip %d %x:%x\n"_fmt,
n, pc_equippoint(sd, n),
sd->status.inventory[n].equip);
if (bool(sd->status.inventory[n].equip))
@@ -4804,7 +4800,7 @@ int pc_divorce(dumb_ptr<map_session_data> sd)
if (p_sd->status.partner_id != sd->status_key.char_id
|| sd->status.partner_id != p_sd->status_key.char_id)
{
- PRINTF("pc_divorce: Illegal partner_id sd=%d p_sd=%d\n",
+ PRINTF("pc_divorce: Illegal partner_id sd=%d p_sd=%d\n"_fmt,
sd->status.partner_id, p_sd->status.partner_id);
return -1;
}
@@ -5265,13 +5261,13 @@ int pc_logout(dumb_ptr<map_session_data> sd) // [fate] Player logs out
// Removed because it's buggy, see above.
if (sd->cast_tick > tick)
{
- if (pc_setglobalreg(sd, "MAGIC_CAST_TICK", sd->cast_tick - tick))
+ if (pc_setglobalreg(sd, "MAGIC_CAST_TICK"_s, sd->cast_tick - tick))
sd->status.sp = 1;
}
else
#endif
- pc_setglobalreg(sd, stringish<VarName>("MAGIC_CAST_TICK"), 0);
+ pc_setglobalreg(sd, stringish<VarName>("MAGIC_CAST_TICK"_s), 0);
- MAP_LOG_STATS(sd, "LOGOUT");
+ MAP_LOG_STATS(sd, "LOGOUT"_fmt);
return 0;
}
diff --git a/src/map/script.cpp b/src/map/script.cpp
index f4dc68f..0cb702b 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -93,7 +93,7 @@ static
Map<SIR, RString> mapregstr_db;
static
int mapreg_dirty = -1;
-AString mapreg_txt = "save/mapreg.txt";
+AString mapreg_txt = "save/mapreg.txt"_s;
constexpr std::chrono::milliseconds MAPREG_AUTOSAVE_INTERVAL = std::chrono::seconds(10);
Map<ScriptLabel, int> scriptlabel_db;
@@ -102,19 +102,19 @@ std::set<ScriptLabel> probable_labels;
UPMap<RString, const ScriptBuffer> userfunc_db;
static
-Array<ZString, 11> pos_str //=
+Array<LString, 11> pos_str //=
{{
- ZString("Head"),
- ZString("Body"),
- ZString("Left hand"),
- ZString("Right hand"),
- ZString("Robe"),
- ZString("Shoes"),
- ZString("Accessory 1"),
- ZString("Accessory 2"),
- ZString("Head 2"),
- ZString("Head 3"),
- ZString("Not Equipped"),
+ "Head"_s,
+ "Body"_s,
+ "Left hand"_s,
+ "Right hand"_s,
+ "Robe"_s,
+ "Shoes"_s,
+ "Accessory 1"_s,
+ "Accessory 2"_s,
+ "Head 2"_s,
+ "Head 3"_s,
+ "Not Equipped"_s,
}};
static
@@ -150,8 +150,8 @@ void mapreg_setregstr(SIR num, XString str);
struct BuiltinFunction
{
void (*func)(ScriptState *);
- ZString name;
- ZString arg;
+ LString name;
+ LString arg;
};
// defined later
extern BuiltinFunction builtin_functions[];
@@ -382,15 +382,15 @@ void disp_error_message(ZString mes, ZString::iterator pos_)
ZString::iterator lineend = std::find(p, startptr.end(), '\n');
if (pos_ < lineend)
{
- PRINTF("\n%s\nline %d : ", mes, line);
+ PRINTF("\n%s\nline %d : "_fmt, mes, line);
for (int i = 0; linestart + i != lineend; i++)
{
if (linestart + i != pos_)
- PRINTF("%c", linestart[i]);
+ PRINTF("%c"_fmt, linestart[i]);
else
- PRINTF("\'%c\'", linestart[i]);
+ PRINTF("\'%c\'"_fmt, linestart[i]);
}
- PRINTF("\a\n");
+ PRINTF("\a\n"_fmt);
return;
}
p = lineend + 1;
@@ -407,7 +407,7 @@ ZString::iterator ScriptBuffer::parse_simpleexpr(ZString::iterator p)
if (*p == ';' || *p == ',')
{
- disp_error_message("unexpected expr end", p);
+ disp_error_message("unexpected expr end"_s, p);
exit(1);
}
if (*p == '(')
@@ -417,7 +417,7 @@ ZString::iterator ScriptBuffer::parse_simpleexpr(ZString::iterator p)
p = skip_space(p);
if ((*p++) != ')')
{
- disp_error_message("unmatch ')'", p);
+ disp_error_message("unmatch ')'"_s, p);
exit(1);
}
}
@@ -438,14 +438,14 @@ ZString::iterator ScriptBuffer::parse_simpleexpr(ZString::iterator p)
p++;
else if (*p == '\n')
{
- disp_error_message("unexpected newline @ string", p);
+ disp_error_message("unexpected newline @ string"_s, p);
exit(1);
}
add_scriptb(*p++);
}
if (!*p)
{
- disp_error_message("unexpected eof @ string", p);
+ disp_error_message("unexpected eof @ string"_s, p);
exit(1);
}
add_scriptb(0);
@@ -457,35 +457,35 @@ ZString::iterator ScriptBuffer::parse_simpleexpr(ZString::iterator p)
ZString::iterator p2 = skip_word(p);
if (p2 == p)
{
- disp_error_message("unexpected character", p);
+ disp_error_message("unexpected character"_s, p);
exit(1);
}
XString word(&*p, &*p2, nullptr);
- if (word.startswith("On") || word.startswith("L_") || word.startswith("S_"))
+ if (word.startswith("On"_s) || word.startswith("L_"_s) || word.startswith("S_"_s))
probable_labels.insert(stringish<ScriptLabel>(word));
- if (parse_cmd_if && (word == "callsub" || word == "callfunc" || word == "return"))
+ if (parse_cmd_if && (word == "callsub"_s || word == "callfunc"_s || word == "return"_s))
{
- disp_error_message("Sorry, callsub/callfunc/return have never worked properly in an if statement.", p);
+ disp_error_message("Sorry, callsub/callfunc/return have never worked properly in an if statement."_s, p);
}
str_data_t *ld = add_strp(word);
parse_cmdp = ld; // warn_*_mismatch_paramnumのために必要
- // why not just check l->str == "if" or std::string(p, p2) == "if"?
- if (ld == search_strp("if")) // warn_cmd_no_commaのために必要
+ // why not just check l->str == "if"_s or std::string(p, p2) == "if"_s?
+ if (ld == search_strp("if"_s)) // warn_cmd_no_commaのために必要
parse_cmd_if++;
p = p2;
if (ld->type != ByteCode::FUNC_ && *p == '[')
{
// array(name[i] => getelementofarray(name,i) )
- add_scriptl(search_strp("getelementofarray"));
+ add_scriptl(search_strp("getelementofarray"_s));
add_scriptc(ByteCode::ARG);
add_scriptl(ld);
p = parse_subexpr(p + 1, -1);
p = skip_space(p);
if (*p != ']')
{
- disp_error_message("unmatch ']'", p);
+ disp_error_message("unmatch ']'"_s, p);
exit(1);
}
p++;
@@ -515,7 +515,7 @@ ZString::iterator ScriptBuffer::parse_subexpr(ZString::iterator p, int limit)
ZString::iterator tmpp = skip_space(p + 1);
if (*tmpp == ';' || *tmpp == ',')
{
- --script_errors; disp_error_message("deprecated: implicit 'next statement' label", p);
+ --script_errors; disp_error_message("deprecated: implicit 'next statement' label"_s, p);
add_scriptl(&LABEL_NEXTLINE_);
p++;
return p;
@@ -560,7 +560,7 @@ ZString::iterator ScriptBuffer::parse_subexpr(ZString::iterator p, int limit)
if (funcp->type != ByteCode::FUNC_)
{
- disp_error_message("expect function", tmpp);
+ disp_error_message("expect function"_s, tmpp);
exit(0);
}
@@ -574,7 +574,7 @@ ZString::iterator ScriptBuffer::parse_subexpr(ZString::iterator p, int limit)
p++;
else if (*p != ')' && script_config.warn_func_no_comma)
{
- disp_error_message("expect ',' or ')' at func params",
+ disp_error_message("expect ',' or ')' at func params"_s,
p);
}
p = skip_space(p);
@@ -583,7 +583,7 @@ ZString::iterator ScriptBuffer::parse_subexpr(ZString::iterator p, int limit)
plist[i] = p;
if (*p != ')')
{
- disp_error_message("func request '(' ')'", p);
+ disp_error_message("func request '(' ')'"_s, p);
exit(1);
}
p++;
@@ -598,7 +598,7 @@ ZString::iterator ScriptBuffer::parse_subexpr(ZString::iterator p, int limit)
break;
if ((arg[j] == 0 && i != j) || (arg[j] == '*' && i < j))
{
- disp_error_message("illegal number of parameters",
+ disp_error_message("illegal number of parameters"_s,
plist[std::min(i, j)]);
}
}
@@ -627,7 +627,7 @@ ZString::iterator ScriptBuffer::parse_expr(ZString::iterator p)
case '[':
case ']':
case '}':
- disp_error_message("unexpected char", p);
+ disp_error_message("unexpected char"_s, p);
exit(1);
}
p = parse_subexpr(p, -1);
@@ -657,21 +657,22 @@ ZString::iterator ScriptBuffer::parse_line(ZString::iterator p, bool *can_step)
str_data_t *cmd = parse_cmdp;
if (cmd->type != ByteCode::FUNC_)
{
- disp_error_message("expect command", p2);
+ disp_error_message("expect command"_s, p2);
// exit(0);
}
{
+ // TODO should be LString, but no heterogenous lookup yet
static
std::set<ZString> terminators =
{
- "goto",
- "return",
- "close",
- "menu",
- "end",
- "mapexit",
- "shop",
+ "goto"_s,
+ "return"_s,
+ "close"_s,
+ "menu"_s,
+ "end"_s,
+ "mapexit"_s,
+ "shop"_s,
};
*can_step = terminators.count(cmd->strs) == 0;
}
@@ -689,7 +690,7 @@ ZString::iterator ScriptBuffer::parse_line(ZString::iterator p, bool *can_step)
else if (*p != ';' && script_config.warn_cmd_no_comma
&& parse_cmd_if * 2 <= i)
{
- disp_error_message("expect ',' or ';' at cmd params", p);
+ disp_error_message("expect ',' or ';' at cmd params"_s, p);
}
p = skip_space(p);
i++;
@@ -697,7 +698,7 @@ ZString::iterator ScriptBuffer::parse_line(ZString::iterator p, bool *can_step)
plist[i] = p;
if (*(p++) != ';')
{
- disp_error_message("need ';'", p);
+ disp_error_message("need ';'"_s, p);
exit(1);
}
add_scriptc(ByteCode::FUNC_);
@@ -712,7 +713,7 @@ ZString::iterator ScriptBuffer::parse_line(ZString::iterator p, bool *can_step)
break;
if ((arg[j] == 0 && i != j) || (arg[j] == '*' && i < j))
{
- disp_error_message("illegal number of parameters",
+ disp_error_message("illegal number of parameters"_s,
plist[std::min(i, j)]);
}
}
@@ -740,7 +741,7 @@ bool read_constdb(ZString filename)
io::ReadFile in(filename);
if (!in.is_open())
{
- PRINTF("can't read %s\n", filename);
+ PRINTF("can't read %s\n"_fmt, filename);
return false;
}
@@ -755,9 +756,9 @@ bool read_constdb(ZString filename)
int val;
int type = 0; // if not provided
// TODO get rid of SSCANF - this is the last serious use
- if (SSCANF(line, "%m[A-Za-z0-9_] %i %i", &name, &val, &type) < 2)
+ if (SSCANF(line, "%m[A-Za-z0-9_] %i %i"_fmt, &name, &val, &type) < 2)
{
- PRINTF("Bad const line: %s\n", line);
+ PRINTF("Bad const line: %s\n"_fmt, line);
rv = false;
continue;
}
@@ -815,7 +816,7 @@ void ScriptBuffer::parse_script(ZString src, int line, bool implicit_end)
p = skip_space(p);
if (*p != '{')
{
- disp_error_message("not found '{'", p);
+ disp_error_message("not found '{'"_s, p);
abort();
}
for (p++; *p && *p != '}';)
@@ -825,7 +826,7 @@ void ScriptBuffer::parse_script(ZString src, int line, bool implicit_end)
{
if (can_step)
{
- --script_errors; disp_error_message("deprecated: implicit fallthrough", p);
+ --script_errors; disp_error_message("deprecated: implicit fallthrough"_s, p);
}
can_step = true;
@@ -838,7 +839,7 @@ void ScriptBuffer::parse_script(ZString src, int line, bool implicit_end)
assert (e1 == e2 && e2 == e3);
if (e3)
{
- disp_error_message("dup label ", p);
+ disp_error_message("dup label "_s, p);
exit(1);
}
set_label(ld, script_buf.size());
@@ -849,7 +850,7 @@ void ScriptBuffer::parse_script(ZString src, int line, bool implicit_end)
if (!can_step)
{
- --script_errors; disp_error_message("deprecated: unreachable statement", p);
+ --script_errors; disp_error_message("deprecated: unreachable statement"_s, p);
}
// 他は全部一緒くた
p = parse_line(p, &can_step);
@@ -864,7 +865,7 @@ void ScriptBuffer::parse_script(ZString src, int line, bool implicit_end)
if (can_step && !implicit_end)
{
- --script_errors; disp_error_message("deprecated: implicit end", p);
+ --script_errors; disp_error_message("deprecated: implicit end"_s, p);
}
add_scriptc(ByteCode::NOP);
@@ -893,17 +894,17 @@ void ScriptBuffer::parse_script(ZString src, int line, bool implicit_end)
for (const auto& pair : scriptlabel_db)
{
ScriptLabel key = pair.first;
- if (key.startswith("On"))
+ if (key.startswith("On"_s))
continue;
- if (!(key.startswith("L_") || key.startswith("S_")))
- PRINTF("Warning: ugly label: %s\n", key);
+ if (!(key.startswith("L_"_s) || key.startswith("S_"_s)))
+ PRINTF("Warning: ugly label: %s\n"_fmt, key);
else if (!probable_labels.count(key))
- PRINTF("Warning: unused label: %s\n", key);
+ PRINTF("Warning: unused label: %s\n"_fmt, key);
}
for (ScriptLabel used : probable_labels)
{
if (!scriptlabel_db.search(used))
- PRINTF("Warning: no such label: %s\n", used);
+ PRINTF("Warning: no such label: %s\n"_fmt, used);
}
probable_labels.clear();
@@ -912,12 +913,12 @@ void ScriptBuffer::parse_script(ZString src, int line, bool implicit_end)
for (size_t i = 0; i < script_buf.size(); i++)
{
if ((i & 15) == 0)
- PRINTF("%04zx : ", i);
- PRINTF("%02x ", script_buf[i]);
+ PRINTF("%04zx : "_fmt, i);
+ PRINTF("%02x "_fmt, script_buf[i]);
if ((i & 15) == 15)
- PRINTF("\n");
+ PRINTF("\n"_fmt);
}
- PRINTF("\n");
+ PRINTF("\n"_fmt);
}
//
@@ -943,7 +944,7 @@ dumb_ptr<map_session_data> script_rid2sd(ScriptState *st)
dumb_ptr<map_session_data> sd = map_id2sd(st->rid);
if (!sd)
{
- PRINTF("script_rid2sd: fatal error ! player not attached!\n");
+ PRINTF("script_rid2sd: fatal error ! player not attached!\n"_fmt);
}
return sd;
}
@@ -958,7 +959,7 @@ void get_val(dumb_ptr<map_session_data> sd, struct script_data *data)
if (data->type == ByteCode::PARAM_)
{
if (sd == NULL)
- PRINTF("get_val error param SP::%d\n", data->u.reg.sp());
+ PRINTF("get_val error param SP::%d\n"_fmt, data->u.reg.sp());
data->type = ByteCode::INT;
if (sd)
data->u.numi = pc_readparam(sd, data->u.reg.sp());
@@ -973,7 +974,7 @@ void get_val(dumb_ptr<map_session_data> sd, struct script_data *data)
if (prefix != '$')
{
if (sd == NULL)
- PRINTF("get_val error name?:%s\n", name);
+ PRINTF("get_val error name?:%s\n"_fmt, name);
}
if (postfix == '$')
{
@@ -990,11 +991,11 @@ void get_val(dumb_ptr<map_session_data> sd, struct script_data *data)
}
else
{
- PRINTF("script: get_val: illegal scope string variable.\n");
- data->u.str = dumb_string::fake("!!ERROR!!");
+ PRINTF("script: get_val: illegal scope string variable.\n"_fmt);
+ data->u.str = dumb_string::fake("!!ERROR!!"_s);
}
if (!data->u.str)
- data->u.str = dumb_string::fake("");
+ data->u.str = dumb_string::fake(""_s);
}
else
{
@@ -1085,7 +1086,7 @@ void set_reg(dumb_ptr<map_session_data> sd, ByteCode type, SIR reg, struct scrip
}
else
{
- PRINTF("script: set_reg: illegal scope string variable !");
+ PRINTF("script: set_reg: illegal scope string variable !"_fmt);
}
}
else
@@ -1143,7 +1144,7 @@ dumb_string conv_str(ScriptState *st, struct script_data *data)
assert (data->type != ByteCode::RETINFO);
if (data->type == ByteCode::INT)
{
- AString buf = STRPRINTF("%d", data->u.numi);
+ AString buf = STRPRINTF("%d"_fmt, data->u.numi);
data->type = ByteCode::STR;
data->u.str = dumb_string::copys(buf);
}
@@ -1285,7 +1286,7 @@ void builtin_goto(ScriptState *st)
{
if (AARGO2(2).type != ByteCode::POS)
{
- PRINTF("script: goto: not label !\n");
+ PRINTF("script: goto: not label !\n"_fmt);
st->state = ScriptEndState::END;
return;
}
@@ -1324,7 +1325,7 @@ void builtin_callfunc(ScriptState *st)
}
else
{
- PRINTF("script:callfunc: function not found! [%s]\n", str);
+ PRINTF("script:callfunc: function not found! [%s]\n"_fmt, str);
st->state = ScriptEndState::END;
}
}
@@ -1442,7 +1443,7 @@ void builtin_menu(ScriptState *st)
// not just the displayed number that ends with the "".
// (Would it be better to pop the stack before rerunning?)
int menu_choices = (st->end - (st->start + 2)) / 2;
- pc_setreg(sd, SIR::from(variable_names.intern("@menu")), sd->npc_menu);
+ pc_setreg(sd, SIR::from(variable_names.intern("@menu"_s)), sd->npc_menu);
sd->state.menu_or_input = 0;
if (sd->npc_menu > 0 && sd->npc_menu <= menu_choices)
{
@@ -1532,9 +1533,9 @@ void builtin_warp(ScriptState *st)
MapName str = stringish<MapName>(ZString(conv_str(st, &AARGO2(2))));
x = conv_num(st, &AARGO2(3));
y = conv_num(st, &AARGO2(4));
- if (str == "Random")
+ if (str == "Random"_s)
pc_randomwarp(sd, BeingRemoveWhy::WARPED);
- else if (str == "SavePoint" or str == "Save")
+ else if (str == "SavePoint"_s or str == "Save"_s)
{
if (sd->bl_m->flag.get(MapFlag::NORETURN))
return;
@@ -1554,7 +1555,7 @@ static
void builtin_areawarp_sub(dumb_ptr<block_list> bl, MapName mapname, int x, int y)
{
dumb_ptr<map_session_data> sd = bl->is_player();
- if (mapname == "Random")
+ if (mapname == "Random"_s)
pc_randomwarp(sd, BeingRemoveWhy::WARPED);
else
pc_setpos(sd, mapname, x, y, BeingRemoveWhy::GONE);
@@ -1762,7 +1763,7 @@ void builtin_setarray(ScriptState *st)
if (prefix != '$' && prefix != '@')
{
- PRINTF("builtin_setarray: illegal scope !\n");
+ PRINTF("builtin_setarray: illegal scope !\n"_fmt);
return;
}
if (prefix != '$')
@@ -1794,7 +1795,7 @@ void builtin_cleararray(ScriptState *st)
if (prefix != '$' && prefix != '@')
{
- PRINTF("builtin_cleararray: illegal scope !\n");
+ PRINTF("builtin_cleararray: illegal scope !\n"_fmt);
return;
}
if (prefix != '$')
@@ -1839,7 +1840,7 @@ void builtin_getarraysize(ScriptState *st)
if (prefix != '$' && prefix != '@')
{
- PRINTF("builtin_copyarray: illegal scope !\n");
+ PRINTF("builtin_copyarray: illegal scope !\n"_fmt);
return;
}
@@ -1858,7 +1859,7 @@ void builtin_getelementofarray(ScriptState *st)
int i = conv_num(st, &AARGO2(3));
if (i > 255 || i < 0)
{
- PRINTF("script: getelementofarray (operator[]): param2 illegal number %d\n",
+ PRINTF("script: getelementofarray (operator[]): param2 illegal number %d\n"_fmt,
i);
push_int(st->stack, ByteCode::INT, 0);
}
@@ -1870,7 +1871,7 @@ void builtin_getelementofarray(ScriptState *st)
}
else
{
- PRINTF("script: getelementofarray (operator[]): param1 not name !\n");
+ PRINTF("script: getelementofarray (operator[]): param1 not name !\n"_fmt);
push_int(st->stack, ByteCode::INT, 0);
}
}
@@ -1924,7 +1925,7 @@ void builtin_countitem(ScriptState *st)
else
{
if (battle_config.error_log)
- PRINTF("wrong item ID : countitem (%i)\n", nameid);
+ PRINTF("wrong item ID : countitem (%i)\n"_fmt, nameid);
}
push_int(st->stack, ByteCode::INT, count);
@@ -2104,7 +2105,6 @@ void builtin_delitem(ScriptState *st)
if (nameid < 500 || amount <= 0)
{
//by Lupus. Don't run FOR if u got wrong item ID or amount<=0
- //PRINTF("wrong item ID or amount<=0 : delitem %i,\n",nameid,amount);
return;
}
@@ -2231,12 +2231,12 @@ void builtin_strcharinfo(ScriptState *st)
if (buf)
push_str(st->stack, ByteCode::STR, buf);
else
- push_str(st->stack, ByteCode::CONSTSTR, dumb_string::fake(""));
+ push_str(st->stack, ByteCode::CONSTSTR, dumb_string::fake(""_s));
}
if (num == 2)
{
// was: guild name
- push_str(st->stack, ByteCode::CONSTSTR, dumb_string::fake(""));
+ push_str(st->stack, ByteCode::CONSTSTR, dumb_string::fake(""_s));
}
}
@@ -2273,7 +2273,7 @@ void builtin_getequipid(ScriptState *st)
sd = script_rid2sd(st);
if (sd == NULL)
{
- PRINTF("getequipid: sd == NULL\n");
+ PRINTF("getequipid: sd == NULL\n"_fmt);
return;
}
num = conv_num(st, &AARGO2(2));
@@ -2312,13 +2312,13 @@ void builtin_getequipname(ScriptState *st)
{
item = sd->inventory_data[i];
if (item)
- buf = STRPRINTF("%s-[%s]", pos_str[num - 1], item->jname);
+ buf = STRPRINTF("%s-[%s]"_fmt, pos_str[num - 1], item->jname);
else
- buf = STRPRINTF("%s-[%s]", pos_str[num - 1], pos_str[10]);
+ buf = STRPRINTF("%s-[%s]"_fmt, pos_str[num - 1], pos_str[10]);
}
else
{
- buf = STRPRINTF("%s-[%s]", pos_str[num - 1], pos_str[10]);
+ buf = STRPRINTF("%s-[%s]"_fmt, pos_str[num - 1], pos_str[10]);
}
push_str(st->stack, ByteCode::STR, dumb_string::copys(buf));
@@ -2683,7 +2683,7 @@ void builtin_killmonster(ScriptState *st)
MapName mapname = stringish<MapName>(ZString(conv_str(st, &AARGO2(2))));
ZString event_ = ZString(conv_str(st, &AARGO2(3)));
NpcEvent event;
- if (event_ != "All")
+ if (event_ != "All"_s)
extract(event_, &event);
map_local *m = map_mapname2mapid(mapname);
@@ -3151,7 +3151,7 @@ static
void builtin_debugmes(ScriptState *st)
{
dumb_string mes = conv_str(st, &AARGO2(2));
- PRINTF("script debug : %d %d : %s\n",
+ PRINTF("script debug : %d %d : %s\n"_fmt,
st->rid, st->oid, mes);
}
@@ -3464,7 +3464,7 @@ void builtin_getitemname(ScriptState *st)
if (i_data)
item_name = dumb_string::copys(i_data->jname);
else
- item_name = dumb_string::copys("Unknown Item");
+ item_name = dumb_string::copys("Unknown Item"_s);
push_str(st->stack, ByteCode::STR, item_name);
}
@@ -3476,7 +3476,7 @@ void builtin_getspellinvocation(ScriptState *st)
AString invocation = magic_find_invocation(name.str());
if (!invocation)
- invocation = "...";
+ invocation = "..."_s;
push_str(st->stack, ByteCode::STR, dumb_string::copys(invocation));
}
@@ -3505,16 +3505,16 @@ void builtin_getinventorylist(ScriptState *st)
if (sd->status.inventory[i].nameid > 0
&& sd->status.inventory[i].amount > 0)
{
- pc_setreg(sd, SIR::from(variable_names.intern("@inventorylist_id"), j),
+ pc_setreg(sd, SIR::from(variable_names.intern("@inventorylist_id"_s), j),
sd->status.inventory[i].nameid);
- pc_setreg(sd, SIR::from(variable_names.intern("@inventorylist_amount"), j),
+ pc_setreg(sd, SIR::from(variable_names.intern("@inventorylist_amount"_s), j),
sd->status.inventory[i].amount);
- pc_setreg(sd, SIR::from(variable_names.intern("@inventorylist_equip"), j),
+ pc_setreg(sd, SIR::from(variable_names.intern("@inventorylist_equip"_s), j),
static_cast<uint16_t>(sd->status.inventory[i].equip));
j++;
}
}
- pc_setreg(sd, SIR::from(variable_names.intern("@inventorylist_count")), j);
+ pc_setreg(sd, SIR::from(variable_names.intern("@inventorylist_count"_s)), j);
}
static
@@ -3534,18 +3534,18 @@ void builtin_getactivatedpoolskilllist(ScriptState *st)
if (sd->status.skill[skill_id].lv)
{
- pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_id"), count),
+ pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_id"_s), count),
static_cast<uint16_t>(skill_id));
- pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_lv"), count),
+ pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_lv"_s), count),
sd->status.skill[skill_id].lv);
- pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_flag"), count),
+ pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_flag"_s), count),
static_cast<uint16_t>(sd->status.skill[skill_id].flags));
- pc_setregstr(sd, SIR::from(variable_names.intern("@skilllist_name$"), count),
+ pc_setregstr(sd, SIR::from(variable_names.intern("@skilllist_name$"_s), count),
skill_name(skill_id));
++count;
}
}
- pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_count")), count);
+ pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_count"_s)), count);
}
@@ -3565,18 +3565,18 @@ void builtin_getunactivatedpoolskilllist(ScriptState *st)
if (sd->status.skill[skill_id].lv
&& !bool(sd->status.skill[skill_id].flags & SkillFlags::POOL_ACTIVATED))
{
- pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_id"), count),
+ pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_id"_s), count),
static_cast<uint16_t>(skill_id));
- pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_lv"), count),
+ pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_lv"_s), count),
sd->status.skill[skill_id].lv);
- pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_flag"), count),
+ pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_flag"_s), count),
static_cast<uint16_t>(sd->status.skill[skill_id].flags));
- pc_setregstr(sd, SIR::from(variable_names.intern("@skilllist_name$"), count),
+ pc_setregstr(sd, SIR::from(variable_names.intern("@skilllist_name$"_s), count),
skill_name(skill_id));
++count;
}
}
- pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_count")), count);
+ pc_setreg(sd, SIR::from(variable_names.intern("@skilllist_count"_s)), count);
}
static
@@ -3775,7 +3775,7 @@ void builtin_npcwarp(ScriptState *st)
if (!nd)
{
- PRINTF("builtin_npcwarp: no such npc: %s\n", npc);
+ PRINTF("builtin_npcwarp: no such npc: %s\n"_fmt, npc);
return;
}
@@ -3984,7 +3984,7 @@ void builtin_shop(ScriptState *st)
nd = npc_name2id(name);
if (!nd)
{
- PRINTF("builtin_shop: no such npc: %s\n", name);
+ PRINTF("builtin_shop: no such npc: %s\n"_fmt, name);
return;
}
@@ -4017,7 +4017,7 @@ void builtin_fakenpcname(ScriptState *st)
dumb_ptr<npc_data> nd = npc_name2id(name);
if (!nd)
{
- PRINTF("builtin_fakenpcname: no such npc: %s\n", name);
+ PRINTF("builtin_fakenpcname: no such npc: %s\n"_fmt, name);
return;
}
nd->name = newname;
@@ -4201,7 +4201,7 @@ void op_2str(ScriptState *st, ByteCode op, dumb_string s1_, dumb_string s2_)
a = s1 <= s2;
break;
default:
- PRINTF("illegal string operater\n");
+ PRINTF("illegal string operater\n"_fmt);
break;
}
@@ -4304,7 +4304,7 @@ void op_2(ScriptState *st, ByteCode op)
else
{
// si,is => error
- PRINTF("script: op_2: int&str, str&int not allow.\n");
+ PRINTF("script: op_2: int&str, str&int not allow.\n"_fmt);
push_int(st->stack, ByteCode::INT, 0);
}
}
@@ -4347,7 +4347,7 @@ void run_func(ScriptState *st)
if (start_sp == 0)
{
if (battle_config.error_log)
- PRINTF("function not found\n");
+ PRINTF("function not found\n"_fmt);
st->state = ScriptEndState::END;
return;
}
@@ -4360,52 +4360,52 @@ void run_func(ScriptState *st)
size_t func = st->stack->stack_datav[st->start].u.numi;
if (st->stack->stack_datav[st->start].type != ByteCode::FUNC_REF)
{
- PRINTF("run_func: not function and command! \n");
+ PRINTF("run_func: not function and command! \n"_fmt);
st->state = ScriptEndState::END;
return;
}
if (DEBUG_RUN && battle_config.etc_log)
{
- PRINTF("run_func : %s\n",
+ PRINTF("run_func : %s\n"_fmt,
builtin_functions[func].name);
- PRINTF("stack dump :");
+ PRINTF("stack dump :"_fmt);
for (script_data& d : st->stack->stack_datav)
{
switch (d.type)
{
case ByteCode::INT:
- PRINTF(" int(%d)", d.u.numi);
+ PRINTF(" int(%d)"_fmt, d.u.numi);
break;
case ByteCode::RETINFO:
- PRINTF(" retinfo(%p)", static_cast<const void *>(d.u.script));
+ PRINTF(" retinfo(%p)"_fmt, static_cast<const void *>(d.u.script));
break;
case ByteCode::PARAM_:
- PRINTF(" param(%d)", d.u.reg.sp());
+ PRINTF(" param(%d)"_fmt, d.u.reg.sp());
break;
case ByteCode::VARIABLE:
- PRINTF(" name(%s)[%d]", variable_names.outtern(d.u.reg.base()), d.u.reg.index());
+ PRINTF(" name(%s)[%d]"_fmt, variable_names.outtern(d.u.reg.base()), d.u.reg.index());
break;
case ByteCode::ARG:
- PRINTF(" arg");
+ PRINTF(" arg"_fmt);
break;
case ByteCode::POS:
- PRINTF(" pos(%d)", d.u.numi);
+ PRINTF(" pos(%d)"_fmt, d.u.numi);
break;
case ByteCode::STR:
- PRINTF(" str(%s)", d.u.str);
+ PRINTF(" str(%s)"_fmt, d.u.str);
break;
case ByteCode::CONSTSTR:
- PRINTF(" cstr(%s)", d.u.str);
+ PRINTF(" cstr(%s)"_fmt, d.u.str);
break;
case ByteCode::FUNC_REF:
- PRINTF(" func(%s)", builtin_functions[d.u.numi].name);
+ PRINTF(" func(%s)"_fmt, builtin_functions[d.u.numi].name);
break;
default:
- PRINTF(" %d,%d", d.type, d.u.numi);
+ PRINTF(" %d,%d"_fmt, d.type, d.u.numi);
}
}
- PRINTF("\n");
+ PRINTF("\n"_fmt);
}
builtin_functions[func].func(st);
@@ -4420,7 +4420,7 @@ void run_func(ScriptState *st)
if (st->defsp < 4
|| st->stack->stack_datav[st->defsp - 1].type != ByteCode::RETINFO)
{
- PRINTF("script:run_func (return) return without callfunc or callsub!\n");
+ PRINTF("script:run_func (return) return without callfunc or callsub!\n"_fmt);
st->state = ScriptEndState::END;
return;
}
@@ -4445,15 +4445,15 @@ void dump_script(const ScriptBuffer *script)
ScriptPointer scriptp(script, 0);
while (scriptp.pos < reinterpret_cast<const std::vector<ByteCode> *>(script)->size())
{
- PRINTF("%6zu: ", scriptp.pos);
+ PRINTF("%6zu: "_fmt, scriptp.pos);
switch (ByteCode c = get_com(&scriptp))
{
case ByteCode::EOL:
- PRINTF("EOL\n"); // extra newline between functions
+ PRINTF("EOL\n"_fmt); // extra newline between functions
break;
case ByteCode::INT:
// synthesized!
- PRINTF("INT %d", get_num(&scriptp));
+ PRINTF("INT %d"_fmt, get_num(&scriptp));
break;
case ByteCode::POS:
@@ -4468,103 +4468,103 @@ void dump_script(const ScriptBuffer *script)
switch(c)
{
case ByteCode::POS:
- PRINTF("POS %d", arg);
+ PRINTF("POS %d"_fmt, arg);
break;
case ByteCode::VARIABLE:
- PRINTF("VARIABLE %s", variable_names.outtern(arg));
+ PRINTF("VARIABLE %s"_fmt, variable_names.outtern(arg));
break;
case ByteCode::FUNC_REF:
- PRINTF("FUNC_REF %s", builtin_functions[arg].name);
+ PRINTF("FUNC_REF %s"_fmt, builtin_functions[arg].name);
break;
case ByteCode::PARAM_:
- PRINTF("PARAM SP::#%d (sorry)", arg);
+ PRINTF("PARAM SP::#%d (sorry)"_fmt, arg);
break;
}
}
break;
case ByteCode::ARG:
- PRINTF("ARG");
+ PRINTF("ARG"_fmt);
break;
case ByteCode::STR:
- PRINTF("STR \"%s\"", scriptp.pops());
+ PRINTF("STR \"%s\""_fmt, scriptp.pops());
break;
case ByteCode::FUNC_:
- PRINTF("FUNC_");
+ PRINTF("FUNC_"_fmt);
break;
case ByteCode::ADD:
- PRINTF("ADD");
+ PRINTF("ADD"_fmt);
break;
case ByteCode::SUB:
- PRINTF("SUB");
+ PRINTF("SUB"_fmt);
break;
case ByteCode::MUL:
- PRINTF("MUL");
+ PRINTF("MUL"_fmt);
break;
case ByteCode::DIV:
- PRINTF("DIV");
+ PRINTF("DIV"_fmt);
break;
case ByteCode::MOD:
- PRINTF("MOD");
+ PRINTF("MOD"_fmt);
break;
case ByteCode::EQ:
- PRINTF("EQ");
+ PRINTF("EQ"_fmt);
break;
case ByteCode::NE:
- PRINTF("NE");
+ PRINTF("NE"_fmt);
break;
case ByteCode::GT:
- PRINTF("GT");
+ PRINTF("GT"_fmt);
break;
case ByteCode::GE:
- PRINTF("GE");
+ PRINTF("GE"_fmt);
break;
case ByteCode::LT:
- PRINTF("LT");
+ PRINTF("LT"_fmt);
break;
case ByteCode::LE:
- PRINTF("LE");
+ PRINTF("LE"_fmt);
break;
case ByteCode::AND:
- PRINTF("AND");
+ PRINTF("AND"_fmt);
break;
case ByteCode::OR:
- PRINTF("OR");
+ PRINTF("OR"_fmt);
break;
case ByteCode::XOR:
- PRINTF("XOR");
+ PRINTF("XOR"_fmt);
break;
case ByteCode::LAND:
- PRINTF("LAND");
+ PRINTF("LAND"_fmt);
break;
case ByteCode::LOR:
- PRINTF("LOR");
+ PRINTF("LOR"_fmt);
break;
case ByteCode::R_SHIFT:
- PRINTF("R_SHIFT");
+ PRINTF("R_SHIFT"_fmt);
break;
case ByteCode::L_SHIFT:
- PRINTF("L_SHIFT");
+ PRINTF("L_SHIFT"_fmt);
break;
case ByteCode::NEG:
- PRINTF("NEG");
+ PRINTF("NEG"_fmt);
break;
case ByteCode::NOT:
- PRINTF("NOT");
+ PRINTF("NOT"_fmt);
break;
case ByteCode::LNOT:
- PRINTF("LNOT");
+ PRINTF("LNOT"_fmt);
break;
case ByteCode::NOP:
- PRINTF("NOP");
+ PRINTF("NOP"_fmt);
break;
default:
- PRINTF("??? %d", c);
+ PRINTF("??? %d"_fmt, c);
break;
}
- PRINTF("\n");
+ PRINTF("\n"_fmt);
}
}
@@ -4591,7 +4591,7 @@ void run_script_main(ScriptState *st, const ScriptBuffer *rootscript)
if (stack->stack_datav.size() != st->defsp)
{
if (battle_config.error_log)
- PRINTF("stack.sp (%zu) != default (%d)\n",
+ PRINTF("stack.sp (%zu) != default (%d)\n"_fmt,
stack->stack_datav.size(),
st->defsp);
stack->stack_datav.resize(st->defsp);
@@ -4646,7 +4646,7 @@ void run_script_main(ScriptState *st, const ScriptBuffer *rootscript)
st->state = ScriptEndState::ZERO;
if (gotocount > 0 && (--gotocount) <= 0)
{
- PRINTF("run_script: infinity loop !\n");
+ PRINTF("run_script: infinity loop !\n"_fmt);
st->state = ScriptEndState::END;
}
}
@@ -4688,14 +4688,14 @@ void run_script_main(ScriptState *st, const ScriptBuffer *rootscript)
default:
if (battle_config.error_log)
- PRINTF("unknown command : %d @ %zu\n",
+ PRINTF("unknown command : %d @ %zu\n"_fmt,
c, st->scriptp.pos);
st->state = ScriptEndState::END;
break;
}
if (cmdcount > 0 && (--cmdcount) <= 0)
{
- PRINTF("run_script: infinity loop !\n");
+ PRINTF("run_script: infinity loop !\n"_fmt);
st->state = ScriptEndState::END;
}
}
@@ -4842,7 +4842,7 @@ void script_load_mapreg(void)
else
{
borken:
- PRINTF("%s: %s broken data !\n", mapreg_txt, AString(buf1));
+ PRINTF("%s: %s broken data !\n"_fmt, mapreg_txt, AString(buf1));
continue;
}
}
@@ -4861,9 +4861,9 @@ void script_save_mapreg_intsub(SIR key, int data, io::WriteFile& fp)
if (name[1] != '@')
{
if (i == 0)
- FPRINTF(fp, "%s\t%d\n", name, data);
+ FPRINTF(fp, "%s\t%d\n"_fmt, name, data);
else
- FPRINTF(fp, "%s,%d\t%d\n", name, i, data);
+ FPRINTF(fp, "%s,%d\t%d\n"_fmt, name, i, data);
}
}
@@ -4875,9 +4875,9 @@ void script_save_mapreg_strsub(SIR key, ZString data, io::WriteFile& fp)
if (name[1] != '@')
{
if (i == 0)
- FPRINTF(fp, "%s\t%s\n", name, data);
+ FPRINTF(fp, "%s\t%s\n"_fmt, name, data);
else
- FPRINTF(fp, "%s,%d\t%s\n", name, i, data);
+ FPRINTF(fp, "%s,%d\t%s\n"_fmt, name, i, data);
}
}
@@ -4929,128 +4929,128 @@ void do_init_script(void)
}
#define BUILTIN(func, args) \
-{builtin_##func, {#func}, {args}}
+{builtin_##func, #func ## _s, {args}}
BuiltinFunction builtin_functions[] =
{
- BUILTIN(mes, "s"),
- BUILTIN(next, ""),
- BUILTIN(close, ""),
- BUILTIN(close2, ""),
- BUILTIN(menu, "sL*"),
- BUILTIN(goto, "L"),
- BUILTIN(callsub, "L"),
- BUILTIN(callfunc, "F"),
- BUILTIN(return, ""),
- BUILTIN(input, "N"),
- BUILTIN(warp, "Mxy"),
- BUILTIN(isat, "Mxy"),
- BUILTIN(areawarp, "MxyxyMxy"),
- BUILTIN(setlook, "ii"),
- BUILTIN(set, "Ne"),
- BUILTIN(setarray, "Ne*"),
- BUILTIN(cleararray, "Nei"),
- BUILTIN(getarraysize, "N"),
- BUILTIN(getelementofarray, "Ni"),
- BUILTIN(if, "iF*"),
- BUILTIN(getitem, "Ii**"),
- BUILTIN(makeitem, "IiMxy"),
- BUILTIN(delitem, "Ii"),
- BUILTIN(heal, "ii"),
- BUILTIN(itemheal, "ii"),
- BUILTIN(percentheal, "ii"),
- BUILTIN(rand, "i*"),
- BUILTIN(pow, "ii"),
- BUILTIN(countitem, "I"),
- BUILTIN(checkweight, "Ii"),
- BUILTIN(readparam, "i*"),
- BUILTIN(getcharid, "i*"),
- BUILTIN(strcharinfo, "i"),
- BUILTIN(getequipid, "i"),
- BUILTIN(getequipname, "i"),
- BUILTIN(statusup2, "ii"),
- BUILTIN(bonus, "ii"),
- BUILTIN(bonus2, "iii"),
- BUILTIN(skill, "ii*"),
- BUILTIN(setskill, "ii"),
- BUILTIN(getskilllv, "i"),
- BUILTIN(getgmlevel, ""),
- BUILTIN(end, ""),
- BUILTIN(getopt2, ""),
- BUILTIN(setopt2, "i"),
- BUILTIN(savepoint, "Mxy"),
- BUILTIN(gettimetick, "i"),
- BUILTIN(gettime, "i"),
- BUILTIN(openstorage, "*"),
- BUILTIN(monster, "Mxysmi*"),
- BUILTIN(areamonster, "Mxyxysmi*"),
- BUILTIN(killmonster, "ME"),
- BUILTIN(killmonsterall, "M"),
- BUILTIN(donpcevent, "E"),
- BUILTIN(addtimer, "tE"),
- BUILTIN(initnpctimer, ""),
- BUILTIN(stopnpctimer, ""),
- BUILTIN(startnpctimer, "*"),
- BUILTIN(setnpctimer, "i"),
- BUILTIN(getnpctimer, "i"),
- BUILTIN(announce, "si"),
- BUILTIN(mapannounce, "Msi"),
- BUILTIN(getusers, "i"),
- BUILTIN(getmapusers, "M"),
- BUILTIN(getareausers, "Mxyxy*"),
- BUILTIN(getareadropitem, "Mxyxyi*"),
- BUILTIN(enablenpc, "s"),
- BUILTIN(disablenpc, "s"),
- BUILTIN(sc_start, "iTi*"),
- BUILTIN(sc_end, "i"),
- BUILTIN(sc_check, "i"),
- BUILTIN(debugmes, "s"),
- BUILTIN(resetstatus, ""),
- BUILTIN(changesex, ""),
- BUILTIN(attachrid, "i"),
- BUILTIN(detachrid, ""),
- BUILTIN(isloggedin, "i"),
- BUILTIN(setmapflag, "Mi"),
- BUILTIN(removemapflag, "Mi"),
- BUILTIN(getmapflag, "Mi"),
- BUILTIN(pvpon, "M"),
- BUILTIN(pvpoff, "M"),
- BUILTIN(emotion, "i"),
- BUILTIN(marriage, "P"),
- BUILTIN(divorce, ""),
- BUILTIN(getitemname, "I"),
- BUILTIN(getspellinvocation, "s"),
- BUILTIN(getpartnerid2, ""),
- BUILTIN(getexp, "ii"),
- BUILTIN(getinventorylist, ""),
- BUILTIN(getactivatedpoolskilllist, ""),
- BUILTIN(getunactivatedpoolskilllist, ""),
- BUILTIN(poolskill, "i"),
- BUILTIN(unpoolskill, "i"),
- BUILTIN(misceffect, "i*"),
- BUILTIN(specialeffect, "i"),
- BUILTIN(specialeffect2, "i"),
- BUILTIN(nude, ""),
- BUILTIN(mapwarp, "MMxy"),
- BUILTIN(cmdothernpc, "ss"),
- BUILTIN(gmcommand, "s"),
- BUILTIN(npcwarp, "xys"),
- BUILTIN(message, "Ps"),
- BUILTIN(npctalk, "s"),
- BUILTIN(mobcount, "ME"),
- BUILTIN(getlook, "i"),
- BUILTIN(getsavepoint, "i"),
- BUILTIN(areatimer, "MxyxytE"),
- BUILTIN(isin, "Mxyxy"),
- BUILTIN(shop, "s"),
- BUILTIN(isdead, ""),
- BUILTIN(unequipbyid, "i"),
- BUILTIN(fakenpcname, "ssi"),
- BUILTIN(getx, ""),
- BUILTIN(gety, ""),
- BUILTIN(getmap, ""),
- BUILTIN(mapexit, ""),
- {nullptr, ZString(), ZString()},
+ BUILTIN(mes, "s"_s),
+ BUILTIN(next, ""_s),
+ BUILTIN(close, ""_s),
+ BUILTIN(close2, ""_s),
+ BUILTIN(menu, "sL*"_s),
+ BUILTIN(goto, "L"_s),
+ BUILTIN(callsub, "L"_s),
+ BUILTIN(callfunc, "F"_s),
+ BUILTIN(return, ""_s),
+ BUILTIN(input, "N"_s),
+ BUILTIN(warp, "Mxy"_s),
+ BUILTIN(isat, "Mxy"_s),
+ BUILTIN(areawarp, "MxyxyMxy"_s),
+ BUILTIN(setlook, "ii"_s),
+ BUILTIN(set, "Ne"_s),
+ BUILTIN(setarray, "Ne*"_s),
+ BUILTIN(cleararray, "Nei"_s),
+ BUILTIN(getarraysize, "N"_s),
+ BUILTIN(getelementofarray, "Ni"_s),
+ BUILTIN(if, "iF*"_s),
+ BUILTIN(getitem, "Ii**"_s),
+ BUILTIN(makeitem, "IiMxy"_s),
+ BUILTIN(delitem, "Ii"_s),
+ BUILTIN(heal, "ii"_s),
+ BUILTIN(itemheal, "ii"_s),
+ BUILTIN(percentheal, "ii"_s),
+ BUILTIN(rand, "i*"_s),
+ BUILTIN(pow, "ii"_s),
+ BUILTIN(countitem, "I"_s),
+ BUILTIN(checkweight, "Ii"_s),
+ BUILTIN(readparam, "i*"_s),
+ BUILTIN(getcharid, "i*"_s),
+ BUILTIN(strcharinfo, "i"_s),
+ BUILTIN(getequipid, "i"_s),
+ BUILTIN(getequipname, "i"_s),
+ BUILTIN(statusup2, "ii"_s),
+ BUILTIN(bonus, "ii"_s),
+ BUILTIN(bonus2, "iii"_s),
+ BUILTIN(skill, "ii*"_s),
+ BUILTIN(setskill, "ii"_s),
+ BUILTIN(getskilllv, "i"_s),
+ BUILTIN(getgmlevel, ""_s),
+ BUILTIN(end, ""_s),
+ BUILTIN(getopt2, ""_s),
+ BUILTIN(setopt2, "i"_s),
+ BUILTIN(savepoint, "Mxy"_s),
+ BUILTIN(gettimetick, "i"_s),
+ BUILTIN(gettime, "i"_s),
+ BUILTIN(openstorage, "*"_s),
+ BUILTIN(monster, "Mxysmi*"_s),
+ BUILTIN(areamonster, "Mxyxysmi*"_s),
+ BUILTIN(killmonster, "ME"_s),
+ BUILTIN(killmonsterall, "M"_s),
+ BUILTIN(donpcevent, "E"_s),
+ BUILTIN(addtimer, "tE"_s),
+ BUILTIN(initnpctimer, ""_s),
+ BUILTIN(stopnpctimer, ""_s),
+ BUILTIN(startnpctimer, "*"_s),
+ BUILTIN(setnpctimer, "i"_s),
+ BUILTIN(getnpctimer, "i"_s),
+ BUILTIN(announce, "si"_s),
+ BUILTIN(mapannounce, "Msi"_s),
+ BUILTIN(getusers, "i"_s),
+ BUILTIN(getmapusers, "M"_s),
+ BUILTIN(getareausers, "Mxyxy*"_s),
+ BUILTIN(getareadropitem, "Mxyxyi*"_s),
+ BUILTIN(enablenpc, "s"_s),
+ BUILTIN(disablenpc, "s"_s),
+ BUILTIN(sc_start, "iTi*"_s),
+ BUILTIN(sc_end, "i"_s),
+ BUILTIN(sc_check, "i"_s),
+ BUILTIN(debugmes, "s"_s),
+ BUILTIN(resetstatus, ""_s),
+ BUILTIN(changesex, ""_s),
+ BUILTIN(attachrid, "i"_s),
+ BUILTIN(detachrid, ""_s),
+ BUILTIN(isloggedin, "i"_s),
+ BUILTIN(setmapflag, "Mi"_s),
+ BUILTIN(removemapflag, "Mi"_s),
+ BUILTIN(getmapflag, "Mi"_s),
+ BUILTIN(pvpon, "M"_s),
+ BUILTIN(pvpoff, "M"_s),
+ BUILTIN(emotion, "i"_s),
+ BUILTIN(marriage, "P"_s),
+ BUILTIN(divorce, ""_s),
+ BUILTIN(getitemname, "I"_s),
+ BUILTIN(getspellinvocation, "s"_s),
+ BUILTIN(getpartnerid2, ""_s),
+ BUILTIN(getexp, "ii"_s),
+ BUILTIN(getinventorylist, ""_s),
+ BUILTIN(getactivatedpoolskilllist, ""_s),
+ BUILTIN(getunactivatedpoolskilllist, ""_s),
+ BUILTIN(poolskill, "i"_s),
+ BUILTIN(unpoolskill, "i"_s),
+ BUILTIN(misceffect, "i*"_s),
+ BUILTIN(specialeffect, "i"_s),
+ BUILTIN(specialeffect2, "i"_s),
+ BUILTIN(nude, ""_s),
+ BUILTIN(mapwarp, "MMxy"_s),
+ BUILTIN(cmdothernpc, "ss"_s),
+ BUILTIN(gmcommand, "s"_s),
+ BUILTIN(npcwarp, "xys"_s),
+ BUILTIN(message, "Ps"_s),
+ BUILTIN(npctalk, "s"_s),
+ BUILTIN(mobcount, "ME"_s),
+ BUILTIN(getlook, "i"_s),
+ BUILTIN(getsavepoint, "i"_s),
+ BUILTIN(areatimer, "MxyxytE"_s),
+ BUILTIN(isin, "Mxyxy"_s),
+ BUILTIN(shop, "s"_s),
+ BUILTIN(isdead, ""_s),
+ BUILTIN(unequipbyid, "i"_s),
+ BUILTIN(fakenpcname, "ssi"_s),
+ BUILTIN(getx, ""_s),
+ BUILTIN(gety, ""_s),
+ BUILTIN(getmap, ""_s),
+ BUILTIN(mapexit, ""_s),
+ {nullptr, ""_s, ""_s},
};
void set_script_var_i(dumb_ptr<map_session_data> sd, VarName var, int e, int val)
@@ -5075,7 +5075,7 @@ int get_script_var_i(dumb_ptr<map_session_data> sd, VarName var, int e)
get_val(sd, &dat);
if (dat.type == ByteCode::INT)
return dat.u.numi;
- PRINTF("Warning: you lied about the type and I'm too lazy to fix it!");
+ PRINTF("Warning: you lied about the type and I'm too lazy to fix it!"_fmt);
return 0;
}
ZString get_script_var_s(dumb_ptr<map_session_data> sd, VarName var, int e)
@@ -5088,6 +5088,6 @@ ZString get_script_var_s(dumb_ptr<map_session_data> sd, VarName var, int e)
get_val(sd, &dat);
if (dat.type == ByteCode::CONSTSTR)
return dat.u.str;
- PRINTF("Warning: you lied about the type and I can't fix it!");
+ PRINTF("Warning: you lied about the type and I can't fix it!"_fmt);
return ZString();
}
diff --git a/src/map/skill-pools.cpp b/src/map/skill-pools.cpp
index 6b46d79..49496bb 100644
--- a/src/map/skill-pools.cpp
+++ b/src/map/skill-pools.cpp
@@ -34,7 +34,7 @@ void skill_pool_register(SkillID id)
if (skill_pool_skills_size + 1 >= MAX_POOL_SKILLS)
{
FPRINTF(stderr,
- "Too many pool skills! Increase MAX_POOL_SKILLS and recompile.");
+ "Too many pool skills! Increase MAX_POOL_SKILLS and recompile."_fmt);
return;
}
@@ -78,7 +78,7 @@ int skill_pool_activate(dumb_ptr<map_session_data> sd, SkillID skill_id)
{
sd->status.skill[skill_id].flags |= SkillFlags::POOL_ACTIVATED;
pc_calcstatus(sd, 0);
- MAP_LOG_PC(sd, "SKILL-ACTIVATE %d %d %d",
+ MAP_LOG_PC(sd, "SKILL-ACTIVATE %d %d %d"_fmt,
skill_id, sd->status.skill[skill_id].lv,
skill_power(sd, skill_id));
return 0;
@@ -97,7 +97,7 @@ int skill_pool_deactivate(dumb_ptr<map_session_data> sd, SkillID skill_id)
if (bool(sd->status.skill[skill_id].flags & SkillFlags::POOL_ACTIVATED))
{
sd->status.skill[skill_id].flags &= ~SkillFlags::POOL_ACTIVATED;
- MAP_LOG_PC(sd, "SKILL-DEACTIVATE %d", skill_id);
+ MAP_LOG_PC(sd, "SKILL-DEACTIVATE %d"_fmt, skill_id);
pc_calcstatus(sd, 0);
return 0;
}
diff --git a/src/map/skill.cpp b/src/map/skill.cpp
index 37a3b44..5b8f2a3 100644
--- a/src/map/skill.cpp
+++ b/src/map/skill.cpp
@@ -54,34 +54,34 @@
struct skill_name_db skill_names[] =
{
- {SkillID::AC_OWL, "OWL", "Owl's_Eye"},
-
- {SkillID::NPC_EMOTION, "EMOTION", "NPC_EMOTION"},
- {SkillID::NPC_POISON, "POISON", "NPC_POISON"},
- {SkillID::NPC_SELFDESTRUCTION, "SELFDESTRUCTION", "Kabooooom!"},
- {SkillID::NPC_SUMMONSLAVE, "SUMMONSLAVE", "NPC_SUMMONSLAVE"},
-
- {SkillID::NV_EMOTE, "EMOTE", "Emote_Skill"},
- {SkillID::NV_TRADE, "TRADE", "Trade_Skill"},
- {SkillID::NV_PARTY, "PARTY", "Party_Skill"},
-
- {SkillID::TMW_MAGIC, "MAGIC", "General Magic"},
- {SkillID::TMW_MAGIC_LIFE, "MAGIC_LIFE", "Life Magic"},
- {SkillID::TMW_MAGIC_WAR, "MAGIC_WAR", "War Magic"},
- {SkillID::TMW_MAGIC_TRANSMUTE, "MAGIC_TRANSMUTE", "Transmutation Magic"},
- {SkillID::TMW_MAGIC_NATURE, "MAGIC_NATURE", "Nature Magic"},
- {SkillID::TMW_MAGIC_ETHER, "MAGIC_ETHER", "Astral Magic"},
- {SkillID::TMW_MAGIC_DARK, "MAGIC_DARK", "Dark Magic"},
- {SkillID::TMW_MAGIC_LIGHT, "MAGIC_LIGHT", "Light Magic"},
-
- {SkillID::TMW_BRAWLING, "BRAWLING", "Brawling"},
- {SkillID::TMW_LUCKY_COUNTER, "LUCKY_COUNTER", "Lucky Counter"},
- {SkillID::TMW_SPEED, "SPEED", "Speed"},
- {SkillID::TMW_RESIST_POISON, "RESIST_POISON", "Resist Poison"},
- {SkillID::TMW_ASTRAL_SOUL, "ASTRAL_SOUL", "Astral Soul"},
- {SkillID::TMW_RAGING, "RAGING", "Raging"},
-
- {SkillID::ZERO, "", ""}
+ {SkillID::AC_OWL, "OWL"_s, "Owl's_Eye"_s},
+
+ {SkillID::NPC_EMOTION, "EMOTION"_s, "NPC_EMOTION"_s},
+ {SkillID::NPC_POISON, "POISON"_s, "NPC_POISON"_s},
+ {SkillID::NPC_SELFDESTRUCTION, "SELFDESTRUCTION"_s, "Kabooooom!"_s},
+ {SkillID::NPC_SUMMONSLAVE, "SUMMONSLAVE"_s, "NPC_SUMMONSLAVE"_s},
+
+ {SkillID::NV_EMOTE, "EMOTE"_s, "Emote_Skill"_s},
+ {SkillID::NV_TRADE, "TRADE"_s, "Trade_Skill"_s},
+ {SkillID::NV_PARTY, "PARTY"_s, "Party_Skill"_s},
+
+ {SkillID::TMW_MAGIC, "MAGIC"_s, "General Magic"_s},
+ {SkillID::TMW_MAGIC_LIFE, "MAGIC_LIFE"_s, "Life Magic"_s},
+ {SkillID::TMW_MAGIC_WAR, "MAGIC_WAR"_s, "War Magic"_s},
+ {SkillID::TMW_MAGIC_TRANSMUTE, "MAGIC_TRANSMUTE"_s, "Transmutation Magic"_s},
+ {SkillID::TMW_MAGIC_NATURE, "MAGIC_NATURE"_s, "Nature Magic"_s},
+ {SkillID::TMW_MAGIC_ETHER, "MAGIC_ETHER"_s, "Astral Magic"_s},
+ {SkillID::TMW_MAGIC_DARK, "MAGIC_DARK"_s, "Dark Magic"_s},
+ {SkillID::TMW_MAGIC_LIGHT, "MAGIC_LIGHT"_s, "Light Magic"_s},
+
+ {SkillID::TMW_BRAWLING, "BRAWLING"_s, "Brawling"_s},
+ {SkillID::TMW_LUCKY_COUNTER, "LUCKY_COUNTER"_s, "Lucky Counter"_s},
+ {SkillID::TMW_SPEED, "SPEED"_s, "Speed"_s},
+ {SkillID::TMW_RESIST_POISON, "RESIST_POISON"_s, "Resist Poison"_s},
+ {SkillID::TMW_ASTRAL_SOUL, "ASTRAL_SOUL"_s, "Astral Soul"_s},
+ {SkillID::TMW_RAGING, "RAGING"_s, "Raging"_s},
+
+ {SkillID::ZERO, ""_s, ""_s}
};
earray<skill_db_, SkillID, SkillID::MAX_SKILL_DB> skill_db;
@@ -690,7 +690,7 @@ int skill_status_change_active(dumb_ptr<block_list> bl, StatusChange type)
if (bl->bl_type != BL::PC && bl->bl_type != BL::MOB)
{
if (battle_config.error_log)
- PRINTF("skill_status_change_active: neither MOB nor PC !\n");
+ PRINTF("skill_status_change_active: neither MOB nor PC !\n"_fmt);
return 0;
}
@@ -715,7 +715,7 @@ void skill_status_change_end(dumb_ptr<block_list> bl, StatusChange type, TimerDa
if (bl->bl_type != BL::PC && bl->bl_type != BL::MOB)
{
if (battle_config.error_log)
- PRINTF("skill_status_change_end: neither MOB nor PC !\n");
+ PRINTF("skill_status_change_end: neither MOB nor PC !\n"_fmt);
return;
}
sc_data = battle_get_sc_data(bl);
@@ -971,7 +971,7 @@ int skill_status_effect(dumb_ptr<block_list> bl, StatusChange type,
else
{
if (battle_config.error_log)
- PRINTF("skill_status_change_start: neither MOB nor PC !\n");
+ PRINTF("skill_status_change_start: neither MOB nor PC !\n"_fmt);
return 0;
}
@@ -1045,7 +1045,7 @@ int skill_status_effect(dumb_ptr<block_list> bl, StatusChange type,
break;
default:
if (battle_config.error_log)
- PRINTF("UnknownStatusChange [%d]\n", type);
+ PRINTF("UnknownStatusChange [%d]\n"_fmt, type);
return 0;
}
@@ -1175,22 +1175,22 @@ void skill_unit_timer_sub_ondelete(dumb_ptr<block_list> bl,
static
SP scan_stat(XString statname)
{
- if (statname == "str")
+ if (statname == "str"_s)
return SP::STR;
- if (statname == "dex")
+ if (statname == "dex"_s)
return SP::DEX;
- if (statname == "agi")
+ if (statname == "agi"_s)
return SP::AGI;
- if (statname == "vit")
+ if (statname == "vit"_s)
return SP::VIT;
- if (statname == "int")
+ if (statname == "int"_s)
return SP::INT;
- if (statname == "luk")
+ if (statname == "luk"_s)
return SP::LUK;
- if (statname == "none")
+ if (statname == "none"_s)
return SP::ZERO;
- FPRINTF(stderr, "Unknown stat `%s'\n", AString(statname));
+ FPRINTF(stderr, "Unknown stat `%s'\n"_fmt, AString(statname));
return SP::ZERO;
}
@@ -1199,7 +1199,7 @@ bool skill_readdb(ZString filename)
io::ReadFile in(filename);
if (!in.is_open())
{
- PRINTF("can't read %s\n", filename);
+ PRINTF("can't read %s\n"_fmt, filename);
return false;
}
@@ -1209,7 +1209,7 @@ bool skill_readdb(ZString filename)
{
// is_comment only works for whole-line comments
// that could change once the Z dependency is dropped ...
- XString comment = "//";
+ LString comment = "//"_s;
XString line = line_.xislice_h(std::search(line_.begin(), line_.end(), comment.begin(), comment.end())).rstrip();
if (!line)
continue;
@@ -1251,9 +1251,9 @@ bool skill_readdb(ZString filename)
continue;
}
- if (castcancel == "yes")
+ if (castcancel == "yes"_s)
skdb.castcancel = true;
- else if (castcancel == "no")
+ else if (castcancel == "no"_s)
skdb.castcancel = false;
else
{
@@ -1261,17 +1261,17 @@ bool skill_readdb(ZString filename)
continue;
}
- if (flags == "passive")
+ if (flags == "passive"_s)
{
skill_pool_register(i);
skdb.poolflags = SkillFlags::POOL_FLAG;
}
- else if (flags == "active")
+ else if (flags == "active"_s)
{
skill_pool_register(i);
skdb.poolflags = SkillFlags::POOL_FLAG | SkillFlags::POOL_ACTIVE;
}
- else if (flags == "no")
+ else if (flags == "no"_s)
skdb.poolflags = SkillFlags::ZERO;
else
{
@@ -1290,7 +1290,7 @@ bool skill_readdb(ZString filename)
skill_db[i] = skdb;
skill_lookup_by_id(i).desc = RString(tmp);
}
- PRINTF("read %s done\n", filename);
+ PRINTF("read %s done\n"_fmt, filename);
return rv;
}
diff --git a/src/map/skill.hpp b/src/map/skill.hpp
index 1a615c1..91fa070 100644
--- a/src/map/skill.hpp
+++ b/src/map/skill.hpp
@@ -61,11 +61,11 @@ earray<skill_db_, SkillID, SkillID::MAX_SKILL_DB> skill_db;
struct skill_name_db
{
SkillID id; // skill id
- RString name; // search strings
+ LString name; // search strings
RString desc; // description that shows up for searches
// this makes const char(&)[] not decay into const char * in {}
- skill_name_db(SkillID i, RString n, RString d)
+ skill_name_db(SkillID i, LString n, LString d)
: id(i), name(n), desc(d)
{}
};
diff --git a/src/map/tmw.cpp b/src/map/tmw.cpp
index 46128d1..7874e8e 100644
--- a/src/map/tmw.cpp
+++ b/src/map/tmw.cpp
@@ -91,7 +91,7 @@ int tmw_CheckChatSpam(dumb_ptr<map_session_data> sd, XString message)
{
sd->chat_lines_in = sd->chat_total_repeats = 0;
- tmw_AutoBan(sd, "chat", battle_config.chat_spam_ban);
+ tmw_AutoBan(sd, "chat"_s, battle_config.chat_spam_ban);
return 1;
}
@@ -100,8 +100,8 @@ int tmw_CheckChatSpam(dumb_ptr<map_session_data> sd, XString message)
(sd->chat_lines_in >= battle_config.chat_spam_warn
|| sd->chat_total_repeats >= battle_config.chat_spam_warn))
{
- clif_displaymessage(sd->sess, "WARNING: You are about to be automatically banned for spam!");
- clif_displaymessage(sd->sess, "WARNING: Please slow down, do not repeat, and do not SHOUT!");
+ clif_displaymessage(sd->sess, "WARNING: You are about to be automatically banned for spam!"_s);
+ clif_displaymessage(sd->sess, "WARNING: Please slow down, do not repeat, and do not SHOUT!"_s);
}
return 0;
@@ -114,16 +114,16 @@ void tmw_AutoBan(dumb_ptr<map_session_data> sd, ZString reason, int length)
sd->auto_ban_info.in_progress = 1;
- AString hack_msg = STRPRINTF("[GM] %s has been autobanned for %s spam",
+ AString hack_msg = STRPRINTF("[GM] %s has been autobanned for %s spam"_fmt,
sd->status_key.name,
reason);
tmw_GmHackMsg(hack_msg);
- AString fake_command = STRPRINTF("@autoban %s %dh (%s spam)",
+ AString fake_command = STRPRINTF("@autoban %s %dh (%s spam)"_fmt,
sd->status_key.name, length, reason);
log_atcommand(sd, fake_command);
- AString anotherbuf = STRPRINTF("You have been banned for %s spamming. Please do not spam.",
+ AString anotherbuf = STRPRINTF("You have been banned for %s spamming. Please do not spam."_fmt,
reason);
clif_displaymessage(sd->sess, anotherbuf);
diff --git a/src/map/trade.cpp b/src/map/trade.cpp
index f358d90..7fbfbec 100644
--- a/src/map/trade.cpp
+++ b/src/map/trade.cpp
@@ -345,7 +345,7 @@ void trade_tradecommit(dumb_ptr<map_session_data> sd)
if ((target_sd = map_id2sd(sd->trade_partner)) != NULL)
{
- MAP_LOG_PC(sd, " TRADECOMMIT WITH %d GIVE %d GET %d",
+ MAP_LOG_PC(sd, " TRADECOMMIT WITH %d GIVE %d GET %d"_fmt,
target_sd->status_key.char_id, sd->deal_zeny,
target_sd->deal_zeny);
if ((sd->deal_locked >= 1) && (target_sd->deal_locked >= 1))
@@ -360,14 +360,14 @@ void trade_tradecommit(dumb_ptr<map_session_data> sd)
{
sd->deal_zeny = 0;
trade_tradecancel(sd);
- MAP_LOG_PC(sd, " TRADECANCEL");
+ MAP_LOG_PC(sd, " TRADECANCEL"_fmt);
return;
}
if (target_sd->deal_zeny > target_sd->status.zeny)
{
target_sd->deal_zeny = 0;
trade_tradecancel(sd);
- MAP_LOG_PC(sd, " TRADECANCEL");
+ MAP_LOG_PC(sd, " TRADECANCEL"_fmt);
return;
}
sd->trade_partner = 0;
@@ -431,7 +431,7 @@ void trade_tradecommit(dumb_ptr<map_session_data> sd)
target_sd->deal_locked = 0;
clif_tradecompleted(sd, 0);
clif_tradecompleted(target_sd, 0);
- MAP_LOG_PC(sd, " TRADEOK");
+ MAP_LOG_PC(sd, " TRADEOK"_fmt);
}
}
}