mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-23 20:38:07 +01:00
Little improvements
steam_user_stats: Use the value stored in the JSON object. steal_inventory: use 'empty' that is guaranteed to be constant in time.
This commit is contained in:
parent
42d9217f00
commit
ef5693d9f8
2 changed files with 5 additions and 11 deletions
|
@ -840,7 +840,7 @@ bool SubmitUpdateProperties( SteamInventoryUpdateHandle_t handle, SteamInventory
|
|||
|
||||
void RunCallbacks()
|
||||
{
|
||||
if (call_definition_update || inventory_requests.size()) {
|
||||
if (call_definition_update || !inventory_requests.empty()) {
|
||||
if (!item_definitions_loaded) {
|
||||
read_items_db();
|
||||
item_definitions_loaded = true;
|
||||
|
@ -854,7 +854,7 @@ void RunCallbacks()
|
|||
call_definition_update = false;
|
||||
}
|
||||
|
||||
if (inventory_requests.size() && !inventory_loaded) {
|
||||
if (!inventory_requests.empty() && !inventory_loaded) {
|
||||
read_inventory_db();
|
||||
inventory_loaded = true;
|
||||
}
|
||||
|
|
|
@ -350,9 +350,7 @@ const char * GetAchievementDisplayAttribute( const char *pchName, const char *pc
|
|||
return static_cast<std::string const&>(item["name"]) == pchName;
|
||||
});
|
||||
if (it != defined_achievements.end()) {
|
||||
static std::string display_name;
|
||||
display_name = it.value()["displayName"].get<std::string>();
|
||||
return display_name.c_str();
|
||||
return it.value()["displayName"].get_ptr<std::string*>()->c_str();
|
||||
}
|
||||
} catch (...) {}
|
||||
}
|
||||
|
@ -363,9 +361,7 @@ const char * GetAchievementDisplayAttribute( const char *pchName, const char *pc
|
|||
return static_cast<std::string const&>(item["name"]) == pchName;
|
||||
});
|
||||
if (it != defined_achievements.end()) {
|
||||
static std::string description;
|
||||
description = it.value()["description"].get<std::string>();
|
||||
return description.c_str();
|
||||
return it.value()["description"].get_ptr<std::string*>()->c_str();
|
||||
}
|
||||
} catch (...) {}
|
||||
}
|
||||
|
@ -376,9 +372,7 @@ const char * GetAchievementDisplayAttribute( const char *pchName, const char *pc
|
|||
return static_cast<std::string const&>(item["name"]) == pchName;
|
||||
});
|
||||
if (it != defined_achievements.end()) {
|
||||
static std::string hidden;
|
||||
hidden = it.value()["hidden"].get<std::string>();
|
||||
return hidden.c_str();
|
||||
return it.value()["hidden"].get_ptr<std::string*>()->c_str();
|
||||
}
|
||||
} catch (...) {}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue