Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2011
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff -r a33e0abe08ce src/newgrf_callbacks.h
  2. --- a/src/newgrf_callbacks.h    Wed Jan 12 15:33:47 2011 +0000
  3. +++ b/src/newgrf_callbacks.h    Sat Jan 22 19:52:29 2011 +0000
  4. @@ -70,7 +70,7 @@
  5.     /** Called whenever the construction state of a house changes. */
  6.     CBID_HOUSE_CONSTRUCTION_STATE_CHANGE = 0x1C, // 15 bit callback
  7.  
  8. -   /** Determine whether a wagon can be attached to an already existing train. */
  9. +   /** Determine whether an already existing consist will allow a wagon to be attached. */
  10.     CBID_TRAIN_ALLOW_WAGON_ATTACH        = 0x1D,
  11.  
  12.     /** Called to determine the colour of a town building. */
  13. @@ -272,6 +272,10 @@
  14.  
  15.     /** Called to determine if one can alter the ground below an object tile */
  16.     CBID_OBJECT_AUTOSLOPE                = 0x15D, // 15 bit callback
  17. +  
  18. +   /** Determine whether a wagon will allow attaching to an existing consist. */
  19. +   CBID_WAGON_ALLOW_ATTACH_TO_CONSIST   = 0x15E,
  20. +  
  21. };
  22.  
  23. /**
  24. diff -r a33e0abe08ce src/table/newgrf_debug_data.h
  25. --- a/src/table/newgrf_debug_data.h Wed Jan 12 15:33:47 2011 +0000
  26. +++ b/src/table/newgrf_debug_data.h Sat Jan 22 19:52:29 2011 +0000
  27. @@ -40,6 +40,7 @@
  28.     NICV(CBID_VEHICLE_SOUND_EFFECT,          CBM_VEHICLE_SOUND_EFFECT),
  29.     NICV(CBID_VEHICLE_AUTOREPLACE_SELECTION, CBM_NO_BIT),
  30.     NICV(CBID_VEHICLE_MODIFY_PROPERTY,       CBM_NO_BIT),
  31. +   NICV(CBID_WAGON_ALLOW_ATTACH_TO_CONSIST, CBM_NO_BIT),
  32.     NIC_END()
  33. };
  34.  
  35. diff -r a33e0abe08ce src/train_cmd.cpp
  36. --- a/src/train_cmd.cpp Wed Jan 12 15:33:47 2011 +0000
  37. +++ b/src/train_cmd.cpp Sat Jan 22 19:52:29 2011 +0000
  38. @@ -971,6 +971,7 @@
  39.             t->InvalidateNewGRFCache();
  40.  
  41.             uint16 callback = GetVehicleCallbackParent(CBID_TRAIN_ALLOW_WAGON_ATTACH, 0, 0, head->engine_type, t, head);
  42. +           uint16 callback2 = GetVehicleCallback(CBID_WAGON_ALLOW_ATTACH_TO_CONSIST, 0, 0, t->engine_type, t);
  43.  
  44.             /* Restore original first_engine data */
  45.             t->gcache.first_engine = first_engine;
  46. @@ -988,6 +989,17 @@
  47.  
  48.                 if (error != STR_NULL) return_cmd_error(error);
  49.             }
  50. +          
  51. +           if (callback2 != CALLBACK_FAILED) {
  52. +               /* A failing callback means everything is okay */
  53. +               StringID error = STR_NULL;
  54. +              
  55. +               if (callback == 0xFD) error = STR_ERROR_INCOMPATIBLE_RAIL_TYPES;
  56. +               if (callback  < 0xFD) error = GetGRFStringID(GetEngineGRFID(t->engine_type), 0xD000 + callback);
  57. +              
  58. +               if (error != STR_NULL) return_cmd_error(error);
  59. +           }
  60. +          
  61.         }
  62.  
  63.         /* And link it to the new part. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement