1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +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

@@ -68,9 +68,9 @@ set(OBJECTS_VERSION "1.2.6")
set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v${OBJECTS_VERSION}/objects.zip")
set(OBJECTS_SHA1 "cd86dd2e42edb513b18293ef7ae52a93a7cdfc57")
set(REPLAYS_VERSION "0.0.63")
set(REPLAYS_VERSION "0.0.64")
set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v${REPLAYS_VERSION}/replays.zip")
set(REPLAYS_SHA1 "1614D0B51393AC73C7CA23402B5B87D082EA3002")
set(REPLAYS_SHA1 "E8DA520B3462090D894F0E7B844C5AB646BFB12E")
option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.")
option(WITH_TESTS "Build tests")

View File

@@ -1700,12 +1700,12 @@ STR_2347 :{RED}{STRINGID} has drowned!
STR_2348 :Show statistics for this staff member
STR_2349 :{WINDOW_COLOUR_2}Wages: {BLACK}{CURRENCY} per month
STR_2350 :{WINDOW_COLOUR_2}Employed: {BLACK}{MONTHYEAR}
STR_2351 :{WINDOW_COLOUR_2}Lawns mown: {BLACK}{COMMA16}
STR_2352 :{WINDOW_COLOUR_2}Gardens watered: {BLACK}{COMMA16}
STR_2353 :{WINDOW_COLOUR_2}Litter swept: {BLACK}{COMMA16}
STR_2354 :{WINDOW_COLOUR_2}Bins emptied: {BLACK}{COMMA16}
STR_2355 :{WINDOW_COLOUR_2}Rides fixed: {BLACK}{COMMA16}
STR_2356 :{WINDOW_COLOUR_2}Rides inspected: {BLACK}{COMMA16}
STR_2351 :{WINDOW_COLOUR_2}Lawns mown: {BLACK}{COMMA32}
STR_2352 :{WINDOW_COLOUR_2}Gardens watered: {BLACK}{COMMA32}
STR_2353 :{WINDOW_COLOUR_2}Litter swept: {BLACK}{COMMA32}
STR_2354 :{WINDOW_COLOUR_2}Bins emptied: {BLACK}{COMMA32}
STR_2355 :{WINDOW_COLOUR_2}Rides fixed: {BLACK}{COMMA32}
STR_2356 :{WINDOW_COLOUR_2}Rides inspected: {BLACK}{COMMA32}
STR_2358 :Units
STR_2359 :Real Values
STR_2360 :Display Resolution:
@@ -3624,7 +3624,7 @@ STR_6431 :RMB
STR_6432 :Mouse {INT32}
STR_6433 :Remove
STR_6434 :Remove all bindings for this shortcut.
STR_6435 :{WINDOW_COLOUR_2}Vandals stopped: {BLACK}{COMMA16}
STR_6435 :{WINDOW_COLOUR_2}Vandals stopped: {BLACK}{COMMA32}
STR_6436 :Toggle invisibility
STR_6437 :Visible
STR_6438 :V

View File

@@ -48,8 +48,8 @@
<TitleSequencesSha1>304d13a126c15bf2c86ff13b81a2f2cc1856ac8d</TitleSequencesSha1>
<ObjectsUrl>https://github.com/OpenRCT2/objects/releases/download/v1.2.6/objects.zip</ObjectsUrl>
<ObjectsSha1>cd86dd2e42edb513b18293ef7ae52a93a7cdfc57</ObjectsSha1>
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.63/replays.zip</ReplaysUrl>
<ReplaysSha1>1614D0B51393AC73C7CA23402B5B87D082EA3002</ReplaysSha1>
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.64/replays.zip</ReplaysUrl>
<ReplaysSha1>E8DA520B3462090D894F0E7B844C5AB646BFB12E</ReplaysSha1>
</PropertyGroup>
<ItemGroup>

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