summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2019-02-15 19:20:26 +0100
committerBardur Arantsson <bardur@scientician.net>2019-02-15 19:20:26 +0100
commit1f5cd3661e0a8c11824dba34adecc07cfb230366 (patch)
tree2d8e056e220bb7e75963a0f0258cc814e3faf200
parent7b8a1e0fb285c4d85e01c3720b0b4b4460d42a66 (diff)
Remove FMTxNNb macros
-rw-r--r--src/h-basic.hpp6
-rw-r--r--src/loadsave.cc4
-rw-r--r--src/object1.cc11
-rw-r--r--src/spells3.cc8
-rw-r--r--src/store.cc13
5 files changed, 17 insertions, 25 deletions
diff --git a/src/h-basic.hpp b/src/h-basic.hpp
index 6de1a4fa..2a29e1ac 100644
--- a/src/h-basic.hpp
+++ b/src/h-basic.hpp
@@ -104,20 +104,14 @@ typedef unsigned char byte;
/* Signed/Unsigned 16 bit value */
typedef signed short s16b;
typedef unsigned short u16b;
-#define FMTs16b "%hd"
-#define FMTu16b "%hu"
/* Signed/Unsigned 32 bit value */
#ifdef L64 /* 64 bit longs */
typedef signed int s32b;
typedef unsigned int u32b;
-#define FMTs32b "%d"
-#define FMTu32b "%u"
#else
typedef signed long s32b;
typedef unsigned long u32b;
-#define FMTs32b "%ld"
-#define FMTu32b "%lu"
#endif
diff --git a/src/loadsave.cc b/src/loadsave.cc
index f3963935..f120b7a2 100644
--- a/src/loadsave.cc
+++ b/src/loadsave.cc
@@ -2693,8 +2693,8 @@ bool load_player(program_args const &args)
/* Message */
- msg_format("Error (%s) reading savefile (version " FMTu32b ").",
- what, vernum);
+ msg_print(fmt::format("Error ({}) reading savefile (version {}).",
+ what, vernum));
msg_print(nullptr);
/* Oops */
diff --git a/src/object1.cc b/src/object1.cc
index dc3dc657..157637a9 100644
--- a/src/object1.cc
+++ b/src/object1.cc
@@ -2020,8 +2020,6 @@ void display_ammo_damage(object_type *o_ptr)
*/
static void describe_device(object_type *o_ptr)
{
- char buf[128];
-
/* Wands/... of shcool spell */
if (((o_ptr->tval == TV_WAND) || (o_ptr->tval == TV_STAFF)) && object_known_p(o_ptr))
{
@@ -2039,15 +2037,14 @@ static void describe_device(object_type *o_ptr)
});
text_out("\nSpell level: ");
- sprintf(buf, FMTs32b, get_level(o_ptr->pval2, 50));
- text_out_c(TERM_L_BLUE, buf);
+
+ text_out_c(TERM_L_BLUE, fmt::format("{}", get_level(o_ptr->pval2, 50)));
text_out("\nMinimum Magic Device level to increase spell level: ");
- text_out_c(TERM_L_BLUE, format("%d", spell_type_skill_level(spell)));
+ text_out_c(TERM_L_BLUE, fmt::format("{}", spell_type_skill_level(spell)));
text_out("\nSpell fail: ");
- sprintf(buf, FMTs32b, spell_chance_device(spell));
- text_out_c(TERM_GREEN, buf);
+ text_out_c(TERM_GREEN, fmt::format("{}", spell_chance_device(spell)));
text_out("\nSpell info: ");
text_out_c(TERM_YELLOW, spell_type_info(spell));
diff --git a/src/spells3.cc b/src/spells3.cc
index c46a77c1..050b1371 100644
--- a/src/spells3.cc
+++ b/src/spells3.cc
@@ -2194,7 +2194,9 @@ casting_result meta_spellbinder()
{
if (spell_type_skill_level(spell_at(s)) > 7 + get_level_s(SPELLBINDER, 35))
{
- msg_format("You are only allowed spells with a base level of " FMTs32b ".", (7 + get_level_s(SPELLBINDER, 35)));
+ msg_print(fmt::format(
+ "You are only allowed spells with a base level of {}.",
+ 7 + get_level_s(SPELLBINDER, 35)));
return CAST;
}
}
@@ -2308,7 +2310,9 @@ casting_result meta_inertia_control()
if (difficulty > get_level_s(INERTIA_CONTROL, 10))
{
- msg_format("This spell inertia flow(" FMTs32b ") is too strong to be controlled by your current spell.", difficulty);
+ msg_print(fmt::format(
+ "This spell inertia flow({}) is too strong to be controlled by your current spell.",
+ difficulty));
stop_inertia_controlled_spell();
return NO_CAST;
}
diff --git a/src/store.cc b/src/store.cc
index db5a8233..ba2f0c2b 100644
--- a/src/store.cc
+++ b/src/store.cc
@@ -1794,7 +1794,6 @@ static bool purchase_haggle(object_type *o_ptr, s32b *price)
{
s32b cur_ask;
bool cancel = false;
- char out_val[160];
char prompt[128];
char o_name[80];
@@ -1811,8 +1810,7 @@ static bool purchase_haggle(object_type *o_ptr, s32b *price)
object_desc_store(o_name, o_ptr, true, 3);
/* Prompt */
- strnfmt(out_val, sizeof(out_val), "%s: " FMTs32b, "Price", cur_ask);
- put_str(out_val, 1, 0);
+ put_str(fmt::format("Price: {}", cur_ask), 1, 0);
strnfmt(prompt, sizeof(prompt), "Buy %s?", o_name);
cancel = !prompt_yesno(prompt);
@@ -1840,7 +1838,6 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
{
s32b cur_ask;
bool cancel = false;
- char out_val[160];
char prompt[128];
char o_name[80];
@@ -1862,8 +1859,8 @@ static bool sell_haggle(object_type *o_ptr, s32b *price)
object_desc(o_name, o_ptr, true, 3);
/* Prompt */
- strnfmt(out_val, sizeof(out_val), "%s: " FMTs32b, "Price", cur_ask);
- put_str(out_val, 1, 0);
+ put_str(fmt::format("Price: {}", cur_ask), 1, 0);
+
strnfmt(prompt, sizeof(prompt), "Sell %s?", o_name);
cancel = !prompt_yesno(prompt);
@@ -2296,7 +2293,7 @@ void store_purchase()
object_desc(o_name, j_ptr, true, 3);
/* Message */
- msg_format("You bought %s for " FMTs32b " gold.", o_name, price);
+ msg_print(fmt::format("You bought {} for {} gold.", o_name, price));
/* Erase the inscription */
j_ptr->inscription.clear();
@@ -2616,7 +2613,7 @@ void store_sell()
object_desc(o_name, q_ptr, true, 3);
/* Describe the result (in message buffer) */
- msg_format("You sold %s for " FMTs32b " gold.", o_name, price);
+ msg_print(fmt::format("You sold {} for {} gold.", o_name, price));
/* Analyze the prices (and comment verbally) */
purchase_analyze(price, value, dummy);