mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-23 02:41:58 -05:00
Move vehicle preference to RideGroupManager
This commit is contained in:
parent
4158a46fa1
commit
434325ea22
6 changed files with 129 additions and 125 deletions
|
@ -1216,7 +1216,6 @@ enum {
|
|||
|
||||
extern const uint8 gRideCategories[RIDE_TYPE_COUNT];
|
||||
|
||||
sint32 vehicle_preference_compare(uint8 rideType, const char * a, const char * b);
|
||||
bool rideTypeShouldLoseSeparateFlag(const rct_ride_entry *rideEntry);
|
||||
|
||||
ParkLoadResult * rct1_load_saved_game(const char *path);
|
||||
|
|
|
@ -2676,27 +2676,4 @@ extern "C"
|
|||
{
|
||||
return RCT1::GetColour(colour);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function keeps a list of the preferred vehicle for every generic track
|
||||
* type, out of the available vehicle types in the current game. It determines
|
||||
* which picture is shown on the new ride tab and which train type is selected
|
||||
* by default.
|
||||
*/
|
||||
sint32 vehicle_preference_compare(uint8 rideType, const char * a, const char * b)
|
||||
{
|
||||
std::vector<const char *> rideEntryOrder = RCT1::GetPreferedRideEntryOrder(rideType);
|
||||
for (const char * object : rideEntryOrder)
|
||||
{
|
||||
if (String::Equals(object, a, true))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (String::Equals(object, b, true))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,8 +51,6 @@ namespace RCT1
|
|||
const char * GetWaterObject(uint8 waterType);
|
||||
|
||||
const std::vector<const char *> GetSceneryObjects(uint8 sceneryType);
|
||||
|
||||
const std::vector<const char *> GetPreferedRideEntryOrder(uint8 rideType);
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
|
|
@ -1382,105 +1382,6 @@ namespace RCT1
|
|||
return map[waterType];
|
||||
}
|
||||
|
||||
const std::vector<const char *> GetPreferedRideEntryOrder(uint8 rideType)
|
||||
{
|
||||
static const std::vector<const char *> preferedRideEntryOrder[] =
|
||||
{
|
||||
{ "SPDRCR "}, // RIDE_TYPE_SPIRAL_ROLLER_COASTER
|
||||
{ "TOGST "}, // RIDE_TYPE_STAND_UP_ROLLER_COASTER
|
||||
{ "ARRSW1 ", "VEKVAMP ", "ARRSW2 "}, // RIDE_TYPE_SUSPENDED_SWINGING_COASTER
|
||||
{ "NEMT "}, // RIDE_TYPE_INVERTED_ROLLER_COASTER
|
||||
{ "ZLDB ", "ZLOG "}, // RIDE_TYPE_JUNIOR_ROLLER_COASTER
|
||||
{ "NRL ", "NRL2 ", "AML1 ", "TRAM1 "}, // RIDE_TYPE_MINIATURE_RAILWAY
|
||||
{ "MONO1 ", "MONO2 ", "MONO3 "}, // RIDE_TYPE_MONORAIL
|
||||
{ "BATFL ", "SKYTR "}, // RIDE_TYPE_MINI_SUSPENDED_COASTER
|
||||
{ "RBOAT ", "BBOAT ", "CBOAT ", "SWANS ", "TRIKE ", "JSKI " }, // RIDE_TYPE_BOAT_RIDE
|
||||
{ "WMOUSE ", "WMMINE "}, // RIDE_TYPE_WOODEN_WILD_MOUSE
|
||||
{ "STEEP1 ", "STEEP2 ", "SBOX "}, // RIDE_TYPE_STEEPLECHASE
|
||||
{ "SPCAR ", "RCR ", "TRUCK1 ", "VCR ", "CTCAR " }, // RIDE_TYPE_CAR_RIDE
|
||||
{ "SSC1 " }, // RIDE_TYPE_LAUNCHED_FREEFALL
|
||||
{ "BOB1 ", "INTBOB " }, // RIDE_TYPE_BOBSLEIGH_COASTER
|
||||
{ "OBS1 ", "OBS2 " }, // RIDE_TYPE_OBSERVATION_TOWER
|
||||
{ "SCHT1 " }, // RIDE_TYPE_LOOPING_ROLLER_COASTER
|
||||
{ "DING1 " }, // RIDE_TYPE_DINGHY_SLIDE
|
||||
{ "AMT1 " }, // RIDE_TYPE_MINE_TRAIN_COASTER
|
||||
{ "CLIFT1 ", "CLIFT2 " }, // RIDE_TYPE_CHAIRLIFT
|
||||
{ "ARRT1 ", "ARRT2 " }, // RIDE_TYPE_CORKSCREW_ROLLER_COASTER
|
||||
{ }, // RIDE_TYPE_MAZE
|
||||
{ }, // RIDE_TYPE_SPIRAL_SLIDE
|
||||
{ "KART1 " }, // RIDE_TYPE_GO_KARTS
|
||||
{ "LFB1 " }, // RIDE_TYPE_LOG_FLUME
|
||||
{ "RAPBOAT " }, // RIDE_TYPE_RIVER_RAPIDS
|
||||
{ }, // RIDE_TYPE_DODGEMS
|
||||
{ }, // RIDE_TYPE_PIRATE_SHIP
|
||||
{ }, // RIDE_TYPE_SWINGING_INVERTER_SHIP
|
||||
{ }, // RIDE_TYPE_FOOD_STALL
|
||||
{ }, // RIDE_TYPE_1D
|
||||
{ }, // RIDE_TYPE_DRINK_STALL
|
||||
{ }, // RIDE_TYPE_1F
|
||||
{ }, // RIDE_TYPE_SHOP
|
||||
{ }, // RIDE_TYPE_MERRY_GO_ROUND
|
||||
{ }, // RIDE_TYPE_22
|
||||
{ }, // RIDE_TYPE_INFORMATION_KIOSK
|
||||
{ }, // RIDE_TYPE_TOILETS
|
||||
{ }, // RIDE_TYPE_FERRIS_WHEEL
|
||||
{ }, // RIDE_TYPE_MOTION_SIMULATOR
|
||||
{ }, // RIDE_TYPE_3D_CINEMA
|
||||
{ }, // RIDE_TYPE_TOP_SPIN
|
||||
{ }, // RIDE_TYPE_SPACE_RINGS
|
||||
{ "REVF1 " }, // RIDE_TYPE_REVERSE_FREEFALL_COASTER
|
||||
{ "LIFT1 " }, // RIDE_TYPE_LIFT
|
||||
{ "BMVD " }, // RIDE_TYPE_VERTICAL_DROP_ROLLER_COASTER
|
||||
{ }, // RIDE_TYPE_CASH_MACHINE
|
||||
{ }, // RIDE_TYPE_TWIST
|
||||
{ }, // RIDE_TYPE_HAUNTED_HOUSE
|
||||
{ }, // RIDE_TYPE_FIRST_AID
|
||||
{ }, // RIDE_TYPE_CIRCUS_SHOW
|
||||
{ "GTC ", "HMCAR " }, // RIDE_TYPE_GHOST_TRAIN
|
||||
{ "BMSD ", "BMSU ", "BMFL ", "BMRB ", "GOLTR " }, // RIDE_TYPE_TWISTER_ROLLER_COASTER
|
||||
{ "PTCT1 ", "MFT ", "PTCT2 " }, // RIDE_TYPE_WOODEN_ROLLER_COASTER
|
||||
{ "SFRIC1 " }, // RIDE_TYPE_SIDE_FRICTION_ROLLER_COASTER
|
||||
{ "SMC1 ", "SMC2 ", "WMSPIN " }, // RIDE_TYPE_WILD_MOUSE
|
||||
{ "ARRX " }, // RIDE_TYPE_MULTI_DIMENSION_ROLLER_COASTER
|
||||
{ }, // RIDE_TYPE_MULTI_DIMENSION_ROLLER_COASTER_ALT
|
||||
{ "BMAIR " }, // RIDE_TYPE_FLYING_ROLLER_COASTER
|
||||
{ }, // RIDE_TYPE_FLYING_ROLLER_COASTER_ALT
|
||||
{ "VREEL " }, // RIDE_TYPE_VIRGINIA_REEL
|
||||
{ "SPBOAT " }, // RIDE_TYPE_SPLASH_BOATS
|
||||
{ "HELICAR " }, // RIDE_TYPE_MINI_HELICOPTERS
|
||||
{ "VEKST " }, // RIDE_TYPE_LAY_DOWN_ROLLER_COASTER
|
||||
{ "SMONO " }, // RIDE_TYPE_SUSPENDED_MONORAIL
|
||||
{ }, // RIDE_TYPE_LAY_DOWN_ROLLER_COASTER_ALT
|
||||
{ "REVCAR " }, // RIDE_TYPE_REVERSER_ROLLER_COASTER
|
||||
{ "UTCAR ", "UTCARR " }, // RIDE_TYPE_HEARTLINE_TWISTER_COASTER
|
||||
{ }, // RIDE_TYPE_MINI_GOLF
|
||||
{ "INTST " }, // RIDE_TYPE_GIGA_COASTER
|
||||
{ "GDROP1 " }, // RIDE_TYPE_ROTO_DROP
|
||||
{ }, // RIDE_TYPE_FLYING_SAUCERS
|
||||
{ }, // RIDE_TYPE_CROOKED_HOUSE
|
||||
{ "MONBK " }, // RIDE_TYPE_MONORAIL_CYCLES
|
||||
{ "SLCT ", "SLCFO ", "VEKDV " }, // RIDE_TYPE_COMPACT_INVERTED_COASTER
|
||||
{ "CSTBOAT " }, // RIDE_TYPE_WATER_COASTER
|
||||
{ "THCAR " }, // RIDE_TYPE_AIR_POWERED_VERTICAL_COASTER
|
||||
{ "IVMC1 " }, // RIDE_TYPE_INVERTED_HAIRPIN_COASTER
|
||||
{ }, // RIDE_TYPE_MAGIC_CARPET
|
||||
{ "SUBMAR " }, // RIDE_TYPE_SUBMARINE_RIDE
|
||||
{ "RFTBOAT " }, // RIDE_TYPE_RIVER_RAFTS
|
||||
{ }, // RIDE_TYPE_50
|
||||
{ }, // RIDE_TYPE_ENTERPRISE
|
||||
{ }, // RIDE_TYPE_52
|
||||
{ }, // RIDE_TYPE_53
|
||||
{ }, // RIDE_TYPE_54
|
||||
{ }, // RIDE_TYPE_55
|
||||
{ "INTINV " }, // RIDE_TYPE_INVERTED_IMPULSE_COASTER
|
||||
{ "WCATC ", "RCKC ", "JSTAR1 " }, // RIDE_TYPE_MINI_ROLLER_COASTER
|
||||
{ "PMT1 " }, // RIDE_TYPE_MINE_RIDE
|
||||
{ }, // RIDE_TYPE_59
|
||||
{ "PREMT1 " }, // RIDE_TYPE_LIM_LAUNCHED_ROLLER_COASTER
|
||||
};
|
||||
return preferedRideEntryOrder[rideType];
|
||||
}
|
||||
|
||||
const std::vector<const char *> GetSceneryObjects(uint8 sceneryType)
|
||||
{
|
||||
static const std::vector<const char *> map[] =
|
||||
|
|
|
@ -15,8 +15,10 @@
|
|||
#pragma endregion
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "RideGroupManager.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../core/String.hpp"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
@ -198,6 +200,105 @@ public:
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::vector<const char *> GetPreferedRideEntryOrder(uint8 rideType) const override
|
||||
{
|
||||
static const std::vector<const char *> preferedRideEntryOrder[] =
|
||||
{
|
||||
{ "SPDRCR "}, // RIDE_TYPE_SPIRAL_ROLLER_COASTER
|
||||
{ "TOGST "}, // RIDE_TYPE_STAND_UP_ROLLER_COASTER
|
||||
{ "ARRSW1 ", "VEKVAMP ", "ARRSW2 "}, // RIDE_TYPE_SUSPENDED_SWINGING_COASTER
|
||||
{ "NEMT "}, // RIDE_TYPE_INVERTED_ROLLER_COASTER
|
||||
{ "ZLDB ", "ZLOG "}, // RIDE_TYPE_JUNIOR_ROLLER_COASTER
|
||||
{ "NRL ", "NRL2 ", "AML1 ", "TRAM1 "}, // RIDE_TYPE_MINIATURE_RAILWAY
|
||||
{ "MONO1 ", "MONO2 ", "MONO3 "}, // RIDE_TYPE_MONORAIL
|
||||
{ "BATFL ", "SKYTR "}, // RIDE_TYPE_MINI_SUSPENDED_COASTER
|
||||
{ "RBOAT ", "BBOAT ", "CBOAT ", "SWANS ", "TRIKE ", "JSKI " }, // RIDE_TYPE_BOAT_RIDE
|
||||
{ "WMOUSE ", "WMMINE "}, // RIDE_TYPE_WOODEN_WILD_MOUSE
|
||||
{ "STEEP1 ", "STEEP2 ", "SBOX "}, // RIDE_TYPE_STEEPLECHASE
|
||||
{ "SPCAR ", "RCR ", "TRUCK1 ", "VCR ", "CTCAR " }, // RIDE_TYPE_CAR_RIDE
|
||||
{ "SSC1 " }, // RIDE_TYPE_LAUNCHED_FREEFALL
|
||||
{ "BOB1 ", "INTBOB " }, // RIDE_TYPE_BOBSLEIGH_COASTER
|
||||
{ "OBS1 ", "OBS2 " }, // RIDE_TYPE_OBSERVATION_TOWER
|
||||
{ "SCHT1 " }, // RIDE_TYPE_LOOPING_ROLLER_COASTER
|
||||
{ "DING1 " }, // RIDE_TYPE_DINGHY_SLIDE
|
||||
{ "AMT1 " }, // RIDE_TYPE_MINE_TRAIN_COASTER
|
||||
{ "CLIFT1 ", "CLIFT2 " }, // RIDE_TYPE_CHAIRLIFT
|
||||
{ "ARRT1 ", "ARRT2 " }, // RIDE_TYPE_CORKSCREW_ROLLER_COASTER
|
||||
{ }, // RIDE_TYPE_MAZE
|
||||
{ }, // RIDE_TYPE_SPIRAL_SLIDE
|
||||
{ "KART1 " }, // RIDE_TYPE_GO_KARTS
|
||||
{ "LFB1 " }, // RIDE_TYPE_LOG_FLUME
|
||||
{ "RAPBOAT " }, // RIDE_TYPE_RIVER_RAPIDS
|
||||
{ }, // RIDE_TYPE_DODGEMS
|
||||
{ }, // RIDE_TYPE_PIRATE_SHIP
|
||||
{ }, // RIDE_TYPE_SWINGING_INVERTER_SHIP
|
||||
{ }, // RIDE_TYPE_FOOD_STALL
|
||||
{ }, // RIDE_TYPE_1D
|
||||
{ }, // RIDE_TYPE_DRINK_STALL
|
||||
{ }, // RIDE_TYPE_1F
|
||||
{ }, // RIDE_TYPE_SHOP
|
||||
{ }, // RIDE_TYPE_MERRY_GO_ROUND
|
||||
{ }, // RIDE_TYPE_22
|
||||
{ }, // RIDE_TYPE_INFORMATION_KIOSK
|
||||
{ }, // RIDE_TYPE_TOILETS
|
||||
{ }, // RIDE_TYPE_FERRIS_WHEEL
|
||||
{ }, // RIDE_TYPE_MOTION_SIMULATOR
|
||||
{ }, // RIDE_TYPE_3D_CINEMA
|
||||
{ }, // RIDE_TYPE_TOP_SPIN
|
||||
{ }, // RIDE_TYPE_SPACE_RINGS
|
||||
{ "REVF1 " }, // RIDE_TYPE_REVERSE_FREEFALL_COASTER
|
||||
{ "LIFT1 " }, // RIDE_TYPE_LIFT
|
||||
{ "BMVD " }, // RIDE_TYPE_VERTICAL_DROP_ROLLER_COASTER
|
||||
{ }, // RIDE_TYPE_CASH_MACHINE
|
||||
{ }, // RIDE_TYPE_TWIST
|
||||
{ }, // RIDE_TYPE_HAUNTED_HOUSE
|
||||
{ }, // RIDE_TYPE_FIRST_AID
|
||||
{ }, // RIDE_TYPE_CIRCUS_SHOW
|
||||
{ "GTC ", "HMCAR " }, // RIDE_TYPE_GHOST_TRAIN
|
||||
{ "BMSD ", "BMSU ", "BMFL ", "BMRB ", "GOLTR " }, // RIDE_TYPE_TWISTER_ROLLER_COASTER
|
||||
{ "PTCT1 ", "MFT ", "PTCT2 " }, // RIDE_TYPE_WOODEN_ROLLER_COASTER
|
||||
{ "SFRIC1 " }, // RIDE_TYPE_SIDE_FRICTION_ROLLER_COASTER
|
||||
{ "SMC1 ", "SMC2 ", "WMSPIN " }, // RIDE_TYPE_WILD_MOUSE
|
||||
{ "ARRX " }, // RIDE_TYPE_MULTI_DIMENSION_ROLLER_COASTER
|
||||
{ }, // RIDE_TYPE_MULTI_DIMENSION_ROLLER_COASTER_ALT
|
||||
{ "BMAIR " }, // RIDE_TYPE_FLYING_ROLLER_COASTER
|
||||
{ }, // RIDE_TYPE_FLYING_ROLLER_COASTER_ALT
|
||||
{ "VREEL " }, // RIDE_TYPE_VIRGINIA_REEL
|
||||
{ "SPBOAT " }, // RIDE_TYPE_SPLASH_BOATS
|
||||
{ "HELICAR " }, // RIDE_TYPE_MINI_HELICOPTERS
|
||||
{ "VEKST " }, // RIDE_TYPE_LAY_DOWN_ROLLER_COASTER
|
||||
{ "SMONO " }, // RIDE_TYPE_SUSPENDED_MONORAIL
|
||||
{ }, // RIDE_TYPE_LAY_DOWN_ROLLER_COASTER_ALT
|
||||
{ "REVCAR " }, // RIDE_TYPE_REVERSER_ROLLER_COASTER
|
||||
{ "UTCAR ", "UTCARR " }, // RIDE_TYPE_HEARTLINE_TWISTER_COASTER
|
||||
{ }, // RIDE_TYPE_MINI_GOLF
|
||||
{ "INTST " }, // RIDE_TYPE_GIGA_COASTER
|
||||
{ "GDROP1 " }, // RIDE_TYPE_ROTO_DROP
|
||||
{ }, // RIDE_TYPE_FLYING_SAUCERS
|
||||
{ }, // RIDE_TYPE_CROOKED_HOUSE
|
||||
{ "MONBK " }, // RIDE_TYPE_MONORAIL_CYCLES
|
||||
{ "SLCT ", "SLCFO ", "VEKDV " }, // RIDE_TYPE_COMPACT_INVERTED_COASTER
|
||||
{ "CSTBOAT " }, // RIDE_TYPE_WATER_COASTER
|
||||
{ "THCAR " }, // RIDE_TYPE_AIR_POWERED_VERTICAL_COASTER
|
||||
{ "IVMC1 " }, // RIDE_TYPE_INVERTED_HAIRPIN_COASTER
|
||||
{ }, // RIDE_TYPE_MAGIC_CARPET
|
||||
{ "SUBMAR " }, // RIDE_TYPE_SUBMARINE_RIDE
|
||||
{ "RFTBOAT " }, // RIDE_TYPE_RIVER_RAFTS
|
||||
{ }, // RIDE_TYPE_50
|
||||
{ }, // RIDE_TYPE_ENTERPRISE
|
||||
{ }, // RIDE_TYPE_52
|
||||
{ }, // RIDE_TYPE_53
|
||||
{ }, // RIDE_TYPE_54
|
||||
{ }, // RIDE_TYPE_55
|
||||
{ "INTINV " }, // RIDE_TYPE_INVERTED_IMPULSE_COASTER
|
||||
{ "WCATC ", "RCKC ", "JSTAR1 " }, // RIDE_TYPE_MINI_ROLLER_COASTER
|
||||
{ "PMT1 " }, // RIDE_TYPE_MINE_RIDE
|
||||
{ }, // RIDE_TYPE_59
|
||||
{ "PREMT1 " }, // RIDE_TYPE_LIM_LAUNCHED_ROLLER_COASTER
|
||||
};
|
||||
return preferedRideEntryOrder[rideType];
|
||||
}
|
||||
};
|
||||
|
||||
static std::unique_ptr<RideGroupManager> _rideGroupManager = std::unique_ptr<RideGroupManager>(new RideGroupManager());
|
||||
|
@ -236,4 +337,28 @@ extern "C"
|
|||
const IRideGroupManager * rideGroupManager = GetRideGroupManager();
|
||||
return rideGroupManager->RideGroupIsInvented(rideGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function keeps a list of the preferred vehicle for every generic track
|
||||
* type, out of the available vehicle types in the current game. It determines
|
||||
* which picture is shown on the new ride tab and which train type is selected
|
||||
* by default.
|
||||
*/
|
||||
sint32 vehicle_preference_compare(uint8 rideType, const char * a, const char * b)
|
||||
{
|
||||
const IRideGroupManager * rideGroupManager = GetRideGroupManager();
|
||||
std::vector<const char *> rideEntryOrder = rideGroupManager->GetPreferedRideEntryOrder(rideType);
|
||||
for (const char * object : rideEntryOrder)
|
||||
{
|
||||
if (String::Equals(object, a, true))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (String::Equals(object, b, true))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,8 +45,11 @@ interface IRideGroupManager
|
|||
virtual ride_group * RideGroupFind(uint8 rideType, uint8 index) const abstract;
|
||||
virtual bool RideGroupsAreEqual(const ride_group * a, const ride_group * b) const abstract;
|
||||
virtual bool RideGroupIsInvented(const ride_group * rideGroup) const abstract;
|
||||
|
||||
virtual const std::vector<const char *> GetPreferedRideEntryOrder(uint8 rideType) const abstract;
|
||||
};
|
||||
|
||||
|
||||
IRideGroupManager * GetRideGroupManager();
|
||||
|
||||
extern "C"
|
||||
|
@ -57,6 +60,7 @@ extern "C"
|
|||
ride_group * ride_group_find(uint8 rideType, uint8 index);
|
||||
bool ride_groups_are_equal(const ride_group * a, const ride_group * b);
|
||||
bool ride_group_is_invented(const ride_group * rideGroup);
|
||||
sint32 vehicle_preference_compare(uint8 rideType, const char * a, const char * b);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue