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.merge-requests/24/head
parent
42d9217f00
commit
ef5693d9f8
|
@ -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 New Issue