summaryrefslogtreecommitdiff
path: root/src/map/grfio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/grfio.cpp')
-rw-r--r--src/map/grfio.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/map/grfio.cpp b/src/map/grfio.cpp
index c3d1e40..4a1656b 100644
--- a/src/map/grfio.cpp
+++ b/src/map/grfio.cpp
@@ -20,28 +20,29 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-#include <sys/stat.h>
-
#include <fcntl.h>
#include <unistd.h>
#include <cassert>
-#include <cstdio>
-#include <cstring>
#include <map>
#include "../strings/mstring.hpp"
#include "../strings/rstring.hpp"
#include "../strings/astring.hpp"
+#include "../strings/zstring.hpp"
#include "../io/cxxstdio.hpp"
#include "../io/read.hpp"
#include "../mmo/extract.hpp"
+#include "../mmo/mmo.hpp"
#include "../poison.hpp"
+
+namespace tmwa
+{
static
std::map<MapName, RString> resnametable;
@@ -50,7 +51,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 +64,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 +86,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 +94,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 {};
}
@@ -105,3 +106,4 @@ std::vector<uint8_t> grfio_reads(MapName rname)
close(fd);
return buffer;
}
+} // namespace tmwa