add from_side check for require_random

"from_side" is an attribute whose only purpose is to enable a check by
the server that a package is really sended by the side given in
"from_side", if thats not the case, the server sets an attribute
"side_invalid". The main purpose of this contruct is to disallow
cheating in mp.
This commit is contained in:
gfgtdf 2014-03-24 20:19:16 +01:00
parent 59a78cadf5
commit 116afcda09

View File

@ -257,6 +257,11 @@ config synced_context::ask_server(const std::string &name, const mp_sync::user_c
replay::process_error("[" + name + "] expected but none found, found instead:\n " + action->debug() + "\n");
return config();
}
if((*action)["from_side"].str() != "server" || (*action)["side_invalid"].to_bool(false) )
{
//we can proceed without getting OOS in this case, but allowing this would allow a "player chan choose their attack results in mp" cheat
replay::process_error("wrong from_side or side_invalid this could mean someone wants to cheat\n");
}
return action->child(name);
}
}