diff options
author | rubidium <rubidium@openttd.org> | 2007-10-20 14:51:09 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-10-20 14:51:09 +0000 |
commit | 8212088c03c0a0af451f734391699e5dab8d8608 (patch) | |
tree | 28fbe813d418b83e119aa615200f98b20ba520c8 /src/graph_gui.cpp | |
parent | 54369cba0f9d1cda2d40752eb337d153b3b6775f (diff) | |
download | openttd-8212088c03c0a0af451f734391699e5dab8d8608.tar.xz |
(svn r11312) -Codechange: implement a overflow safe integer and use that for money and don't misuses CommandCost to have a overflow safe integer. Based on a patch by Noldo.
Diffstat (limited to 'src/graph_gui.cpp')
-rw-r--r-- | src/graph_gui.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 7231ec6f3..31f51f578 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -41,8 +41,8 @@ enum { }; /* Apparently these don't play well with enums. */ -static const int64 INVALID_DATAPOINT = INT64_MAX; // Value used for a datapoint that shouldn't be drawn. -static const uint INVALID_DATAPOINT_POS = UINT_MAX; // Used to determine if the previous point was drawn. +static const OverflowSafeInt64 INVALID_DATAPOINT = INT64_MAX; // Value used for a datapoint that shouldn't be drawn. +static const uint INVALID_DATAPOINT_POS = UINT_MAX; // Used to determine if the previous point was drawn. struct GraphDrawer { uint excluded_data; ///< bitmask of the datasets that shouldn't be displayed. @@ -70,9 +70,9 @@ struct GraphDrawer { static void DrawGraph(const GraphDrawer *gw) { - uint x, y; ///< Reused whenever x and y coordinates are needed. - int64 highest_value; ///< Highest value to be drawn. - int x_axis_offset; ///< Distance from the top of the graph to the x axis. + uint x, y; ///< Reused whenever x and y coordinates are needed. + OverflowSafeInt64 highest_value; ///< Highest value to be drawn. + int x_axis_offset; ///< Distance from the top of the graph to the x axis. /* the colors and cost array of GraphDrawer must accomodate * both values for cargo and players. So if any are higher, quit */ @@ -515,7 +515,7 @@ static void DeliveredCargoGraphWndProc(Window *w, WindowEvent *e) if (p->is_active) { gd.colors[numd] = _colour_gradient[p->player_color][6]; for (int j = gd.num_on_x_axis, i = 0; --j >= 0;) { - gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_DATAPOINT : p->old_economy[j].delivered_cargo; + gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_DATAPOINT : (OverflowSafeInt64)p->old_economy[j].delivered_cargo; i++; } } @@ -582,7 +582,7 @@ static void PerformanceHistoryWndProc(Window *w, WindowEvent *e) if (p->is_active) { gd.colors[numd] = _colour_gradient[p->player_color][6]; for (int j = gd.num_on_x_axis, i = 0; --j >= 0;) { - gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_DATAPOINT : p->old_economy[j].performance_history; + gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_DATAPOINT : (OverflowSafeInt64)p->old_economy[j].performance_history; i++; } } |