summaryrefslogtreecommitdiff
path: root/road_cmd.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2005-11-23 15:08:29 +0000
committertruelight <truelight@openttd.org>2005-11-23 15:08:29 +0000
commit8315736569fc09518d7e2193c6c2f2f7986d0575 (patch)
tree39b2634d00d2ef0c50327795368bd790f4a2d3af /road_cmd.c
parent062d654df11a2a5d2bfa62a12781ed8665ed394f (diff)
downloadopenttd-8315736569fc09518d7e2193c6c2f2f7986d0575.tar.xz
(svn r3232) -Add: implemented the event-system for AIs
-Add: added several hooks (event-callbacks) for road-related-stuff
Diffstat (limited to 'road_cmd.c')
-rw-r--r--road_cmd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/road_cmd.c b/road_cmd.c
index 34382402c..4592bd7a0 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -17,6 +17,7 @@
#include "depot.h"
#include "pbs.h"
#include "debug.h"
+#include "ai/ai_event.h"
/* When true, GetTrackStatus for roads will treat roads under reconstruction
* as normal roads instead of impassable. This is used when detecting whether
@@ -671,6 +672,8 @@ int32 CmdBuildRoadDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
(p1 | 0x20) /* map5 */
);
+ ai_event(_current_player, ottd_Event_BuildDepot, dep->index, tile);
+ ai_event(_current_player, ottd_Event_BuildRoadDepot, dep->index, tile);
}
return cost + _price.build_road_depot;
}
@@ -1156,6 +1159,10 @@ static uint32 VehicleEnter_Road(Vehicle *v, TileIndex tile, int x, int y)
if (v->type == VEH_Road && v->u.road.frame == 11) {
if (_roadveh_enter_depot_unk0[GB(_m[tile].m5, 0, 2)] == v->u.road.state) {
RoadVehEnterDepot(v);
+
+ ai_event(v->owner, ottd_Event_VehicleEnterDepot, v->index, tile);
+ ai_event(v->owner, ottd_Event_RoadVehicleEnterDepot, v->index, tile);
+
return 4;
}
}