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

Method ProcessChange

engine/Poseidon/AI/AICenterStats.cpp:873–981  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

871}
872
873bool AIMap::ProcessChange()
874{
875 AI_ERROR(_dirty.GetXRange() == LandRange);
876 AI_ERROR(_dirty.GetYRange() == LandRange);
877
878 if (_changesQueue.Size() < 1)
879 {
880 return false; // done
881 }
882 AITargetChange& info = _changesQueue[0];
883 if (Glob.time < info.time)
884 {
885 return false; // cannot continue
886 }
887 int x = info.x;
888 int z = info.z;
889 const VehicleType* type = info.type;
890 BYTE dirty;
891 if (info.enemy)
892 {
893 dirty = DIRTY_ENEMY;
894 }
895 else
896 {
897 dirty = DIRTY_UNKNOWN;
898 }
899 int i, j, r;
900 int xMin, xMax, zMin, zMax;
901
902 float maxRange = -FLT_MAX;
903 for (int w = 0; w < type->NWeaponSystems(); w++)
904 {
905 const WeaponType* weapon = type->GetWeaponSystem(w);
906 for (int i = 0; i < weapon->_muzzles.Size(); i++)
907 {
908 const MuzzleType* muzzle = weapon->_muzzles[i];
909 const MagazineType* magazine = muzzle->_typicalMagazine;
910 if (!magazine)
911 {
912 continue;
913 }
914 for (int j = 0; j < magazine->_modes.Size(); j++)
915 {
916 const AmmoType* ammo = magazine->_modes[j]->_ammo;
917 if (ammo)
918 {
919 saturateMax(maxRange, ammo->maxRange);
920 }
921 }
922 }
923 }
924 if (maxRange < 0)
925 {
926 goto ExitProcessChange;
927 }
928 r = toIntCeil(maxRange * InvLandGrid);
929
930 xMin = x - r;

Callers 3

SerializeMethod · 0.80
InitSensorsMethod · 0.80
UpdateMapMethod · 0.80

Calls 9

saturateMaxFunction · 0.85
saturateMinFunction · 0.85
GetXRangeMethod · 0.80
GetYRangeMethod · 0.80
SquareFunction · 0.50
SizeMethod · 0.45
NWeaponSystemsMethod · 0.45
GetWeaponSystemMethod · 0.45
DeleteMethod · 0.45

Tested by

no test coverage detected