Skip to content

Commit 965f898

Browse files
committed
Implements "Construction yard exists" trigger event.
1 parent 9cebf8b commit 965f898

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

src/extensions/tevent/teventext.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ const char *TEventClassExtension::Event_Name(int action)
205205
return "Power Greater Than...";
206206
case TEVENT_INFANTRY_DESTROYED:
207207
return "Destroyed, Infantry, All...";
208+
case TEVENT_CONSTRUCTION_YARD:
209+
return "Construction yard exists";
208210
default:
209211
return "<invalid>";
210212
}
@@ -249,6 +251,8 @@ const char *TEventClassExtension::Event_Description(int action)
249251
return "Triggers if the specified house's power is greater than or equal to the value specified.";
250252
case TEVENT_INFANTRY_DESTROYED:
251253
return "Triggers when all infantry of the specified side have been destroyed. Typically used for end of game conditions.";
254+
case TEVENT_CONSTRUCTION_YARD:
255+
return "Triggers if the specified house has one or more construction yards.";
252256
default:
253257
return "<invalid>";
254258
}
@@ -663,3 +667,18 @@ bool TEventClassExtension::Infantry_Destroyed(TEventClass *this_ptr, TEventType
663667

664668
return false;
665669
}
670+
671+
672+
/**
673+
* Evaluation function for "TEVENT_CONSTRUCTION_YARD".
674+
*
675+
* @author: CCHyper
676+
*/
677+
bool TEventClassExtension::House_Has_Construction_Yard(TEventClass *this_ptr, TEventType event, HouseClass *house, const ObjectClass *object, TDEventClass &td, bool &tripped, TechnoClass *source)
678+
{
679+
if (house->ConstructionYards.Count() > 0) {
680+
return true;
681+
}
682+
683+
return false;
684+
}

src/extensions/tevent/teventext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,5 @@ TEventClassExtension final : public AbstractClassExtension
9191
static bool Power_Less_Than(TEventClass *this_ptr, TEventType event, HouseClass *house, const ObjectClass *object, TDEventClass &td, bool &tripped, TechnoClass *source);
9292
static bool Power_Greater_Than(TEventClass *this_ptr, TEventType event, HouseClass *house, const ObjectClass *object, TDEventClass &td, bool &tripped, TechnoClass *source);
9393
static bool Infantry_Destroyed(TEventClass *this_ptr, TEventType event, HouseClass *house, const ObjectClass *object, TDEventClass &td, bool &tripped, TechnoClass *source);
94+
static bool House_Has_Construction_Yard(TEventClass *this_ptr, TEventType event, HouseClass *house, const ObjectClass *object, TDEventClass &td, bool &tripped, TechnoClass *source);
9495
};

src/vinifera/vinifera_defines.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ typedef enum ExtTEventType
185185
TEVENT_POWER_LESS_THAN,
186186
TEVENT_POWER_GREATER_THAN,
187187
TEVENT_INFANTRY_DESTROYED,
188+
TEVENT_CONSTRUCTION_YARD,
188189

189190
/**
190191
* The new total ExtTEventType count.

0 commit comments

Comments
 (0)