mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-27 16:54:52 +01:00
* Add `STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE` * Add `STR_ERR_TRACK_ON_THIS_TILE_NEEDS_WATER` * Return existing `GameAction::Result` * Add `STR_ERR_ACTION_INVALID_FOR_THAT_STAFF_TYPE` I am open to suggestions for a different message! Originally this was going to be STR_ERR_WRONG_STAFF_TYPE but I thought that was confusing because the game action arguments do not specify a staff type. We want it to mean "the staff ID you specified is the wrong StaffType for this game action". * Refactor `StaffSetColour()` to return `Result` * Remove unnecessary arguments when `Status` is `Ok` * Refactor `SwapTileElements()` to return `Result` Also add STR_ERR_CANT_SWAP_TILE_ELEMENT_WITH_ITSELF * Format code * Use `STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE` in title * Format code using Github web editor * Format indentation
65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
/*****************************************************************************
|
|
* Copyright (c) 2014-2024 OpenRCT2 developers
|
|
*
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
|
*
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
|
*****************************************************************************/
|
|
|
|
#include "ParkSetEntranceFeeAction.h"
|
|
|
|
#include "../Cheats.h"
|
|
#include "../GameState.h"
|
|
#include "../core/MemoryStream.h"
|
|
#include "../interface/Window.h"
|
|
#include "../localisation/StringIds.h"
|
|
#include "../world/Park.h"
|
|
|
|
using namespace OpenRCT2;
|
|
|
|
ParkSetEntranceFeeAction::ParkSetEntranceFeeAction(money64 fee)
|
|
: _fee(fee)
|
|
{
|
|
}
|
|
|
|
void ParkSetEntranceFeeAction::AcceptParameters(GameActionParameterVisitor& visitor)
|
|
{
|
|
visitor.Visit("value", _fee);
|
|
}
|
|
|
|
uint16_t ParkSetEntranceFeeAction::GetActionFlags() const
|
|
{
|
|
return GameAction::GetActionFlags() | GameActions::Flags::AllowWhilePaused;
|
|
}
|
|
|
|
void ParkSetEntranceFeeAction::Serialise(DataSerialiser& stream)
|
|
{
|
|
GameAction::Serialise(stream);
|
|
|
|
stream << DS_TAG(_fee);
|
|
}
|
|
|
|
GameActions::Result ParkSetEntranceFeeAction::Query() const
|
|
{
|
|
bool noMoney = (GetGameState().ParkFlags & PARK_FLAGS_NO_MONEY) != 0;
|
|
bool forceFreeEntry = !ParkEntranceFeeUnlocked();
|
|
if (noMoney || forceFreeEntry)
|
|
{
|
|
return GameActions::Result(GameActions::Status::Disallowed, STR_ERR_CANT_CHANGE_PARK_ENTRANCE_FEE, STR_NONE);
|
|
}
|
|
if (_fee < 0.00_GBP || _fee > MAX_ENTRANCE_FEE)
|
|
{
|
|
return GameActions::Result(
|
|
GameActions::Status::InvalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
|
|
}
|
|
return GameActions::Result();
|
|
}
|
|
|
|
GameActions::Result ParkSetEntranceFeeAction::Execute() const
|
|
{
|
|
GetGameState().ParkEntranceFee = _fee;
|
|
WindowInvalidateByClass(WindowClass::ParkInformation);
|
|
return GameActions::Result();
|
|
}
|