/// <summary> /// Updates data. /// </summary> public void Update() { // Get and categorize vehicles. // First update? if (this.bucketeer != null) { // Data is initialized. Just check buildings for this frame. uint endBucket = this.bucketeer.GetEnd(); uint counter = 0; while (this.bucket != endBucket) { if (counter > 256) { throw new Exception("Update bucket loop counter to high"); } counter++; this.bucket = this.bucketeer.GetNext(this.bucket + 1); Bucketeer.Boundaries bounds = this.bucketeer.GetBoundaries(this.bucket); this.HandleVehicles(bounds.FirstId, bounds.LastId); } } else { if (Global.BucketedUpdates) { uint length = (uint)Singleton <VehicleManager> .instance.m_vehicles.m_buffer.Length; this.bucketFactor = length / (this.bucketMask + 1); //Log.DevDebug(this, "Update", "bucketFactor", length, this.bucketMask, this.bucketFactor); this.bucketeer = new Bucketeer(this.bucketMask, this.bucketFactor); this.bucket = this.bucketeer.GetEnd(); } this.HandleVehicles(); } }
/// <summary> /// Updates data. /// </summary> /// <exception cref="System.Exception">Update bucket loop counter to high.</exception> public void Update() { // Get and categorize vehicles. // First update? if (this.bucketeer != null) { // Data is initialized. Just check buildings for this frame. uint endBucket = this.bucketeer.GetEnd(); uint counter = 0; while (this.bucket != endBucket) { if (counter > 256) { throw new Exception("Update bucket loop counter to high"); } counter++; this.bucket = this.bucketeer.GetNext(this.bucket + 1); Bucketeer.Boundaries bounds = this.bucketeer.GetBoundaries(this.bucket); this.HandleVehicles(bounds.FirstId, bounds.LastId); } } else { if (Global.BucketedUpdates) { uint length = (uint)Singleton<VehicleManager>.instance.m_vehicles.m_buffer.Length; this.bucketFactor = length / (this.bucketMask + 1); Log.Debug(this, "Update", "bucketFactor", length, this.bucketMask, this.bucketFactor); this.bucketeer = new Bucketeer(this.bucketMask, this.bucketFactor); this.bucket = this.bucketeer.GetEnd(); } this.HandleVehicles(); } }