2016-10-16 18:44:57 +02:00
|
|
|
/*****************************************************************************
|
2018-06-15 14:07:34 +02:00
|
|
|
* Copyright (c) 2014-2018 OpenRCT2 developers
|
2016-10-16 18:44:57 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2016-10-16 18:44:57 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2016-10-16 18:44:57 +02:00
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "Utils.hpp"
|
|
|
|
|
2020-06-17 13:52:10 +02:00
|
|
|
#include "Data.h"
|
|
|
|
|
2017-12-31 13:21:34 +01:00
|
|
|
#include <openrct2/ride/Ride.h>
|
2020-02-22 17:49:52 +01:00
|
|
|
#include <openrct2/ride/RideData.h>
|
2017-10-17 13:51:47 +02:00
|
|
|
#include <openrct2/ride/Track.h>
|
2017-10-16 12:02:23 +02:00
|
|
|
#include <openrct2/ride/TrackData.h>
|
2016-10-16 18:44:57 +02:00
|
|
|
|
2018-06-22 22:29:03 +02:00
|
|
|
namespace Utils
|
|
|
|
{
|
|
|
|
int getTrackSequenceCount(uint8_t rideType, uint8_t trackType)
|
|
|
|
{
|
2016-10-16 18:44:57 +02:00
|
|
|
int sequenceCount = 0;
|
|
|
|
|
2018-06-22 22:29:03 +02:00
|
|
|
for (int i = 0; i < 256; i++)
|
|
|
|
{
|
2021-02-08 21:28:41 +01:00
|
|
|
if (TrackBlocks[trackType][i].index == 0xFF)
|
2018-06-22 22:29:03 +02:00
|
|
|
{
|
2016-10-16 18:44:57 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
sequenceCount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sequenceCount;
|
|
|
|
}
|
|
|
|
|
2018-06-22 22:29:03 +02:00
|
|
|
bool rideSupportsTrackType(uint8_t rideType, uint8_t trackType)
|
|
|
|
{
|
2021-02-26 10:01:00 +01:00
|
|
|
TRACK_PAINT_FUNCTION_GETTER newPaintGetter = GetRideTypeDescriptor(rideType).TrackPaintFunction;
|
2016-10-16 18:44:57 +02:00
|
|
|
|
2018-06-22 22:29:03 +02:00
|
|
|
if (newPaintGetter == nullptr)
|
|
|
|
{
|
2016-10-16 18:44:57 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-09-08 04:42:42 +02:00
|
|
|
if (newPaintGetter(trackType) == nullptr)
|
2018-06-22 22:29:03 +02:00
|
|
|
{
|
2016-10-16 18:44:57 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-06-22 22:29:03 +02:00
|
|
|
if (RideTypeTrackPaintFunctionsOld[rideType][trackType] == 0)
|
|
|
|
{
|
2016-10-16 18:44:57 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-06-22 22:29:03 +02:00
|
|
|
bool rideIsImplemented(uint8_t rideType)
|
|
|
|
{
|
2021-02-26 10:01:00 +01:00
|
|
|
TRACK_PAINT_FUNCTION_GETTER newPaintGetter = GetRideTypeDescriptor(rideType).TrackPaintFunction;
|
2016-10-16 18:44:57 +02:00
|
|
|
return (newPaintGetter != 0);
|
|
|
|
}
|
2018-06-22 22:29:03 +02:00
|
|
|
} // namespace Utils
|