diff options
author | Bardur Arantsson <bardur@scientician.net> | 2017-05-02 19:20:57 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2017-05-02 19:20:57 +0200 |
commit | a40a0d1aeddb4742e486f601cbcc7e9ddcc06e2d (patch) | |
tree | da5e8653050f47fc68f14d0062c11273774688e5 /src/squeltch.cc | |
parent | c2ff640e5540fd4c55dd054ae87dd510a11155e9 (diff) |
Move player_{name,base} to Game
Diffstat (limited to 'src/squeltch.cc')
-rw-r--r-- | src/squeltch.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/squeltch.cc b/src/squeltch.cc index 747c6beb..8d2db53a 100644 --- a/src/squeltch.cc +++ b/src/squeltch.cc @@ -33,6 +33,7 @@ #include <algorithm> #include <deque> +#include <fmt/format.h> #include <list> #include <memory> #include <string> @@ -170,16 +171,15 @@ static int create_new_rule() static void automatizer_save_rules() { - char name[30] = { '\0' }; char buf[1025]; char ch; int hgt, wid; Term_get_size(&wid, &hgt); - sprintf(name, "%s.atm", player_name); + std::string name = fmt::format("{}.atm", game->player_name); - if (!input_box("Save name?", hgt / 2, wid / 2, name, sizeof(name))) + if (!input_box("Save name?", hgt / 2, wid / 2, &name, 30)) { return; } @@ -201,7 +201,7 @@ static void automatizer_save_rules() }; // Build the filename - path_build(buf, 1024, ANGBAND_DIR_USER, name); + path_build(buf, 1024, ANGBAND_DIR_USER, name.c_str()); if (file_exist(buf)) { |