summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-02-08 15:09:25 -0800
committerBen Longbons <b.r.longbons@gmail.com>2014-02-08 16:18:22 -0800
commit730e5dde39333cb2f63c72a7d7152bee5c4dbb05 (patch)
tree510ef3e0ad46ecf1f2bee1fa42f26e6377b51686 /src/map
parent7a15a3efe85837d52d950cc9f895eadcc9eb6be1 (diff)
downloadtmwa-730e5dde39333cb2f63c72a7d7152bee5c4dbb05.tar.gz
tmwa-730e5dde39333cb2f63c72a7d7152bee5c4dbb05.tar.bz2
tmwa-730e5dde39333cb2f63c72a7d7152bee5c4dbb05.tar.xz
tmwa-730e5dde39333cb2f63c72a7d7152bee5c4dbb05.zip
Implement AString
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.cpp148
-rw-r--r--src/map/atcommand.hpp2
-rw-r--r--src/map/battle.cpp6
-rw-r--r--src/map/chrif.cpp4
-rw-r--r--src/map/clif.cpp28
-rw-r--r--src/map/grfio.cpp17
-rw-r--r--src/map/intif.cpp10
-rw-r--r--src/map/itemdb.cpp4
-rw-r--r--src/map/magic-expr.cpp10
-rw-r--r--src/map/magic-expr.hpp2
-rw-r--r--src/map/magic-interpreter-base.cpp10
-rw-r--r--src/map/magic-interpreter-parser.ypp29
-rw-r--r--src/map/magic-interpreter.hpp18
-rw-r--r--src/map/magic.hpp4
-rw-r--r--src/map/map.cpp16
-rw-r--r--src/map/map.hpp17
-rw-r--r--src/map/mob.cpp6
-rw-r--r--src/map/npc.cpp24
-rw-r--r--src/map/npc.hpp6
-rw-r--r--src/map/pc.cpp13
-rw-r--r--src/map/pc.hpp2
-rw-r--r--src/map/script.cpp37
-rw-r--r--src/map/script.hpp7
-rw-r--r--src/map/skill.cpp8
-rw-r--r--src/map/skill.hpp11
-rw-r--r--src/map/tmw.cpp8
26 files changed, 229 insertions, 218 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index f5deab8..dca9b4e 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -5,7 +5,7 @@
#include <ctime>
#include "../strings/mstring.hpp"
-#include "../strings/fstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
#include "../strings/vstring.hpp"
@@ -182,7 +182,7 @@ void log_atcommand(dumb_ptr<map_session_data> sd, ZString cmd)
cmd);
}
-FString gm_log;
+AString gm_log;
io::AppendFile *get_gm_log()
{
@@ -201,7 +201,7 @@ io::AppendFile *get_gm_log()
return gm_logfile.get();
last_logfile_nr = logfile_nr;
- FString fullname = STRPRINTF("%s.%04d-%02d",
+ AString fullname = STRPRINTF("%s.%04d-%02d",
gm_log, year, month);
if (gm_logfile)
@@ -212,7 +212,7 @@ io::AppendFile *get_gm_log()
if (!gm_logfile)
{
perror("GM log file");
- gm_log = FString();
+ gm_log = AString();
}
return gm_logfile.get();
}
@@ -235,24 +235,24 @@ bool is_atcommand(Session *s, dumb_ptr<map_session_data> sd,
gmlvl = pc_isGM(sd);
if (battle_config.atcommand_gm_only != 0 && !gmlvl)
{
- FString output = STRPRINTF("GM command is level 0, but this server disables level 0 commands: %s",
- FString(command));
+ AString output = STRPRINTF("GM command is level 0, but this server disables level 0 commands: %s",
+ AString(command));
clif_displaymessage(s, output);
return true;
}
if (!info)
{
- FString output = STRPRINTF("GM command not found: %s",
- FString(command));
+ AString output = STRPRINTF("GM command not found: %s",
+ AString(command));
clif_displaymessage(s, output);
return true;
// don't show in chat
}
if (info->level > gmlvl)
{
- FString 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",
info->level, gmlvl,
- FString(command));
+ AString(command));
clif_displaymessage(s, output);
return true;
}
@@ -269,7 +269,7 @@ bool is_atcommand(Session *s, dumb_ptr<map_session_data> sd,
break;
case ATCE::USAGE:
clif_displaymessage(s, "Command failed: usage error");
- clif_displaymessage(s, STRPRINTF("Usage: %s %s", FString(command), info->args));
+ clif_displaymessage(s, STRPRINTF("Usage: %s %s", AString(command), info->args));
break;
case ATCE::EXIST:
clif_displaymessage(s, "Command failed: something does not exist (or already exists)");
@@ -328,7 +328,7 @@ bool atcommand_config_read(ZString cfgName)
}
bool rv = true;
- FString line;
+ AString line;
while (in.getline(line))
{
if (is_comment(line))
@@ -442,7 +442,7 @@ ATCE atcommand_setup(Session *s, dumb_ptr<map_session_data> sd,
return ATCE::USAGE;
level--;
- FString buf;
+ AString buf;
buf = STRPRINTF("-255 %s", character);
atcommand_character_baselevel(s, sd, buf);
@@ -606,7 +606,7 @@ 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
- FString output = STRPRINTF("%s: %s (%d,%d)",
+ AString output = STRPRINTF("%s: %s (%d,%d)",
pl_sd->status.name,
pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y);
clif_displaymessage(s, output);
@@ -651,7 +651,7 @@ ATCE atcommand_goto(Session *s, dumb_ptr<map_session_data> sd,
return ATCE::PERM;
}
pc_setpos(sd, pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y, BeingRemoveWhy::WARPED);
- FString output = STRPRINTF("Jump to %s", character);
+ AString output = STRPRINTF("Jump to %s", character);
clif_displaymessage(s, output);
}
else
@@ -692,7 +692,7 @@ ATCE atcommand_jump(Session *s, dumb_ptr<map_session_data> sd,
return ATCE::PERM;
}
pc_setpos(sd, sd->mapname_, x, y, BeingRemoveWhy::WARPED);
- FString output = STRPRINTF("Jump to %d %d", x, y);
+ AString output = STRPRINTF("Jump to %d %d", x, y);
clif_displaymessage(s, output);
}
else
@@ -734,7 +734,7 @@ ATCE atcommand_who(Session *s, dumb_ptr<map_session_data> sd,
if (player_name.contains_seq(match_text))
{
// search with no case sensitive
- FString output;
+ AString output;
if (pl_GM_level > 0)
output = STRPRINTF(
"Name: %s (GM:%d) | Location: %s %d %d",
@@ -758,7 +758,7 @@ ATCE atcommand_who(Session *s, dumb_ptr<map_session_data> sd,
clif_displaymessage(s, "1 player found.");
else
{
- FString output = STRPRINTF("%d players found.", count);
+ AString output = STRPRINTF("%d players found.", count);
clif_displaymessage(s, output);
}
@@ -799,7 +799,7 @@ 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");
- FString output;
+ AString output;
if (pl_GM_level > 0)
output = STRPRINTF(
"Name: %s (GM:%d) | Party: '%s'",
@@ -817,7 +817,7 @@ ATCE atcommand_whogroup(Session *s, dumb_ptr<map_session_data> sd,
clif_displaymessage(s, "1 player found.");
else
{
- FString output = STRPRINTF("%d players found.", count);
+ AString output = STRPRINTF("%d players found.", count);
clif_displaymessage(s, output);
}
@@ -859,7 +859,7 @@ ATCE atcommand_whomap(Session *s, dumb_ptr<map_session_data> sd,
// you can look only lower or same level
if (pl_sd->bl_m == map_id)
{
- FString output;
+ AString output;
if (pl_GM_level > 0)
output = STRPRINTF(
"Name: %s (GM:%d) | Location: %s %d %d",
@@ -877,7 +877,7 @@ ATCE atcommand_whomap(Session *s, dumb_ptr<map_session_data> sd,
}
}
- FString output = STRPRINTF("%d players found in map '%s'.",
+ AString output = STRPRINTF("%d players found in map '%s'.",
count, map_id->name_);
clif_displaymessage(s, output);
@@ -922,7 +922,7 @@ ATCE atcommand_whomapgroup(Session *s, dumb_ptr<map_session_data> sd,
{
p = party_search(pl_sd->status.party_id);
PartyName temp0 = p ? p->name : stringish<PartyName>("None");
- FString output;
+ AString output;
if (pl_GM_level > 0)
output = STRPRINTF("Name: %s (GM:%d) | Party: '%s'",
pl_sd->status.name, pl_GM_level, temp0);
@@ -936,7 +936,7 @@ ATCE atcommand_whomapgroup(Session *s, dumb_ptr<map_session_data> sd,
}
}
- FString output;
+ AString output;
if (count == 0)
output = STRPRINTF("No player found in map '%s'.", map_id->name_);
else if (count == 1)
@@ -984,7 +984,7 @@ ATCE atcommand_whogm(Session *s, dumb_ptr<map_session_data> sd,
if (player_name.contains_seq(match_text))
{
// search with no case sensitive
- FString output;
+ AString output;
output = STRPRINTF(
"Name: %s (GM:%d) | Location: %s %d %d",
pl_sd->status.name, pl_GM_level,
@@ -1015,7 +1015,7 @@ ATCE atcommand_whogm(Session *s, dumb_ptr<map_session_data> sd,
clif_displaymessage(s, "1 GM found.");
else
{
- FString output = STRPRINTF("%d GMs found.", count);
+ AString output = STRPRINTF("%d GMs found.", count);
clif_displaymessage(s, output);
}
@@ -1067,7 +1067,7 @@ ATCE atcommand_speed(Session *s, dumb_ptr<map_session_data> sd,
{
if (!message)
{
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"Please, enter a speed value (usage: @speed <%d-%d>).",
static_cast<uint32_t>(MIN_WALK_SPEED.count()),
static_cast<uint32_t>(MAX_WALK_SPEED.count()));
@@ -1086,7 +1086,7 @@ ATCE atcommand_speed(Session *s, dumb_ptr<map_session_data> sd,
}
else
{
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"Please, enter a valid speed value (usage: @speed <%d-%d>).",
static_cast<uint32_t>(MIN_WALK_SPEED.count()),
static_cast<uint32_t>(MAX_WALK_SPEED.count()));
@@ -1746,7 +1746,7 @@ ATCE atcommand_spawn(Session *s, dumb_ptr<map_session_data> sd,
clif_displaymessage(s, "All monster summoned!");
else
{
- FString output = STRPRINTF("%d monster(s) summoned!",
+ AString output = STRPRINTF("%d monster(s) summoned!",
count);
clif_displaymessage(s, output);
}
@@ -1795,7 +1795,7 @@ void atlist_nearby_sub(dumb_ptr<block_list> bl, Session *s)
{
nullpo_retv(bl);
- FString buf = STRPRINTF(" - \"%s\"",
+ AString buf = STRPRINTF(" - \"%s\"",
bl->is_player()->status.name);
clif_displaymessage(s, buf);
}
@@ -1831,7 +1831,7 @@ ATCE atcommand_gat(Session *s, dumb_ptr<map_session_data> sd,
for (y = 2; y >= -2; y--)
{
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"%s (x= %d, y= %d) %02X %02X %02X %02X %02X",
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),
@@ -2049,7 +2049,7 @@ ATCE atcommand_recall(Session *s, dumb_ptr<map_session_data> sd,
return ATCE::PERM;
}
pc_setpos(pl_sd, sd->mapname_, sd->bl_x, sd->bl_y, BeingRemoveWhy::QUIT);
- FString output = STRPRINTF("%s recalled!", character);
+ AString output = STRPRINTF("%s recalled!", character);
clif_displaymessage(s, output);
}
else
@@ -2109,7 +2109,7 @@ ATCE atcommand_character_stats(Session *s, dumb_ptr<map_session_data>,
dumb_ptr<map_session_data> pl_sd = map_nick2sd(character);
if (pl_sd != NULL)
{
- FString output;
+ AString output;
output = STRPRINTF("'%s' stats:", pl_sd->status.name);
clif_displaymessage(s, output);
output = STRPRINTF("Base Level - %d", pl_sd->status.base_level),
@@ -2163,13 +2163,13 @@ ATCE atcommand_character_stats_all(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()));
if (pl_sd && pl_sd->state.auth)
{
- FString gmlevel;
+ AString gmlevel;
if (pc_isGM(pl_sd) > 0)
gmlevel = STRPRINTF("| GM Lvl: %d", pc_isGM(pl_sd));
else
gmlevel = " ";
- FString output;
+ AString output;
output = STRPRINTF(
"Name: %s | BLvl: %d | Job: Novice/Human (Lvl: %d) | HP: %d/%d | SP: %d/%d",
pl_sd->status.name, pl_sd->status.base_level,
@@ -2198,7 +2198,7 @@ ATCE atcommand_character_stats_all(Session *s, dumb_ptr<map_session_data>,
clif_displaymessage(s, "1 player found.");
else
{
- FString output = STRPRINTF("%d players found.", count);
+ AString output = STRPRINTF("%d players found.", count);
clif_displaymessage(s, output);
}
@@ -2935,7 +2935,7 @@ ATCE atcommand_idsearch(Session *s, dumb_ptr<map_session_data>,
if (!extract(message, &item_name) || !item_name)
return ATCE::USAGE;
- FString output = STRPRINTF("The reference result of '%s' (name: id):", item_name);
+ AString output = STRPRINTF("The reference result of '%s' (name: id):", item_name);
clif_displaymessage(s, output);
match = 0;
for (i = 0; i < 20000; i++)
@@ -2970,7 +2970,7 @@ 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);
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"'%s' skill points reseted!", character);
clif_displaymessage(s, output);
}
@@ -3005,7 +3005,7 @@ 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);
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"'%s' stats points reseted!",
character);
clif_displaymessage(s, output);
@@ -3046,7 +3046,7 @@ ATCE atcommand_charreset(Session *s, dumb_ptr<map_session_data> sd,
// [Fate] Reset magic quest variables
pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_EXP"), 0);
// [Fate] Reset magic experience
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"'%s' skill and stats points reseted!", character);
clif_displaymessage(s, output);
}
@@ -3131,7 +3131,7 @@ ATCE atcommand_char_wipe(Session *s, dumb_ptr<map_session_data> sd,
pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_EXP"), 0);
// [Fate] Reset magic experience
- FString output = STRPRINTF("%s: wiped.", character);
+ AString output = STRPRINTF("%s: wiped.", character);
clif_displaymessage(s, output);
}
else
@@ -3341,7 +3341,7 @@ ATCE atcommand_recallall(Session *s, dumb_ptr<map_session_data> sd,
clif_displaymessage(s, "All characters recalled!");
if (count)
{
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"Because you are not authorised to warp from some maps, %d player(s) have not been recalled.",
count);
clif_displaymessage(s, output);
@@ -3391,7 +3391,7 @@ 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);
}
}
- FString 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.", p->name);
clif_displaymessage(s, output);
if (count)
{
@@ -3432,7 +3432,7 @@ ATCE atcommand_mapinfo(Session *s, dumb_ptr<map_session_data> sd,
return ATCE::EXIST;
clif_displaymessage(s, "------ Map Info ------");
- FString output = STRPRINTF("Map Name: %s", map_name);
+ AString output = STRPRINTF("Map Name: %s", map_name);
clif_displaymessage(s, output);
output = STRPRINTF("Players In Map: %d", m_id->users);
clif_displaymessage(s, output);
@@ -3565,13 +3565,13 @@ ATCE atcommand_partyspy(Session *s, dumb_ptr<map_session_data> sd,
if (sd->partyspy == p->party_id)
{
sd->partyspy = 0;
- FString output = STRPRINTF("No longer spying on the %s party.", p->name);
+ AString output = STRPRINTF("No longer spying on the %s party.", p->name);
clif_displaymessage(s, output);
}
else
{
sd->partyspy = p->party_id;
- FString output = STRPRINTF("Spying on the %s party.", p->name);
+ AString output = STRPRINTF("Spying on the %s party.", p->name);
clif_displaymessage(s, output);
}
}
@@ -3636,7 +3636,7 @@ ATCE atcommand_servertime(Session *s, dumb_ptr<map_session_data>,
{
timestamp_seconds_buffer tsbuf;
stamp_time(tsbuf);
- FString temp = STRPRINTF("Server time: %s", tsbuf);
+ AString temp = STRPRINTF("Server time: %s", tsbuf);
clif_displaymessage(s, temp);
return ATCE::OKAY;
@@ -3678,7 +3678,7 @@ ATCE atcommand_chardelitem(Session *s, dumb_ptr<map_session_data> sd,
item_position = pc_search_inventory(pl_sd, item_id);
// for next loop
}
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"%d item(s) removed by a GM.",
count);
clif_displaymessage(pl_sd->sess, output);
@@ -3723,7 +3723,7 @@ ATCE atcommand_broadcast(Session *, dumb_ptr<map_session_data> sd,
if (!message)
return ATCE::USAGE;
- FString output = STRPRINTF("%s : %s", sd->status.name, message);
+ AString output = STRPRINTF("%s : %s", sd->status.name, message);
intif_GMmessage(output);
return ATCE::OKAY;
@@ -3736,7 +3736,7 @@ ATCE atcommand_localbroadcast(Session *, dumb_ptr<map_session_data> sd,
if (!message)
return ATCE::USAGE;
- FString output = STRPRINTF("%s : %s", sd->status.name, message);
+ AString output = STRPRINTF("%s : %s", sd->status.name, message);
clif_GMmessage(sd, output, 1);
@@ -3844,7 +3844,7 @@ ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd,
count++;
if (count == 1)
{
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"------ Items list of '%s' ------",
pl_sd->status.name);
clif_displaymessage(s, output);
@@ -3888,7 +3888,7 @@ ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd,
else
equipstr = MString();
- FString output;
+ AString output;
if (sd->status.inventory[i].refine)
output = STRPRINTF("%d %s %+d (%s %+d, id: %d) %s",
pl_sd->status.inventory[i].amount,
@@ -3897,13 +3897,13 @@ ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd,
item_data->jname,
pl_sd->status.inventory[i].refine,
pl_sd->status.inventory[i].nameid,
- FString(equipstr));
+ AString(equipstr));
else
output = STRPRINTF("%d %s (%s, id: %d) %s",
pl_sd->status.inventory[i].amount,
item_data->name, item_data->jname,
pl_sd->status.inventory[i].nameid,
- FString(equipstr));
+ AString(equipstr));
clif_displaymessage(s, output);
MString voutput;
@@ -3938,7 +3938,7 @@ ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd,
// replace trailing ", "
voutput.pop_back();
voutput.back() = ')';
- clif_displaymessage(s, FString(voutput));
+ clif_displaymessage(s, AString(voutput));
}
}
}
@@ -3946,7 +3946,7 @@ ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd,
clif_displaymessage(s, "No item found on this player.");
else
{
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"%d item(s) found in %d kind(s) of items.",
counter, count);
clif_displaymessage(s, output);
@@ -3999,12 +3999,12 @@ ATCE atcommand_character_storage_list(Session *s, dumb_ptr<map_session_data> sd,
count++;
if (count == 1)
{
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"------ Storage items list of '%s' ------",
pl_sd->status.name);
clif_displaymessage(s, output);
}
- FString output;
+ AString output;
if (stor->storage_[i].refine)
output = STRPRINTF("%d %s %+d (%s %+d, id: %d)",
stor->storage_[i].amount,
@@ -4052,7 +4052,7 @@ ATCE atcommand_character_storage_list(Session *s, dumb_ptr<map_session_data> sd,
// replace last ", "
voutput.pop_back();
voutput.back() = ')';
- clif_displaymessage(s, FString(voutput));
+ clif_displaymessage(s, AString(voutput));
}
}
}
@@ -4061,7 +4061,7 @@ ATCE atcommand_character_storage_list(Session *s, dumb_ptr<map_session_data> sd,
"No item found in the storage of this player.");
else
{
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"%d item(s) found in %d kind(s) of items.",
counter, count);
clif_displaymessage(s, output);
@@ -4117,13 +4117,13 @@ ATCE atcommand_character_cart_list(Session *s, dumb_ptr<map_session_data> sd,
count++;
if (count == 1)
{
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"------ Cart items list of '%s' ------",
pl_sd->status.name);
clif_displaymessage(s, output);
}
- FString output;
+ AString output;
if (pl_sd->status.cart[i].refine)
output = STRPRINTF("%d %s %+d (%s %+d, id: %d)",
pl_sd->status.cart[i].amount,
@@ -4170,7 +4170,7 @@ ATCE atcommand_character_cart_list(Session *s, dumb_ptr<map_session_data> sd,
{
voutput.pop_back();
voutput.back() = '0';
- clif_displaymessage(s, FString(voutput));
+ clif_displaymessage(s, AString(voutput));
}
}
}
@@ -4179,7 +4179,7 @@ ATCE atcommand_character_cart_list(Session *s, dumb_ptr<map_session_data> sd,
"No item found in the cart of this player.");
else
{
- FString output = STRPRINTF("%d item(s) found in %d kind(s) of items.",
+ AString output = STRPRINTF("%d item(s) found in %d kind(s) of items.",
counter, count);
clif_displaymessage(s, output);
}
@@ -4312,9 +4312,9 @@ ATCE atcommand_addwarp(Session *s, dumb_ptr<map_session_data> sd,
if (!extract(message, record<' '>(&mapname, &x, &y)))
return ATCE::USAGE;
- FString w1 = STRPRINTF("%s,%d,%d", sd->mapname_, sd->bl_x, sd->bl_y);
- FString w3 = STRPRINTF("%s%d%d%d%d", mapname, sd->bl_x, sd->bl_y, x, y);
- FString w4 = STRPRINTF("1,1,%s.gat,%d,%d", mapname, x, y);
+ 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);
NpcName w3name = stringish<NpcName>(w3);
int ret = npc_parse_warp(w1, ZString("warp"), w3name, w4);
@@ -4322,7 +4322,7 @@ ATCE atcommand_addwarp(Session *s, dumb_ptr<map_session_data> sd,
// warp failed
return ATCE::RANGE;
- FString output = STRPRINTF("New warp NPC => %s", w3);
+ AString output = STRPRINTF("New warp NPC => %s", w3);
clif_displaymessage(s, output);
return ATCE::OKAY;
@@ -4689,7 +4689,7 @@ ATCE atcommand_magic_info(Session *s, dumb_ptr<map_session_data>,
dumb_ptr<map_session_data> pl_sd = map_nick2sd(character);
if (pl_sd)
{
- FString buf = STRPRINTF(
+ AString buf = STRPRINTF(
"`%s' has the following magic skills:",
character);
clif_displaymessage(s, buf);
@@ -4788,7 +4788,7 @@ ATCE atcommand_tee(Session *, dumb_ptr<map_session_data> sd,
data += sd->status.name.to__actual();
data += " : ";
data += message;
- clif_message(sd, FString(data));
+ clif_message(sd, AString(data));
return ATCE::OKAY;
}
@@ -4845,7 +4845,7 @@ ATCE atcommand_jump_iterate(Session *s, dumb_ptr<map_session_data> sd,
return ATCE::PERM;
}
pc_setpos(sd, pl_sd->bl_m->name_, pl_sd->bl_x, pl_sd->bl_y, BeingRemoveWhy::WARPED);
- FString output = STRPRINTF("Jump to %s", pl_sd->status.name);
+ AString output = STRPRINTF("Jump to %s", pl_sd->status.name);
clif_displaymessage(s, output);
sd->followtarget = pl_sd->bl_id;
@@ -4896,7 +4896,7 @@ ATCE atcommand_skillpool_info(Session *s, dumb_ptr<map_session_data>,
int pool_skills_nr = skill_pool(pl_sd, pool_skills);
int i;
- FString buf = STRPRINTF(
+ AString buf = STRPRINTF(
"Active skills %d out of %d for %s:",
pool_skills_nr, skill_pool_max(pl_sd), character);
clif_displaymessage(s, buf);
@@ -4915,7 +4915,7 @@ ATCE atcommand_skillpool_info(Session *s, dumb_ptr<map_session_data>,
for (i = 0; i < skill_pool_skills_size; ++i)
{
- const FString& name = skill_name(skill_pool_skills[i]);
+ const RString& name = skill_name(skill_pool_skills[i]);
int lvl = pl_sd->status.skill[skill_pool_skills[i]].lv;
if (lvl)
@@ -5042,7 +5042,7 @@ ATCE atcommand_ipcheck(Session *s, dumb_ptr<map_session_data>,
// Is checking GM levels really needed here?
if (ip == pl_sd->get_ip())
{
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"Name: %s | Location: %s %d %d",
pl_sd->status.name, pl_sd->mapname_,
pl_sd->bl_x, pl_sd->bl_y);
diff --git a/src/map/atcommand.hpp b/src/map/atcommand.hpp
index a18b035..c825976 100644
--- a/src/map/atcommand.hpp
+++ b/src/map/atcommand.hpp
@@ -15,7 +15,7 @@ bool atcommand_config_read(ZString cfgName);
void log_atcommand(dumb_ptr<map_session_data> sd, ZString cmd);
// only used by map.cpp
-extern FString gm_log;
+extern AString gm_log;
void atcommand_config_write(ZString cfgName);
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index 35cef79..d1e79ef 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -2,7 +2,7 @@
#include <cstring>
-#include "../strings/fstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../io/cxxstdio.hpp"
@@ -2420,7 +2420,7 @@ bool battle_config_read(ZString cfgName)
return false;
}
- FString line;
+ AString line;
while (in.getline(line))
{
#define BATTLE_CONFIG_VAR(name) {{#name}, &battle_config.name}
@@ -2555,7 +2555,7 @@ bool battle_config_read(ZString cfgName)
goto continue_outer;
}
- PRINTF("WARNING: unknown battle conf key: %s\n", FString(w1));
+ PRINTF("WARNING: unknown battle conf key: %s\n", AString(w1));
rv = false;
continue_outer:
diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp
index ab67b5c..c49a101 100644
--- a/src/map/chrif.cpp
+++ b/src/map/chrif.cpp
@@ -4,7 +4,7 @@
#include <cstring>
-#include "../strings/fstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../io/cxxstdio.hpp"
@@ -462,7 +462,7 @@ int chrif_char_ask_name_answer(Session *s)
dumb_ptr<map_session_data> sd = map_id2sd(acc);
if (acc >= 0 && sd != NULL)
{
- FString output;
+ AString output;
if (RFIFOW(s, 32) == 1) // player not found
output = STRPRINTF("The player '%s' doesn't exist.",
player_name);
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index 61c47d9..3fc716d 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -6,7 +6,7 @@
#include <cstring>
#include <ctime>
-#include "../strings/fstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
@@ -217,7 +217,7 @@ enum class ChatType
};
static
-FString clif_validate_chat(dumb_ptr<map_session_data> sd, ChatType type);
+AString clif_validate_chat(dumb_ptr<map_session_data> sd, ChatType type);
/*==========================================
* clif_sendでSendWho::AREA*指定時用
@@ -3761,7 +3761,7 @@ void clif_parse_GlobalMessage(Session *s, dumb_ptr<map_session_data> sd)
{
nullpo_retv(sd);
- FString mbuf = clif_validate_chat(sd, ChatType::Global);
+ AString mbuf = clif_validate_chat(sd, ChatType::Global);
if (!mbuf)
{
clif_displaymessage(s, "Your message could not be sent.");
@@ -4017,7 +4017,7 @@ void clif_parse_Wis(Session *s, dumb_ptr<map_session_data> sd)
nullpo_retv(sd);
- FString mbuf = clif_validate_chat(sd, ChatType::Whisper);
+ AString mbuf = clif_validate_chat(sd, ChatType::Whisper);
if (!mbuf)
{
clif_displaymessage(s, "Your message could not be sent.");
@@ -4628,7 +4628,7 @@ void clif_parse_PartyMessage(Session *s, dumb_ptr<map_session_data> sd)
{
nullpo_retv(sd);
- FString mbuf = clif_validate_chat(sd, ChatType::Party);
+ AString mbuf = clif_validate_chat(sd, ChatType::Party);
if (!mbuf)
{
clif_displaymessage(s, "Your message could not be sent.");
@@ -5294,15 +5294,15 @@ void WARN_MALFORMED_MSG(dumb_ptr<map_session_data> sd, const char *msg)
* @return a dynamically allocated copy of the message, or empty string upon failure
*/
static
-FString clif_validate_chat(dumb_ptr<map_session_data> sd, ChatType type)
+AString clif_validate_chat(dumb_ptr<map_session_data> sd, ChatType type)
{
- nullpo_retr(FString(), sd);
+ nullpo_retr(AString(), sd);
/*
* Don't send chat in the period between the ban and the connection's
* closure.
*/
if (sd->auto_ban_info.in_progress)
- return FString();
+ return AString();
Session *s = sd->sess;
size_t msg_len = RFIFOW(s, 2) - 4;
@@ -5326,14 +5326,14 @@ FString clif_validate_chat(dumb_ptr<map_session_data> sd, ChatType type)
if (!msg_len)
{
WARN_MALFORMED_MSG(sd, "no message sent");
- return FString();
+ return AString();
}
/* The client sent (or claims to have sent) an empty message. */
if (msg_len == min_len)
{
WARN_MALFORMED_MSG(sd, "empty message");
- return FString();
+ return AString();
}
/* The protocol specifies that the target must be 24 bytes long. */
@@ -5342,7 +5342,7 @@ FString clif_validate_chat(dumb_ptr<map_session_data> sd, ChatType type)
/* Disallow malformed messages. */
clif_setwaitclose(s);
WARN_MALFORMED_MSG(sd, "illegal target name");
- return FString();
+ return AString();
}
size_t pstart = 4;
@@ -5352,7 +5352,7 @@ FString clif_validate_chat(dumb_ptr<map_session_data> sd, ChatType type)
pstart += 24;
buf_len -= 24;
}
- FString pbuf = RFIFO_STRING(s, pstart, buf_len);
+ AString pbuf = RFIFO_STRING(s, pstart, buf_len);
/*
* The client attempted to exceed the maximum message length.
@@ -5364,7 +5364,7 @@ FString 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");
- return FString();
+ return AString();
}
if (type == ChatType::Global)
@@ -5375,7 +5375,7 @@ FString clif_validate_chat(dumb_ptr<map_session_data> sd, ChatType type)
/* Disallow malformed/spoofed messages. */
clif_setwaitclose(s);
WARN_MALFORMED_MSG(sd, "spoofed name/invalid format");
- return FString();
+ return AString();
}
/* Step beyond the separator. */
XString xs = p.xslice_t(name_len + 3);
diff --git a/src/map/grfio.cpp b/src/map/grfio.cpp
index ff73c90..d89fe21 100644
--- a/src/map/grfio.cpp
+++ b/src/map/grfio.cpp
@@ -13,7 +13,8 @@
#include <map>
#include "../strings/mstring.hpp"
-#include "../strings/fstring.hpp"
+#include "../strings/rstring.hpp"
+#include "../strings/astring.hpp"
#include "../io/cxxstdio.hpp"
#include "../io/read.hpp"
@@ -23,7 +24,7 @@
#include "../poison.hpp"
static
-std::map<MapName, FString> resnametable;
+std::map<MapName, RString> resnametable;
bool load_resnametable(ZString filename)
{
@@ -35,11 +36,11 @@ bool load_resnametable(ZString filename)
}
bool rv = true;
- FString line;
+ AString line;
while (in.getline(line))
{
MapName key;
- FString value;
+ AString value;
if (!extract(line,
record<'#'>(&key, &value)))
{
@@ -47,6 +48,7 @@ bool load_resnametable(ZString filename)
rv = false;
continue;
}
+ // TODO add "data/" here ...
resnametable[key] = value;
}
return rv;
@@ -54,18 +56,21 @@ bool load_resnametable(ZString filename)
/// Change *.gat to *.wlk
static
-FString grfio_resnametable(MapName rname)
+RString grfio_resnametable(MapName rname)
{
+ // TODO return an error instead of throwing an exception
return resnametable.at(rname);
}
std::vector<uint8_t> grfio_reads(MapName rname)
{
MString lfname_;
+ // TODO ... instead of here
lfname_ += "data/";
lfname_ += grfio_resnametable(rname);
- FString lfname = FString(lfname_);
+ AString lfname = AString(lfname_);
+ // TODO wrap this immediately
int fd = open(lfname.c_str(), O_RDONLY);
if (fd == -1)
{
diff --git a/src/map/intif.cpp b/src/map/intif.cpp
index 7d699dd..e994bdb 100644
--- a/src/map/intif.cpp
+++ b/src/map/intif.cpp
@@ -3,7 +3,7 @@
#include <cstdlib>
#include <cstring>
-#include "../strings/fstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
@@ -254,7 +254,7 @@ int intif_parse_WisMessage(Session *s)
CharName to = stringish<CharName>(RFIFO_STRING<24>(s, 32));
size_t len = RFIFOW(s, 2) - 56;
- FString buf = RFIFO_STRING(s, 56, len);
+ AString buf = RFIFO_STRING(s, 56, len);
if (battle_config.etc_log)
{
@@ -313,7 +313,7 @@ void mapif_parse_WisToGM(Session *s)
min_gm_level = RFIFOW(s, 28);
CharName Wisp_name = stringish<CharName>(RFIFO_STRING<24>(s, 4));
- FString message = RFIFO_STRING(s, 30, len);
+ AString message = RFIFO_STRING(s, 30, len);
// information is sended to all online GM
for (io::FD i : iter_fds())
{
@@ -503,7 +503,7 @@ static
void intif_parse_PartyMessage(Session *s)
{
size_t len = RFIFOW(s, 2) - 12;
- FString buf = RFIFO_STRING(s, 12, len);
+ AString buf = RFIFO_STRING(s, 12, len);
party_recv_message(RFIFOL(s, 4), RFIFOL(s, 8), buf);
}
@@ -542,7 +542,7 @@ int intif_parse(Session *s)
{
case 0x3800:
{
- FString mes = RFIFO_STRING(s, 4, packet_len - 4);
+ AString mes = RFIFO_STRING(s, 4, packet_len - 4);
clif_GMmessage(NULL, mes, 0);
}
break;
diff --git a/src/map/itemdb.cpp b/src/map/itemdb.cpp
index bcef583..ba225bd 100644
--- a/src/map/itemdb.cpp
+++ b/src/map/itemdb.cpp
@@ -3,7 +3,7 @@
#include <cstdlib>
#include <cstring>
-#include "../strings/fstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
@@ -161,7 +161,7 @@ bool itemdb_readdb(ZString filename)
lines = 0;
- FString line;
+ AString line;
while (in.getline(line))
{
lines++;
diff --git a/src/map/magic-expr.cpp b/src/map/magic-expr.cpp
index 655da1b..7343e50 100644
--- a/src/map/magic-expr.cpp
+++ b/src/map/magic-expr.cpp
@@ -6,7 +6,7 @@
#include <cmath>
#include "../strings/mstring.hpp"
-#include "../strings/fstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/vstring.hpp"
@@ -93,7 +93,7 @@ void magic_clear_var(val_t *v)
}
static
-FString show_entity(dumb_ptr<block_list> entity)
+AString show_entity(dumb_ptr<block_list> entity)
{
switch (entity->bl_type)
{
@@ -126,7 +126,7 @@ void stringify(val_t *v, int within_op)
{"north"}, {"north-east"},
{"east"}, {"south-east"},
}};
- FString buf;
+ AString buf;
switch (v->ty)
{
@@ -287,7 +287,7 @@ int fun_add(dumb_ptr<env_t>, val_t *result, const_array<val_t> args)
MString m;
m += ARGSTR(0);
m += ARGSTR(1);
- RESULTSTR = dumb_string::copys(FString(m));
+ RESULTSTR = dumb_string::copys(AString(m));
result->ty = TYPE::STRING;
}
return 0;
@@ -1677,7 +1677,7 @@ int magic_eval_int(dumb_ptr<env_t> env, dumb_ptr<expr_t> expr)
return result.v.v_int;
}
-FString magic_eval_str(dumb_ptr<env_t> env, dumb_ptr<expr_t> expr)
+AString magic_eval_str(dumb_ptr<env_t> env, dumb_ptr<expr_t> expr)
{
val_t result;
magic_eval(env, &result, expr);
diff --git a/src/map/magic-expr.hpp b/src/map/magic-expr.hpp
index 7601bef..0fdc435 100644
--- a/src/map/magic-expr.hpp
+++ b/src/map/magic-expr.hpp
@@ -61,7 +61,7 @@ int magic_eval_int(dumb_ptr<env_t> env, dumb_ptr<expr_t> expr);
/**
* Evaluates an expression and coerces the result into a string
*/
-FString magic_eval_str(dumb_ptr<env_t> env, dumb_ptr<expr_t> expr);
+AString magic_eval_str(dumb_ptr<env_t> env, dumb_ptr<expr_t> expr);
dumb_ptr<expr_t> magic_new_expr(EXPR ty);
diff --git a/src/map/magic-interpreter-base.cpp b/src/map/magic-interpreter-base.cpp
index 0ba145a..f1878a0 100644
--- a/src/map/magic-interpreter-base.cpp
+++ b/src/map/magic-interpreter-base.cpp
@@ -3,7 +3,7 @@
#include "magic-interpreter-aux.hpp"
#include "magic-interpreter.hpp"
-#include "../strings/fstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/xstring.hpp"
#include "../io/cxxstdio.hpp"
@@ -68,13 +68,13 @@ void set_spell SETTER(dumb_ptr<spell_t>, TYPE::SPELL, v_spell)
magic_conf_t magic_conf; /* Global magic conf */
env_t magic_default_env = { &magic_conf, NULL };
-FString magic_find_invocation(XString spellname)
+AString magic_find_invocation(XString spellname)
{
auto it = magic_conf.spells_by_name.find(spellname);
if (it != magic_conf.spells_by_name.end())
return it->second->invocation;
- return FString();
+ return AString();
}
dumb_ptr<spell_t> magic_find_spell(XString invocation)
@@ -90,14 +90,14 @@ dumb_ptr<spell_t> magic_find_spell(XString invocation)
/* Spell anchors */
/* -------------------------------------------------------------------------------- */
-FString magic_find_anchor_invocation(XString anchor_name)
+AString magic_find_anchor_invocation(XString anchor_name)
{
auto it = magic_conf.anchors_by_name.find(anchor_name);
if (it != magic_conf.anchors_by_name.end())
return it->second->invocation;
- return FString();
+ return AString();
}
dumb_ptr<teleport_anchor_t> magic_find_anchor(XString name)
diff --git a/src/map/magic-interpreter-parser.ypp b/src/map/magic-interpreter-parser.ypp
index a86f1c8..3ec1bdd 100644
--- a/src/map/magic-interpreter-parser.ypp
+++ b/src/map/magic-interpreter-parser.ypp
@@ -3,7 +3,7 @@
#include "magic-interpreter.hpp"
extern
-FString current_magic_filename;
+AString current_magic_filename;
} // %code requires
%code
@@ -13,7 +13,8 @@ FString current_magic_filename;
#include <cassert>
#include <cstdarg> // exception to "no va_list" rule, even after cxxstdio
-#include "../strings/fstring.hpp"
+#include "../strings/rstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../io/cxxstdio.hpp"
@@ -23,7 +24,7 @@ FString current_magic_filename;
#include "itemdb.hpp"
#include "magic-expr.hpp"
-FString current_magic_filename;
+AString current_magic_filename;
// can't use src/warnings.hpp in generated code
#pragma GCC diagnostic warning "-Wall"
@@ -37,13 +38,13 @@ static
size_t intern_id(ZString id_name);
static
-dumb_ptr<expr_t> fun_expr(FString name, const_array<dumb_ptr<expr_t>> argv, int line, int column);
+dumb_ptr<expr_t> fun_expr(AString name, const_array<dumb_ptr<expr_t>> argv, int line, int column);
static
dumb_ptr<expr_t> dot_expr(dumb_ptr<expr_t> lhs, int id);
static
-void BIN_EXPR(dumb_ptr<expr_t>& x, FString name, dumb_ptr<expr_t> arg1, dumb_ptr<expr_t> arg2, int line, int column)
+void BIN_EXPR(dumb_ptr<expr_t>& x, AString name, dumb_ptr<expr_t> arg1, dumb_ptr<expr_t> arg2, int line, int column)
{
dumb_ptr<expr_t> e[2];
e[0] = arg1;
@@ -82,7 +83,7 @@ static
void add_teleport_anchor(dumb_ptr<teleport_anchor_t> anchor, int line_nr);
static
-dumb_ptr<effect_t> op_effect(FString name, const_array<dumb_ptr<expr_t>> argv, int line, int column);
+dumb_ptr<effect_t> op_effect(AString name, const_array<dumb_ptr<expr_t>> argv, int line, int column);
// in magic-interpreter-lexer.cpp
int magic_frontend_lex(void);
@@ -94,10 +95,10 @@ static
dumb_ptr<effect_t> call_proc(ZString name, dumb_ptr<std::vector<dumb_ptr<expr_t>>> argvp, int line_nr, int column);
static
-void bind_constant(FString name, val_t *val, int line_nr);
+void bind_constant(RString name, val_t *val, int line_nr);
static
-val_t *find_constant(FString name);
+val_t *find_constant(RString name);
} // %code
@@ -1182,7 +1183,7 @@ dumb_ptr<expr_t> dot_expr(dumb_ptr<expr_t> expr, int id)
return retval;
}
-dumb_ptr<expr_t> fun_expr(FString name, const_array<dumb_ptr<expr_t>> argv, int line, int column)
+dumb_ptr<expr_t> fun_expr(AString name, const_array<dumb_ptr<expr_t>> argv, int line, int column)
{
dumb_ptr<expr_t> expr;
fun_t *fun = magic_get_fun(name);
@@ -1293,7 +1294,7 @@ dumb_ptr<effect_t> set_effect_continuation(dumb_ptr<effect_t> src, dumb_ptr<effe
return retval;
}
-dumb_ptr<effect_t> op_effect(FString name, const_array<dumb_ptr<expr_t>> argv, int line, int column)
+dumb_ptr<effect_t> op_effect(AString name, const_array<dumb_ptr<expr_t>> argv, int line, int column)
{
dumb_ptr<effect_t> effect;
op_t *op = magic_get_op(name);
@@ -1325,7 +1326,7 @@ dumb_ptr<effect_t> op_effect(FString name, const_array<dumb_ptr<expr_t>> argv, i
}
-std::map<FString, proc_t> procs;
+std::map<RString, proc_t> procs;
// I think this was a memory leak (or undefined behavior)
void install_proc(dumb_ptr<proc_t> proc)
@@ -1358,9 +1359,9 @@ dumb_ptr<effect_t> call_proc(ZString name, dumb_ptr<std::vector<dumb_ptr<expr_t>
return retval;
}
-std::map<FString, val_t> const_defm;
+std::map<RString, val_t> const_defm;
-void bind_constant(FString name, val_t *val, int line_nr)
+void bind_constant(RString name, val_t *val, int line_nr)
{
if (!const_defm.insert({name, *val}).second)
{
@@ -1368,7 +1369,7 @@ void bind_constant(FString name, val_t *val, int line_nr)
}
}
-val_t *find_constant(FString name)
+val_t *find_constant(RString name)
{
auto it = const_defm.find(name);
if (it != const_defm.end())
diff --git a/src/map/magic-interpreter.hpp b/src/map/magic-interpreter.hpp
index 19f8574..7e42499 100644
--- a/src/map/magic-interpreter.hpp
+++ b/src/map/magic-interpreter.hpp
@@ -6,7 +6,7 @@
# include <cassert>
# include "../strings/fwd.hpp"
-# include "../strings/fstring.hpp"
+# include "../strings/rstring.hpp"
# include "magic.hpp"
# include "map.hpp"
@@ -244,8 +244,8 @@ struct letdef_t
struct spell_t
{
- FString name;
- FString invocation;
+ RString name;
+ RString invocation;
SPELL_FLAG flags;
int arg;
SPELLARG spellarg_ty;
@@ -261,8 +261,8 @@ struct spell_t
struct teleport_anchor_t
{
- FString name;
- FString invocation;
+ RString name;
+ RString invocation;
dumb_ptr<expr_t> location;
};
@@ -274,15 +274,15 @@ struct magic_conf_t
{
struct mcvar
{
- FString name;
+ RString name;
val_t val;
};
// This should probably be done by a dedicated "intern pool" class
std::vector<mcvar> varv;
- std::map<FString, dumb_ptr<spell_t>> spells_by_name, spells_by_invocation;
+ std::map<RString, dumb_ptr<spell_t>> spells_by_name, spells_by_invocation;
- std::map<FString, dumb_ptr<teleport_anchor_t>> anchors_by_name, anchors_by_invocation;
+ std::map<RString, dumb_ptr<teleport_anchor_t>> anchors_by_name, anchors_by_invocation;
};
/* Execution environment */
@@ -434,7 +434,7 @@ struct args_rec_t
struct proc_t
{
- FString name;
+ RString name;
std::vector<int> argv;
dumb_ptr<effect_t> body;
diff --git a/src/map/magic.hpp b/src/map/magic.hpp
index 5d4e517..1fabd6f 100644
--- a/src/map/magic.hpp
+++ b/src/map/magic.hpp
@@ -46,14 +46,14 @@ void spell_effect_report_termination(int invocation, int bl_id,
*
* Returns empty string if not found
*/
-FString magic_find_invocation(XString spellname);
+AString magic_find_invocation(XString spellname);
/**
* Identifies the invocation used to denote a teleport location
*
* Returns empty string if not found
*/
-FString magic_find_anchor_invocation(XString teleport_location);
+AString magic_find_anchor_invocation(XString teleport_location);
/**
* Execute a spell invocation and sets up timers to finish
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 8a1d8eb..caab5b4 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -10,7 +10,7 @@
#include <cstdlib>
#include <cstring>
-#include "../strings/fstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
#include "../strings/vstring.hpp"
@@ -75,7 +75,7 @@ int first_free_object_id = 0, last_object_id = 0;
interval_t autosave_time = DEFAULT_AUTOSAVE_INTERVAL;
int save_settings = 0xFFFF;
-FString motd_txt = "conf/motd.txt";
+AString motd_txt = "conf/motd.txt";
CharName wisp_server_name = stringish<CharName>("Server"); // can be modified in char-server configuration file
@@ -1351,7 +1351,7 @@ constexpr int LOGFILE_SECONDS_PER_CHUNK_SHIFT = 10;
static
std::unique_ptr<io::AppendFile> map_logfile;
static
-FString map_logfile_name;
+AString map_logfile_name;
static
long map_logfile_index;
@@ -1360,7 +1360,7 @@ void map_close_logfile(void)
{
if (map_logfile)
{
- FString filename = STRPRINTF("%s.%ld", map_logfile_name, map_logfile_index);
+ AString filename = STRPRINTF("%s.%ld", map_logfile_name, map_logfile_index);
const char *args[] =
{
"gzip",
@@ -1386,7 +1386,7 @@ void map_start_logfile(long index)
{
map_logfile_index = index;
- FString filename_buf = STRPRINTF(
+ AString filename_buf = STRPRINTF(
"%s.%ld",
map_logfile_name,
map_logfile_index);
@@ -1399,7 +1399,7 @@ void map_start_logfile(long index)
}
static
-void map_set_logfile(FString filename)
+void map_set_logfile(AString filename)
{
struct timeval tv;
@@ -1445,7 +1445,7 @@ bool map_config_read(ZString cfgName)
}
bool rv = true;
- FString line;
+ AString line;
while (in.getline(line))
{
if (is_comment(line))
@@ -1663,7 +1663,7 @@ bool map_confs(XString key, ZString value)
return load_resnametable(value);
if (key == "const_db")
return read_constdb(value);
- PRINTF("unknown map conf key: %s\n", FString(key));
+ PRINTF("unknown map conf key: %s\n", AString(key));
return false;
}
diff --git a/src/map/map.hpp b/src/map/map.hpp
index 897c619..092fd80 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -9,7 +9,8 @@
# include <list>
# include "../strings/fwd.hpp"
-# include "../strings/fstring.hpp"
+# include "../strings/rstring.hpp"
+# include "../strings/astring.hpp"
# include "../strings/vstring.hpp"
# include "../io/cxxstdio.hpp"
@@ -193,7 +194,7 @@ struct map_session_data : block_list, SessionData
// but one should probably be replaced with a ScriptPointer ???
const ScriptBuffer *npc_script, *npc_scriptroot;
std::vector<struct script_data> npc_stackbuf;
- FString npc_str;
+ RString npc_str;
struct
{
unsigned storage:1;
@@ -267,8 +268,8 @@ struct map_session_data : block_list, SessionData
// Not anymore! Well, sort of.
DMap<SIR, int> regm;
// can't be DMap because we want predictable .c_str()s
- // This could change once FString ensures CoW.
- Map<SIR, FString> regstrm;
+ // TODO this can change now
+ Map<SIR, RString> regstrm;
earray<struct status_change, StatusChange, StatusChange::MAX_STATUSCHANGE> sc_data;
short sc_count;
@@ -302,7 +303,7 @@ struct map_session_data : block_list, SessionData
TimeT chat_repeat_reset_due;
int chat_lines_in;
int chat_total_repeats;
- FString chat_lastmsg;
+ RString chat_lastmsg;
tick_t flood_rates[0x220];
TimeT packet_flood_reset_due;
@@ -347,7 +348,7 @@ struct npc_data : block_list
Option option;
short flag;
- std::list<FString> eventqueuel;
+ std::list<RString> eventqueuel;
Timer eventtimer[MAX_EVENTTIMER];
short arenaflag;
@@ -414,7 +415,7 @@ public:
class npc_data_message : public npc_data
{
public:
- FString message;
+ RString message;
};
constexpr int MOB_XP_BONUS_BASE = 1024;
@@ -574,7 +575,7 @@ struct flooritem_data : block_list
extern interval_t autosave_time;
extern int save_settings;
-extern FString motd_txt;
+extern AString motd_txt;
extern CharName wisp_server_name;
diff --git a/src/map/mob.cpp b/src/map/mob.cpp
index 7a73df5..2a06cf7 100644
--- a/src/map/mob.cpp
+++ b/src/map/mob.cpp
@@ -8,7 +8,7 @@
#include <algorithm>
-#include "../strings/fstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/xstring.hpp"
#include "../io/cxxstdio.hpp"
@@ -3420,7 +3420,7 @@ bool mob_readdb(ZString filename)
PRINTF("Unable to read mob db: %s\n", filename);
return false;
}
- FString line;
+ AString line;
while (in.getline(line))
{
int mob_class;
@@ -3631,7 +3631,7 @@ bool mob_readskilldb(ZString filename)
PRINTF("can't read %s\n", filename);
return false;
}
- FString line;
+ AString line;
while (in.getline(line))
{
int mob_id;
diff --git a/src/map/npc.cpp b/src/map/npc.cpp
index 4a116b2..788d785 100644
--- a/src/map/npc.cpp
+++ b/src/map/npc.cpp
@@ -8,7 +8,7 @@
#include <list>
#include "../strings/mstring.hpp"
-#include "../strings/fstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
@@ -34,7 +34,7 @@
#include "../poison.hpp"
static
-std::list<FString> npc_srcs;
+std::list<AString> npc_srcs;
static
int npc_id = START_NPC_NUM;
@@ -903,7 +903,7 @@ void npc_clearsrcfile(void)
* 読み込むnpcファイルの追加
*------------------------------------------
*/
-void npc_addsrcfile(FString name)
+void npc_addsrcfile(AString name)
{
if (name == "clear")
{
@@ -918,7 +918,7 @@ void npc_addsrcfile(FString name)
* 読み込むnpcファイルの削除
*------------------------------------------
*/
-void npc_delsrcfile(FString name)
+void npc_delsrcfile(XString name)
{
if (name == "all")
{
@@ -1209,7 +1209,7 @@ int npc_parse_script(XString w1, XString w2, NpcName w3, ZString w4,
if (it != srcbuf.rend() && *it == '}')
break;
- FString line;
+ AString line;
if (!fp.getline(line))
// eof
break;
@@ -1226,7 +1226,7 @@ int npc_parse_script(XString w1, XString w2, NpcName w3, ZString w4,
srcbuf += line;
srcbuf += '\n';
}
- script = parse_script(FString(srcbuf), startline);
+ script = parse_script(AString(srcbuf), startline);
if (script == NULL)
// script parse error?
return 1;
@@ -1404,7 +1404,7 @@ int npc_parse_function(XString, XString, XString w3, ZString,
if (it != srcbuf.rend() && *it == '}')
break;
- FString line;
+ AString line;
if (!fp.getline(line))
break;
(*lines)++;
@@ -1417,7 +1417,7 @@ int npc_parse_function(XString, XString, XString w3, ZString,
srcbuf += line;
srcbuf += '\n';
}
- std::unique_ptr<const ScriptBuffer> script = parse_script(FString(srcbuf), startline);
+ std::unique_ptr<const ScriptBuffer> script = parse_script(AString(srcbuf), startline);
if (script == NULL)
{
// script parse error?
@@ -1636,7 +1636,7 @@ int npc_parse_mapflag(XString w1, XString, XString w3, ZString w4)
}
dumb_ptr<npc_data> npc_spawn_text(map_local *m, int x, int y,
- int npc_class, NpcName name, FString message)
+ int npc_class, NpcName name, AString message)
{
dumb_ptr<npc_data_message> retval;
retval.new_();
@@ -1678,7 +1678,7 @@ void npc_free_internal(dumb_ptr<npc_data> nd_)
else if (nd_->npc_subtype == NpcSubtype::MESSAGE)
{
dumb_ptr<npc_data_message> nd = nd_->is_message();
- nd->message = FString();
+ nd->message = AString();
}
nd_.delete_();
}
@@ -1722,7 +1722,7 @@ bool do_init_npc(void)
for (; !npc_srcs.empty(); npc_srcs.pop_front())
{
- FString nsl = npc_srcs.front();
+ AString nsl = npc_srcs.front();
io::ReadFile fp(nsl);
if (!fp.is_open())
{
@@ -1733,7 +1733,7 @@ bool do_init_npc(void)
PRINTF("\rLoading NPCs [%d]: %-54s", npc_id - START_NPC_NUM,
nsl);
int lines = 0;
- FString zline;
+ AString zline;
while (fp.getline(zline))
{
XString w1, w2, w3, w4x;
diff --git a/src/map/npc.hpp b/src/map/npc.hpp
index 17eea04..4d4cef1 100644
--- a/src/map/npc.hpp
+++ b/src/map/npc.hpp
@@ -39,15 +39,15 @@ int npc_get_new_npc_id(void);
* \param message The message to speak. If message is NULL, the NPC will not do anything at all.
*/
dumb_ptr<npc_data> npc_spawn_text(map_local *m, int x, int y,
- int class_, NpcName name, FString message);
+ int class_, NpcName name, AString message);
/**
* Uninstalls and frees an NPC
*/
void npc_free(dumb_ptr<npc_data> npc);
-void npc_addsrcfile(FString);
-void npc_delsrcfile(FString);
+void npc_addsrcfile(AString);
+void npc_delsrcfile(XString);
bool do_init_npc(void);
int npc_event_do_oninit(void);
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 8d242ae..c9588bb 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -4,7 +4,8 @@
#include <cstdlib>
#include <cstring>
-#include "../strings/fstring.hpp"
+#include "../strings/rstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../io/cxxstdio.hpp"
@@ -751,7 +752,7 @@ int pc_authok(int id, int login_id2, TimeT connect_until_time,
sd->chat_reset_due = TimeT();
sd->chat_lines_in = sd->chat_total_repeats = 0;
sd->chat_repeat_reset_due = TimeT();
- sd->chat_lastmsg = FString();
+ sd->chat_lastmsg = RString();
for (tick_t& t : sd->flood_rates)
t = tick_t();
@@ -780,7 +781,7 @@ void pc_show_motd(dumb_ptr<map_session_data> sd)
io::ReadFile in(motd_txt);
if (in.is_open())
{
- FString buf;
+ AString buf;
while (in.getline(buf))
{
clif_displaymessage(sd->sess, buf);
@@ -3094,7 +3095,7 @@ int pc_gainexp_reason(dumb_ptr<map_session_data> sd, int base_exp, int job_exp,
if (battle_config.disp_experience)
{
- FString output = STRPRINTF(
+ AString output = STRPRINTF(
"Experienced Gained Base:%d Job:%d",
base_exp, job_exp);
clif_displaymessage(sd->sess, output);
@@ -4123,7 +4124,7 @@ ZString pc_readregstr(dumb_ptr<map_session_data> sd, SIR reg)
{
nullpo_retr(ZString(), sd);
- FString *s = sd->regstrm.search(reg);
+ RString *s = sd->regstrm.search(reg);
if (s)
return *s;
@@ -4134,7 +4135,7 @@ ZString pc_readregstr(dumb_ptr<map_session_data> sd, SIR reg)
* script用文字列変数の値を設定
*------------------------------------------
*/
-void pc_setregstr(dumb_ptr<map_session_data> sd, SIR reg, FString str)
+void pc_setregstr(dumb_ptr<map_session_data> sd, SIR reg, RString str)
{
nullpo_retv(sd);
diff --git a/src/map/pc.hpp b/src/map/pc.hpp
index 48ba8f3..be66cc4 100644
--- a/src/map/pc.hpp
+++ b/src/map/pc.hpp
@@ -123,7 +123,7 @@ int pc_setparam(dumb_ptr<map_session_data>, SP, int);
int pc_readreg(dumb_ptr<map_session_data>, SIR);
void pc_setreg(dumb_ptr<map_session_data>, SIR, int);
ZString pc_readregstr(dumb_ptr<map_session_data> sd, SIR reg);
-void pc_setregstr(dumb_ptr<map_session_data> sd, SIR reg, FString str);
+void pc_setregstr(dumb_ptr<map_session_data> sd, SIR reg, RString str);
int pc_readglobalreg(dumb_ptr<map_session_data>, VarName );
int pc_setglobalreg(dumb_ptr<map_session_data>, VarName , int);
int pc_readaccountreg(dumb_ptr<map_session_data>, VarName );
diff --git a/src/map/script.cpp b/src/map/script.cpp
index c154182..36ceb8c 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -8,7 +8,8 @@
#include <ctime>
#include "../strings/mstring.hpp"
-#include "../strings/fstring.hpp"
+#include "../strings/rstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
@@ -49,27 +50,27 @@ constexpr bool DEBUG_RUN = false;
struct str_data_t
{
ByteCode type;
- FString strs;
+ RString strs;
int backpatch;
int label_;
int val;
};
static
-Map<FString, str_data_t> str_datam;
+Map<RString, str_data_t> str_datam;
static
str_data_t LABEL_NEXTLINE_;
static
DMap<SIR, int> mapreg_db;
static
-Map<SIR, FString> mapregstr_db;
+Map<SIR, RString> mapregstr_db;
static
int mapreg_dirty = -1;
-FString mapreg_txt = "save/mapreg.txt";
+AString mapreg_txt = "save/mapreg.txt";
constexpr std::chrono::milliseconds MAPREG_AUTOSAVE_INTERVAL = std::chrono::seconds(10);
Map<ScriptLabel, int> scriptlabel_db;
-UPMap<FString, const ScriptBuffer> userfunc_db;
+UPMap<RString, const ScriptBuffer> userfunc_db;
static
const char *pos_str[11] =
@@ -157,7 +158,7 @@ str_data_t *add_strp(XString p)
if (str_data_t *rv = search_strp(p))
return rv;
- FString p2 = p;
+ RString p2 = p;
str_data_t *datum = str_datam.init(p2);
datum->type = ByteCode::NOP;
datum->strs = p2;
@@ -699,13 +700,13 @@ bool read_constdb(ZString filename)
}
bool rv = true;
- FString line;
+ AString line;
while (in.getline(line))
{
if (is_comment(line))
continue;
- FString name;
+ AString name;
int val;
int type = 0; // if not provided
// TODO get rid of SSCANF - this is the last serious use
@@ -908,7 +909,7 @@ void get_val(ScriptState *st, struct script_data *data)
}
else if (prefix == '$')
{
- FString *s = mapregstr_db.search(data->u.reg);
+ RString *s = mapregstr_db.search(data->u.reg);
data->u.str = s ? dumb_string::fake(*s) : dumb_string();
}
else
@@ -1059,7 +1060,7 @@ dumb_string conv_str(ScriptState *st, struct script_data *data)
assert (data->type != ByteCode::RETINFO);
if (data->type == ByteCode::INT)
{
- FString buf = STRPRINTF("%d", data->u.numi);
+ AString buf = STRPRINTF("%d", data->u.numi);
data->type = ByteCode::STR;
data->u.str = dumb_string::copys(buf);
}
@@ -1340,7 +1341,7 @@ void builtin_menu(ScriptState *st)
buf += ':';
}
- clif_scriptmenu(script_rid2sd(st), st->oid, FString(buf));
+ clif_scriptmenu(script_rid2sd(st), st->oid, AString(buf));
}
else
{
@@ -2233,7 +2234,7 @@ void builtin_getequipname(ScriptState *st)
dumb_ptr<map_session_data> sd;
struct item_data *item;
- FString buf;
+ AString buf;
sd = script_rid2sd(st);
num = conv_num(st, &AARGO2(2));
@@ -3572,7 +3573,7 @@ void builtin_getspellinvocation(ScriptState *st)
{
dumb_string name = conv_str(st, &AARGO2(2));
- FString invocation = magic_find_invocation(name.str());
+ AString invocation = magic_find_invocation(name.str());
if (!invocation)
invocation = "...";
@@ -3938,7 +3939,7 @@ void builtin_npctalk(ScriptState *st)
message += nd->name;
message += " : ";
message += ZString(str);
- clif_message(nd, FString(message));
+ clif_message(nd, AString(message));
}
}
@@ -4275,7 +4276,7 @@ void op_add(ScriptState *st)
if (back.type == ByteCode::STR)
back.u.str.delete_();
back1.type = ByteCode::STR;
- back1.u.str = dumb_string::copys(FString(buf));
+ back1.u.str = dumb_string::copys(AString(buf));
}
}
@@ -4921,7 +4922,7 @@ void script_load_mapreg(void)
if (!in.is_open())
return;
- FString line;
+ AString line;
while (in.getline(line))
{
XString buf1, buf2;
@@ -4952,7 +4953,7 @@ void script_load_mapreg(void)
else
{
borken:
- PRINTF("%s: %s broken data !\n", mapreg_txt, FString(buf1));
+ PRINTF("%s: %s broken data !\n", mapreg_txt, AString(buf1));
continue;
}
}
diff --git a/src/map/script.hpp b/src/map/script.hpp
index ec52f65..22a079b 100644
--- a/src/map/script.hpp
+++ b/src/map/script.hpp
@@ -6,7 +6,8 @@
# include <vector>
-# include "../strings/fstring.hpp"
+# include "../strings/rstring.hpp"
+# include "../strings/astring.hpp"
# include "../strings/zstring.hpp"
# include "../common/db.hpp"
@@ -157,12 +158,12 @@ struct ScriptLabel;
extern
Map<ScriptLabel, int> scriptlabel_db;
extern
-UPMap<FString, const ScriptBuffer> userfunc_db;
+UPMap<RString, const ScriptBuffer> userfunc_db;
void do_init_script(void);
void do_final_script(void);
-extern FString mapreg_txt;
+extern AString mapreg_txt;
extern int script_errors;
diff --git a/src/map/skill.cpp b/src/map/skill.cpp
index 2253d9d..0222202 100644
--- a/src/map/skill.cpp
+++ b/src/map/skill.cpp
@@ -6,7 +6,7 @@
#include <ctime>
#include "../strings/mstring.hpp"
-#include "../strings/fstring.hpp"
+#include "../strings/rstring.hpp"
#include "../strings/xstring.hpp"
#include "../io/cxxstdio.hpp"
@@ -1169,7 +1169,7 @@ SP scan_stat(XString statname)
if (statname == "none")
return SP::ZERO;
- FPRINTF(stderr, "Unknown stat `%s'\n", FString(statname));
+ FPRINTF(stderr, "Unknown stat `%s'\n", AString(statname));
return SP::ZERO;
}
@@ -1183,7 +1183,7 @@ bool skill_readdb(ZString filename)
}
bool rv = true;
- FString line_;
+ AString line_;
while (in.getline(line_))
{
// is_comment only works for whole-line comments
@@ -1267,7 +1267,7 @@ bool skill_readdb(ZString filename)
c = ' ';
skill_db[i] = skdb;
- skill_lookup_by_id(i).desc = FString(tmp);
+ skill_lookup_by_id(i).desc = RString(tmp);
}
PRINTF("read %s done\n", filename);
diff --git a/src/map/skill.hpp b/src/map/skill.hpp
index 5f29443..e8f36ab 100644
--- a/src/map/skill.hpp
+++ b/src/map/skill.hpp
@@ -5,7 +5,8 @@
# include "skill-pools.hpp"
# include "../strings/fwd.hpp"
-# include "../strings/fstring.hpp"
+# include "../strings/rstring.hpp"
+# include "../strings/astring.hpp"
# include "map.hpp"
@@ -39,11 +40,11 @@ earray<skill_db_, SkillID, SkillID::MAX_SKILL_DB> skill_db;
struct skill_name_db
{
SkillID id; // skill id
- FString name; // search strings
- FString desc; // description that shows up for searches
+ RString 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, FString n, FString d)
+ skill_name_db(SkillID i, RString n, RString d)
: id(i), name(n), desc(d)
{}
};
@@ -129,7 +130,7 @@ bool skill_pool_is_activated(dumb_ptr<map_session_data> sd, SkillID skill);
int skill_pool_deactivate(dumb_ptr<map_session_data> sd, SkillID skill);
// Yield configurable skill name
inline
-const FString& skill_name(SkillID skill)
+const RString& skill_name(SkillID skill)
{
return skill_lookup_by_id(skill).desc;
}
diff --git a/src/map/tmw.cpp b/src/map/tmw.cpp
index 7e661bb..72cfa2b 100644
--- a/src/map/tmw.cpp
+++ b/src/map/tmw.cpp
@@ -3,7 +3,7 @@
#include <cctype>
#include <cstring>
-#include "../strings/fstring.hpp"
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
@@ -95,16 +95,16 @@ void tmw_AutoBan(dumb_ptr<map_session_data> sd, ZString reason, int length)
sd->auto_ban_info.in_progress = 1;
- FString hack_msg = STRPRINTF("[GM] %s has been autobanned for %s spam",
+ AString hack_msg = STRPRINTF("[GM] %s has been autobanned for %s spam",
sd->status.name,
reason);
tmw_GmHackMsg(hack_msg);
- FString fake_command = STRPRINTF("@autoban %s %dh (%s spam)",
+ AString fake_command = STRPRINTF("@autoban %s %dh (%s spam)",
sd->status.name, length, reason);
log_atcommand(sd, fake_command);
- FString 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.",
reason);
clif_displaymessage(sd->sess, anotherbuf);