diff options
author | peter1138 <peter1138@openttd.org> | 2006-05-02 21:43:47 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-05-02 21:43:47 +0000 |
commit | 6c3cc7fd16c92c752450c64ec25e04c68fd08db3 (patch) | |
tree | 0958f8fee6faaca47b93aeacaf65259a216e8669 /train_cmd.c | |
parent | a38c8605b09e272d9def47b163ecf4220b94bad0 (diff) | |
download | openttd-6c3cc7fd16c92c752450c64ec25e04c68fd08db3.tar.xz |
(svn r4703) - NewGRF: add support for callback 0x1D, "can wagon be attached". This can be used to disallow freight wagons to be placed in passenger trains, along with other uses.
Diffstat (limited to 'train_cmd.c')
-rw-r--r-- | train_cmd.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/train_cmd.c b/train_cmd.c index 8d9378848..2b9df49ac 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -27,6 +27,7 @@ #include "train.h" #include "newgrf_callbacks.h" #include "newgrf_engine.h" +#include "newgrf_text.h" #include "direction.h" static bool TrainCheckIfLineEnds(Vehicle *v); @@ -1076,6 +1077,17 @@ int32 CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) if (flags & DC_EXEC) src->unitnumber = unit_num; } + if (dst_head != NULL) { + /* Check NewGRF Callback 0x1D */ + uint16 callback = GetVehicleCallbackParent(CBID_TRAIN_ALLOW_WAGON_ATTACH, 0, 0, dst_head->engine_type, src, dst_head); + if (callback != CALLBACK_FAILED) { + if (callback == 0xFD) return CMD_ERROR; + if (callback < 0xFD) { + StringID error = GetGRFStringID(GetEngineGRFID(dst_head->engine_type), 0xD000 + callback); + return_cmd_error(error); + } + } + } /* do it? */ if (flags & DC_EXEC) { |