Codechange: Pass additional data as byte stream to command callbacks.

This commit is contained in:
Michael Lutz
2021-10-31 22:07:22 +01:00
parent 0f64ee5ce1
commit eab18f06a4
23 changed files with 98 additions and 112 deletions

View File

@@ -687,11 +687,11 @@ SQInteger ScriptInstance::GetOpsTillSuspend()
return this->engine->GetOpsTillSuspend();
}
bool ScriptInstance::DoCommandCallback(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2, Commands cmd)
bool ScriptInstance::DoCommandCallback(const CommandCost &result, TileIndex tile, const CommandDataBuffer &data, Commands cmd)
{
ScriptObject::ActiveInstance active(this);
if (!ScriptObject::CheckLastCommand(tile, p1, p2, cmd)) {
if (!ScriptObject::CheckLastCommand(tile, data, cmd)) {
Debug(script, 1, "DoCommandCallback terminating a script, last command does not match expected command");
return false;
}
@@ -705,7 +705,7 @@ bool ScriptInstance::DoCommandCallback(const CommandCost &result, TileIndex tile
ScriptObject::SetLastCost(result.GetCost());
}
ScriptObject::SetLastCommand(INVALID_TILE, 0, 0, CMD_END);
ScriptObject::SetLastCommand(INVALID_TILE, {}, CMD_END);
return true;
}