mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-05 11:44:53 +01:00
Modified Inventory to match steam's implementation
This commit is contained in:
parent
06f88d4687
commit
5c66c21f53
3 changed files with 76 additions and 30 deletions
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue