Update visibility system

*visibility updates and ai relocations processed simultaneously for each grid
  *these operations now are not synchronized for different grids
  *some changes into structure of visibility notifiers

--HG--
branch : trunk
This commit is contained in:
silver1ce
2010-02-27 15:25:14 +02:00
parent 1815d19b85
commit fcaa318fb3
18 changed files with 290 additions and 475 deletions

View File

@@ -27,14 +27,19 @@
#include "GameSystem/Grid.h"
#include "GameSystem/GridReference.h"
#include "Timer.h"
#include "Util.h"
#define DEFAULT_VISIBILITY_NOTIFY_PERIOD 1000
class GridInfo
{
public:
GridInfo()
: i_timer(0), i_unloadActiveLockCount(0), i_unloadExplicitLock(false), i_unloadReferenceLock(false) {}
: i_timer(0), i_unloadActiveLockCount(0), i_unloadExplicitLock(false), i_unloadReferenceLock(false),
vis_Update(0, irand(0,DEFAULT_VISIBILITY_NOTIFY_PERIOD)) {}
GridInfo(time_t expiry, bool unload = true )
: i_timer(expiry), i_unloadActiveLockCount(0), i_unloadExplicitLock(!unload), i_unloadReferenceLock(false) {}
: i_timer(expiry), i_unloadActiveLockCount(0), i_unloadExplicitLock(!unload), i_unloadReferenceLock(false),
vis_Update(0, irand(0,DEFAULT_VISIBILITY_NOTIFY_PERIOD)) {}
const TimeTracker& getTimeTracker() const { return i_timer; }
bool getUnloadLock() const { return i_unloadActiveLockCount || i_unloadExplicitLock || i_unloadReferenceLock; }
void setUnloadExplicitLock( bool on ) { i_unloadExplicitLock = on; }
@@ -45,9 +50,11 @@ public:
void setTimer(const TimeTracker& pTimer) { i_timer = pTimer; }
void ResetTimeTracker(time_t interval) { i_timer.Reset(interval); }
void UpdateTimeTracker(time_t diff) { i_timer.Update(diff); }
PeriodicTimer& getRelocationTimer() { return vis_Update; }
private:
TimeTracker i_timer;
PeriodicTimer vis_Update;
uint16 i_unloadActiveLockCount : 16; // lock from active object spawn points (prevent clone loading)
bool i_unloadExplicitLock : 1; // explicit manual lock or config setting
bool i_unloadReferenceLock : 1; // lock from instance map copy