diff options
author | peter1138 <peter1138@openttd.org> | 2008-01-30 10:27:45 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2008-01-30 10:27:45 +0000 |
commit | 1cdee354b490d4c1dbbfe05f51322b2b143cb392 (patch) | |
tree | 22f875899541e51c8617d9f8deec54d43ce51599 /src | |
parent | 94aa04948c35a08fadc26a1213440f83fc1f6825 (diff) | |
download | openttd-1cdee354b490d4c1dbbfe05f51322b2b143cb392.tar.xz |
(svn r12019) -Codechange: Add support for passenger engine designation for AI-use, NewGRF property 0x08 for trains.
Diffstat (limited to 'src')
-rw-r--r-- | src/ai/default/default.cpp | 3 | ||||
-rw-r--r-- | src/engine.h | 1 | ||||
-rw-r--r-- | src/newgrf.cpp | 5 | ||||
-rw-r--r-- | src/table/engines.h | 2 |
4 files changed, 7 insertions, 4 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp index 957ba653e..7bddaa2cb 100644 --- a/src/ai/default/default.cpp +++ b/src/ai/default/default.cpp @@ -154,6 +154,9 @@ static EngineID AiChooseTrainToBuild(RailType railtype, Money money, byte flag, continue; } + /* Don't choose an engine designated for passenger use for freight. */ + if (rvi->ai_passenger_only != 0 && flag == 1) continue; + CommandCost ret = DoCommand(tile, i, 0, 0, CMD_BUILD_RAIL_VEHICLE); if (CmdSucceeded(ret) && ret.GetCost() <= money && rvi->ai_rank >= best_veh_score) { best_veh_score = rvi->ai_rank; diff --git a/src/engine.h b/src/engine.h index 69fff1c20..38f824522 100644 --- a/src/engine.h +++ b/src/engine.h @@ -42,6 +42,7 @@ struct RailVehicleInfo { byte capacity; CargoID cargo_type; byte ai_rank; + byte ai_passenger_only; ///< Bit value to tell AI that this engine is for passenger use only uint16 pow_wag_power; byte pow_wag_weight; byte visual_effect; // NOTE: this is not 100% implemented yet, at the moment it is only used as a 'fallback' value diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 119def0d5..d5fdb161b 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -348,10 +348,9 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf } break; case 0x08: // AI passenger service - /** @todo Tells the AI that this engine is designed for + /* Tells the AI that this engine is designed for * passenger services and shouldn't be used for freight. */ - grf_load_byte(&buf); - ret = true; + rvi->ai_passenger_only = grf_load_byte(&buf); break; case 0x09: { // Speed (1 unit is 1 kmh) diff --git a/src/table/engines.h b/src/table/engines.h index e02a4850b..9faa06e42 100644 --- a/src/table/engines.h +++ b/src/table/engines.h @@ -345,7 +345,7 @@ const EngineInfo _orig_engine_info[] = { * @param m engclass * Tractive effort coefficient by default is the same as TTDPatch, 0.30*256=76 */ -#define RVI(a, b, c, d, e, f, g, h, i, j, k, l, m) { a, b, c, {l}, d, e, f, g, h, m, i, j, k, 0, 0, 0, 0, 76, 0 } +#define RVI(a, b, c, d, e, f, g, h, i, j, k, l, m) { a, b, c, {l}, d, e, f, g, h, m, i, j, k, 0, 0, 0, 0, 0, 76, 0 } #define M RAILVEH_MULTIHEAD #define W RAILVEH_WAGON #define G RAILVEH_SINGLEHEAD |