mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 20:13:07 +01:00
Game actions fixes
This commit is contained in:
@@ -176,8 +176,10 @@ namespace GameActions
|
||||
uint32 playerId = action->GetPlayer();
|
||||
|
||||
network_set_player_last_action(network_get_player_index(playerId), action->GetType());
|
||||
if(result->Cost != 0)
|
||||
if (result->Cost != 0)
|
||||
{
|
||||
network_add_player_money_spent(playerId, result->Cost);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,11 +23,8 @@
|
||||
#include "../core/DataSerialiser.h"
|
||||
#include "../core/IStream.hpp"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../game.h"
|
||||
#include "../world/map.h"
|
||||
}
|
||||
#include "../game.h"
|
||||
#include "../world/map.h"
|
||||
|
||||
/**
|
||||
* Common error codes for game actions.
|
||||
@@ -123,7 +120,7 @@ public:
|
||||
virtual uint16 GetActionFlags() const
|
||||
{
|
||||
// Make sure we execute some things only on the client.
|
||||
if ((GetFlags() & GAME_COMMAND_FLAG_GHOST) != 0 ||
|
||||
if ((GetFlags() & GAME_COMMAND_FLAG_GHOST) != 0 ||
|
||||
(GetFlags() & GAME_COMMAND_FLAG_5) != 0)
|
||||
{
|
||||
return GA_FLAGS::CLIENT_ONLY;
|
||||
|
||||
@@ -14,20 +14,17 @@
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../core/MemoryStream.h"
|
||||
#include "../localisation/string_ids.h"
|
||||
#include "../OpenRCT2.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
#pragma once
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../cheats.h"
|
||||
#include "../world/entrance.h"
|
||||
#include "../world/park.h"
|
||||
#include "../world/footpath.h"
|
||||
}
|
||||
#include "../cheats.h"
|
||||
#include "../world/entrance.h"
|
||||
#include "../world/park.h"
|
||||
#include "../world/footpath.h"
|
||||
|
||||
struct PlaceParkEntranceGameActionResult : public GameActionResult
|
||||
{
|
||||
|
||||
@@ -21,17 +21,14 @@
|
||||
#include "../localisation/string_ids.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../localisation/date.h"
|
||||
#include "../cheats.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../world/park.h"
|
||||
#include "../rct1.h"
|
||||
#include "../ride/ride_data.h"
|
||||
#include "../ride/ride.h"
|
||||
#include "../ride/station.h"
|
||||
}
|
||||
#include "../localisation/date.h"
|
||||
#include "../cheats.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../world/park.h"
|
||||
#include "../rct1.h"
|
||||
#include "../ride/ride_data.h"
|
||||
#include "../ride/ride.h"
|
||||
#include "../ride/station.h"
|
||||
|
||||
struct RideCreateGameActionResult : public GameActionResult
|
||||
{
|
||||
@@ -308,5 +305,5 @@ public:
|
||||
res->Position.x = (uint16)0x8000;
|
||||
|
||||
return std::move(res);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,19 +19,16 @@
|
||||
#include "../core/MemoryStream.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../cheats.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../ride/ride.h"
|
||||
#include "../world/park.h"
|
||||
}
|
||||
#include "../cheats.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../ride/ride.h"
|
||||
#include "../world/park.h"
|
||||
|
||||
struct RideDemolishAction : public GameActionBase<GAME_COMMAND_DEMOLISH_RIDE, GameActionResult>
|
||||
{
|
||||
private:
|
||||
sint32 _rideIndex;
|
||||
sint32 _rideIndex = -1;
|
||||
|
||||
public:
|
||||
RideDemolishAction() {}
|
||||
@@ -91,7 +88,7 @@ public:
|
||||
for (sint32 i = 0; i < MAX_BANNERS; i++)
|
||||
{
|
||||
rct_banner *banner = &gBanners[i];
|
||||
if (banner->type != BANNER_NULL &&
|
||||
if (banner->type != BANNER_NULL &&
|
||||
banner->flags & BANNER_FLAG_LINKED_TO_RIDE &&
|
||||
banner->colour == _rideIndex)
|
||||
{
|
||||
@@ -125,7 +122,7 @@ public:
|
||||
// remove any free voucher for this ride from peep
|
||||
if (peep->item_standard_flags & PEEP_ITEM_VOUCHER)
|
||||
{
|
||||
if (peep->voucher_type == VOUCHER_TYPE_RIDE_FREE &&
|
||||
if (peep->voucher_type == VOUCHER_TYPE_RIDE_FREE &&
|
||||
peep->voucher_arguments == _rideIndex)
|
||||
{
|
||||
peep->item_standard_flags &= ~(PEEP_ITEM_VOUCHER);
|
||||
@@ -198,7 +195,7 @@ public:
|
||||
|
||||
res->Position = { x, y, z };
|
||||
}
|
||||
|
||||
|
||||
window_close_by_number(WC_RIDE_CONSTRUCTION, _rideIndex);
|
||||
window_close_by_number(WC_RIDE, _rideIndex);
|
||||
window_close_by_number(WC_DEMOLISH_RIDE_PROMPT, _rideIndex);
|
||||
@@ -209,4 +206,3 @@ public:
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -20,23 +20,20 @@
|
||||
#include "../localisation/string_ids.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../cheats.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../world/park.h"
|
||||
}
|
||||
#include "../cheats.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../world/park.h"
|
||||
|
||||
struct RideSetNameAction : public GameActionBase<GAME_COMMAND_SET_RIDE_NAME, GameActionResult>
|
||||
{
|
||||
private:
|
||||
sint32 _rideIndex;
|
||||
sint32 _rideIndex = -1;
|
||||
std::string _name;
|
||||
|
||||
public:
|
||||
RideSetNameAction() {}
|
||||
RideSetNameAction(sint32 rideIndex, const std::string& name)
|
||||
RideSetNameAction(sint32 rideIndex, const std::string& name)
|
||||
: _rideIndex(rideIndex),
|
||||
_name(name)
|
||||
{
|
||||
@@ -108,4 +105,3 @@ public:
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -20,19 +20,16 @@
|
||||
#include "../localisation/string_ids.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../cheats.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../world/park.h"
|
||||
#include "../ride/ride.h"
|
||||
}
|
||||
#include "../cheats.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../world/park.h"
|
||||
#include "../ride/ride.h"
|
||||
|
||||
struct RideSetStatusAction : public GameActionBase<GAME_COMMAND_SET_RIDE_STATUS, GameActionResult>
|
||||
{
|
||||
private:
|
||||
uint8 _rideIndex;
|
||||
uint8 _status;
|
||||
sint32 _rideIndex = -1;
|
||||
uint8 _status = RIDE_STATUS_CLOSED;
|
||||
|
||||
public:
|
||||
RideSetStatusAction() {}
|
||||
@@ -56,7 +53,7 @@ public:
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
{
|
||||
if (_rideIndex >= MAX_RIDES)
|
||||
if (_rideIndex >= MAX_RIDES || _rideIndex < 0)
|
||||
{
|
||||
log_warning("Invalid game command for ride %u", _rideIndex);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_INVALID_SELECTION_OF_OBJECTS);
|
||||
|
||||
Reference in New Issue
Block a user