From 9fc464a322b9c2e2679fdf78109449759e4b3672 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Sun, 10 Mar 2019 09:20:34 +0000 Subject: [PATCH] Remove game command Correct the copyright Include correct headers --- src/openrct2/Game.cpp | 2 +- src/openrct2/Game.h | 12 +- .../actions/SurfaceSetStyleAction.hpp | 3 +- src/openrct2/world/Map.cpp | 139 ------------------ src/openrct2/world/Map.h | 2 - 5 files changed, 9 insertions(+), 149 deletions(-) diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 333bb07afa..3b9550ffad 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -1280,7 +1280,7 @@ GAME_COMMAND_POINTER* new_game_command_table[GAME_COMMAND_COUNT] = { nullptr, nullptr, nullptr, - game_command_change_surface_style, + nullptr, nullptr, game_command_set_guest_name, game_command_set_staff_name, diff --git a/src/openrct2/Game.h b/src/openrct2/Game.h index 7a495fb1ab..640d057b88 100644 --- a/src/openrct2/Game.h +++ b/src/openrct2/Game.h @@ -38,12 +38,12 @@ enum GAME_COMMAND GAME_COMMAND_PLACE_PATH, // GA GAME_COMMAND_PLACE_PATH_FROM_TRACK, // GA GAME_COMMAND_REMOVE_PATH, // GA - GAME_COMMAND_CHANGE_SURFACE_STYLE, - GAME_COMMAND_SET_RIDE_PRICE, // GA - GAME_COMMAND_SET_GUEST_NAME, // GA - GAME_COMMAND_SET_STAFF_NAME, // GA - GAME_COMMAND_RAISE_LAND, // GA - GAME_COMMAND_LOWER_LAND, // GA + GAME_COMMAND_CHANGE_SURFACE_STYLE, // GA + GAME_COMMAND_SET_RIDE_PRICE, // GA + GAME_COMMAND_SET_GUEST_NAME, // GA + GAME_COMMAND_SET_STAFF_NAME, // GA + GAME_COMMAND_RAISE_LAND, // GA + GAME_COMMAND_LOWER_LAND, // GA GAME_COMMAND_EDIT_LAND_SMOOTH, GAME_COMMAND_RAISE_WATER, // GA GAME_COMMAND_LOWER_WATER, // GA diff --git a/src/openrct2/actions/SurfaceSetStyleAction.hpp b/src/openrct2/actions/SurfaceSetStyleAction.hpp index 6bfdd957cc..cf281f1f7b 100644 --- a/src/openrct2/actions/SurfaceSetStyleAction.hpp +++ b/src/openrct2/actions/SurfaceSetStyleAction.hpp @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014-2018 OpenRCT2 developers + * 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 @@ -10,6 +10,7 @@ #pragma once #include "../Context.h" +#include "../OpenRCT2.h" #include "../management/Finance.h" #include "../object/ObjectManager.h" #include "../object/TerrainEdgeObject.h" diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 25d3ec1a6f..82dd757cce 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -877,145 +877,6 @@ void game_command_set_large_scenery_colour( *ebx = 0; } -/** - * - * rct2: 0x00663CCD - */ -static money32 map_change_surface_style( - int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint8_t surfaceStyle, uint8_t edgeStyle, uint8_t flags) -{ - gCommandExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING; - - x0 = std::max(x0, 32); - y0 = std::max(y0, 32); - x1 = std::min(x1, (int32_t)gMapSizeMaxXY); - y1 = std::min(y1, (int32_t)gMapSizeMaxXY); - - int32_t xMid, yMid; - - xMid = (x0 + x1) / 2 + 16; - yMid = (y0 + y1) / 2 + 16; - - int32_t heightMid = tile_element_height(xMid, yMid); - - gCommandPosition.x = xMid; - gCommandPosition.y = yMid; - gCommandPosition.z = heightMid; - - // Do nothing during pause - if (game_is_paused() && !gCheatsBuildInPauseMode) - { - return 0; - } - - // Do nothing if not in editor, sandbox mode or landscaping is forbidden - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode - && (gParkFlags & PARK_FLAGS_FORBID_LANDSCAPE_CHANGES)) - { - return 0; - } - - money32 surfaceCost = 0; - money32 edgeCost = 0; - for (int32_t x = x0; x <= x1; x += 32) - { - for (int32_t y = y0; y <= y1; y += 32) - { - if (x > 0x1FFF) - continue; - if (y > 0x1FFF) - continue; - - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) - { - if (!map_is_location_in_park({ x, y })) - continue; - } - - auto surfaceElement = map_get_surface_element_at({ x, y })->AsSurface(); - if (surfaceElement == nullptr) - { - continue; - } - - if (surfaceStyle != 0xFF) - { - uint8_t cur_terrain = surfaceElement->GetSurfaceStyle(); - - if (surfaceStyle != cur_terrain) - { - // Prevent network-originated value of surfaceStyle from causing - // invalid access. - uint8_t style = surfaceStyle & 0x1F; - auto& objManager = GetContext()->GetObjectManager(); - const auto surfaceObj = static_cast( - objManager.GetLoadedObject(OBJECT_TYPE_TERRAIN_SURFACE, style)); - if (surfaceObj != nullptr) - { - surfaceCost += surfaceObj->Price; - } - - if (flags & GAME_COMMAND_FLAG_APPLY) - { - surfaceElement->SetSurfaceStyle(surfaceStyle); - - map_invalidate_tile_full(x, y); - footpath_remove_litter(x, y, tile_element_height(x, y)); - } - } - } - - if (edgeStyle != 0xFF) - { - uint8_t currentEdge = surfaceElement->GetEdgeStyle(); - - if (edgeStyle != currentEdge) - { - edgeCost += 100; - - if (flags & GAME_COMMAND_FLAG_APPLY) - { - surfaceElement->SetEdgeStyle(edgeStyle); - map_invalidate_tile_full(x, y); - } - } - } - - if (flags & GAME_COMMAND_FLAG_APPLY) - { - if (surfaceElement->CanGrassGrow() && (surfaceElement->GetGrassLength() & 7) != GRASS_LENGTH_CLEAR_0) - { - surfaceElement->SetGrassLength(GRASS_LENGTH_CLEAR_0); - map_invalidate_tile_full(x, y); - } - } - } - } - - if (flags & GAME_COMMAND_FLAG_APPLY && gGameCommandNestLevel == 1) - { - LocationXYZ16 coord; - coord.x = ((x0 + x1) / 2) + 16; - coord.y = ((y0 + y1) / 2) + 16; - coord.z = tile_element_height(coord.x, coord.y); - network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord); - } - - return (gParkFlags & PARK_FLAGS_NO_MONEY) ? 0 : surfaceCost + edgeCost; -} - -/** - * - * rct2: 0x00663CCD - */ -void game_command_change_surface_style( - int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, [[maybe_unused]] int32_t* esi, int32_t* edi, int32_t* ebp) -{ - *ebx = map_change_surface_style( - (int16_t)(*eax & 0xFFFF), (int16_t)(*ecx & 0xFFFF), (int16_t)(*edi & 0xFFFF), (int16_t)(*ebp & 0xFFFF), *edx & 0xFF, - (*edx & 0xFF00) >> 8, *ebx & 0xFF); -} - // 0x00981A1E // Table of pre-calculated surface slopes (32) when raising the land tile for a given selection (5) // 0x1F = new slope diff --git a/src/openrct2/world/Map.h b/src/openrct2/world/Map.h index b62a305f95..7c7a395a05 100644 --- a/src/openrct2/world/Map.h +++ b/src/openrct2/world/Map.h @@ -202,8 +202,6 @@ void game_command_set_large_scenery_colour( int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp); void game_command_set_banner_colour( int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp); -void game_command_change_surface_style( - int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp); void game_command_smooth_land(int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp); void game_command_place_banner( int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);