Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 330 vs 331 for /trunk/Source Code/AI/AIEntity.cpp

Diff revisions: vs.
  @@ -43,18 +43,18 @@
43 43 _agentID = -1;
44 44 _agent = nullptr;
45 45
46 - MemoryManager::SAFE_DELETE( _AISceneImpl );
47 - for (SensorMap::value_type& it : _sensorList) {
48 - MemoryManager::SAFE_DELETE( it.second );
49 - }
50 - _sensorList.clear();
46 + MemoryManager::DELETE( _AISceneImpl );
47 + MemoryManager::DELETE_HASHMAP(_sensorList);
51 48 }
52 49
53 50 void AIEntity::load(const vec3<F32>& position) {
54 51 setPosition(position);
55 52
56 53 if (!isAgentLoaded() && _detourCrowd) {
57 - _agentID = _detourCrowd->addAgent(position, _unitRef ? _unitRef->getMovementSpeed() : (_detourCrowd->getAgentHeight() / 2)*3.5f, 10.0f);
54 + _agentID = _detourCrowd->addAgent(position,
55 + _unitRef ? _unitRef->getMovementSpeed() :
56 + (_detourCrowd->getAgentHeight() / 2) * 3.5f,
57 + 10.0f);
58 58 _agent = _detourCrowd->getAgent(_agentID);
59 59 _destination = position;
60 60 }
  @@ -102,10 +102,10 @@
102 102 Sensor* sensor = nullptr;
103 103 switch (type) {
104 104 case AUDIO_SENSOR: {
105 - sensor = New AudioSensor(this);
105 + sensor = MemoryManager_NEW AudioSensor(this);
106 106 } break;
107 107 case VISUAL_SENSOR: {
108 - sensor = New VisualSensor(this);
108 + sensor = MemoryManager_NEW VisualSensor(this);
109 109 } break;
110 110 };
111 111
  @@ -160,7 +160,8 @@
160 160 }
161 161
162 162 void AIEntity::init() {
163 - DIVIDE_ASSERT(_AISceneImpl != nullptr, "AIEntity error: Can't init entity without a proper AISceneImpl");
163 + DIVIDE_ASSERT(_AISceneImpl != nullptr,
164 + "AIEntity error: Can't init entity without a proper AISceneImpl");
164 165 _AISceneImpl->init();
165 166 }
166 167
  @@ -265,8 +266,15 @@
265 266 }
266 267 vec3<F32> result;
267 268 // Find position on navmesh
268 - if(!_detourCrowd->getNavMesh().getRandomPositionInCircle(destination, DESTINATION_RADIUS, vec3<F32>(5), result, 10)) {
269 - if (!_detourCrowd->getNavMesh().getClosestPosition(destination, vec3<F32>(5), DESTINATION_RADIUS, result)) {
269 + if(!_detourCrowd->getNavMesh().getRandomPositionInCircle(destination,
270 + DESTINATION_RADIUS,
271 + vec3<F32>(5),
272 + result,
273 + 10)) {
274 + if (!_detourCrowd->getNavMesh().getClosestPosition(destination,
275 + vec3<F32>(5),
276 + DESTINATION_RADIUS,
277 + result)) {
270 278 return false;
271 279 }
272 280 }