1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 03:53:07 +01:00

Merge branch 'develop' into HEAD

This commit is contained in:
duncanspumpkin
2021-10-08 07:54:24 +01:00
9 changed files with 74 additions and 26 deletions

View File

@@ -50,9 +50,9 @@ set(OBJECTS_VERSION "1.2.1")
set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v${OBJECTS_VERSION}/objects.zip")
set(OBJECTS_SHA1 "540e004abc683b3fe22211f5234e3d78ab023c5f")
set(REPLAYS_VERSION "0.0.54")
set(REPLAYS_VERSION "0.0.55")
set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v${REPLAYS_VERSION}/replays.zip")
set(REPLAYS_SHA1 "FF54C3699C3A0DF02269C5EB4C4A9C8E6D5C4EB4")
set(REPLAYS_SHA1 "70B4B7CB26A428801676BCC615F3881E72A45406")
option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.")
option(WITH_TESTS "Build tests")

View File

@@ -22,6 +22,7 @@
- Fix: [#15170] Plugin: incorrect label text alignment.
- Fix: [#15184] Crash when hovering over water types in Object Selection.
- Fix: [#15193] Crash when rides/stalls are demolished.
- Fix: [#15197] Cannot place flat ride after removing it in construction window.
- Fix: [#15199] Construction window is not closed when a ride gets demolished.
- Fix: [#15213] Freeze when hovering over Reverse Freefall Coaster in Russian.
- Fix: [#15255] Tile Inspector shows banner information on walls that do not contain one.
@@ -30,6 +31,7 @@
- Fix: [#15476] Crash when placing/clearing small scenery.
- Fix: [#15487] Map animations do not work correctly when loading an exported SV6 file in vanilla RCT2.
- Fix: [#15496] Crash in paint_swinging_inverter_ship_structure().
- Fix: [#15503] Freeze when doing specific coaster merges with block brakes.
- Fix: [#15514] Two different “quit to menu” menu items are available in track designer and track design manager.
- Improved: [#3417] Crash dumps are now placed in their own folder.
- Change: [#8601] Revert ToonTower base block fix to re-enable support blocking.

View File

@@ -48,8 +48,8 @@
<TitleSequencesSha1>304d13a126c15bf2c86ff13b81a2f2cc1856ac8d</TitleSequencesSha1>
<ObjectsUrl>https://github.com/OpenRCT2/objects/releases/download/v1.2.1/objects.zip</ObjectsUrl>
<ObjectsSha1>540e004abc683b3fe22211f5234e3d78ab023c5f</ObjectsSha1>
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.54/replays.zip</ReplaysUrl>
<ReplaysSha1>FF54C3699C3A0DF02269C5EB4C4A9C8E6D5C4EB4</ReplaysSha1>
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.55/replays.zip</ReplaysUrl>
<ReplaysSha1>70B4B7CB26A428801676BCC615F3881E72A45406</ReplaysSha1>
</PropertyGroup>
<ItemGroup>

View File

@@ -1931,6 +1931,14 @@ static void window_ride_construction_mouseup_demolish(rct_window* w)
const rct_preview_track* trackBlock = ted.Block;
newCoords->z = (tileElement->GetBaseZ()) - trackBlock->z;
gGotoStartPlacementMode = true;
// When flat rides are deleted, the window should be reset so the ride can be placed again.
const auto rideId = w->rideId;
auto ride = get_ride(rideId);
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_FLAT_RIDE))
{
ride_initialise_construction_window(ride);
}
}
auto trackRemoveAction = TrackRemoveAction(

View File

@@ -567,11 +567,10 @@ void window_staff_overview_dropdown(rct_window* w, rct_widgetindex widgetIndex,
{
return;
}
// TODO: THIS SHOULD BE NETWORKED
peep->ClearPatrolArea();
gfx_invalidate_screen();
staff_update_greyed_patrol_areas();
auto staffSetPatrolAreaAction = StaffSetPatrolAreaAction(
peep->sprite_index, {}, StaffSetPatrolAreaMode::ClearAll);
GameActions::Execute(&staffSetPatrolAreaAction);
}
else
{
@@ -1241,7 +1240,9 @@ void window_staff_overview_tool_down(rct_window* w, rct_widgetindex widgetIndex,
{
_staffPatrolAreaPaintValue = PatrolAreaValue::SET;
}
auto staffSetPatrolAreaAction = StaffSetPatrolAreaAction(w->number, destCoords);
auto staffSetPatrolAreaAction = StaffSetPatrolAreaAction(
w->number, destCoords,
_staffPatrolAreaPaintValue == PatrolAreaValue::SET ? StaffSetPatrolAreaMode::Set : StaffSetPatrolAreaMode::Unset);
GameActions::Execute(&staffSetPatrolAreaAction);
}
}
@@ -1275,7 +1276,9 @@ void window_staff_overview_tool_drag(rct_window* w, rct_widgetindex widgetIndex,
if (_staffPatrolAreaPaintValue == PatrolAreaValue::UNSET && !patrolAreaValue)
return; // Since area is already the value we want, skip...
auto staffSetPatrolAreaAction = StaffSetPatrolAreaAction(w->number, destCoords);
auto staffSetPatrolAreaAction = StaffSetPatrolAreaAction(
w->number, destCoords,
_staffPatrolAreaPaintValue == PatrolAreaValue::SET ? StaffSetPatrolAreaMode::Set : StaffSetPatrolAreaMode::Unset);
GameActions::Execute(&staffSetPatrolAreaAction);
}

View File

@@ -14,9 +14,10 @@
#include "../peep/Staff.h"
#include "../world/Entity.h"
StaffSetPatrolAreaAction::StaffSetPatrolAreaAction(uint16_t spriteId, const CoordsXY& loc)
StaffSetPatrolAreaAction::StaffSetPatrolAreaAction(uint16_t spriteId, const CoordsXY& loc, const StaffSetPatrolAreaMode mode)
: _spriteId(spriteId)
, _loc(loc)
, _mode(mode)
{
}
@@ -28,7 +29,7 @@ uint16_t StaffSetPatrolAreaAction::GetActionFlags() const
void StaffSetPatrolAreaAction::Serialise(DataSerialiser& stream)
{
GameAction::Serialise(stream);
stream << DS_TAG(_spriteId) << DS_TAG(_loc);
stream << DS_TAG(_spriteId) << DS_TAG(_loc) << DS_TAG(_mode);
}
GameActions::Result::Ptr StaffSetPatrolAreaAction::Query() const
@@ -54,6 +55,19 @@ GameActions::Result::Ptr StaffSetPatrolAreaAction::Query() const
return MakeResult();
}
static void InvalidatePatrolTile(const CoordsXY& loc)
{
// Align the location to the top left of the patrol square
const auto alignedLoc = CoordsXY{ loc.x & 0x1F80, loc.y & 0x1F80 };
for (int32_t y = 0; y < 4 * COORDS_XY_STEP; y += COORDS_XY_STEP)
{
for (int32_t x = 0; x < 4 * COORDS_XY_STEP; x += COORDS_XY_STEP)
{
map_invalidate_tile_full(alignedLoc + CoordsXY{ x, y });
}
}
}
GameActions::Result::Ptr StaffSetPatrolAreaAction::Execute() const
{
auto staff = TryGetEntity<Staff>(_spriteId);
@@ -63,21 +77,26 @@ GameActions::Result::Ptr StaffSetPatrolAreaAction::Execute() const
return MakeResult(GameActions::Status::InvalidParameters, STR_NONE);
}
staff->TogglePatrolArea(_loc);
if (!staff->HasPatrolArea())
switch (_mode)
{
// This frees the data if there is no patrol area
staff->ClearPatrolArea();
case StaffSetPatrolAreaMode::Set:
staff->SetPatrolArea(_loc, true);
InvalidatePatrolTile(_loc);
break;
case StaffSetPatrolAreaMode::Unset:
staff->SetPatrolArea(_loc, false);
if (!staff->HasPatrolArea())
{
staff->ClearPatrolArea();
}
InvalidatePatrolTile(_loc);
break;
case StaffSetPatrolAreaMode::ClearAll:
staff->ClearPatrolArea();
gfx_invalidate_screen();
break;
}
for (int32_t y = 0; y < 4 * COORDS_XY_STEP; y += COORDS_XY_STEP)
{
for (int32_t x = 0; x < 4 * COORDS_XY_STEP; x += COORDS_XY_STEP)
{
map_invalidate_tile_full({ (_loc.x & 0x1F80) + x, (_loc.y & 0x1F80) + y });
}
}
staff_update_greyed_patrol_areas();
return MakeResult();

View File

@@ -11,15 +11,23 @@
#include "GameAction.h"
enum class StaffSetPatrolAreaMode : uint8_t
{
Set,
Unset,
ClearAll
};
DEFINE_GAME_ACTION(StaffSetPatrolAreaAction, GameCommand::SetStaffPatrol, GameActions::Result)
{
private:
uint16_t _spriteId{ SPRITE_INDEX_NULL };
CoordsXY _loc;
StaffSetPatrolAreaMode _mode;
public:
StaffSetPatrolAreaAction() = default;
StaffSetPatrolAreaAction(uint16_t spriteId, const CoordsXY& loc);
StaffSetPatrolAreaAction(uint16_t spriteId, const CoordsXY& loc, const StaffSetPatrolAreaMode mode);
uint16_t GetActionFlags() const override;

View File

@@ -40,7 +40,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 "12"
#define NETWORK_STREAM_VERSION "13"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
static Peep* _pickup_peep = nullptr;

View File

@@ -3497,8 +3497,16 @@ void Ride::MoveTrainsToBlockBrakes(TrackElement* firstBlock)
continue;
}
size_t numIterations = 0;
do
{
// Fixes both freezing issues in #15503.
// TODO: refactor the code so a tortoise-and-hare algorithm can be used.
if (numIterations++ > 1000000)
{
break;
}
firstBlock->SetBlockBrakeClosed(true);
for (Vehicle* car = train; car != nullptr; car = GetEntity<Vehicle>(car->next_vehicle_on_train))
{