Provide a game command translation

This commit is contained in:
duncanspumpkin 2019-05-18 08:06:09 +01:00
parent 3162d4dc75
commit afca838f17
1 changed files with 22 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include "actions/RideEntranceExitPlaceAction.hpp"
#include "actions/RideSetSetting.hpp"
#include "actions/SetCheatAction.hpp"
#include "actions/TileModifyAction.hpp"
#include "actions/TrackPlaceAction.hpp"
#include "config/Config.h"
#include "core/DataSerialiser.h"
@ -537,6 +538,27 @@ namespace OpenRCT2
result.action->SetFlags(command.ebx & 0xFF);
break;
}
case GAME_COMMAND_MODIFY_TILE:
{
int32_t param1 = command.edx;
int32_t param2 = command.edi;
CoordsXY loc = { (command.ecx & 0xFF) * 32, ((command.ecx >> 8) & 0xFF) * 32 };
TileModifyType type = static_cast<TileModifyType>(command.eax & 0xFF);
if (type == TileModifyType::AnyPaste)
{
TileElement copiedElement{};
int32_t data[2] = { command.edx, command.edi };
std::memcpy(&copiedElement, &data[0], 8);
result.action = std::make_unique<TileModifyAction>(loc, type, 0, 0, copiedElement);
}
else
{
result.action = std::make_unique<TileModifyAction>(loc, type, param1, param2);
}
result.action->SetFlags(command.ebx & 0xFF);
break;
}
default:
throw std::runtime_error("Deprecated game command requires replay translation.");
}