- attempt to improve performance when crc logging is disabled
This commit is contained in:
parent
35b8251bef
commit
cc4f4aaa37
|
@ -694,30 +694,35 @@ string Unit::getParticleInfo() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::end(ParticleSystem *particleSystem) {
|
void Unit::end(ParticleSystem *particleSystem) {
|
||||||
|
if(particleSystem == fire) {
|
||||||
|
fire = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
vector<ParticleSystem*>::iterator iterFind = find(attackParticleSystems.begin(),attackParticleSystems.end(),particleSystem);
|
vector<ParticleSystem*>::iterator iterFind = find(attackParticleSystems.begin(),attackParticleSystems.end(),particleSystem);
|
||||||
if(iterFind != attackParticleSystems.end()) {
|
if(iterFind != attackParticleSystems.end()) {
|
||||||
attackParticleSystems.erase(iterFind);
|
attackParticleSystems.erase(iterFind);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
vector<UnitParticleSystem*>::iterator iterFind1 = find(smokeParticleSystems.begin(),smokeParticleSystems.end(),particleSystem);
|
vector<UnitParticleSystem*>::iterator iterFind1 = find(smokeParticleSystems.begin(),smokeParticleSystems.end(),particleSystem);
|
||||||
if(iterFind1 != smokeParticleSystems.end()) {
|
if(iterFind1 != smokeParticleSystems.end()) {
|
||||||
smokeParticleSystems.erase(iterFind1);
|
smokeParticleSystems.erase(iterFind1);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
iterFind = find(fireParticleSystems.begin(),fireParticleSystems.end(),particleSystem);
|
iterFind = find(fireParticleSystems.begin(),fireParticleSystems.end(),particleSystem);
|
||||||
if(iterFind != fireParticleSystems.end()) {
|
if(iterFind != fireParticleSystems.end()) {
|
||||||
fireParticleSystems.erase(iterFind);
|
fireParticleSystems.erase(iterFind);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
iterFind1 = find(damageParticleSystems.begin(),damageParticleSystems.end(),particleSystem);
|
iterFind1 = find(damageParticleSystems.begin(),damageParticleSystems.end(),particleSystem);
|
||||||
if(iterFind1 != damageParticleSystems.end()) {
|
if(iterFind1 != damageParticleSystems.end()) {
|
||||||
damageParticleSystems.erase(iterFind1);
|
damageParticleSystems.erase(iterFind1);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
iterFind1 = find(unitParticleSystems.begin(),unitParticleSystems.end(),particleSystem);
|
iterFind1 = find(unitParticleSystems.begin(),unitParticleSystems.end(),particleSystem);
|
||||||
if(iterFind1 != unitParticleSystems.end()) {
|
if(iterFind1 != unitParticleSystems.end()) {
|
||||||
unitParticleSystems.erase(iterFind1);
|
unitParticleSystems.erase(iterFind1);
|
||||||
}
|
return;
|
||||||
|
|
||||||
if(particleSystem == fire) {
|
|
||||||
fire = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5229,10 +5234,12 @@ Checksum Unit::getCRC() {
|
||||||
if(consoleDebug) printf("#11 Unit: %d CRC: %u commands.size(): %ld\n",id,crcForUnit.getSum(),commands.size());
|
if(consoleDebug) printf("#11 Unit: %d CRC: %u commands.size(): %ld\n",id,crcForUnit.getSum(),commands.size());
|
||||||
|
|
||||||
//Commands commands;
|
//Commands commands;
|
||||||
crcForUnit.addInt64((int64)commands.size());
|
if(commands.empty() == false) {
|
||||||
for(Commands::const_iterator it= commands.begin(); it != commands.end(); ++it) {
|
crcForUnit.addInt(commands.size());
|
||||||
uint32 crc = (*it)->getCRC().getSum();
|
for(Commands::const_iterator it= commands.begin(); it != commands.end(); ++it) {
|
||||||
crcForUnit.addBytes(&crc,sizeof(uint32));
|
uint32 crc = (*it)->getCRC().getSum();
|
||||||
|
crcForUnit.addBytes(&crc,sizeof(uint32));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("#11 Unit: %d CRC: %u observers.size(): %ld\n",id,crcForUnit.getSum(),observers.size());
|
//printf("#11 Unit: %d CRC: %u observers.size(): %ld\n",id,crcForUnit.getSum(),observers.size());
|
||||||
|
@ -5246,7 +5253,7 @@ Checksum Unit::getCRC() {
|
||||||
//vector<UnitParticleSystemType*> queuedUnitParticleSystemTypes;
|
//vector<UnitParticleSystemType*> queuedUnitParticleSystemTypes;
|
||||||
|
|
||||||
//UnitParticleSystems damageParticleSystems;
|
//UnitParticleSystems damageParticleSystems;
|
||||||
crcForUnit.addInt64((int64)damageParticleSystems.size());
|
crcForUnit.addInt(damageParticleSystems.size());
|
||||||
|
|
||||||
if(consoleDebug) printf("#12 Unit: %d CRC: %u\n",id,crcForUnit.getSum());
|
if(consoleDebug) printf("#12 Unit: %d CRC: %u\n",id,crcForUnit.getSum());
|
||||||
|
|
||||||
|
@ -5264,7 +5271,6 @@ Checksum Unit::getCRC() {
|
||||||
//std::string lastSource;
|
//std::string lastSource;
|
||||||
//int lastRenderFrame;
|
//int lastRenderFrame;
|
||||||
//bool visible;
|
//bool visible;
|
||||||
crcForUnit.addInt(modelFacing);
|
|
||||||
|
|
||||||
//int retryCurrCommandCount;
|
//int retryCurrCommandCount;
|
||||||
|
|
||||||
|
@ -5275,7 +5281,7 @@ Checksum Unit::getCRC() {
|
||||||
|
|
||||||
crcForUnit.addInt(inBailOutAttempt);
|
crcForUnit.addInt(inBailOutAttempt);
|
||||||
|
|
||||||
crcForUnit.addInt64((int64)badHarvestPosList.size());
|
crcForUnit.addInt(badHarvestPosList.size());
|
||||||
//crcForUnit.addInt(lastHarvestResourceTarget.first());
|
//crcForUnit.addInt(lastHarvestResourceTarget.first());
|
||||||
|
|
||||||
if(consoleDebug) printf("#14 Unit: %d CRC: %u\n",id,crcForUnit.getSum());
|
if(consoleDebug) printf("#14 Unit: %d CRC: %u\n",id,crcForUnit.getSum());
|
||||||
|
@ -5295,7 +5301,7 @@ Checksum Unit::getCRC() {
|
||||||
//int maxQueuedCommandDisplayCount;
|
//int maxQueuedCommandDisplayCount;
|
||||||
|
|
||||||
//UnitAttackBoostEffectOriginator currentAttackBoostOriginatorEffect;
|
//UnitAttackBoostEffectOriginator currentAttackBoostOriginatorEffect;
|
||||||
crcForUnit.addInt64((int64)currentAttackBoostOriginatorEffect.currentAttackBoostUnits.size());
|
crcForUnit.addInt(currentAttackBoostOriginatorEffect.currentAttackBoostUnits.size());
|
||||||
|
|
||||||
if(consoleDebug) printf("#15 Unit: %d CRC: %u\n",id,crcForUnit.getSum());
|
if(consoleDebug) printf("#15 Unit: %d CRC: %u\n",id,crcForUnit.getSum());
|
||||||
|
|
||||||
|
@ -5329,17 +5335,19 @@ Checksum Unit::getCRC() {
|
||||||
|
|
||||||
if(consoleDebug) printf("#17 Unit: %d CRC: %u\n",id,crcForUnit.getSum());
|
if(consoleDebug) printf("#17 Unit: %d CRC: %u\n",id,crcForUnit.getSum());
|
||||||
|
|
||||||
if(getParticleInfo() != "") {
|
if(this->getParticleInfo() != "") {
|
||||||
crcForUnit.addString(this->getParticleInfo());
|
crcForUnit.addString(this->getParticleInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
crcForUnit.addInt64((int64)attackParticleSystems.size());
|
crcForUnit.addInt(attackParticleSystems.size());
|
||||||
for(unsigned int index = 0; index < attackParticleSystems.size(); ++index) {
|
if(isNetworkCRCEnabled() == true) {
|
||||||
ParticleSystem *ps = attackParticleSystems[index];
|
for(unsigned int index = 0; index < attackParticleSystems.size(); ++index) {
|
||||||
if(ps != NULL &&
|
ParticleSystem *ps = attackParticleSystems[index];
|
||||||
Renderer::getInstance().validateParticleSystemStillExists(ps,rsGame) == true) {
|
if(ps != NULL &&
|
||||||
uint32 crc = ps->getCRC().getSum();
|
Renderer::getInstance().validateParticleSystemStillExists(ps,rsGame) == true) {
|
||||||
crcForUnit.addBytes(&crc,sizeof(uint32));
|
uint32 crc = ps->getCRC().getSum();
|
||||||
|
crcForUnit.addBytes(&crc,sizeof(uint32));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue