MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / EntityAI

Method EntityAI

engine/Poseidon/AI/VehicleAI.cpp:1069–1173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1067*/
1068
1069EntityAI::EntityAI(EntityAIType* type, bool fullCreate)
1070 : Entity(type->_shape, type, -1),
1071
1072 _lockedBeg(VZero), _lockedSoldier(false), _stratGoToPos(VZero),
1073
1074 _avoidSpeed(1e5), _avoidSpeedTime(TIME_MIN),
1075
1076 _avoidAside(0), _avoidAsideWanted(0), // obstacle avoidance offset
1077 _lastSimplePath(TIME_MIN),
1078
1079 _isDead(false), _isStopped(false), _isUpsideDown(false), _userStopped(false), _pilotLight(false),
1080
1081 _showFlag(true), _laserTargetOn(false),
1082
1083 _inFormation(true),
1084
1085 _shootVisible(0), _shootAudible(0), _shootTimeRest(1e10), _allowDammage(true),
1086
1087 _locked(false), _tempLocked(false), _locker(new AILocker()),
1088
1089 // when we scanned for visible targets
1090 _trackTargetsTime(TIME_MIN), _trackNearTargetsTime(TIME_MIN), _newTargetsTime(TIME_MIN),
1091 _nearestEnemy(1e10), // nearest known enemy
1092 _sensorColID(-1),
1093
1094 _lastDammageTime(Glob.time - 120), _lastShotTime(Glob.time - 120), _limitSpeed(GetType()->GetMaxSpeedMs() * 2),
1095
1096 _lastWeaponNotReady(Glob.time), _lastWeaponReady(Glob.time - 10),
1097
1098 _currentWeapon(-1), _forceFireWeapon(-1), _rearmCredit(0), // used during rearm
1099
1100 // attack position search
1101 _attackEngageTime(Glob.time - 60), _attackRefreshTime(Glob.time - 60),
1102
1103 _attackAggresivePos(VZero), _attackEconomicalPos(VZero),
1104
1105 // goto automat
1106 _fireState(FireDone), _fireStateDelay(Glob.time - 60),
1107
1108 _aimObserverAsked(VZero),
1109
1110 _nextUserActionId(0)
1111
1112// fireat/goto automat
1113{
1114 AI_ERROR(type == GetType())
1115
1116 _hit.Realloc(type->_hitPoints.Size());
1117 _hit.Resize(type->_hitPoints.Size());
1118 for (int i = 0; i < type->_hitPoints.Size(); i++)
1119 {
1120 _hit[i] = 0;
1121 }
1122
1123 AI_ERROR(type);
1124 AI_ERROR(!type->IsAbstract());
1125 AI_ERROR(_shape == type->_shape);
1126

Callers

nothing calls this directly

Calls 14

GetMaxSpeedMsMethod · 0.80
IsAbstractMethod · 0.80
GetTypeFunction · 0.50
ReallocMethod · 0.45
SizeMethod · 0.45
ResizeMethod · 0.45
NMagazinesMethod · 0.45
GetMagazineMethod · 0.45
RandomValueMethod · 0.45
NWeaponSystemsMethod · 0.45
GetWeaponSystemMethod · 0.45
PreloadedMethod · 0.45

Tested by

no test coverage detected