Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -r a33e0abe08ce src/newgrf_callbacks.h
- --- a/src/newgrf_callbacks.h Wed Jan 12 15:33:47 2011 +0000
- +++ b/src/newgrf_callbacks.h Sat Jan 22 19:52:29 2011 +0000
- @@ -70,7 +70,7 @@
- /** Called whenever the construction state of a house changes. */
- CBID_HOUSE_CONSTRUCTION_STATE_CHANGE = 0x1C, // 15 bit callback
- - /** Determine whether a wagon can be attached to an already existing train. */
- + /** Determine whether an already existing consist will allow a wagon to be attached. */
- CBID_TRAIN_ALLOW_WAGON_ATTACH = 0x1D,
- /** Called to determine the colour of a town building. */
- @@ -272,6 +272,10 @@
- /** Called to determine if one can alter the ground below an object tile */
- CBID_OBJECT_AUTOSLOPE = 0x15D, // 15 bit callback
- +
- + /** Determine whether a wagon will allow attaching to an existing consist. */
- + CBID_WAGON_ALLOW_ATTACH_TO_CONSIST = 0x15E,
- +
- };
- /**
- diff -r a33e0abe08ce src/table/newgrf_debug_data.h
- --- a/src/table/newgrf_debug_data.h Wed Jan 12 15:33:47 2011 +0000
- +++ b/src/table/newgrf_debug_data.h Sat Jan 22 19:52:29 2011 +0000
- @@ -40,6 +40,7 @@
- NICV(CBID_VEHICLE_SOUND_EFFECT, CBM_VEHICLE_SOUND_EFFECT),
- NICV(CBID_VEHICLE_AUTOREPLACE_SELECTION, CBM_NO_BIT),
- NICV(CBID_VEHICLE_MODIFY_PROPERTY, CBM_NO_BIT),
- + NICV(CBID_WAGON_ALLOW_ATTACH_TO_CONSIST, CBM_NO_BIT),
- NIC_END()
- };
- diff -r a33e0abe08ce src/train_cmd.cpp
- --- a/src/train_cmd.cpp Wed Jan 12 15:33:47 2011 +0000
- +++ b/src/train_cmd.cpp Sat Jan 22 19:52:29 2011 +0000
- @@ -971,6 +971,7 @@
- t->InvalidateNewGRFCache();
- uint16 callback = GetVehicleCallbackParent(CBID_TRAIN_ALLOW_WAGON_ATTACH, 0, 0, head->engine_type, t, head);
- + uint16 callback2 = GetVehicleCallback(CBID_WAGON_ALLOW_ATTACH_TO_CONSIST, 0, 0, t->engine_type, t);
- /* Restore original first_engine data */
- t->gcache.first_engine = first_engine;
- @@ -988,6 +989,17 @@
- if (error != STR_NULL) return_cmd_error(error);
- }
- +
- + if (callback2 != CALLBACK_FAILED) {
- + /* A failing callback means everything is okay */
- + StringID error = STR_NULL;
- +
- + if (callback == 0xFD) error = STR_ERROR_INCOMPATIBLE_RAIL_TYPES;
- + if (callback < 0xFD) error = GetGRFStringID(GetEngineGRFID(t->engine_type), 0xD000 + callback);
- +
- + if (error != STR_NULL) return_cmd_error(error);
- + }
- +
- }
- /* And link it to the new part. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement