Fix types passed to printf-like functions

This commit is contained in:
Michał Janiszewski 2019-02-09 22:54:33 +01:00
parent be491d3c6f
commit 70ef8151fc
6 changed files with 14 additions and 13 deletions

View File

@ -217,7 +217,7 @@ public:
if (tileElement == nullptr)
{
Ride* ride = get_ride(_rideIndex);
openrct2_assert(ride != nullptr, "Invalid ride index: %d\n", _rideIndex);
openrct2_assert(ride != nullptr, "Invalid ride index: %d\n", uint32_t(_rideIndex));
money32 price = (((RideTrackCosts[ride->type].track_price * TrackPricing[TRACK_ELEM_MAZE]) >> 16));
res->Cost = price / 2 * 10;

View File

@ -56,7 +56,7 @@ public:
Ride* ride = get_ride(_rideIndex);
if (ride->type == RIDE_TYPE_NULL)
{
log_warning("Invalid game command for ride %u", _rideIndex);
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_DEMOLISH_RIDE, STR_NONE);
}
@ -101,7 +101,7 @@ public:
Ride* ride = get_ride(_rideIndex);
if (ride->type == RIDE_TYPE_NULL)
{
log_warning("Invalid game command for ride %u", _rideIndex);
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_DEMOLISH_RIDE, STR_NONE);
}

View File

@ -70,14 +70,14 @@ public:
{
if (_rideIndex >= MAX_RIDES || _rideIndex == RIDE_ID_NULL)
{
log_warning("Invalid game command for ride %u", _rideIndex);
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
}
Ride* ride = get_ride(_rideIndex);
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
{
log_warning("Invalid game command, ride_id = %u", _rideIndex);
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
}
@ -117,7 +117,7 @@ public:
Ride* ride = get_ride(_rideIndex);
if (ride == nullptr)
{
log_warning("Invalid game command, ride_id = %u", _rideIndex);
log_warning("Invalid game command, ride_id = %u", uint32_t(_rideIndex));
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
}

View File

@ -55,7 +55,7 @@ public:
Ride* ride = get_ride(_rideIndex);
if (ride->type == RIDE_TYPE_NULL)
{
log_warning("Invalid game command for ride %u", _rideIndex);
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_RENAME_RIDE_ATTRACTION, STR_NONE);
}
@ -85,7 +85,7 @@ public:
Ride* ride = get_ride(_rideIndex);
if (ride->type == RIDE_TYPE_NULL)
{
log_warning("Invalid game command for ride %u", _rideIndex);
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_CANT_RENAME_RIDE_ATTRACTION, STR_NONE);
}

View File

@ -65,7 +65,7 @@ public:
if (_rideIndex >= MAX_RIDES || _rideIndex < 0)
{
log_warning("Invalid game command for ride %u", _rideIndex);
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
res->Error = GA_ERROR::INVALID_PARAMETERS;
res->ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
return res;
@ -107,7 +107,7 @@ public:
if (ride->type == RIDE_TYPE_NULL)
{
log_warning("Invalid game command for ride %u", _rideIndex);
log_warning("Invalid game command for ride %u", uint32_t(_rideIndex));
res->Error = GA_ERROR::INVALID_PARAMETERS;
res->ErrorMessage = STR_INVALID_SELECTION_OF_OBJECTS;
return res;

View File

@ -342,9 +342,10 @@ public:
void AddObjectFromFile(const std::string_view& objectName, const void* data, size_t dataSize) override
{
utf8 path[MAX_PATH];
GetPathForNewObject(path, sizeof(path), std::string(objectName).c_str());
std::string objectNameString(objectName);
GetPathForNewObject(path, sizeof(path), objectNameString.c_str());
log_verbose("Adding object: [%s]", objectName);
log_verbose("Adding object: [%s]", objectNameString.c_str());
try
{
File::WriteAllBytes(path, data, dataSize);
@ -352,7 +353,7 @@ public:
}
catch (const std::exception&)
{
Console::Error::WriteLine("Failed saving object: [%s] to '%s'.", objectName, path);
Console::Error::WriteLine("Failed saving object: [%s] to '%s'.", objectNameString.c_str(), path);
}
}