Fix load configs
This commit is contained in:
@@ -25,8 +25,12 @@ struct WorldFactory
|
||||
std::ifstream config_file("./Worlds/" #WorldName ".world");\
|
||||
if (config_file.fail())\
|
||||
throw std::runtime_error("Can't open world file");\
|
||||
config_file.seekg(0, std::ios::end);\
|
||||
size_t file_size = config_file.tellg();\
|
||||
config_file.seekg(0, std::ios::beg);\
|
||||
std::string data;\
|
||||
std::getline(config_file, data);\
|
||||
data.resize(file_size);\
|
||||
config_file.read(data.data(), file_size);\
|
||||
world->load(std::make_shared<SaveMap>(data));\
|
||||
return world;\
|
||||
}},
|
||||
|
||||
Reference in New Issue
Block a user