mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-06 06:32:56 +01:00
Remove todo and clang format where required
Change array type to avoid additional code Make CI's happier
This commit is contained in:
@@ -354,35 +354,35 @@ static void window_track_place_tooldown(rct_window* w, rct_widgetindex widgetInd
|
||||
if (res->Error == GA_ERROR::OK)
|
||||
{
|
||||
auto tdAction = TrackDesignAction({ trackLoc.x, trackLoc.y, trackLoc.z, _currentTrackPieceDirection }, *_trackDesign);
|
||||
tdAction.SetCallback([trackLoc](const GameAction*, const TrackDesignActionResult* res) {
|
||||
if (res->Error == GA_ERROR::OK)
|
||||
tdAction.SetCallback([trackLoc](const GameAction*, const TrackDesignActionResult* result) {
|
||||
if (result->Error == GA_ERROR::OK)
|
||||
{
|
||||
auto ride = get_ride(res->rideIndex);
|
||||
auto ride = get_ride(result->rideIndex);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
window_close_by_class(WC_ERROR);
|
||||
audio_play_sound_at_location(SoundId::PlaceItem, { trackLoc.x, trackLoc.y, trackLoc.z });
|
||||
|
||||
_currentRideIndex = res->rideIndex;
|
||||
_currentRideIndex = result->rideIndex;
|
||||
if (track_design_are_entrance_and_exit_placed())
|
||||
{
|
||||
auto intent = Intent(WC_RIDE);
|
||||
intent.putExtra(INTENT_EXTRA_RIDE_ID, res->rideIndex);
|
||||
intent.putExtra(INTENT_EXTRA_RIDE_ID, result->rideIndex);
|
||||
context_open_intent(&intent);
|
||||
auto w = window_find_by_class(WC_TRACK_DESIGN_PLACE);
|
||||
window_close(w);
|
||||
auto wnd = window_find_by_class(WC_TRACK_DESIGN_PLACE);
|
||||
window_close(wnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
ride_initialise_construction_window(ride);
|
||||
auto w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
window_event_mouse_up_call(w, WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE);
|
||||
auto wnd = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
window_event_mouse_up_call(wnd, WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
audio_play_sound_at_location(SoundId::Error, res->Position);
|
||||
audio_play_sound_at_location(SoundId::Error, result->Position);
|
||||
}
|
||||
});
|
||||
GameActions::Execute(&tdAction);
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#include "../object/ObjectRepository.h"
|
||||
#include "../ride/RideGroupManager.h"
|
||||
#include "../ride/TrackDesign.h"
|
||||
#include "RideSetName.hpp"
|
||||
#include "RideDemolishAction.hpp"
|
||||
#include "RideSetName.hpp"
|
||||
#include "RideSetSetting.hpp"
|
||||
#include "RideSetVehiclesAction.hpp"
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GameAction.h"
|
||||
#include "../ride/TrackDesign.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
class TrackDesignActionResult final : public GameActionResult
|
||||
{
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
TrackDesignAction()
|
||||
{
|
||||
}
|
||||
TrackDesignAction(CoordsXYZD location, const TrackDesign &td)
|
||||
TrackDesignAction(CoordsXYZD location, const TrackDesign& td)
|
||||
: _loc(location)
|
||||
, _td(td)
|
||||
{
|
||||
|
||||
@@ -643,7 +643,9 @@ template<> struct DataSerializerTraits<TrackDesignEntranceElement>
|
||||
static void log(IStream* stream, const TrackDesignEntranceElement& val)
|
||||
{
|
||||
char msg[128] = {};
|
||||
snprintf(msg, sizeof(msg), "TrackDesignEntranceElement(x = %d, y = %d, z = %d, dir = %d, isExit = %d)", val.x, val.y, val.z, val.direction, val.isExit);
|
||||
snprintf(
|
||||
msg, sizeof(msg), "TrackDesignEntranceElement(x = %d, y = %d, z = %d, dir = %d, isExit = %d)", val.x, val.y, val.z,
|
||||
val.direction, val.isExit);
|
||||
stream->Write(msg, strlen(msg));
|
||||
}
|
||||
};
|
||||
@@ -676,9 +678,29 @@ template<> struct DataSerializerTraits<TrackDesignSceneryElement>
|
||||
{
|
||||
char msg[128] = {};
|
||||
snprintf(
|
||||
msg, sizeof(msg), "TrackDesignSceneryElement(x = %d, y = %d, z = %d, flags = %d, colour1 = %d, colour2 = %d)", val.x, val.y, val.z,
|
||||
val.flags, val.primary_colour, val.secondary_colour);
|
||||
msg, sizeof(msg), "TrackDesignSceneryElement(x = %d, y = %d, z = %d, flags = %d, colour1 = %d, colour2 = %d)",
|
||||
val.x, val.y, val.z, val.flags, val.primary_colour, val.secondary_colour);
|
||||
stream->Write(msg, strlen(msg));
|
||||
stream->WriteArray(val.scenery_object.name, 8);
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct DataSerializerTraits<rct_vehicle_colour>
|
||||
{
|
||||
static void encode(IStream* stream, const rct_vehicle_colour& val)
|
||||
{
|
||||
stream->Write(&val.body_colour);
|
||||
stream->Write(&val.trim_colour);
|
||||
}
|
||||
static void decode(IStream* stream, rct_vehicle_colour& val)
|
||||
{
|
||||
stream->Read(&val.body_colour);
|
||||
stream->Read(&val.trim_colour);
|
||||
}
|
||||
static void log(IStream* stream, const rct_vehicle_colour& val)
|
||||
{
|
||||
char msg[128] = {};
|
||||
snprintf(msg, sizeof(msg), "rct_vehicle_colour(body_colour = %d, trim_colour = %d)", val.body_colour, val.trim_colour);
|
||||
stream->Write(msg, strlen(msg));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ bool T6Exporter::SaveTrack(IStream* stream)
|
||||
tempStream.WriteValue<uint32_t>(_trackDesign->flags);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->ride_mode);
|
||||
tempStream.WriteValue<uint8_t>((_trackDesign->colour_scheme & 0x3) | (2 << 2));
|
||||
tempStream.WriteArray(_trackDesign->vehicle_colours, RCT12_MAX_VEHICLE_COLOURS);
|
||||
tempStream.WriteArray(_trackDesign->vehicle_colours.data(), RCT12_MAX_VEHICLE_COLOURS);
|
||||
tempStream.WriteValue<uint8_t>(0);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->entrance_style);
|
||||
tempStream.WriteValue<uint8_t>(_trackDesign->total_air_time);
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#include "../actions/LargeSceneryRemoveAction.hpp"
|
||||
#include "../actions/MazePlaceTrackAction.hpp"
|
||||
#include "../actions/RideEntranceExitPlaceAction.hpp"
|
||||
#include "../actions/RideSetSetting.hpp"
|
||||
#include "../actions/RideSetName.hpp"
|
||||
#include "../actions/RideSetSetting.hpp"
|
||||
#include "../actions/RideSetVehiclesAction.hpp"
|
||||
#include "../actions/SmallSceneryPlaceAction.hpp"
|
||||
#include "../actions/SmallSceneryRemoveAction.hpp"
|
||||
@@ -29,9 +29,9 @@
|
||||
#include "../actions/WallPlaceAction.hpp"
|
||||
#include "../actions/WallRemoveAction.hpp"
|
||||
#include "../audio/audio.h"
|
||||
#include "../core/DataSerialiser.h"
|
||||
#include "../core/File.h"
|
||||
#include "../core/String.hpp"
|
||||
#include "../core/DataSerialiser.h"
|
||||
#include "../drawing/X8DrawingEngine.h"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../localisation/StringIds.h"
|
||||
@@ -81,7 +81,6 @@ LocationXYZ16 gTrackPreviewOrigin;
|
||||
|
||||
bool byte_9D8150;
|
||||
static uint8_t _trackDesignPlaceOperation;
|
||||
static bool _trackDesignDontPlaceScenery;
|
||||
static money32 _trackDesignPlaceCost;
|
||||
static int16_t _trackDesignPlaceZ;
|
||||
static int16_t _trackDesignPlaceSceneryZ;
|
||||
@@ -569,7 +568,7 @@ void TrackDesign::Serialise(DataSerialiser& stream)
|
||||
stream << DS_TAG(ride_mode);
|
||||
stream << DS_TAG(track_flags);
|
||||
stream << DS_TAG(colour_scheme);
|
||||
//stream << DS_TAG(vehicle_colours); todo
|
||||
stream << DS_TAG(vehicle_colours);
|
||||
stream << DS_TAG(entrance_style);
|
||||
stream << DS_TAG(total_air_time);
|
||||
stream << DS_TAG(depart_flags);
|
||||
|
||||
@@ -88,7 +88,7 @@ struct TrackDesign
|
||||
uint8_t ride_mode;
|
||||
uint8_t track_flags;
|
||||
uint8_t colour_scheme;
|
||||
rct_vehicle_colour vehicle_colours[RCT2_MAX_CARS_PER_TRAIN];
|
||||
std::array<rct_vehicle_colour, RCT2_MAX_CARS_PER_TRAIN> vehicle_colours;
|
||||
uint8_t entrance_style;
|
||||
uint8_t total_air_time;
|
||||
uint8_t depart_flags;
|
||||
|
||||
Reference in New Issue
Block a user