(svn r12019) -Codechange: Add support for passenger engine designation for AI-use, NewGRF property 0x08 for trains.

This commit is contained in:
peter1138 2008-01-30 10:27:45 +00:00
parent 94aa04948c
commit 1cdee354b4
4 changed files with 7 additions and 4 deletions

View File

@ -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;

View File

@ -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

View File

@ -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)

View File

@ -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