Make isteamutils call result functions respect callback delays.

merge-requests/23/merge
Mr_Goldberg 2019-10-05 15:41:28 -04:00
parent 1427a4bcef
commit 736d1a9090
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278
1 changed files with 7 additions and 3 deletions

View File

@ -110,8 +110,12 @@ struct Steam_Call_Result {
return check_timedout(created, STEAM_CALLRESULT_TIMEOUT);
}
bool call_completed() {
return (!reserved) && check_timedout(created, run_in);
}
bool can_execute() {
return (!reserved) && (!to_delete) && check_timedout(created, run_in);
return (!to_delete) && call_completed();
}
bool has_cb() {
@ -169,14 +173,14 @@ public:
bool exists(SteamAPICall_t api_call) {
auto cr = std::find_if(callresults.begin(), callresults.end(), [api_call](struct Steam_Call_Result const& item) { return item.api_call == api_call; });
if (cr == callresults.end()) return false;
if (cr->reserved) return false;
if (!cr->call_completed()) return false;
return true;
}
bool callback_result(SteamAPICall_t api_call, void *copy_to, unsigned int size) {
auto cb_result = std::find_if(callresults.begin(), callresults.end(), [api_call](struct Steam_Call_Result const& item) { return item.api_call == api_call; });
if (cb_result != callresults.end()) {
if (cb_result->reserved) return false;
if (!cb_result->call_completed()) return false;
if (cb_result->result.size() > size) return false;
memcpy(copy_to, &(cb_result->result[0]), cb_result->result.size());