mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-04 09:25:11 +02:00
use std::numeric_limtis<uint64_t>::max() instead of -1
This commit is contained in:
parent
70d6aa99e8
commit
6d7574cab9
4 changed files with 8 additions and 6 deletions
|
@ -20,7 +20,7 @@
|
||||||
void EntitySimulation::setEntityTree(EntityTreePointer tree) {
|
void EntitySimulation::setEntityTree(EntityTreePointer tree) {
|
||||||
if (_entityTree && _entityTree != tree) {
|
if (_entityTree && _entityTree != tree) {
|
||||||
_mortalEntities.clear();
|
_mortalEntities.clear();
|
||||||
_nextExpiry = uint64_t(-1);
|
_nextExpiry = std::numeric_limits<uint64_t>::max();
|
||||||
_entitiesToUpdate.clear();
|
_entitiesToUpdate.clear();
|
||||||
_entitiesToSort.clear();
|
_entitiesToSort.clear();
|
||||||
_simpleKinematicEntities.clear();
|
_simpleKinematicEntities.clear();
|
||||||
|
@ -74,7 +74,7 @@ void EntitySimulation::expireMortalEntities(uint64_t now) {
|
||||||
if (now > _nextExpiry) {
|
if (now > _nextExpiry) {
|
||||||
PROFILE_RANGE_EX(simulation_physics, "ExpireMortals", 0xffff00ff, (uint64_t)_mortalEntities.size());
|
PROFILE_RANGE_EX(simulation_physics, "ExpireMortals", 0xffff00ff, (uint64_t)_mortalEntities.size());
|
||||||
// only search for expired entities if we expect to find one
|
// only search for expired entities if we expect to find one
|
||||||
_nextExpiry = uint64_t(-1);
|
_nextExpiry = std::numeric_limits<uint64_t>::max();
|
||||||
QMutexLocker lock(&_mutex);
|
QMutexLocker lock(&_mutex);
|
||||||
SetOfEntities::iterator itemItr = _mortalEntities.begin();
|
SetOfEntities::iterator itemItr = _mortalEntities.begin();
|
||||||
while (itemItr != _mortalEntities.end()) {
|
while (itemItr != _mortalEntities.end()) {
|
||||||
|
@ -220,7 +220,7 @@ void EntitySimulation::changeEntity(EntityItemPointer entity) {
|
||||||
void EntitySimulation::clearEntities() {
|
void EntitySimulation::clearEntities() {
|
||||||
QMutexLocker lock(&_mutex);
|
QMutexLocker lock(&_mutex);
|
||||||
_mortalEntities.clear();
|
_mortalEntities.clear();
|
||||||
_nextExpiry = uint64_t(-1);
|
_nextExpiry = std::numeric_limits<uint64_t>::max();
|
||||||
_entitiesToUpdate.clear();
|
_entitiesToUpdate.clear();
|
||||||
_entitiesToSort.clear();
|
_entitiesToSort.clear();
|
||||||
_simpleKinematicEntities.clear();
|
_simpleKinematicEntities.clear();
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#ifndef hifi_EntitySimulation_h
|
#ifndef hifi_EntitySimulation_h
|
||||||
#define hifi_EntitySimulation_h
|
#define hifi_EntitySimulation_h
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
@ -44,7 +46,7 @@ const int DIRTY_SIMULATION_FLAGS =
|
||||||
|
|
||||||
class EntitySimulation : public QObject, public std::enable_shared_from_this<EntitySimulation> {
|
class EntitySimulation : public QObject, public std::enable_shared_from_this<EntitySimulation> {
|
||||||
public:
|
public:
|
||||||
EntitySimulation() : _mutex(QMutex::Recursive), _entityTree(NULL), _nextExpiry(uint64_t(-1)) { }
|
EntitySimulation() : _mutex(QMutex::Recursive), _entityTree(NULL), _nextExpiry(std::numeric_limits<uint64_t>::max()) { }
|
||||||
virtual ~EntitySimulation() { setEntityTree(NULL); }
|
virtual ~EntitySimulation() { setEntityTree(NULL); }
|
||||||
|
|
||||||
inline EntitySimulationPointer getThisPointer() const {
|
inline EntitySimulationPointer getThisPointer() const {
|
||||||
|
|
|
@ -54,7 +54,7 @@ void SimpleEntitySimulation::updateEntitiesInternal(uint64_t now) {
|
||||||
if (now > _nextOwnerlessExpiry) {
|
if (now > _nextOwnerlessExpiry) {
|
||||||
// search for ownerless objects that have expired
|
// search for ownerless objects that have expired
|
||||||
QMutexLocker lock(&_mutex);
|
QMutexLocker lock(&_mutex);
|
||||||
_nextOwnerlessExpiry = -1;
|
_nextOwnerlessExpiry = std::numeric_limits<uint64_t>::max();
|
||||||
SetOfEntities::iterator itemItr = _entitiesThatNeedSimulationOwner.begin();
|
SetOfEntities::iterator itemItr = _entitiesThatNeedSimulationOwner.begin();
|
||||||
while (itemItr != _entitiesThatNeedSimulationOwner.end()) {
|
while (itemItr != _entitiesThatNeedSimulationOwner.end()) {
|
||||||
EntityItemPointer entity = *itemItr;
|
EntityItemPointer entity = *itemItr;
|
||||||
|
|
|
@ -343,7 +343,7 @@ void PhysicalEntitySimulation::sendOwnershipBids(uint32_t numSubsteps) {
|
||||||
uint64_t now = usecTimestampNow();
|
uint64_t now = usecTimestampNow();
|
||||||
if (now > _nextBidExpiry) {
|
if (now > _nextBidExpiry) {
|
||||||
PROFILE_RANGE_EX(simulation_physics, "Bid", 0x00000000, (uint64_t)_bids.size());
|
PROFILE_RANGE_EX(simulation_physics, "Bid", 0x00000000, (uint64_t)_bids.size());
|
||||||
_nextBidExpiry = (uint64_t)(-1);
|
_nextBidExpiry = std::numeric_limits<uint64_t>::max();
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
while (i < _bids.size()) {
|
while (i < _bids.size()) {
|
||||||
bool removeBid = false;
|
bool removeBid = false;
|
||||||
|
|
Loading…
Reference in a new issue