1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 20:43:04 +01:00

Merge pull request #16592 from skdltmxn/fix-integer-overflow

Fix staff statistics overflow
This commit is contained in:
Duncan
2022-02-14 21:41:52 +00:00
committed by GitHub
7 changed files with 28 additions and 28 deletions

View File

@@ -1079,37 +1079,37 @@ void WindowStaffStatsPaint(rct_window* w, rct_drawpixelinfo* dpi)
{
case StaffType::Handyman:
ft = Formatter();
ft.Add<uint16_t>(peep->StaffLawnsMown);
ft.Add<uint32_t>(peep->StaffLawnsMown);
DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_LAWNS_MOWN, ft);
screenCoords.y += LIST_ROW_HEIGHT;
ft = Formatter();
ft.Add<uint16_t>(peep->StaffGardensWatered);
ft.Add<uint32_t>(peep->StaffGardensWatered);
DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_GARDENS_WATERED, ft);
screenCoords.y += LIST_ROW_HEIGHT;
ft = Formatter();
ft.Add<uint16_t>(peep->StaffLitterSwept);
ft.Add<uint32_t>(peep->StaffLitterSwept);
DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_LITTER_SWEPT, ft);
screenCoords.y += LIST_ROW_HEIGHT;
ft = Formatter();
ft.Add<uint16_t>(peep->StaffBinsEmptied);
ft.Add<uint32_t>(peep->StaffBinsEmptied);
DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_BINS_EMPTIED, ft);
break;
case StaffType::Mechanic:
ft = Formatter();
ft.Add<uint16_t>(peep->StaffRidesInspected);
ft.Add<uint32_t>(peep->StaffRidesInspected);
DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_RIDES_INSPECTED, ft);
screenCoords.y += LIST_ROW_HEIGHT;
ft = Formatter();
ft.Add<uint16_t>(peep->StaffRidesFixed);
ft.Add<uint32_t>(peep->StaffRidesFixed);
DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_RIDES_FIXED, ft);
break;
case StaffType::Security:
ft = Formatter();
ft.Add<uint16_t>(peep->StaffVandalsStopped);
ft.Add<uint32_t>(peep->StaffVandalsStopped);
DrawTextBasic(dpi, screenCoords, STR_STAFF_STAT_VANDALS_STOPPED, ft);
break;
case StaffType::Entertainer:

View File

@@ -38,20 +38,20 @@ public:
uint8_t StaffMowingTimeout;
union
{
uint16_t StaffLawnsMown;
uint16_t StaffRidesFixed;
uint32_t StaffLawnsMown;
uint32_t StaffRidesFixed;
};
union
{
uint16_t StaffGardensWatered;
uint16_t StaffRidesInspected;
uint32_t StaffGardensWatered;
uint32_t StaffRidesInspected;
};
union
{
uint16_t StaffLitterSwept;
uint16_t StaffVandalsStopped;
uint32_t StaffLitterSwept;
uint32_t StaffVandalsStopped;
};
uint16_t StaffBinsEmptied;
uint32_t StaffBinsEmptied;
void UpdateStaff(uint32_t stepsToTake);
void Tick128UpdateStaff();

View File

@@ -42,7 +42,7 @@
// This string specifies which version of network stream current build uses.
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "15"
#define NETWORK_STREAM_VERSION "16"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
static Peep* _pickup_peep = nullptr;

View File

@@ -8,10 +8,10 @@ struct ObjectRepositoryItem;
namespace OpenRCT2
{
// Current version that is saved.
constexpr uint32_t PARK_FILE_CURRENT_VERSION = 0x8;
constexpr uint32_t PARK_FILE_CURRENT_VERSION = 0x9;
// The minimum version that is forwards compatible with the current version.
constexpr uint32_t PARK_FILE_MIN_VERSION = 0x8;
constexpr uint32_t PARK_FILE_MIN_VERSION = 0x9;
constexpr uint32_t PARK_FILE_MAGIC = 0x4B524150; // PARK