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.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/map/grfio.cpp b/src/map/grfio.cpp
index c5a55f5..ff73c90 100644
--- a/src/map/grfio.cpp
+++ b/src/map/grfio.cpp
@@ -23,16 +23,18 @@
#include "../poison.hpp"
static
-std::map<MapName, FString> load_resnametable()
+std::map<MapName, FString> resnametable;
+
+bool load_resnametable(ZString filename)
{
- io::ReadFile in("data/resnametable.txt");
+ io::ReadFile in(filename);
if (!in.is_open())
{
- fprintf(stderr, "Missing data/resnametable.txt");
- abort();
+ FPRINTF(stderr, "Missing %s\n", filename);
+ return false;
}
- std::map<MapName, FString> out;
+ bool rv = true;
FString line;
while (in.getline(line))
{
@@ -40,19 +42,20 @@ std::map<MapName, FString> load_resnametable()
FString value;
if (!extract(line,
record<'#'>(&key, &value)))
+ {
+ PRINTF("Bad resnametable line: %s\n", line);
+ rv = false;
continue;
- out[key] = value;
+ }
+ resnametable[key] = value;
}
- return out;
+ return rv;
}
/// Change *.gat to *.wlk
static
FString grfio_resnametable(MapName rname)
{
- static
- std::map<MapName, FString> resnametable = load_resnametable();
-
return resnametable.at(rname);
}