OpenRCT2/test/testpaint/Utils.cpp

66 lines
1.7 KiB
C++
Raw Normal View History

2016-10-16 18:44:57 +02:00
/*****************************************************************************
* Copyright (c) 2014-2018 OpenRCT2 developers
2016-10-16 18:44:57 +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
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
2016-10-16 18:44:57 +02:00
*****************************************************************************/
#include "Utils.hpp"
#include "Data.h"
2017-12-31 13:21:34 +01:00
#include <openrct2/ride/Ride.h>
#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)
{
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;
}
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)
{
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