- added more crc checking info to track oos

This commit is contained in:
Mark Vejvoda 2013-10-19 21:12:08 +00:00
parent 4bc1e1b5bc
commit a4a32fc4fe
5 changed files with 42 additions and 1 deletions

View File

@ -73,7 +73,8 @@ public:
Object(ObjectType *objectType, const Vec3f &pos, const Vec2i &mapPos);
virtual ~Object();
void end(); //to kill particles
virtual void end(); //to kill particles
virtual void logParticleInfo(string info) {};
void initParticles();
void initParticlesFromTypes(const ModelParticleSystemTypes *particleTypes);
static void setStateCallback(ObjectStateInterface *value) { stateCallback=value; }

View File

@ -646,6 +646,19 @@ void Unit::dumpMemoryList() {
}
#endif
void Unit::logParticleInfo(string info) {
networkCRCParticleInfoList.push_back(info);
}
string Unit::getParticleInfo() const {
string result = "";
if(networkCRCParticleInfoList.empty() == false) {
for(unsigned int index = 0; index < networkCRCParticleInfoList.size(); ++index) {
result += networkCRCParticleInfoList[index] + "|";
}
}
return result;
}
void Unit::end(ParticleSystem *particleSystem) {
vector<ParticleSystem*>::iterator iterFind = find(attackParticleSystems.begin(),attackParticleSystems.end(),particleSystem);
if(iterFind != attackParticleSystems.end()) {
@ -4278,6 +4291,9 @@ std::string Unit::toString(bool crcMode) const {
result += "getNetworkCRCDecHpList() = " + getNetworkCRCDecHpList() + "\n";
}
if(getParticleInfo() != "") {
result += "getParticleInfo() = " + getParticleInfo() + "\n";
}
for(unsigned int index = 0; index < attackParticleSystems.size(); ++index) {
ParticleSystem *ps = attackParticleSystems[index];
if(ps != NULL &&
@ -5262,6 +5278,10 @@ Checksum Unit::getCRC() {
if(consoleDebug) printf("#17 Unit: %d CRC: %u\n",id,crcForUnit.getSum());
if(getParticleInfo() != "") {
crcForUnit.addString(this->getParticleInfo());
}
crcForUnit.addInt64((int64)attackParticleSystems.size());
for(unsigned int index = 0; index < attackParticleSystems.size(); ++index) {
ParticleSystem *ps = attackParticleSystems[index];

View File

@ -488,6 +488,8 @@ private:
string networkCRCParticleObserverLogInfo;
vector<string> networkCRCDecHpList;
vector<string> networkCRCParticleInfoList;
public:
Unit(int id, UnitPathInterface *path, const Vec2i &pos, const UnitType *type, Faction *faction, Map *map, CardinalDir placeFacing);
virtual ~Unit();
@ -794,6 +796,9 @@ public:
Checksum getCRC();
virtual void end(ParticleSystem *particleSystem);
virtual void logParticleInfo(string info);
void clearParticleInfo() { networkCRCParticleInfoList.clear(); }
string getParticleInfo() const;
void addNetworkCRCDecHp(string info) { networkCRCDecHpList.push_back(info); }

View File

@ -85,7 +85,9 @@ public:
class ParticleOwner {
public:
virtual ~ParticleOwner() {}
virtual void end(ParticleSystem *particleSystem)= 0;
virtual void logParticleInfo(string info)= 0;
};
// =====================================================

View File

@ -1816,6 +1816,13 @@ void ProjectileParticleSystem::update(){
//arrive destination
arriveDestinationDistance = truncateDecimal<float>(flatPos.dist(endPos),6);
if(this->particleOwner != NULL) {
char szBuf[8096]="";
snprintf(szBuf,8095,"LINE: %d arriveDestinationDistance = %f",__LINE__,arriveDestinationDistance);
this->particleOwner->logParticleInfo(szBuf);
}
if(arriveDestinationDistance < 0.5f) {
fade();
model= NULL;
@ -2143,6 +2150,12 @@ void SplashParticleSystem::update() {
t= clamp(t, 0.0f, 1.0f);
setTween(t,t);
if(this->particleOwner != NULL) {
char szBuf[8096]="";
snprintf(szBuf,8095,"LINE: %d emissionRate = %f",__LINE__,emissionRate);
this->particleOwner->logParticleInfo(szBuf);
}
if(emissionRate < 0.0f) {//otherwise this system lives forever!
fade();
}