mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add ParkEntranceRemove GameAction
This commit is contained in:
parent
9cbc308c40
commit
791c3059f6
|
@ -44,6 +44,7 @@
|
|||
2AAFD7FE220DD374002461A4 /* PauseToggleAction.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 2AAFD7FD220DD374002461A4 /* PauseToggleAction.hpp */; };
|
||||
2AAFD800220DD3D2002461A4 /* LandSetHeightAction.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 2AAFD7FF220DD3D2002461A4 /* LandSetHeightAction.hpp */; };
|
||||
2ACBAB172226850A0034FB91 /* RideSetSetting.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 2ACBAB162226850A0034FB91 /* RideSetSetting.hpp */; };
|
||||
2ADE2EEA2244183D002598AF /* ParkEntranceRemoveAction.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 2ADE2EE92244183D002598AF /* ParkEntranceRemoveAction.hpp */; };
|
||||
2ADE2F062244187B002598AF /* SurfaceSetStyleAction.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 2ADE2EEB22441878002598AF /* SurfaceSetStyleAction.hpp */; };
|
||||
2ADE2F072244187B002598AF /* MazeSetTrackAction.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 2ADE2EEC22441878002598AF /* MazeSetTrackAction.hpp */; };
|
||||
2ADE2F082244187B002598AF /* ClearAction.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 2ADE2EED22441878002598AF /* ClearAction.hpp */; };
|
||||
|
@ -694,6 +695,7 @@
|
|||
2AAFD7FD220DD374002461A4 /* PauseToggleAction.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = PauseToggleAction.hpp; sourceTree = "<group>"; };
|
||||
2AAFD7FF220DD3D2002461A4 /* LandSetHeightAction.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = LandSetHeightAction.hpp; sourceTree = "<group>"; };
|
||||
2ACBAB162226850A0034FB91 /* RideSetSetting.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = RideSetSetting.hpp; sourceTree = "<group>"; };
|
||||
2ADE2EE92244183D002598AF /* ParkEntranceRemoveAction.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ParkEntranceRemoveAction.hpp; sourceTree = "<group>"; };
|
||||
2ADE2EEB22441878002598AF /* SurfaceSetStyleAction.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SurfaceSetStyleAction.hpp; sourceTree = "<group>"; };
|
||||
2ADE2EEC22441878002598AF /* MazeSetTrackAction.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = MazeSetTrackAction.hpp; sourceTree = "<group>"; };
|
||||
2ADE2EED22441878002598AF /* ClearAction.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ClearAction.hpp; sourceTree = "<group>"; };
|
||||
|
@ -2117,6 +2119,7 @@
|
|||
C6352B871F477032006CCEE3 /* actions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2ADE2EE92244183D002598AF /* ParkEntranceRemoveAction.hpp */,
|
||||
2ADE2F042244187A002598AF /* BannerSetNameAction.hpp */,
|
||||
2ADE2EED22441878002598AF /* ClearAction.hpp */,
|
||||
2ADE2EFF2244187A002598AF /* ClimateSetAction.hpp */,
|
||||
|
@ -3503,6 +3506,7 @@
|
|||
2ADE2F2E224418E7002598AF /* ConversionTables.h in Headers */,
|
||||
933F2CBB20935668001B33FD /* LocalisationService.h in Headers */,
|
||||
2A5C1368221E9F9000F8C245 /* TrackRemoveAction.hpp in Headers */,
|
||||
2ADE2EEA2244183D002598AF /* ParkEntranceRemoveAction.hpp in Headers */,
|
||||
2A61CAFB2229E5C50095AD67 /* RideEntranceExitPlaceAction.hpp in Headers */,
|
||||
2ADE2F162244187B002598AF /* ParkSetParameterAction.hpp in Headers */,
|
||||
C6352B861F477022006CCEE3 /* Endianness.h in Headers */,
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <openrct2/OpenRCT2.h>
|
||||
#include <openrct2/actions/FootpathSceneryRemoveAction.hpp>
|
||||
#include <openrct2/actions/LargeSceneryRemoveAction.hpp>
|
||||
#include <openrct2/actions/ParkEntranceRemoveAction.hpp>
|
||||
#include <openrct2/actions/SmallSceneryRemoveAction.hpp>
|
||||
#include <openrct2/actions/WallRemoveAction.hpp>
|
||||
#include <openrct2/localisation/Localisation.h>
|
||||
|
@ -530,8 +531,8 @@ void viewport_interaction_remove_park_entrance(TileElement* tileElement, int32_t
|
|||
y -= CoordsDirectionDelta[rotation].y;
|
||||
break;
|
||||
}
|
||||
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
||||
game_do_command(x, GAME_COMMAND_FLAG_APPLY, y, tileElement->base_height / 2, GAME_COMMAND_REMOVE_PARK_ENTRANCE, 0, 0);
|
||||
auto parkEntranceRemoveAction = ParkEntranceRemoveAction({ x, y, tileElement->base_height * 8 });
|
||||
GameActions::Execute(&parkEntranceRemoveAction);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1280,7 +1280,7 @@ GAME_COMMAND_POINTER* new_game_command_table[GAME_COMMAND_COUNT] = {
|
|||
nullptr,
|
||||
game_command_buy_land_rights,
|
||||
game_command_place_park_entrance,
|
||||
game_command_remove_park_entrance,
|
||||
nullptr,
|
||||
game_command_set_maze_track,
|
||||
game_command_set_park_entrance_fee,
|
||||
nullptr,
|
||||
|
|
|
@ -55,9 +55,9 @@ enum GAME_COMMAND
|
|||
GAME_COMMAND_SET_PARK_NAME, // GA
|
||||
GAME_COMMAND_SET_PARK_OPEN, // GA
|
||||
GAME_COMMAND_BUY_LAND_RIGHTS,
|
||||
GAME_COMMAND_PLACE_PARK_ENTRANCE, // GA
|
||||
GAME_COMMAND_REMOVE_PARK_ENTRANCE,
|
||||
GAME_COMMAND_SET_MAZE_TRACK,
|
||||
GAME_COMMAND_PLACE_PARK_ENTRANCE, // GA
|
||||
GAME_COMMAND_REMOVE_PARK_ENTRANCE, // GA
|
||||
GAME_COMMAND_SET_MAZE_TRACK, // GA
|
||||
GAME_COMMAND_SET_PARK_ENTRANCE_FEE, // GA
|
||||
GAME_COMMAND_SET_STAFF_COLOUR, // GA
|
||||
GAME_COMMAND_PLACE_WALL,
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "LargeSceneryRemoveAction.hpp"
|
||||
#include "LoadOrQuitAction.hpp"
|
||||
#include "MazeSetTrackAction.hpp"
|
||||
#include "ParkEntranceRemoveAction.hpp"
|
||||
#include "ParkMarketingAction.hpp"
|
||||
#include "ParkSetLoanAction.hpp"
|
||||
#include "ParkSetNameAction.hpp"
|
||||
|
@ -78,6 +79,7 @@ namespace GameActions
|
|||
Register<GuestSetNameAction>();
|
||||
Register<MazeSetTrackAction>();
|
||||
Register<ParkMarketingAction>();
|
||||
Register<ParkEntranceRemoveAction>();
|
||||
Register<ParkSetLoanAction>();
|
||||
Register<ParkSetNameAction>();
|
||||
Register<ParkSetParameterAction>();
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2019 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../management/Finance.h"
|
||||
#include "../world/Entrance.h"
|
||||
#include "../world/Park.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
DEFINE_GAME_ACTION(ParkEntranceRemoveAction, GAME_COMMAND_REMOVE_PARK_ENTRANCE, GameActionResult)
|
||||
{
|
||||
private:
|
||||
CoordsXYZ _loc;
|
||||
|
||||
public:
|
||||
ParkEntranceRemoveAction() = default;
|
||||
|
||||
ParkEntranceRemoveAction(CoordsXYZ loc)
|
||||
: _loc(loc)
|
||||
{
|
||||
}
|
||||
|
||||
uint16_t GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::EDITOR_ONLY;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser & stream) override
|
||||
{
|
||||
GameAction::Serialise(stream);
|
||||
|
||||
stream << DS_TAG(_loc);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
{
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode)
|
||||
{
|
||||
return MakeResult(GA_ERROR::NOT_IN_EDITOR_MODE, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
auto res = MakeResult();
|
||||
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LAND_PURCHASE;
|
||||
res->Position = _loc;
|
||||
res->ErrorTitle = STR_CANT_REMOVE_THIS;
|
||||
|
||||
auto entranceIndex = park_entrance_get_index(_loc.x, _loc.y, _loc.z);
|
||||
if (entranceIndex == -1)
|
||||
{
|
||||
log_error("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
{
|
||||
auto res = MakeResult();
|
||||
res->ExpenditureType = RCT_EXPENDITURE_TYPE_LAND_PURCHASE;
|
||||
res->Position = _loc;
|
||||
res->ErrorTitle = STR_CANT_REMOVE_THIS;
|
||||
|
||||
auto entranceIndex = park_entrance_get_index(_loc.x, _loc.y, _loc.z);
|
||||
if (entranceIndex == -1)
|
||||
{
|
||||
log_error("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z);
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS);
|
||||
}
|
||||
|
||||
auto direction = (gParkEntrances[entranceIndex].direction - 1) & 3;
|
||||
|
||||
// Centre (sign)
|
||||
ParkEntranceRemoveSegment(_loc);
|
||||
|
||||
// Left post
|
||||
ParkEntranceRemoveSegment(
|
||||
{ _loc.x + CoordsDirectionDelta[direction].x, _loc.y + CoordsDirectionDelta[direction].y, _loc.z });
|
||||
|
||||
// Right post
|
||||
ParkEntranceRemoveSegment(
|
||||
{ _loc.x - CoordsDirectionDelta[direction].x, _loc.y - CoordsDirectionDelta[direction].y, _loc.z });
|
||||
|
||||
gParkEntrances.erase(gParkEntrances.begin() + entranceIndex);
|
||||
return res;
|
||||
}
|
||||
|
||||
private:
|
||||
void ParkEntranceRemoveSegment(CoordsXYZ loc) const
|
||||
{
|
||||
auto entranceElement = map_get_park_entrance_element_at(loc.x, loc.y, loc.z / 8, true);
|
||||
if (entranceElement == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
map_invalidate_tile(loc.x, loc.y, entranceElement->base_height * 8, entranceElement->clearance_height * 8);
|
||||
entranceElement->Remove();
|
||||
update_park_fences({ loc.x, loc.y });
|
||||
}
|
||||
};
|
|
@ -31,7 +31,7 @@
|
|||
// This string specifies which version of network stream current build uses.
|
||||
// It is used for making sure only compatible builds get connected, even within
|
||||
// single OpenRCT2 version.
|
||||
#define NETWORK_STREAM_VERSION "7"
|
||||
#define NETWORK_STREAM_VERSION "8"
|
||||
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
|
||||
|
||||
static Peep* _pickup_peep = nullptr;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "../Cheats.h"
|
||||
#include "../Game.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "../actions/ParkEntranceRemoveAction.hpp"
|
||||
#include "../actions/RideEntranceExitPlaceAction.hpp"
|
||||
#include "../actions/RideEntranceExitRemoveAction.hpp"
|
||||
#include "../localisation/StringIds.h"
|
||||
|
@ -35,59 +36,6 @@ std::vector<CoordsXYZD> gParkEntrances;
|
|||
CoordsXYZD gRideEntranceExitGhostPosition;
|
||||
uint8_t gRideEntranceExitGhostStationIndex;
|
||||
|
||||
static void ParkEntranceRemoveSegment(int32_t x, int32_t y, int32_t z)
|
||||
{
|
||||
EntranceElement* tileElement;
|
||||
|
||||
tileElement = map_get_park_entrance_element_at(x, y, z, true);
|
||||
if (tileElement == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
map_invalidate_tile(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8);
|
||||
tileElement->Remove();
|
||||
update_park_fences({ x, y });
|
||||
}
|
||||
|
||||
static money32 ParkEntranceRemove(int16_t x, int16_t y, uint8_t z, uint8_t flags)
|
||||
{
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_EDITOR) && !gCheatsSandboxMode)
|
||||
{
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_LAND_PURCHASE;
|
||||
gCommandPosition.x = x;
|
||||
gCommandPosition.y = y;
|
||||
gCommandPosition.z = z * 16;
|
||||
|
||||
if (!(flags & GAME_COMMAND_FLAG_APPLY))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto entranceIndex = park_entrance_get_index(x, y, z * 16);
|
||||
if (entranceIndex == -1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto direction = (gParkEntrances[entranceIndex].direction - 1) & 3;
|
||||
|
||||
// Centre (sign)
|
||||
ParkEntranceRemoveSegment(x, y, z * 2);
|
||||
|
||||
// Left post
|
||||
ParkEntranceRemoveSegment(x + CoordsDirectionDelta[direction].x, y + CoordsDirectionDelta[direction].y, z * 2);
|
||||
|
||||
// Right post
|
||||
ParkEntranceRemoveSegment(x - CoordsDirectionDelta[direction].x, y - CoordsDirectionDelta[direction].y, z * 2);
|
||||
|
||||
gParkEntrances.erase(gParkEntrances.begin() + entranceIndex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static money32 RideEntranceExitPlaceGhost(
|
||||
ride_id_t rideIndex, int16_t x, int16_t y, uint8_t direction, uint8_t placeType, uint8_t stationNum)
|
||||
{
|
||||
|
@ -99,17 +47,6 @@ static money32 RideEntranceExitPlaceGhost(
|
|||
return res->Error == GA_ERROR::OK ? res->Cost : MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00666A63
|
||||
*/
|
||||
void game_command_remove_park_entrance(
|
||||
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, [[maybe_unused]] int32_t* esi, [[maybe_unused]] int32_t* edi,
|
||||
[[maybe_unused]] int32_t* ebp)
|
||||
{
|
||||
*ebx = ParkEntranceRemove(*eax & 0xFFFF, *ecx & 0xFFFF, *edx & 0xFF, *ebx & 0xFF);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00666F9E
|
||||
|
@ -119,9 +56,10 @@ void park_entrance_remove_ghost()
|
|||
if (gParkEntranceGhostExists)
|
||||
{
|
||||
gParkEntranceGhostExists = false;
|
||||
game_do_command(
|
||||
gParkEntranceGhostPosition.x, GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5 | GAME_COMMAND_FLAG_APPLY,
|
||||
gParkEntranceGhostPosition.y, gParkEntranceGhostPosition.z, GAME_COMMAND_REMOVE_PARK_ENTRANCE, 0, 0);
|
||||
auto parkEntranceRemoveAction = ParkEntranceRemoveAction(
|
||||
{ gParkEntranceGhostPosition.x, gParkEntranceGhostPosition.y, gParkEntranceGhostPosition.z * 16 });
|
||||
parkEntranceRemoveAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
|
||||
GameActions::Execute(&parkEntranceRemoveAction);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,9 +26,6 @@ struct rct_entrance_type
|
|||
assert_struct_size(rct_entrance_type, 8);
|
||||
#pragma pack(pop)
|
||||
|
||||
void game_command_remove_park_entrance(
|
||||
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);
|
||||
|
||||
struct TileElement;
|
||||
|
||||
extern bool gParkEntranceGhostExists;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "../actions/LandRaiseAction.hpp"
|
||||
#include "../actions/LandSetHeightAction.hpp"
|
||||
#include "../actions/LargeSceneryRemoveAction.hpp"
|
||||
#include "../actions/ParkEntranceRemoveAction.hpp"
|
||||
#include "../actions/SmallSceneryRemoveAction.hpp"
|
||||
#include "../actions/WallRemoveAction.hpp"
|
||||
#include "../actions/WaterSetHeightAction.hpp"
|
||||
|
@ -2655,8 +2656,8 @@ static void clear_element_at(int32_t x, int32_t y, TileElement** elementPtr)
|
|||
y -= CoordsDirectionDelta[rotation].y;
|
||||
break;
|
||||
}
|
||||
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
||||
game_do_command(x, GAME_COMMAND_FLAG_APPLY, y, element->base_height / 2, GAME_COMMAND_REMOVE_PARK_ENTRANCE, 0, 0);
|
||||
auto parkEntranceRemoveAction = ParkEntranceRemoveAction({ x, y, element->base_height * 8 });
|
||||
GameActions::Execute(&parkEntranceRemoveAction);
|
||||
break;
|
||||
}
|
||||
case TILE_ELEMENT_TYPE_WALL:
|
||||
|
|
Loading…
Reference in New Issue