mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix LOAD commands after removing a park from sequence
This commit is contained in:
parent
2c0786eb24
commit
e74cb7ac2a
|
@ -295,6 +295,25 @@ extern "C"
|
|||
}
|
||||
seq->NumSaves--;
|
||||
|
||||
// Update load commands
|
||||
for (size_t i = 0; i < seq->NumCommands; i++)
|
||||
{
|
||||
TitleCommand * command = &seq->Commands[i];
|
||||
if (command->Type == TITLE_SCRIPT_LOAD)
|
||||
{
|
||||
if (command->SaveIndex == index)
|
||||
{
|
||||
// Park no longer exists, so reset load command to invalid
|
||||
command->SaveIndex = SAVE_INDEX_INVALID;
|
||||
}
|
||||
else if (command->SaveIndex > index)
|
||||
{
|
||||
// Park index will have shifted by -1
|
||||
command->SaveIndex--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -352,7 +371,7 @@ static std::vector<TitleCommand> LegacyScriptRead(utf8 * script, size_t scriptLe
|
|||
if (_stricmp(token, "LOAD") == 0)
|
||||
{
|
||||
command.Type = TITLE_SCRIPT_LOAD;
|
||||
command.SaveIndex = UINT8_MAX;
|
||||
command.SaveIndex = SAVE_INDEX_INVALID;
|
||||
for (size_t i = 0; i < saves.size(); i++)
|
||||
{
|
||||
if (String::Equals(part1, saves[i], true))
|
||||
|
|
|
@ -77,7 +77,10 @@ enum TITLE_SCRIPT
|
|||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
constexpr const utf8 * TITLE_SEQUENCE_EXTENSION = ".parkseq";
|
||||
constexpr const utf8 * TITLE_SEQUENCE_EXTENSION = ".parkseq";
|
||||
constexpr uint8 SAVE_INDEX_INVALID = UINT8_MAX;
|
||||
#else
|
||||
#define SAVE_INDEX_INVALID UINT8_MAX
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -870,7 +870,7 @@ static void window_title_editor_scrollpaint_commands(rct_window *w, rct_drawpixe
|
|||
switch (command->Type) {
|
||||
case TITLE_SCRIPT_LOAD:
|
||||
commandName = STR_TITLE_EDITOR_COMMAND_LOAD_FILE;
|
||||
if (command->SaveIndex == 0xFF) {
|
||||
if (command->SaveIndex == SAVE_INDEX_INVALID) {
|
||||
commandName = STR_TITLE_EDITOR_COMMAND_LOAD_NO_SAVE;
|
||||
error = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue