summaryrefslogtreecommitdiff
path: root/train_gui.c
diff options
context:
space:
mode:
authorhackykid <hackykid@openttd.org>2005-06-05 15:37:00 +0000
committerhackykid <hackykid@openttd.org>2005-06-05 15:37:00 +0000
commiteb173099e92b0004fb9fd23253d9500481079a52 (patch)
tree6e71df41bc09c11b7f906d7ef2ea613673f6e33c /train_gui.c
parent9ac03e71816b2d9227e4705f7ec5166bfdd710eb (diff)
downloadopenttd-eb173099e92b0004fb9fd23253d9500481079a52.tar.xz
(svn r2411) - Codechange: Have trains cache stuff like consist power/weight/max speed instead of recalculating it each time.
- Fix: Station ratings now depends on the max speed of a consist, without being affected by other speed limits from realistic acceleration.
Diffstat (limited to 'train_gui.c')
-rw-r--r--train_gui.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/train_gui.c b/train_gui.c
index fad335d32..3d7c09435 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -979,7 +979,6 @@ static void DrawTrainDetailsWindow(Window *w)
{
const Vehicle *v, *u;
uint16 tot_cargo[NUM_CARGO][2]; // count total cargo ([0]-actual cargo, [1]-total cargo)
- int max_speed = 0xFFFF;
int i,num,x,y,sel;
StringID str;
byte det_tab = WP(w, traindetails_d).tab;
@@ -999,8 +998,6 @@ static void DrawTrainDetailsWindow(Window *w)
tot_cargo[u->cargo_type][0] += u->cargo_count;
tot_cargo[u->cargo_type][1] += u->cargo_cap;
}
- if (RailVehInfo(u->engine_type)->max_speed != 0)
- max_speed = min(max_speed, RailVehInfo(u->engine_type)->max_speed);
} while ( (u = u->next) != NULL);
/* set scroll-amount seperately from counting, as to not
@@ -1043,7 +1040,7 @@ static void DrawTrainDetailsWindow(Window *w)
SetDParam(3, GetTrainRunningCost(v) >> 8);
DrawString(x, 15, STR_885D_AGE_RUNNING_COST_YR, 0);
- SetDParam(2, max_speed * 10 >> 4);
+ SetDParam(2, v->u.rail.cached_max_speed * 10 >> 4);
SetDParam(1, v->u.rail.cached_power);
SetDParam(0, v->u.rail.cached_weight);
DrawString(x, 25, STR_885E_WEIGHT_T_POWER_HP_MAX_SPEED, 0);