Modified Inventory to match steam's implementation

This commit is contained in:
Nemirtingas 2019-07-14 19:22:30 +02:00
parent 06f88d4687
commit 5c66c21f53
3 changed files with 76 additions and 30 deletions

View file

@ -19,10 +19,8 @@
#include <fstream>
#include "json.hpp"
std::map<SteamItemDef_t, std::map<std::string, std::string>> read_items_db(std::string const& items_db)
void read_items_db(std::string items_db, std::map<SteamItemDef_t, std::map<std::string, std::string>> *items, bool *is_loadedb)
{
std::map<SteamItemDef_t, std::map<std::string, std::string>> items;
std::ifstream items_file(items_db);
// If there is a file and we opened it
if( items_file )
@ -51,13 +49,12 @@ std::map<SteamItemDef_t, std::map<std::string, std::string>> read_items_db(std::
}
}
items.swap(tmp);
items->swap(tmp);
}
catch (std::exception& e)
{
PRINT_DEBUG("Error while parsing json: %s", e.what());
}
}
return items;
*is_loadedb = true;
}