summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-11-16 14:07:34 +0000
committertron <tron@openttd.org>2005-11-16 14:07:34 +0000
commit96dea28eaeac76daa5c8ca7e5e1e64ee3fcc0360 (patch)
tree44a3729c9f3a8af0b9157ed9316a0de163729f33 /train_cmd.c
parent5cceeaa37f33a0ad426fb7bed446448e5ff943e5 (diff)
downloadopenttd-96dea28eaeac76daa5c8ca7e5e1e64ee3fcc0360.tar.xz
(svn r3208) Don't explicitly pass the engine type to look for to GetRearEngine(), because it's the engine type of the vehicle which gets passed as first parameter
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/train_cmd.c b/train_cmd.c
index 31e74ee75..f933984e7 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -1080,13 +1080,13 @@ int32 CmdStartStopTrain(int x, int y, uint32 flags, uint32 p1, uint32 p2)
* engine is 'started', first 'close' that before 'closing' our
* searched engine
*/
-Vehicle *GetRearEngine(const Vehicle *v, EngineID engine)
+Vehicle* GetRearEngine(const Vehicle* v)
{
Vehicle *u;
int en_count = 1;
for (u = v->next; u != NULL; u = u->next) {
- if (u->engine_type == engine) { // find matching engine
+ if (u->engine_type == v->engine_type) { // find matching engine
en_count += (IS_FIRSTHEAD_SPRITE(u->spritenum)) ? +1 : -1;
if (en_count == 0) return (Vehicle *)u;
@@ -1142,7 +1142,7 @@ int32 CmdSellRailWagon(int x, int y, uint32 flags, uint32 p1, uint32 p2)
/* 1. Delete the engine, if it is dualheaded also delete the matching
* rear engine of the loco (from the point of deletion onwards) */
- Vehicle *rear = (RailVehInfo(v->engine_type)->flags & RVI_MULTIHEAD) ? GetRearEngine(v, v->engine_type) : NULL;
+ Vehicle* rear = (RailVehInfo(v->engine_type)->flags & RVI_MULTIHEAD) ? GetRearEngine(v) : NULL;
if (rear != NULL) {
cost -= v->value;
if (flags & DC_EXEC) {