mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-22 14:24:33 +01:00
Move scenario objective/category/name/details into Scenario::Options
This commit is contained in:
@@ -420,7 +420,7 @@ static void ShortcutQuickSaveGame()
|
||||
auto intent = Intent(WindowClass::Loadsave);
|
||||
intent.PutEnumExtra<LoadSaveAction>(INTENT_EXTRA_LOADSAVE_ACTION, LoadSaveAction::save);
|
||||
intent.PutEnumExtra<LoadSaveType>(INTENT_EXTRA_LOADSAVE_TYPE, LoadSaveType::landscape);
|
||||
intent.PutExtra(INTENT_EXTRA_PATH, getGameState().scenarioName);
|
||||
intent.PutExtra(INTENT_EXTRA_PATH, getGameState().scenarioOptions.name);
|
||||
ContextOpenIntent(&intent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto intent = Intent(WindowClass::Loadsave);
|
||||
intent.PutEnumExtra<LoadSaveAction>(INTENT_EXTRA_LOADSAVE_ACTION, LoadSaveAction::save);
|
||||
intent.PutEnumExtra<LoadSaveType>(INTENT_EXTRA_LOADSAVE_TYPE, LoadSaveType::scenario);
|
||||
intent.PutExtra(INTENT_EXTRA_PATH, gameState.scenarioName);
|
||||
intent.PutExtra(INTENT_EXTRA_PATH, gameState.scenarioOptions.name);
|
||||
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<CloseCallback>(SaveScenarioCallback));
|
||||
ContextOpenIntent(&intent);
|
||||
}
|
||||
|
||||
@@ -683,7 +683,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
void SetObjective(int32_t objective)
|
||||
{
|
||||
auto& gameState = getGameState();
|
||||
gameState.scenarioObjective.Type = objective;
|
||||
auto& scenarioOptions = gameState.scenarioOptions;
|
||||
|
||||
scenarioOptions.objective.Type = objective;
|
||||
Invalidate();
|
||||
|
||||
// Set default objective arguments
|
||||
@@ -695,30 +697,30 @@ namespace OpenRCT2::Ui::Windows
|
||||
case OBJECTIVE_10_ROLLERCOASTERS:
|
||||
break;
|
||||
case OBJECTIVE_GUESTS_BY:
|
||||
gameState.scenarioObjective.Year = 3;
|
||||
gameState.scenarioObjective.NumGuests = 1500;
|
||||
scenarioOptions.objective.Year = 3;
|
||||
scenarioOptions.objective.NumGuests = 1500;
|
||||
break;
|
||||
case OBJECTIVE_PARK_VALUE_BY:
|
||||
gameState.scenarioObjective.Year = 3;
|
||||
gameState.scenarioObjective.Currency = 50000.00_GBP;
|
||||
scenarioOptions.objective.Year = 3;
|
||||
scenarioOptions.objective.Currency = 50000.00_GBP;
|
||||
break;
|
||||
case OBJECTIVE_GUESTS_AND_RATING:
|
||||
gameState.scenarioObjective.NumGuests = 2000;
|
||||
scenarioOptions.objective.NumGuests = 2000;
|
||||
break;
|
||||
case OBJECTIVE_MONTHLY_RIDE_INCOME:
|
||||
gameState.scenarioObjective.Currency = 10000.00_GBP;
|
||||
scenarioOptions.objective.Currency = 10000.00_GBP;
|
||||
break;
|
||||
case OBJECTIVE_10_ROLLERCOASTERS_LENGTH:
|
||||
gameState.scenarioObjective.MinimumLength = 1200;
|
||||
scenarioOptions.objective.MinimumLength = 1200;
|
||||
break;
|
||||
case OBJECTIVE_FINISH_5_ROLLERCOASTERS:
|
||||
gameState.scenarioObjective.MinimumExcitement = RideRating::make(6, 70);
|
||||
scenarioOptions.objective.MinimumExcitement = RideRating::make(6, 70);
|
||||
break;
|
||||
case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE:
|
||||
gameState.scenarioObjective.Currency = 50000.00_GBP;
|
||||
scenarioOptions.objective.Currency = 50000.00_GBP;
|
||||
break;
|
||||
case OBJECTIVE_MONTHLY_FOOD_INCOME:
|
||||
gameState.scenarioObjective.Currency = 1000.00_GBP;
|
||||
scenarioOptions.objective.Currency = 1000.00_GBP;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -726,10 +728,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
void ShowObjectiveDropdown()
|
||||
{
|
||||
const auto& gameState = getGameState();
|
||||
int32_t numItems = 0, objectiveType;
|
||||
Widget* dropdownWidget;
|
||||
const auto& scenarioOptions = gameState.scenarioOptions;
|
||||
|
||||
dropdownWidget = &widgets[WIDX_OBJECTIVE];
|
||||
int32_t numItems = 0, objectiveType;
|
||||
|
||||
for (auto i = 0; i < OBJECTIVE_COUNT; i++)
|
||||
{
|
||||
@@ -749,11 +750,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
}
|
||||
|
||||
Widget* dropdownWidget = &widgets[WIDX_OBJECTIVE];
|
||||
WindowDropdownShowTextCustomWidth(
|
||||
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
|
||||
colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 3);
|
||||
|
||||
objectiveType = gameState.scenarioObjective.Type;
|
||||
objectiveType = scenarioOptions.objective.Type;
|
||||
for (int32_t j = 0; j < numItems; j++)
|
||||
{
|
||||
if (gDropdownItems[j].args - STR_OBJECTIVE_DROPDOWN_NONE == objectiveType)
|
||||
@@ -766,81 +768,81 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void ShowCategoryDropdown()
|
||||
{
|
||||
int32_t i;
|
||||
Widget* dropdownWidget;
|
||||
|
||||
dropdownWidget = &widgets[WIDX_CATEGORY];
|
||||
|
||||
for (i = EnumValue(ScenarioCategory::beginner); i <= EnumValue(ScenarioCategory::other); i++)
|
||||
for (int32_t i = EnumValue(ScenarioCategory::beginner); i <= EnumValue(ScenarioCategory::other); i++)
|
||||
{
|
||||
gDropdownItems[i].format = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItems[i].args = kScenarioCategoryStringIds[i];
|
||||
}
|
||||
|
||||
Widget* dropdownWidget = &widgets[WIDX_CATEGORY];
|
||||
WindowDropdownShowTextCustomWidth(
|
||||
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
|
||||
colours[1], 0, Dropdown::Flag::StayOpen, 5, dropdownWidget->width() - 3);
|
||||
Dropdown::SetChecked(EnumValue(getGameState().scenarioCategory), true);
|
||||
|
||||
Dropdown::SetChecked(EnumValue(getGameState().scenarioOptions.category), true);
|
||||
}
|
||||
|
||||
void Arg1Increase()
|
||||
{
|
||||
auto& gameState = getGameState();
|
||||
switch (gameState.scenarioObjective.Type)
|
||||
auto& scenarioOptions = gameState.scenarioOptions;
|
||||
|
||||
switch (scenarioOptions.objective.Type)
|
||||
{
|
||||
case OBJECTIVE_PARK_VALUE_BY:
|
||||
case OBJECTIVE_MONTHLY_RIDE_INCOME:
|
||||
case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE:
|
||||
if (gameState.scenarioObjective.Currency >= kObjectiveCurrencyLoanAndValueMax)
|
||||
if (scenarioOptions.objective.Currency >= kObjectiveCurrencyLoanAndValueMax)
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
gameState.scenarioObjective.Currency += kObjectiveCurrencyLoanAndValueAdjustment;
|
||||
scenarioOptions.objective.Currency += kObjectiveCurrencyLoanAndValueAdjustment;
|
||||
Invalidate();
|
||||
}
|
||||
break;
|
||||
case OBJECTIVE_MONTHLY_FOOD_INCOME:
|
||||
if (gameState.scenarioObjective.Currency >= kObjectiveCurrencyFoodMax)
|
||||
if (scenarioOptions.objective.Currency >= kObjectiveCurrencyFoodMax)
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
gameState.scenarioObjective.Currency += kObjectiveCurrencyFoodAdjustment;
|
||||
scenarioOptions.objective.Currency += kObjectiveCurrencyFoodAdjustment;
|
||||
Invalidate();
|
||||
}
|
||||
break;
|
||||
case OBJECTIVE_10_ROLLERCOASTERS_LENGTH:
|
||||
if (gameState.scenarioObjective.MinimumLength >= kObjectiveLengthMax)
|
||||
if (scenarioOptions.objective.MinimumLength >= kObjectiveLengthMax)
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
gameState.scenarioObjective.MinimumLength += kObjectiveLengthAdjustment;
|
||||
scenarioOptions.objective.MinimumLength += kObjectiveLengthAdjustment;
|
||||
Invalidate();
|
||||
}
|
||||
break;
|
||||
case OBJECTIVE_FINISH_5_ROLLERCOASTERS:
|
||||
if (gameState.scenarioObjective.MinimumExcitement >= kObjectiveExcitementMax)
|
||||
if (scenarioOptions.objective.MinimumExcitement >= kObjectiveExcitementMax)
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
gameState.scenarioObjective.MinimumExcitement += kObjectiveExcitementAdjustment;
|
||||
scenarioOptions.objective.MinimumExcitement += kObjectiveExcitementAdjustment;
|
||||
Invalidate();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (gameState.scenarioObjective.NumGuests >= kObjectiveGuestsMax)
|
||||
if (scenarioOptions.objective.NumGuests >= kObjectiveGuestsMax)
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
gameState.scenarioObjective.NumGuests += kObjectiveGuestsAdjustment;
|
||||
scenarioOptions.objective.NumGuests += kObjectiveGuestsAdjustment;
|
||||
Invalidate();
|
||||
}
|
||||
break;
|
||||
@@ -850,62 +852,64 @@ namespace OpenRCT2::Ui::Windows
|
||||
void Arg1Decrease()
|
||||
{
|
||||
auto& gameState = getGameState();
|
||||
switch (gameState.scenarioObjective.Type)
|
||||
auto& scenarioOptions = gameState.scenarioOptions;
|
||||
|
||||
switch (scenarioOptions.objective.Type)
|
||||
{
|
||||
case OBJECTIVE_PARK_VALUE_BY:
|
||||
case OBJECTIVE_MONTHLY_RIDE_INCOME:
|
||||
case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE:
|
||||
if (gameState.scenarioObjective.Currency <= kObjectiveCurrencyLoanAndValueMin)
|
||||
if (scenarioOptions.objective.Currency <= kObjectiveCurrencyLoanAndValueMin)
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
gameState.scenarioObjective.Currency -= kObjectiveCurrencyLoanAndValueAdjustment;
|
||||
scenarioOptions.objective.Currency -= kObjectiveCurrencyLoanAndValueAdjustment;
|
||||
Invalidate();
|
||||
}
|
||||
break;
|
||||
case OBJECTIVE_MONTHLY_FOOD_INCOME:
|
||||
if (gameState.scenarioObjective.Currency <= kObjectiveCurrencyFoodMin)
|
||||
if (scenarioOptions.objective.Currency <= kObjectiveCurrencyFoodMin)
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
gameState.scenarioObjective.Currency -= kObjectiveCurrencyFoodAdjustment;
|
||||
scenarioOptions.objective.Currency -= kObjectiveCurrencyFoodAdjustment;
|
||||
Invalidate();
|
||||
}
|
||||
break;
|
||||
case OBJECTIVE_10_ROLLERCOASTERS_LENGTH:
|
||||
if (gameState.scenarioObjective.MinimumLength <= kObjectiveLengthMin)
|
||||
if (scenarioOptions.objective.MinimumLength <= kObjectiveLengthMin)
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
gameState.scenarioObjective.MinimumLength -= kObjectiveLengthAdjustment;
|
||||
scenarioOptions.objective.MinimumLength -= kObjectiveLengthAdjustment;
|
||||
Invalidate();
|
||||
}
|
||||
break;
|
||||
case OBJECTIVE_FINISH_5_ROLLERCOASTERS:
|
||||
if (gameState.scenarioObjective.MinimumExcitement <= kObjectiveExcitementMin)
|
||||
if (scenarioOptions.objective.MinimumExcitement <= kObjectiveExcitementMin)
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
gameState.scenarioObjective.MinimumExcitement -= kObjectiveExcitementAdjustment;
|
||||
scenarioOptions.objective.MinimumExcitement -= kObjectiveExcitementAdjustment;
|
||||
Invalidate();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (gameState.scenarioObjective.NumGuests <= kObjectiveGuestsMin)
|
||||
if (scenarioOptions.objective.NumGuests <= kObjectiveGuestsMin)
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
gameState.scenarioObjective.NumGuests -= kObjectiveGuestsAdjustment;
|
||||
scenarioOptions.objective.NumGuests -= kObjectiveGuestsAdjustment;
|
||||
Invalidate();
|
||||
}
|
||||
break;
|
||||
@@ -915,13 +919,15 @@ namespace OpenRCT2::Ui::Windows
|
||||
void Arg2Increase()
|
||||
{
|
||||
auto& gameState = getGameState();
|
||||
if (gameState.scenarioObjective.Year >= kObjectiveYearMax)
|
||||
auto& scenarioOptions = gameState.scenarioOptions;
|
||||
|
||||
if (scenarioOptions.objective.Year >= kObjectiveYearMax)
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
gameState.scenarioObjective.Year += kObjectiveYearAdjustment;
|
||||
scenarioOptions.objective.Year += kObjectiveYearAdjustment;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
@@ -929,13 +935,15 @@ namespace OpenRCT2::Ui::Windows
|
||||
void Arg2Decrease()
|
||||
{
|
||||
auto& gameState = getGameState();
|
||||
if (gameState.scenarioObjective.Year <= kObjectiveYearMin)
|
||||
auto& scenarioOptions = gameState.scenarioOptions;
|
||||
|
||||
if (scenarioOptions.objective.Year <= kObjectiveYearMin)
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
gameState.scenarioObjective.Year -= kObjectiveYearAdjustment;
|
||||
scenarioOptions.objective.Year -= kObjectiveYearAdjustment;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
@@ -1009,7 +1017,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
case WIDX_OBJECTIVE_DROPDOWN:
|
||||
// TODO: Don't rely on string ID order
|
||||
newObjectiveType = static_cast<uint8_t>(gDropdownItems[dropdownIndex].args - STR_OBJECTIVE_DROPDOWN_NONE);
|
||||
if (gameState.scenarioObjective.Type != newObjectiveType)
|
||||
if (gameState.scenarioOptions.objective.Type != newObjectiveType)
|
||||
SetObjective(newObjectiveType);
|
||||
break;
|
||||
}
|
||||
@@ -1027,7 +1035,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
OnPrepareDraw();
|
||||
InvalidateWidget(WIDX_TAB_1);
|
||||
|
||||
objectiveType = getGameState().scenarioObjective.Type;
|
||||
objectiveType = getGameState().scenarioOptions.objective.Type;
|
||||
|
||||
// Check if objective is allowed by money and pay-per-ride settings.
|
||||
const bool objectiveAllowedByMoneyUsage = !(getGameState().park.flags & PARK_FLAGS_NO_MONEY)
|
||||
@@ -1052,7 +1060,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
switch (gameState.scenarioObjective.Type)
|
||||
switch (gameState.scenarioOptions.objective.Type)
|
||||
{
|
||||
case OBJECTIVE_GUESTS_BY:
|
||||
case OBJECTIVE_PARK_VALUE_BY:
|
||||
@@ -1096,7 +1104,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (widgets[WIDX_OBJECTIVE_ARG_1_LABEL].type != WidgetType::empty)
|
||||
{
|
||||
// Objective argument 1 label
|
||||
switch (gameState.scenarioObjective.Type)
|
||||
switch (gameState.scenarioOptions.objective.Type)
|
||||
{
|
||||
case OBJECTIVE_GUESTS_BY:
|
||||
case OBJECTIVE_GUESTS_AND_RATING:
|
||||
@@ -1135,6 +1143,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
void ObjectiveOnDraw(RenderTarget& rt)
|
||||
{
|
||||
const auto& gameState = getGameState();
|
||||
const auto& scenarioOptions = gameState.scenarioOptions;
|
||||
|
||||
DrawWidgets(rt);
|
||||
DrawTabImages(rt);
|
||||
@@ -1142,7 +1151,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
// Objective value
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_OBJECTIVE].left + 1, widgets[WIDX_OBJECTIVE].top };
|
||||
auto ft = Formatter();
|
||||
ft.Add<StringId>(ObjectiveDropdownOptionNames[gameState.scenarioObjective.Type]);
|
||||
ft.Add<StringId>(ObjectiveDropdownOptionNames[scenarioOptions.objective.Type]);
|
||||
DrawTextBasic(rt, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft);
|
||||
|
||||
if (widgets[WIDX_OBJECTIVE_ARG_1].type != WidgetType::empty)
|
||||
@@ -1154,31 +1163,31 @@ namespace OpenRCT2::Ui::Windows
|
||||
screenCoords = windowPos
|
||||
+ ScreenCoordsXY{ widgets[WIDX_OBJECTIVE_ARG_1].left + 1, widgets[WIDX_OBJECTIVE_ARG_1].top };
|
||||
ft = Formatter();
|
||||
switch (gameState.scenarioObjective.Type)
|
||||
switch (scenarioOptions.objective.Type)
|
||||
{
|
||||
case OBJECTIVE_GUESTS_BY:
|
||||
case OBJECTIVE_GUESTS_AND_RATING:
|
||||
stringId = STR_WINDOW_COLOUR_2_COMMA32;
|
||||
ft.Add<int32_t>(gameState.scenarioObjective.NumGuests);
|
||||
ft.Add<int32_t>(scenarioOptions.objective.NumGuests);
|
||||
break;
|
||||
case OBJECTIVE_PARK_VALUE_BY:
|
||||
case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE:
|
||||
case OBJECTIVE_MONTHLY_RIDE_INCOME:
|
||||
case OBJECTIVE_MONTHLY_FOOD_INCOME:
|
||||
stringId = STR_CURRENCY_FORMAT_LABEL;
|
||||
ft.Add<money64>(gameState.scenarioObjective.Currency);
|
||||
ft.Add<money64>(scenarioOptions.objective.Currency);
|
||||
break;
|
||||
case OBJECTIVE_10_ROLLERCOASTERS_LENGTH:
|
||||
stringId = STR_WINDOW_COLOUR_2_LENGTH;
|
||||
ft.Add<uint16_t>(gameState.scenarioObjective.MinimumLength);
|
||||
ft.Add<uint16_t>(scenarioOptions.objective.MinimumLength);
|
||||
break;
|
||||
case OBJECTIVE_FINISH_5_ROLLERCOASTERS:
|
||||
stringId = STR_WINDOW_COLOUR_2_COMMA2DP32;
|
||||
ft.Add<uint16_t>(gameState.scenarioObjective.MinimumExcitement);
|
||||
ft.Add<uint16_t>(scenarioOptions.objective.MinimumExcitement);
|
||||
break;
|
||||
default:
|
||||
stringId = STR_WINDOW_COLOUR_2_COMMA2DP32;
|
||||
ft.Add<money64>(gameState.scenarioObjective.Currency);
|
||||
ft.Add<money64>(scenarioOptions.objective.Currency);
|
||||
break;
|
||||
}
|
||||
DrawTextBasic(rt, screenCoords, stringId, ft, wColour2);
|
||||
@@ -1190,7 +1199,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
screenCoords = windowPos
|
||||
+ ScreenCoordsXY{ widgets[WIDX_OBJECTIVE_ARG_2].left + 1, widgets[WIDX_OBJECTIVE_ARG_2].top };
|
||||
ft = Formatter();
|
||||
ft.Add<uint16_t>((gameState.scenarioObjective.Year * MONTH_COUNT) - 1);
|
||||
ft.Add<uint16_t>((scenarioOptions.objective.Year * MONTH_COUNT) - 1);
|
||||
DrawTextBasic(rt, screenCoords, STR_WINDOW_OBJECTIVE_VALUE_DATE, ft);
|
||||
}
|
||||
}
|
||||
@@ -1218,12 +1227,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
case WIDX_SCENARIO_NAME:
|
||||
WindowTextInputRawOpen(
|
||||
this, WIDX_SCENARIO_NAME, STR_SCENARIO_NAME, STR_ENTER_SCENARIO_NAME, {},
|
||||
gameState.scenarioName.c_str(), kScenarioNameMaxLength);
|
||||
gameState.scenarioOptions.name.c_str(), kScenarioNameMaxLength);
|
||||
break;
|
||||
case WIDX_DETAILS:
|
||||
WindowTextInputRawOpen(
|
||||
this, WIDX_DETAILS, STR_PARK_SCENARIO_DETAILS, STR_ENTER_SCENARIO_DESCRIPTION, {},
|
||||
gameState.scenarioDetails.c_str(), kScenarioDetailsNameMaxLength);
|
||||
gameState.scenarioOptions.details.c_str(), kScenarioDetailsNameMaxLength);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1248,9 +1257,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
case WIDX_CATEGORY_DROPDOWN:
|
||||
{
|
||||
auto& gameState = getGameState();
|
||||
if (gameState.scenarioCategory != static_cast<ScenarioCategory>(dropdownIndex))
|
||||
if (gameState.scenarioOptions.category != static_cast<ScenarioCategory>(dropdownIndex))
|
||||
{
|
||||
gameState.scenarioCategory = static_cast<ScenarioCategory>(dropdownIndex);
|
||||
gameState.scenarioOptions.category = static_cast<ScenarioCategory>(dropdownIndex);
|
||||
Invalidate();
|
||||
}
|
||||
break;
|
||||
@@ -1288,7 +1297,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
auto ft = Formatter();
|
||||
ft.Add<StringId>(STR_STRING);
|
||||
ft.Add<const char*>(gameState.scenarioName.c_str());
|
||||
ft.Add<const char*>(gameState.scenarioOptions.name.c_str());
|
||||
DrawTextEllipsised(rt, screenCoords, widthToSet, STR_WINDOW_SCENARIO_NAME, ft);
|
||||
|
||||
// Scenario details label
|
||||
@@ -1301,7 +1310,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
ft = Formatter();
|
||||
ft.Add<StringId>(STR_STRING);
|
||||
ft.Add<const char*>(gameState.scenarioDetails.c_str());
|
||||
ft.Add<const char*>(gameState.scenarioOptions.details.c_str());
|
||||
DrawTextWrapped(rt, screenCoords, widthToSet, STR_BLACK_STRING, ft);
|
||||
|
||||
// Scenario category label
|
||||
@@ -1311,7 +1320,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
// Scenario category value
|
||||
screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_CATEGORY].left + 1, widgets[WIDX_CATEGORY].top };
|
||||
ft = Formatter();
|
||||
ft.Add<StringId>(kScenarioCategoryStringIds[EnumValue(gameState.scenarioCategory)]);
|
||||
ft.Add<StringId>(kScenarioCategoryStringIds[EnumValue(gameState.scenarioOptions.category)]);
|
||||
DrawTextBasic(rt, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft);
|
||||
}
|
||||
|
||||
@@ -1325,6 +1334,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
return;
|
||||
|
||||
auto& gameState = getGameState();
|
||||
auto& scenarioOptions = gameState.scenarioOptions;
|
||||
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_PARK_NAME:
|
||||
@@ -1332,18 +1343,18 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto action = ParkSetNameAction(std::string(text));
|
||||
GameActions::Execute(&action);
|
||||
|
||||
if (gameState.scenarioName.empty())
|
||||
if (scenarioOptions.name.empty())
|
||||
{
|
||||
gameState.scenarioName = gameState.park.name;
|
||||
scenarioOptions.name = gameState.park.name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WIDX_SCENARIO_NAME:
|
||||
gameState.scenarioName = text;
|
||||
scenarioOptions.name = text;
|
||||
Invalidate();
|
||||
break;
|
||||
case WIDX_DETAILS:
|
||||
gameState.scenarioDetails = text;
|
||||
scenarioOptions.details = text;
|
||||
Invalidate();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
DrawTextBasic(rt, windowPos + ScreenCoordsXY{ 8, titleBarBottom + 280 }, stringId, ft);
|
||||
|
||||
// Objective related financial information
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_MONTHLY_FOOD_INCOME)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_MONTHLY_FOOD_INCOME)
|
||||
{
|
||||
auto lastMonthProfit = FinanceGetLastMonthShopProfit();
|
||||
ft = Formatter();
|
||||
|
||||
@@ -521,7 +521,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
widgets[WIDX_OPEN_LIGHT].image = ImageId(openLightImage);
|
||||
|
||||
// Only allow closing of park for guest / rating objective
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_GUESTS_AND_RATING)
|
||||
disabled_widgets |= (1uLL << WIDX_OPEN_OR_CLOSE) | (1uLL << WIDX_CLOSE_LIGHT) | (1uLL << WIDX_OPEN_LIGHT);
|
||||
else
|
||||
disabled_widgets &= ~((1uLL << WIDX_OPEN_OR_CLOSE) | (1uLL << WIDX_CLOSE_LIGHT) | (1uLL << WIDX_OPEN_LIGHT));
|
||||
@@ -545,7 +545,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (ThemeGetFlags() & UITHEME_FLAG_USE_LIGHTS_PARK)
|
||||
{
|
||||
widgets[WIDX_OPEN_OR_CLOSE].type = WidgetType::empty;
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_GUESTS_AND_RATING)
|
||||
{
|
||||
widgets[WIDX_CLOSE_LIGHT].type = WidgetType::flatBtn;
|
||||
widgets[WIDX_OPEN_LIGHT].type = WidgetType::flatBtn;
|
||||
@@ -1073,7 +1073,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
+ ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 7 };
|
||||
auto ft = Formatter();
|
||||
ft.Add<StringId>(STR_STRING);
|
||||
ft.Add<const char*>(gameState.scenarioDetails.c_str());
|
||||
ft.Add<const char*>(gameState.scenarioOptions.details.c_str());
|
||||
screenCoords.y += DrawTextWrapped(rt, screenCoords, 222, STR_BLACK_STRING, ft);
|
||||
screenCoords.y += 5;
|
||||
|
||||
@@ -1083,9 +1083,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Objective
|
||||
ft = Formatter();
|
||||
formatObjective(ft, gameState.scenarioObjective);
|
||||
formatObjective(ft, gameState.scenarioOptions.objective);
|
||||
|
||||
screenCoords.y += DrawTextWrapped(rt, screenCoords, 221, kObjectiveNames[gameState.scenarioObjective.Type], ft);
|
||||
screenCoords.y += DrawTextWrapped(
|
||||
rt, screenCoords, 221, kObjectiveNames[gameState.scenarioOptions.objective.Type], ft);
|
||||
screenCoords.y += 5;
|
||||
|
||||
// Objective outcome
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
intent = std::make_unique<Intent>(WindowClass::Loadsave);
|
||||
intent->PutEnumExtra<LoadSaveAction>(INTENT_EXTRA_LOADSAVE_ACTION, LoadSaveAction::save);
|
||||
intent->PutEnumExtra<LoadSaveType>(INTENT_EXTRA_LOADSAVE_TYPE, LoadSaveType::landscape);
|
||||
intent->PutExtra(INTENT_EXTRA_PATH, getGameState().scenarioName);
|
||||
intent->PutExtra(INTENT_EXTRA_PATH, getGameState().scenarioOptions.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -465,7 +465,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto intent = Intent(WindowClass::Loadsave);
|
||||
intent.PutEnumExtra<LoadSaveAction>(INTENT_EXTRA_LOADSAVE_ACTION, LoadSaveAction::save);
|
||||
intent.PutEnumExtra<LoadSaveType>(INTENT_EXTRA_LOADSAVE_TYPE, LoadSaveType::landscape);
|
||||
intent.PutExtra(INTENT_EXTRA_PATH, getGameState().scenarioName);
|
||||
intent.PutExtra(INTENT_EXTRA_PATH, getGameState().scenarioOptions.name);
|
||||
ContextOpenIntent(&intent);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -112,14 +112,14 @@ namespace OpenRCT2::Editor
|
||||
gLegacyScene = LegacyScene::scenarioEditor;
|
||||
gameState.editorStep = EditorStep::ObjectSelection;
|
||||
gameState.park.flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
||||
gameState.scenarioCategory = ScenarioCategory::other;
|
||||
gameState.scenarioOptions.category = ScenarioCategory::other;
|
||||
ObjectListLoad();
|
||||
ViewportInitAll();
|
||||
WindowBase* mainWindow = OpenEditorWindows();
|
||||
mainWindow->SetViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
|
||||
LoadPalette();
|
||||
gScreenAge = 0;
|
||||
gameState.scenarioName = LanguageGetString(STR_MY_NEW_SCENARIO);
|
||||
gameState.scenarioOptions.name = LanguageGetString(STR_MY_NEW_SCENARIO);
|
||||
|
||||
GameLoadScripts();
|
||||
GameNotifyMapChanged();
|
||||
@@ -156,7 +156,7 @@ namespace OpenRCT2::Editor
|
||||
|
||||
gLegacyScene = LegacyScene::scenarioEditor;
|
||||
gameState.editorStep = EditorStep::OptionsSelection;
|
||||
gameState.scenarioCategory = ScenarioCategory::other;
|
||||
gameState.scenarioOptions.category = ScenarioCategory::other;
|
||||
ViewportInitAll();
|
||||
OpenEditorWindows();
|
||||
FinaliseMainView();
|
||||
|
||||
@@ -34,6 +34,11 @@ namespace OpenRCT2::Scenario
|
||||
{
|
||||
struct Options
|
||||
{
|
||||
Objective objective;
|
||||
ScenarioCategory category;
|
||||
std::string name;
|
||||
std::string details;
|
||||
|
||||
money64 initialCash;
|
||||
|
||||
money64 guestInitialCash;
|
||||
@@ -60,7 +65,6 @@ namespace OpenRCT2
|
||||
|
||||
uint32_t nextGuestNumber;
|
||||
|
||||
Objective scenarioObjective;
|
||||
uint16_t scenarioParkRatingWarningDays;
|
||||
money64 scenarioCompletedCompanyValue;
|
||||
money64 scenarioCompanyValueRecord;
|
||||
@@ -72,9 +76,6 @@ namespace OpenRCT2
|
||||
|
||||
EditorStep editorStep;
|
||||
|
||||
ScenarioCategory scenarioCategory;
|
||||
std::string scenarioName;
|
||||
std::string scenarioDetails;
|
||||
std::string scenarioCompletedBy;
|
||||
std::string scenarioFileName;
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ GameActions::Result CheatSetAction::Execute() const
|
||||
ParkSetOpen(!Park::IsOpen(gameState.park));
|
||||
break;
|
||||
case CheatType::HaveFun:
|
||||
gameState.scenarioObjective.Type = OBJECTIVE_HAVE_FUN;
|
||||
gameState.scenarioOptions.objective.Type = OBJECTIVE_HAVE_FUN;
|
||||
break;
|
||||
case CheatType::SetForcedParkRating:
|
||||
Park::SetForcedRating(_param1);
|
||||
|
||||
@@ -226,7 +226,7 @@ GameActions::Result RideCreateAction::Execute() const
|
||||
ride->price[1] = GetShopItemDescriptor(rideEntry->shop_item[1]).DefaultPrice;
|
||||
}
|
||||
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_BUILD_THE_BEST)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_BUILD_THE_BEST)
|
||||
{
|
||||
ride->price[0] = 0;
|
||||
}
|
||||
|
||||
@@ -484,15 +484,15 @@ namespace OpenRCT2
|
||||
void ReadWriteScenarioChunk(GameState_t& gameState, OrcaStream& os)
|
||||
{
|
||||
os.readWriteChunk(ParkFileChunkType::SCENARIO, [&gameState, &os](OrcaStream::ChunkStream& cs) {
|
||||
cs.readWrite(gameState.scenarioCategory);
|
||||
ReadWriteStringTable(cs, gameState.scenarioName, "en-GB");
|
||||
cs.readWrite(gameState.scenarioOptions.category);
|
||||
ReadWriteStringTable(cs, gameState.scenarioOptions.name, "en-GB");
|
||||
ReadWriteStringTable(cs, gameState.park.name, "en-GB");
|
||||
ReadWriteStringTable(cs, gameState.scenarioDetails, "en-GB");
|
||||
ReadWriteStringTable(cs, gameState.scenarioOptions.details, "en-GB");
|
||||
|
||||
cs.readWrite(gameState.scenarioObjective.Type);
|
||||
cs.readWrite(gameState.scenarioObjective.Year);
|
||||
cs.readWrite(gameState.scenarioObjective.NumGuests);
|
||||
cs.readWrite(gameState.scenarioObjective.Currency);
|
||||
cs.readWrite(gameState.scenarioOptions.objective.Type);
|
||||
cs.readWrite(gameState.scenarioOptions.objective.Year);
|
||||
cs.readWrite(gameState.scenarioOptions.objective.NumGuests);
|
||||
cs.readWrite(gameState.scenarioOptions.objective.Currency);
|
||||
|
||||
cs.readWrite(gameState.scenarioParkRatingWarningDays);
|
||||
|
||||
|
||||
@@ -358,7 +358,7 @@ namespace OpenRCT2::RCT1
|
||||
gameStateInitAll(gameState, { mapSize, mapSize });
|
||||
gameState.editorStep = EditorStep::ObjectSelection;
|
||||
gameState.park.flags |= PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
||||
gameState.scenarioCategory = ScenarioCategory::other;
|
||||
gameState.scenarioOptions.category = ScenarioCategory::other;
|
||||
}
|
||||
|
||||
std::string GetRCT1ScenarioName()
|
||||
@@ -2447,8 +2447,8 @@ namespace OpenRCT2::RCT1
|
||||
}
|
||||
}
|
||||
|
||||
gameState.scenarioName = std::move(name);
|
||||
gameState.scenarioDetails = std::move(details);
|
||||
gameState.scenarioOptions.name = std::move(name);
|
||||
gameState.scenarioOptions.details = std::move(details);
|
||||
if (_isScenario && !parkName.empty())
|
||||
{
|
||||
auto& park = getGameState().park;
|
||||
@@ -2458,21 +2458,21 @@ namespace OpenRCT2::RCT1
|
||||
|
||||
void ImportScenarioObjective(GameState_t& gameState)
|
||||
{
|
||||
gameState.scenarioObjective.Type = _s4.ScenarioObjectiveType;
|
||||
gameState.scenarioObjective.Year = _s4.ScenarioObjectiveYears;
|
||||
gameState.scenarioObjective.NumGuests = _s4.ScenarioObjectiveNumGuests;
|
||||
gameState.scenarioOptions.objective.Type = _s4.ScenarioObjectiveType;
|
||||
gameState.scenarioOptions.objective.Year = _s4.ScenarioObjectiveYears;
|
||||
gameState.scenarioOptions.objective.NumGuests = _s4.ScenarioObjectiveNumGuests;
|
||||
|
||||
// RCT1 used a different way of calculating the park value.
|
||||
// This is corrected here, but since scenario_objective_currency doubles as minimum excitement rating,
|
||||
// we need to check the goal to avoid affecting scenarios like Volcania.
|
||||
if (_s4.ScenarioObjectiveType == OBJECTIVE_PARK_VALUE_BY)
|
||||
gameState.scenarioObjective.Currency = CorrectRCT1ParkValue(_s4.ScenarioObjectiveCurrency);
|
||||
gameState.scenarioOptions.objective.Currency = CorrectRCT1ParkValue(_s4.ScenarioObjectiveCurrency);
|
||||
else
|
||||
gameState.scenarioObjective.Currency = ToMoney64(_s4.ScenarioObjectiveCurrency);
|
||||
gameState.scenarioOptions.objective.Currency = ToMoney64(_s4.ScenarioObjectiveCurrency);
|
||||
|
||||
// This does not seem to be saved in the objective arguments, so look up the ID from the available rides instead.
|
||||
if (_s4.ScenarioObjectiveType == OBJECTIVE_BUILD_THE_BEST)
|
||||
gameState.scenarioObjective.RideId = GetBuildTheBestRideId();
|
||||
gameState.scenarioOptions.objective.RideId = GetBuildTheBestRideId();
|
||||
}
|
||||
|
||||
void ImportSavedView(GameState_t& gameState)
|
||||
|
||||
@@ -350,7 +350,7 @@ namespace OpenRCT2::RCT2
|
||||
Initialise(gameState);
|
||||
|
||||
gameState.editorStep = _s6.Info.EditorStep;
|
||||
gameState.scenarioCategory = _s6.Info.Category;
|
||||
gameState.scenarioOptions.category = _s6.Info.Category;
|
||||
|
||||
// Some scenarios have their scenario details in UTF-8, due to earlier bugs in OpenRCT2.
|
||||
auto loadMaybeUTF8 = [](std::string_view str) -> std::string {
|
||||
@@ -359,14 +359,14 @@ namespace OpenRCT2::RCT2
|
||||
|
||||
if (_s6.Header.Type == S6_TYPE_SCENARIO)
|
||||
{
|
||||
gameState.scenarioName = loadMaybeUTF8(_s6.Info.Name);
|
||||
gameState.scenarioDetails = loadMaybeUTF8(_s6.Info.Details);
|
||||
gameState.scenarioOptions.name = loadMaybeUTF8(_s6.Info.Name);
|
||||
gameState.scenarioOptions.details = loadMaybeUTF8(_s6.Info.Details);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Saved games do not have an info chunk
|
||||
gameState.scenarioName = loadMaybeUTF8(_s6.ScenarioName);
|
||||
gameState.scenarioDetails = loadMaybeUTF8(_s6.ScenarioDescription);
|
||||
gameState.scenarioOptions.name = loadMaybeUTF8(_s6.ScenarioName);
|
||||
gameState.scenarioOptions.details = loadMaybeUTF8(_s6.ScenarioDescription);
|
||||
}
|
||||
|
||||
gameState.date = OpenRCT2::Date{ _s6.ElapsedMonths, _s6.CurrentDay };
|
||||
@@ -468,16 +468,16 @@ namespace OpenRCT2::RCT2
|
||||
gameState.scenarioOptions.guestInitialCash = ToMoney64(_s6.GuestInitialCash);
|
||||
gameState.scenarioOptions.guestInitialHunger = _s6.GuestInitialHunger;
|
||||
gameState.scenarioOptions.guestInitialThirst = _s6.GuestInitialThirst;
|
||||
gameState.scenarioObjective.Type = _s6.ObjectiveType;
|
||||
gameState.scenarioObjective.Year = _s6.ObjectiveYear;
|
||||
gameState.scenarioOptions.objective.Type = _s6.ObjectiveType;
|
||||
gameState.scenarioOptions.objective.Year = _s6.ObjectiveYear;
|
||||
// Pad013580FA
|
||||
gameState.scenarioObjective.Currency = _s6.ObjectiveCurrency;
|
||||
gameState.scenarioOptions.objective.Currency = _s6.ObjectiveCurrency;
|
||||
// In RCT2, the ride string IDs start at index STR_0002 and are directly mappable.
|
||||
// This is not always the case in OpenRCT2, so we use the actual ride ID.
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_BUILD_THE_BEST)
|
||||
gameState.scenarioObjective.RideId = _s6.ObjectiveGuests - kRCT2RideStringStart;
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_BUILD_THE_BEST)
|
||||
gameState.scenarioOptions.objective.RideId = _s6.ObjectiveGuests - kRCT2RideStringStart;
|
||||
else
|
||||
gameState.scenarioObjective.NumGuests = _s6.ObjectiveGuests;
|
||||
gameState.scenarioOptions.objective.NumGuests = _s6.ObjectiveGuests;
|
||||
ImportMarketingCampaigns();
|
||||
|
||||
gameState.park.currentExpenditure = ToMoney64(_s6.CurrentExpenditure);
|
||||
@@ -641,8 +641,8 @@ namespace OpenRCT2::RCT2
|
||||
{
|
||||
// Scenario details
|
||||
gameState.scenarioCompletedBy = RCT2StringToUTF8(gameState.scenarioCompletedBy, RCT2LanguageId::EnglishUK);
|
||||
gameState.scenarioName = RCT2StringToUTF8(gameState.scenarioName, RCT2LanguageId::EnglishUK);
|
||||
gameState.scenarioDetails = RCT2StringToUTF8(gameState.scenarioDetails, RCT2LanguageId::EnglishUK);
|
||||
gameState.scenarioOptions.name = RCT2StringToUTF8(gameState.scenarioOptions.name, RCT2LanguageId::EnglishUK);
|
||||
gameState.scenarioOptions.details = RCT2StringToUTF8(gameState.scenarioOptions.details, RCT2LanguageId::EnglishUK);
|
||||
}
|
||||
|
||||
void ImportRides()
|
||||
|
||||
@@ -84,7 +84,7 @@ void ScenarioBegin(GameState_t& gameState)
|
||||
GameLoadInit();
|
||||
ScenarioReset(gameState);
|
||||
|
||||
if (gameState.scenarioObjective.Type != OBJECTIVE_NONE && !gLoadKeepWindowsOpen)
|
||||
if (gameState.scenarioOptions.objective.Type != OBJECTIVE_NONE && !gLoadKeepWindowsOpen)
|
||||
ContextOpenWindowView(WV_PARK_OBJECTIVE);
|
||||
|
||||
gScreenAge = 0;
|
||||
@@ -112,9 +112,9 @@ void ScenarioReset(GameState_t& gameState)
|
||||
auto& objManager = GetContext()->GetObjectManager();
|
||||
if (auto* textObject = objManager.GetLoadedObject<ScenarioMetaObject>(0); textObject != nullptr)
|
||||
{
|
||||
gameState.scenarioName = textObject->GetScenarioName();
|
||||
gameState.scenarioOptions.name = textObject->GetScenarioName();
|
||||
gameState.park.name = textObject->GetParkName();
|
||||
gameState.scenarioDetails = textObject->GetScenarioDetails();
|
||||
gameState.scenarioOptions.details = textObject->GetScenarioDetails();
|
||||
}
|
||||
|
||||
// Set the last saved game path
|
||||
@@ -285,7 +285,7 @@ static void ScenarioDayUpdate(GameState_t& gameState)
|
||||
{
|
||||
FinanceUpdateDailyProfit();
|
||||
PeepUpdateDaysInQueue();
|
||||
switch (gameState.scenarioObjective.Type)
|
||||
switch (gameState.scenarioOptions.objective.Type)
|
||||
{
|
||||
case OBJECTIVE_10_ROLLERCOASTERS:
|
||||
case OBJECTIVE_GUESTS_AND_RATING:
|
||||
@@ -526,7 +526,7 @@ uint32_t ScenarioRandMax(uint32_t max)
|
||||
*/
|
||||
static ResultWithMessage ScenarioPrepareRidesForSave(GameState_t& gameState)
|
||||
{
|
||||
int32_t isFiveCoasterObjective = gameState.scenarioObjective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS;
|
||||
int32_t isFiveCoasterObjective = gameState.scenarioOptions.objective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS;
|
||||
uint8_t rcs = 0;
|
||||
|
||||
for (auto& ride : GetRideManager())
|
||||
@@ -592,7 +592,7 @@ ResultWithMessage ScenarioPrepareForSave(GameState_t& gameState)
|
||||
return { false, prepareRidesResult.Message };
|
||||
}
|
||||
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_GUESTS_AND_RATING)
|
||||
gameState.park.flags |= PARK_FLAGS_PARK_OPEN;
|
||||
|
||||
ScenarioReset(gameState);
|
||||
@@ -858,7 +858,7 @@ bool AllowEarlyCompletion()
|
||||
|
||||
static void ScenarioCheckObjective(GameState_t& gameState)
|
||||
{
|
||||
auto status = gameState.scenarioObjective.Check(gameState);
|
||||
auto status = gameState.scenarioOptions.objective.Check(gameState);
|
||||
if (status == ObjectiveStatus::Success)
|
||||
{
|
||||
ScenarioSuccess(gameState);
|
||||
|
||||
@@ -41,22 +41,22 @@ namespace OpenRCT2::Scripting
|
||||
private:
|
||||
std::string type_get()
|
||||
{
|
||||
return std::string(ScenarioObjectiveTypeMap[getGameState().scenarioObjective.Type]);
|
||||
return std::string(ScenarioObjectiveTypeMap[getGameState().scenarioOptions.objective.Type]);
|
||||
}
|
||||
|
||||
void type_set(const std::string& value)
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
getGameState().scenarioObjective.Type = ScenarioObjectiveTypeMap[value];
|
||||
getGameState().scenarioOptions.objective.Type = ScenarioObjectiveTypeMap[value];
|
||||
}
|
||||
|
||||
uint16_t guests_get()
|
||||
{
|
||||
auto& gameState = getGameState();
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_BY
|
||||
|| gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_GUESTS_BY
|
||||
|| gameState.scenarioOptions.objective.Type == OBJECTIVE_GUESTS_AND_RATING)
|
||||
{
|
||||
return gameState.scenarioObjective.NumGuests;
|
||||
return gameState.scenarioOptions.objective.NumGuests;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -65,20 +65,20 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
auto& gameState = getGameState();
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_BY
|
||||
|| gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_AND_RATING)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_GUESTS_BY
|
||||
|| gameState.scenarioOptions.objective.Type == OBJECTIVE_GUESTS_AND_RATING)
|
||||
{
|
||||
gameState.scenarioObjective.NumGuests = value;
|
||||
gameState.scenarioOptions.objective.NumGuests = value;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t year_get()
|
||||
{
|
||||
const auto& gameState = getGameState();
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_BY
|
||||
|| gameState.scenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_GUESTS_BY
|
||||
|| gameState.scenarioOptions.objective.Type == OBJECTIVE_PARK_VALUE_BY)
|
||||
{
|
||||
return gameState.scenarioObjective.Year;
|
||||
return gameState.scenarioOptions.objective.Year;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -87,19 +87,19 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
auto& gameState = getGameState();
|
||||
ThrowIfGameStateNotMutable();
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_GUESTS_BY
|
||||
|| gameState.scenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_GUESTS_BY
|
||||
|| gameState.scenarioOptions.objective.Type == OBJECTIVE_PARK_VALUE_BY)
|
||||
{
|
||||
gameState.scenarioObjective.Year = value;
|
||||
gameState.scenarioOptions.objective.Year = value;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t length_get()
|
||||
{
|
||||
const auto& gameState = getGameState();
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_10_ROLLERCOASTERS_LENGTH)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_10_ROLLERCOASTERS_LENGTH)
|
||||
{
|
||||
return gameState.scenarioObjective.NumGuests;
|
||||
return gameState.scenarioOptions.objective.NumGuests;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -108,18 +108,18 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
auto& gameState = getGameState();
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_10_ROLLERCOASTERS_LENGTH)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_10_ROLLERCOASTERS_LENGTH)
|
||||
{
|
||||
gameState.scenarioObjective.NumGuests = value;
|
||||
gameState.scenarioOptions.objective.NumGuests = value;
|
||||
}
|
||||
}
|
||||
|
||||
money64 excitement_get()
|
||||
{
|
||||
const auto& gameState = getGameState();
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS)
|
||||
{
|
||||
return gameState.scenarioObjective.Currency;
|
||||
return gameState.scenarioOptions.objective.Currency;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -128,19 +128,19 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
auto& gameState = getGameState();
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_FINISH_5_ROLLERCOASTERS)
|
||||
{
|
||||
gameState.scenarioObjective.Currency = value;
|
||||
gameState.scenarioOptions.objective.Currency = value;
|
||||
}
|
||||
}
|
||||
|
||||
money64 parkValue_get()
|
||||
{
|
||||
const auto& gameState = getGameState();
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY
|
||||
|| gameState.scenarioObjective.Type == OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_PARK_VALUE_BY
|
||||
|| gameState.scenarioOptions.objective.Type == OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE)
|
||||
{
|
||||
return gameState.scenarioObjective.Currency;
|
||||
return gameState.scenarioOptions.objective.Currency;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -149,20 +149,20 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
auto& gameState = getGameState();
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY
|
||||
|| gameState.scenarioObjective.Type == OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_PARK_VALUE_BY
|
||||
|| gameState.scenarioOptions.objective.Type == OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE)
|
||||
{
|
||||
gameState.scenarioObjective.Currency = value;
|
||||
gameState.scenarioOptions.objective.Currency = value;
|
||||
}
|
||||
}
|
||||
|
||||
money64 monthlyIncome_get()
|
||||
{
|
||||
const auto& gameState = getGameState();
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_MONTHLY_RIDE_INCOME
|
||||
|| gameState.scenarioObjective.Type == OBJECTIVE_MONTHLY_FOOD_INCOME)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_MONTHLY_RIDE_INCOME
|
||||
|| gameState.scenarioOptions.objective.Type == OBJECTIVE_MONTHLY_FOOD_INCOME)
|
||||
{
|
||||
return gameState.scenarioObjective.Currency;
|
||||
return gameState.scenarioOptions.objective.Currency;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -171,10 +171,10 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
auto& gameState = getGameState();
|
||||
if (gameState.scenarioObjective.Type == OBJECTIVE_PARK_VALUE_BY
|
||||
|| gameState.scenarioObjective.Type == OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE)
|
||||
if (gameState.scenarioOptions.objective.Type == OBJECTIVE_PARK_VALUE_BY
|
||||
|| gameState.scenarioOptions.objective.Type == OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE)
|
||||
{
|
||||
gameState.scenarioObjective.Currency = value;
|
||||
gameState.scenarioOptions.objective.Currency = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,24 +198,24 @@ namespace OpenRCT2::Scripting
|
||||
public:
|
||||
std::string name_get()
|
||||
{
|
||||
return getGameState().scenarioName;
|
||||
return getGameState().scenarioOptions.name;
|
||||
}
|
||||
|
||||
void name_set(const std::string& value)
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
getGameState().scenarioName = value;
|
||||
getGameState().scenarioOptions.name = value;
|
||||
}
|
||||
|
||||
std::string details_get()
|
||||
{
|
||||
return getGameState().scenarioDetails;
|
||||
return getGameState().scenarioOptions.details;
|
||||
}
|
||||
|
||||
void details_set(const std::string& value)
|
||||
{
|
||||
ThrowIfGameStateNotMutable();
|
||||
getGameState().scenarioDetails = value;
|
||||
getGameState().scenarioOptions.details = value;
|
||||
}
|
||||
|
||||
std::string completedBy_get()
|
||||
|
||||
@@ -313,9 +313,9 @@ namespace OpenRCT2::Park
|
||||
gameState.scenarioOptions.guestInitialHappiness = Park::CalculateGuestInitialHappiness(50);
|
||||
gameState.scenarioOptions.guestInitialHunger = 200;
|
||||
gameState.scenarioOptions.guestInitialThirst = 200;
|
||||
gameState.scenarioObjective.Type = OBJECTIVE_GUESTS_BY;
|
||||
gameState.scenarioObjective.Year = 4;
|
||||
gameState.scenarioObjective.NumGuests = 1000;
|
||||
gameState.scenarioOptions.objective.Type = OBJECTIVE_GUESTS_BY;
|
||||
gameState.scenarioOptions.objective.Year = 4;
|
||||
gameState.scenarioOptions.objective.NumGuests = 1000;
|
||||
gameState.landPrice = 90.00_GBP;
|
||||
gameState.constructionRightsPrice = 40.00_GBP;
|
||||
gameState.park.flags = PARK_FLAGS_NO_MONEY | PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
|
||||
@@ -323,8 +323,8 @@ namespace OpenRCT2::Park
|
||||
FinanceResetHistory();
|
||||
AwardReset();
|
||||
|
||||
gameState.scenarioName.clear();
|
||||
gameState.scenarioDetails = String::toStd(LanguageGetString(STR_NO_DETAILS_YET));
|
||||
gameState.scenarioOptions.name.clear();
|
||||
gameState.scenarioOptions.details = String::toStd(LanguageGetString(STR_NO_DETAILS_YET));
|
||||
}
|
||||
|
||||
void Update(GameState_t& gameState, const Date& date)
|
||||
|
||||
Reference in New Issue
Block a user