mirror of https://github.com/OpenRCT2/OpenRCT2.git
Replace uint8's with EnumValue
Replace uint8's with EnumValue Replace uint8's with EnumValue Revertl arge change Revert large change Format
This commit is contained in:
parent
ef9840f29b
commit
56df39dcb4
|
@ -1274,7 +1274,7 @@ private:
|
|||
// Climate value
|
||||
screenCoords = windowPos + ScreenCoordsXY{ climateWidget.left + 1, climateWidget.top };
|
||||
auto ft = Formatter();
|
||||
ft.Add<StringId>(ClimateNames[static_cast<uint8_t>(gameState.Climate)]);
|
||||
ft.Add<StringId>(ClimateNames[EnumValue(gameState.Climate)]);
|
||||
DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft);
|
||||
}
|
||||
|
||||
|
|
|
@ -3435,7 +3435,7 @@ private:
|
|||
}
|
||||
|
||||
// Mode
|
||||
widgets[WIDX_MODE].text = RideModeNames[static_cast<int>(ride->mode)];
|
||||
widgets[WIDX_MODE].text = RideModeNames[EnumValue(ride->mode)];
|
||||
|
||||
// Waiting
|
||||
widgets[WIDX_LOAD].text = VehicleLoadNames[(ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD_MASK)];
|
||||
|
|
|
@ -127,7 +127,7 @@ static Widget* window_staff_page_widgets[] = {
|
|||
class StaffWindow final : public Window
|
||||
{
|
||||
private:
|
||||
EntertainerCostume _availableCostumes[static_cast<uint8_t>(EntertainerCostume::Count)]{};
|
||||
EntertainerCostume _availableCostumes[EnumValue(EntertainerCostume::Count)]{};
|
||||
uint16_t _tabAnimationOffset = 0;
|
||||
int32_t _pickedPeepOldX = LOCATION_NULL;
|
||||
|
||||
|
@ -778,7 +778,7 @@ private:
|
|||
{
|
||||
checkedIndex = i;
|
||||
}
|
||||
gDropdownItems[i].Args = StaffCostumeNames[static_cast<uint8_t>(costume)];
|
||||
gDropdownItems[i].Args = StaffCostumeNames[EnumValue(costume)];
|
||||
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
||||
}
|
||||
|
||||
|
|
|
@ -677,7 +677,7 @@ private:
|
|||
static EntertainerCostume GetRandomEntertainerCostume()
|
||||
{
|
||||
auto result = EntertainerCostume::Panda;
|
||||
EntertainerCostume costumeList[static_cast<uint8_t>(EntertainerCostume::Count)];
|
||||
EntertainerCostume costumeList[EnumValue(EntertainerCostume::Count)];
|
||||
int32_t numCostumes = StaffGetAvailableEntertainerCostumeList(costumeList);
|
||||
if (numCostumes > 0)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "core/Console.hpp"
|
||||
#include "core/String.hpp"
|
||||
#include "util/Util.h"
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
|
@ -38,7 +39,7 @@ static FILE* diagnostic_get_stream(DiagnosticLevel level)
|
|||
|
||||
#ifdef __ANDROID__
|
||||
|
||||
int _android_log_priority[static_cast<uint8_t>(DiagnosticLevel::Count)] = {
|
||||
int _android_log_priority[EnumValue(DiagnosticLevel::Count)] = {
|
||||
ANDROID_LOG_FATAL, ANDROID_LOG_ERROR, ANDROID_LOG_WARN, ANDROID_LOG_VERBOSE, ANDROID_LOG_INFO,
|
||||
};
|
||||
|
||||
|
@ -50,7 +51,7 @@ void DiagnosticLog(DiagnosticLevel diagnosticLevel, const char* format, ...)
|
|||
return;
|
||||
|
||||
va_start(args, format);
|
||||
__android_log_vprint(_android_log_priority[static_cast<uint8_t>(diagnosticLevel)], "OpenRCT2", format, args);
|
||||
__android_log_vprint(_android_log_priority[EnumValue(diagnosticLevel)], "OpenRCT2", format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
@ -66,7 +67,7 @@ void DiagnosticLogWithLocation(
|
|||
snprintf(buf, 1024, "[%s:%d (%s)]: ", file, line, function);
|
||||
|
||||
va_start(args, format);
|
||||
__android_log_vprint(_android_log_priority[static_cast<uint8_t>(diagnosticLevel)], file, format, args);
|
||||
__android_log_vprint(_android_log_priority[EnumValue(diagnosticLevel)], file, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
@ -91,7 +92,7 @@ void DiagnosticLog(DiagnosticLevel diagnosticLevel, const char* format, ...)
|
|||
if (_log_levels[static_cast<uint8_t>(diagnosticLevel)])
|
||||
{
|
||||
// Level
|
||||
auto prefix = String::StdFormat("%s: ", _level_strings[static_cast<uint8_t>(diagnosticLevel)]);
|
||||
auto prefix = String::StdFormat("%s: ", _level_strings[EnumValue(diagnosticLevel)]);
|
||||
|
||||
// Message
|
||||
va_start(args, format);
|
||||
|
@ -112,12 +113,11 @@ void DiagnosticLogWithLocation(
|
|||
std::string prefix;
|
||||
if (_log_location_enabled)
|
||||
{
|
||||
prefix = String::StdFormat(
|
||||
"%s[%s:%d (%s)]: ", _level_strings[static_cast<uint8_t>(diagnosticLevel)], file, line, function);
|
||||
prefix = String::StdFormat("%s[%s:%d (%s)]: ", _level_strings[EnumValue(diagnosticLevel)], file, line, function);
|
||||
}
|
||||
else
|
||||
{
|
||||
prefix = String::StdFormat("%s: ", _level_strings[static_cast<uint8_t>(diagnosticLevel)]);
|
||||
prefix = String::StdFormat("%s: ", _level_strings[EnumValue(diagnosticLevel)]);
|
||||
}
|
||||
|
||||
// Message
|
||||
|
|
|
@ -131,7 +131,7 @@ GameActions::Result RideSetStatusAction::Execute() const
|
|||
return res;
|
||||
}
|
||||
|
||||
res.ErrorTitle = _StatusErrorTitles[static_cast<uint8_t>(_status)];
|
||||
res.ErrorTitle = _StatusErrorTitles[EnumValue(_status)];
|
||||
|
||||
Formatter ft(res.ErrorMessageArgs.data());
|
||||
ft.Increment(6);
|
||||
|
|
|
@ -71,10 +71,10 @@ static constexpr CommandLineOptionDefinition StandardOptions[]
|
|||
{ CMDLINE_TYPE_SWITCH, &_about, NAC, "about", "show information about " OPENRCT2_NAME },
|
||||
{ CMDLINE_TYPE_SWITCH, &_verbose, NAC, "verbose", "log verbose messages" },
|
||||
{ CMDLINE_TYPE_SWITCH, &_headless, NAC, "headless", "run " OPENRCT2_NAME " headless" IMPLIES_SILENT_BREAKPAD },
|
||||
#ifndef DISABLE_NETWORK
|
||||
#ifndef DISABLE_NETWORK
|
||||
{ CMDLINE_TYPE_INTEGER, &_port, NAC, "port", "port to use for hosting or joining a server" },
|
||||
{ CMDLINE_TYPE_STRING, &_address, NAC, "address", "address to listen on when hosting a server" },
|
||||
#endif
|
||||
#endif
|
||||
{ CMDLINE_TYPE_STRING, &_password, NAC, "password", "password needed to join the server" },
|
||||
{ CMDLINE_TYPE_STRING, &_userDataPath, NAC, "user-data-path", "path to the user data directory (containing config.ini)" },
|
||||
{ CMDLINE_TYPE_STRING, &_openrct2DataPath, NAC, "openrct2-data-path", "path to the OpenRCT2 data directory (containing languages)" },
|
||||
|
@ -173,7 +173,7 @@ exitcode_t CommandLine::HandleCommandDefault()
|
|||
{
|
||||
if (_verbose)
|
||||
{
|
||||
_log_levels[static_cast<uint8_t>(DiagnosticLevel::Verbose)] = true;
|
||||
_log_levels[EnumValue(DiagnosticLevel::Verbose)] = true;
|
||||
PrintLaunchInformation();
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ private:
|
|||
{
|
||||
const auto& filePath = scanResult.Files.at(i);
|
||||
|
||||
if (_log_levels[static_cast<uint8_t>(DiagnosticLevel::Verbose)])
|
||||
if (_log_levels[EnumValue(DiagnosticLevel::Verbose)])
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(printLock);
|
||||
LOG_VERBOSE("FileIndex:Indexing '%s'", filePath.c_str());
|
||||
|
|
|
@ -142,7 +142,7 @@ enum class EntertainerCostume : uint8_t
|
|||
Count
|
||||
};
|
||||
|
||||
extern const StringId StaffCostumeNames[static_cast<uint8_t>(EntertainerCostume::Count)];
|
||||
extern const StringId StaffCostumeNames[EnumValue(EntertainerCostume::Count)];
|
||||
|
||||
colour_t StaffGetColour(StaffType staffType);
|
||||
GameActions::Result StaffSetColour(StaffType staffType, colour_t value);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../util/Util.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace OpenRCT2::Entity::Yaw
|
||||
|
@ -63,7 +65,7 @@ namespace OpenRCT2::Entity::Yaw
|
|||
|
||||
[[nodiscard]] constexpr int32_t YawToPrecision(int32_t yaw, SpritePrecision precision)
|
||||
{
|
||||
return yaw >> PrecisionOffset[static_cast<uint8_t>(precision)];
|
||||
return yaw >> PrecisionOffset[EnumValue(precision)];
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr uint8_t NumSpritesPrecision(SpritePrecision precision)
|
||||
|
|
|
@ -679,8 +679,7 @@ static int32_t ConsoleCommandGet(InteractiveConsole& console, const arguments_t&
|
|||
else if (argv[0] == "climate")
|
||||
{
|
||||
console.WriteFormatLine(
|
||||
"climate %s (%d)", ClimateNames[static_cast<uint8_t>(gameState.Climate)],
|
||||
static_cast<uint8_t>(gameState.Climate));
|
||||
"climate %s (%d)", ClimateNames[EnumValue(gameState.Climate)], EnumValue(gameState.Climate));
|
||||
}
|
||||
else if (argv[0] == "game_speed")
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "../common.h"
|
||||
#include "../core/String.hpp"
|
||||
#include "../util/Util.h"
|
||||
|
||||
// List of currencies
|
||||
enum class CurrencyType : uint8_t
|
||||
|
@ -61,7 +62,7 @@ struct CurrencyDescriptor
|
|||
};
|
||||
|
||||
// List of currency formats
|
||||
extern CurrencyDescriptor CurrencyDescriptors[static_cast<uint8_t>(CurrencyType::Count)];
|
||||
extern CurrencyDescriptor CurrencyDescriptors[EnumValue(CurrencyType::Count)];
|
||||
|
||||
/**
|
||||
* Loads custom currency saved parameters into {@link CurrencyDescriptors}'
|
||||
|
|
|
@ -845,8 +845,8 @@ namespace RCT2
|
|||
// SC6[6]
|
||||
uint32_t NextFreeTileElementPointerIndex;
|
||||
Entity Entities[Limits::MaxEntitiesRCTCExtended];
|
||||
uint16_t EntityListsHead[static_cast<uint8_t>(EntityListId::Count)];
|
||||
uint16_t EntityListsCount[static_cast<uint8_t>(EntityListId::Count)];
|
||||
uint16_t EntityListsHead[EnumValue(EntityListId::Count)];
|
||||
uint16_t EntityListsCount[EnumValue(EntityListId::Count)];
|
||||
StringId ParkName;
|
||||
uint8_t Pad013573D6[2];
|
||||
uint32_t ParkNameArgs;
|
||||
|
|
|
@ -16,22 +16,22 @@
|
|||
|
||||
uint32_t CarEntry::NumRotationSprites(SpriteGroupType spriteGroup) const
|
||||
{
|
||||
return NumSpritesPrecision(SpriteGroups[static_cast<uint8_t>(spriteGroup)].spritePrecision);
|
||||
return NumSpritesPrecision(SpriteGroups[EnumValue(spriteGroup)].spritePrecision);
|
||||
}
|
||||
|
||||
int32_t CarEntry::SpriteByYaw(int32_t yaw, SpriteGroupType spriteGroup) const
|
||||
{
|
||||
return YawToPrecision(yaw, SpriteGroups[static_cast<uint8_t>(spriteGroup)].spritePrecision);
|
||||
return YawToPrecision(yaw, SpriteGroups[EnumValue(spriteGroup)].spritePrecision);
|
||||
}
|
||||
|
||||
bool CarEntry::GroupEnabled(SpriteGroupType spriteGroup) const
|
||||
{
|
||||
return SpriteGroups[static_cast<uint8_t>(spriteGroup)].Enabled();
|
||||
return SpriteGroups[EnumValue(spriteGroup)].Enabled();
|
||||
}
|
||||
|
||||
uint32_t CarEntry::GroupImageId(SpriteGroupType spriteGroup) const
|
||||
{
|
||||
return SpriteGroups[static_cast<uint8_t>(spriteGroup)].imageId;
|
||||
return SpriteGroups[EnumValue(spriteGroup)].imageId;
|
||||
}
|
||||
|
||||
uint32_t CarEntry::SpriteOffset(SpriteGroupType spriteGroup, int32_t imageDirection, uint8_t rankIndex) const
|
||||
|
|
|
@ -4923,7 +4923,7 @@ OpenRCT2::BitSet<TRACK_GROUP_COUNT> RideEntryGetSupportedTrackPieces(const RideO
|
|||
{
|
||||
for (auto& group : trackPieceRequiredSprites[i])
|
||||
{
|
||||
auto precision = defaultVehicle->SpriteGroups[static_cast<uint8_t>(group.VehicleSpriteGroup)].spritePrecision;
|
||||
auto precision = defaultVehicle->SpriteGroups[EnumValue(group.VehicleSpriteGroup)].spritePrecision;
|
||||
if (precision < group.MinPrecision)
|
||||
supportedPieces.set(i, false);
|
||||
}
|
||||
|
|
|
@ -512,7 +512,7 @@ extern const CarEntry CableLiftVehicle;
|
|||
|
||||
extern const uint16_t RideFilmLength[3];
|
||||
|
||||
extern const StringId RideModeNames[static_cast<uint8_t>(RideMode::Count)];
|
||||
extern const StringId RideModeNames[EnumValue(RideMode::Count)];
|
||||
|
||||
// clang-format off
|
||||
constexpr RideTypeDescriptor DummyRTD =
|
||||
|
@ -546,7 +546,7 @@ constexpr RideTypeDescriptor DummyRTD =
|
|||
.ColourPreview = { static_cast<uint32_t>(SPR_NONE), static_cast<uint32_t>(SPR_NONE) },
|
||||
.ColourKey = RideColourKey::Ride,
|
||||
.Name = "invalid",
|
||||
.RatingsData =
|
||||
.RatingsData =
|
||||
{
|
||||
RatingsCalculationType::FlatRide,
|
||||
{ RIDE_RATING(1, 00), RIDE_RATING(1, 00), RIDE_RATING(1, 00) },
|
||||
|
|
|
@ -517,7 +517,7 @@ static bool vehicle_move_info_valid(
|
|||
{
|
||||
return false;
|
||||
}
|
||||
if (offset >= gTrackVehicleInfo[static_cast<uint8_t>(trackSubposition)][typeAndDirection]->size)
|
||||
if (offset >= gTrackVehicleInfo[EnumValue(trackSubposition)][typeAndDirection]->size)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ static const VehicleInfo* vehicle_get_move_info(
|
|||
static constexpr VehicleInfo zero = {};
|
||||
return &zero;
|
||||
}
|
||||
return &gTrackVehicleInfo[static_cast<uint8_t>(trackSubposition)][typeAndDirection]->info[offset];
|
||||
return &gTrackVehicleInfo[EnumValue(trackSubposition)][typeAndDirection]->info[offset];
|
||||
}
|
||||
|
||||
const VehicleInfo* Vehicle::GetMoveInfo() const
|
||||
|
@ -550,7 +550,7 @@ uint16_t VehicleGetMoveInfoSize(VehicleTrackSubposition trackSubposition, track_
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
return gTrackVehicleInfo[static_cast<uint8_t>(trackSubposition)][typeAndDirection]->size;
|
||||
return gTrackVehicleInfo[EnumValue(trackSubposition)][typeAndDirection]->size;
|
||||
}
|
||||
|
||||
uint16_t Vehicle::GetTrackProgress() const
|
||||
|
|
|
@ -91,7 +91,7 @@ void ClimateReset(ClimateType climate)
|
|||
auto& gameState = GetGameState();
|
||||
auto weather = WeatherType::PartiallyCloudy;
|
||||
int32_t month = GetDate().GetMonth();
|
||||
const WeatherTransition* transition = &ClimateTransitions[static_cast<uint8_t>(climate)][month];
|
||||
const WeatherTransition* transition = &ClimateTransitions[EnumValue(climate)][month];
|
||||
const WeatherState* weatherState = &ClimateWeatherData[EnumValue(weather)];
|
||||
|
||||
gameState.Climate = climate;
|
||||
|
@ -202,7 +202,7 @@ void ClimateForceWeather(WeatherType weather)
|
|||
{
|
||||
auto& gameState = GetGameState();
|
||||
int32_t month = GetDate().GetMonth();
|
||||
const WeatherTransition* transition = &ClimateTransitions[static_cast<uint8_t>(gameState.Climate)][month];
|
||||
const WeatherTransition* transition = &ClimateTransitions[EnumValue(gameState.Climate)][month];
|
||||
const auto weatherState = &ClimateWeatherData[EnumValue(weather)];
|
||||
|
||||
gameState.ClimateCurrent.Weather = weather;
|
||||
|
@ -306,7 +306,7 @@ static void ClimateDetermineFutureWeather(int32_t randomDistribution)
|
|||
|
||||
// Generate a random variable with values 0 up to DistributionSize-1 and chose weather from the distribution table
|
||||
// accordingly
|
||||
const WeatherTransition* transition = &ClimateTransitions[static_cast<uint8_t>(gameState.Climate)][month];
|
||||
const WeatherTransition* transition = &ClimateTransitions[EnumValue(gameState.Climate)][month];
|
||||
WeatherType nextWeather = (transition->Distribution[((randomDistribution & 0xFF) * transition->DistributionSize) >> 8]);
|
||||
gameState.ClimateNext.Weather = nextWeather;
|
||||
|
||||
|
|
Loading…
Reference in New Issue