diff options
author | frosch <frosch@openttd.org> | 2010-04-13 19:10:08 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-04-13 19:10:08 +0000 |
commit | 1f28e232c3e3da4f11ddc7d12d3618c489c32625 (patch) | |
tree | b49964c58925414c042a0f5bcd59dfa7988ffa73 /src/ship_cmd.cpp | |
parent | 088282bcf8ce6d301fd8a5b0d8a3409bceaab32d (diff) | |
download | openttd-1f28e232c3e3da4f11ddc7d12d3618c489c32625.tar.xz |
(svn r19621) -Codechange: Remove direct usage of magic 'p1's in build vehicle commands.
Diffstat (limited to 'src/ship_cmd.cpp')
-rw-r--r-- | src/ship_cmd.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 6f5528600..5de839bf7 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -611,11 +611,12 @@ bool Ship::Tick() */ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) { + EngineID eid = GB(p1, 0, 16); UnitID unit_num; - if (!IsEngineBuildable(p1, VEH_SHIP, _current_company)) return_cmd_error(STR_ERROR_SHIP_NOT_AVAILABLE); + if (!IsEngineBuildable(eid, VEH_SHIP, _current_company)) return_cmd_error(STR_ERROR_SHIP_NOT_AVAILABLE); - const Engine *e = Engine::Get(p1); + const Engine *e = Engine::Get(eid); CommandCost value(EXPENSES_NEW_VEHICLES, e->GetCost()); /* Engines without valid cargo should not be available */ @@ -660,7 +661,7 @@ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 v->last_station_visited = INVALID_STATION; v->max_speed = svi->max_speed; - v->engine_type = p1; + v->engine_type = eid; v->reliability = e->reliability; v->reliability_spd_dec = e->reliability_spd_dec; @@ -692,7 +693,7 @@ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Ship window } - Company::Get(_current_company)->num_engines[p1]++; + Company::Get(_current_company)->num_engines[eid]++; } return value; |