#include <src/Misc/JammerClass.h>
List of all members.
Public Member Functions |
| JammerClass (TechnoClass *GameObject) |
| JammerClass (TechnoClass *GameObject, TechnoExt::ExtData *pExt) |
void | UnjamAll () |
| Unregisters this Jammer on all structures.
|
void | Update () |
| Updates this Jammer's status on all eligible structures.
|
Private Member Functions |
bool | InRangeOf (BuildingClass *) |
| Calculates if the jammer is in range of this building.
|
bool | IsEligible (BuildingClass *) |
| Checks if this building can/should be jammed.
|
void | Jam (BuildingClass *) |
| Attempts to jam the given building. (Actually just registers the Jammer with it, the jamming happens in a hook.)
|
void | Unjam (BuildingClass *) |
| Attempts to unjam the given building. (Actually just unregisters the Jammer with it, the unjamming happens in a hook.)
|
Private Attributes |
int | LastScan |
| Frame number when the last scan was performed.
|
TechnoClass * | AttachedToObject |
| Pointer to game object this jammer is on.
|
TechnoExt::ExtData * | Ext |
| Pointer to the ExtData object this jammer is in.
|
Static Private Attributes |
static const int | ScanInterval = 30 |
| Minimum delay between scans in frames (two seconds/thirty frames).
|
Constructor & Destructor Documentation
JammerClass::JammerClass |
( |
TechnoClass * |
GameObject | ) |
[inline] |
Member Function Documentation
bool JammerClass::InRangeOf |
( |
BuildingClass * |
TargetBuilding | ) |
[private] |
Calculates if the jammer is in range of this building.
- Parameters:
-
TargetBuilding | The building to check the distance to. |
bool JammerClass::IsEligible |
( |
BuildingClass * |
TargetBuilding | ) |
[private] |
Checks if this building can/should be jammed.
- Parameters:
-
TargetBuilding | The building whose eligibility to check. |
{
return (!this->AttachedToObject->Owner->IsAlliedWith(TargetBuilding->Owner)
&& (TargetBuilding->Type->Radar || TargetBuilding->Type->SpySat));
}
void JammerClass::Jam |
( |
BuildingClass * |
TargetBuilding | ) |
[private] |
Attempts to jam the given building. (Actually just registers the Jammer with it, the jamming happens in a hook.)
- Parameters:
-
TargetBuilding | The building to jam. |
void JammerClass::Unjam |
( |
BuildingClass * |
TargetBuilding | ) |
[private] |
Attempts to unjam the given building. (Actually just unregisters the Jammer with it, the unjamming happens in a hook.)
- Parameters:
-
TargetBuilding | The building to unjam. |
void JammerClass::UnjamAll |
( |
| ) |
|
Unregisters this Jammer on all structures.
void JammerClass::Update |
( |
| ) |
|
Updates this Jammer's status on all eligible structures.
{
if((Unsorted::CurrentFrame - this->LastScan) < this->ScanInterval) {
return;
}
for(int i = 0; i < BuildingClass::Array->Count; ++i) {
BuildingClass* curBuilding = BuildingClass::Array->GetItem(i);
if(this->IsEligible(curBuilding)) {
if(this->InRangeOf(curBuilding)) {
this->Jam(curBuilding);
} else {
this->Unjam(curBuilding);
}
} else {
this->Unjam(curBuilding);
}
}
this->LastScan = Unsorted::CurrentFrame;
}
Member Data Documentation
Pointer to game object this jammer is on.
Pointer to the ExtData object this jammer is in.
Frame number when the last scan was performed.
Minimum delay between scans in frames (two seconds/thirty frames).
The documentation for this class was generated from the following files: