diff options
author | celestar <celestar@openttd.org> | 2007-01-11 11:05:01 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2007-01-11 11:05:01 +0000 |
commit | 2ac0410767683fb0e6315433f9805712cb85f5bd (patch) | |
tree | f9cb6bcd0d0b855706d1e00e0a4ffd2757c7e039 /src/depot_gui.cpp | |
parent | 7996c9e560f61cddba0a3ad48b95c81d9030ef99 (diff) | |
download | openttd-2ac0410767683fb0e6315433f9805712cb85f5bd.tar.xz |
(svn r8055) -Codechange: Replace the different max, dmax, maxu whatever macros by a simple template function max(), that requires two arguments of the same type. While I'm at it change a variable called "max" to "maxval" in a function that calls max().
Diffstat (limited to 'src/depot_gui.cpp')
-rw-r--r-- | src/depot_gui.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index d929696b8..395ef99e6 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -194,7 +194,8 @@ static void DrawDepotWindow(Window *w) { Vehicle **vl = WP(w, depot_d).vehicle_list; TileIndex tile = w->window_number; - int x, y, i, hnum, max; + int x, y, i, maxval; + uint16 hnum; uint16 num = WP(w, depot_d).engine_count; /* Set the row and number of boxes in each row based on the number of boxes drawn in the matrix */ @@ -218,7 +219,7 @@ static void DrawDepotWindow(Window *w) hnum = 8; for (num = 0; num < WP(w, depot_d).engine_count; num++) { const Vehicle *v = vl[num]; - hnum = maxu(hnum, v->u.rail.cached_total_length); + hnum = max(hnum, v->u.rail.cached_total_length); } /* Always have 1 empty row, so people can change the setting of the train */ SetVScrollCount(w, WP(w, depot_d).engine_count + WP(w, depot_d).wagon_count + 1); @@ -240,22 +241,22 @@ static void DrawDepotWindow(Window *w) DrawWindowWidgets(w); num = w->vscroll.pos * boxes_in_each_row; - max = min(WP(w, depot_d).engine_count, num + (rows_in_display * boxes_in_each_row)); + maxval = min(WP(w, depot_d).engine_count, num + (rows_in_display * boxes_in_each_row)); - for (x = 2, y = 15; num < max; y += w->resize.step_height, x = 2) { // Draw the rows + for (x = 2, y = 15; num < maxval; y += w->resize.step_height, x = 2) { // Draw the rows byte i; - for (i = 0; i < boxes_in_each_row && num < max; i++, num++, x += w->resize.step_width) { + for (i = 0; i < boxes_in_each_row && num < maxval; i++, num++, x += w->resize.step_width) { /* Draw all vehicles in the current row */ const Vehicle *v = vl[num]; DrawVehicleInDepot(w, v, x, y); } } - max = min(WP(w, depot_d).engine_count + WP(w, depot_d).wagon_count, (w->vscroll.pos * boxes_in_each_row) + (rows_in_display * boxes_in_each_row)); + maxval = min(WP(w, depot_d).engine_count + WP(w, depot_d).wagon_count, (w->vscroll.pos * boxes_in_each_row) + (rows_in_display * boxes_in_each_row)); /* draw the train wagons, that do not have an engine in front */ - for (; num < max; num++, y += 14) { + for (; num < maxval; num++, y += 14) { const Vehicle *v = WP(w, depot_d).wagon_list[num - WP(w, depot_d).engine_count]; const Vehicle *u; |