Fixed [scenario] map_file basically being unusable

Automatically checking the path relative to a maps/ directory without binary
path support results in an invalid path almost every single time. If I remember
correctly from my testing, the only time that worked was if I added a data/maps
folder.

(cherry-picked from commit 42349651cb)
This commit is contained in:
Charles Dang 2018-06-10 10:29:02 +11:00
parent e68bdd1b5f
commit 201b2973d2
2 changed files with 5 additions and 2 deletions

View file

@ -248,6 +248,7 @@
* Fixed Lua errors when setting a music track that cannot be found when the
playlist is already empty, e.g. if there's no music installed for the
game (issue #3194).
* Fixed [scenario] map_file= being unusable in most circumstances.
## Version 1.13.12
### Security fixes

View file

@ -138,12 +138,14 @@ bool ends_with(const std::string& str, const std::string& suffix)
std::string read_map(const std::string& name)
{
std::string res;
std::string map_location = get_wml_location("maps/" + name);
std::string map_location = get_wml_location(name);
if(!map_location.empty()) {
res = read_file(map_location);
}
if (res.empty()) {
// TODO: might be nice to have automatic detection of the maps/ directory?
if(res.empty()) {
res = read_file(get_user_data_dir() + "/editor/maps/" + name);
}