try to cleanup possible memory issue
This commit is contained in:
parent
3a6544a257
commit
f66a0834c9
|
@ -2979,9 +2979,9 @@ bool Unit::repair(){
|
||||||
|
|
||||||
//decrements HP and returns if dead
|
//decrements HP and returns if dead
|
||||||
bool Unit::decHp(int decrementValue) {
|
bool Unit::decHp(int decrementValue) {
|
||||||
char szBuf[8096]="";
|
// char szBuf[8096]="";
|
||||||
snprintf(szBuf,8095,"this->hp = %d, decrementValue = %d",this->hp,decrementValue);
|
// snprintf(szBuf,8095,"this->hp = %d, decrementValue = %d",this->hp,decrementValue);
|
||||||
addNetworkCRCDecHp(szBuf);
|
// addNetworkCRCDecHp(szBuf);
|
||||||
|
|
||||||
if(this->hp == 0) {
|
if(this->hp == 0) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -4251,14 +4251,14 @@ std::string Unit::toString(bool crcMode) const {
|
||||||
result += "lastStuckFrame = " + uIntToStr(lastStuckFrame) + "\n";
|
result += "lastStuckFrame = " + uIntToStr(lastStuckFrame) + "\n";
|
||||||
result += "lastStuckPos = " + lastStuckPos.getString() + "\n";
|
result += "lastStuckPos = " + lastStuckPos.getString() + "\n";
|
||||||
|
|
||||||
if(attackParticleSystems.size() > 0) {
|
if(attackParticleSystems.empty() == false) {
|
||||||
result += "attackParticleSystems count = " + intToStr(attackParticleSystems.size()) + "\n";
|
result += "attackParticleSystems count = " + intToStr(attackParticleSystems.size()) + "\n";
|
||||||
}
|
}
|
||||||
if(networkCRCParticleLogInfo != "") {
|
if(networkCRCParticleLogInfo != "") {
|
||||||
result += "networkCRCParticleLogInfo = " + networkCRCParticleLogInfo + "\n";
|
result += "networkCRCParticleLogInfo = " + networkCRCParticleLogInfo + "\n";
|
||||||
}
|
}
|
||||||
result += "networkCRCParticleObserverLogInfo = " + networkCRCParticleObserverLogInfo + "\n";
|
result += "networkCRCParticleObserverLogInfo = " + networkCRCParticleObserverLogInfo + "\n";
|
||||||
if(networkCRCDecHpList.size() > 0) {
|
if(networkCRCDecHpList.empty() == false) {
|
||||||
result += "getNetworkCRCDecHpList() = " + getNetworkCRCDecHpList() + "\n";
|
result += "getNetworkCRCDecHpList() = " + getNetworkCRCDecHpList() + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -782,14 +782,16 @@ public:
|
||||||
void setNetworkCRCParticleLogInfo(string networkCRCParticleLogInfo) { this->networkCRCParticleLogInfo = networkCRCParticleLogInfo; }
|
void setNetworkCRCParticleLogInfo(string networkCRCParticleLogInfo) { this->networkCRCParticleLogInfo = networkCRCParticleLogInfo; }
|
||||||
void setNetworkCRCParticleObserverLogInfo(string networkCRCParticleObserverLogInfo) { this->networkCRCParticleObserverLogInfo = networkCRCParticleObserverLogInfo; }
|
void setNetworkCRCParticleObserverLogInfo(string networkCRCParticleObserverLogInfo) { this->networkCRCParticleObserverLogInfo = networkCRCParticleObserverLogInfo; }
|
||||||
|
|
||||||
void clearNetworkCRCDecHpList() { networkCRCDecHpList.clear(); }
|
//void clearNetworkCRCDecHpList() { networkCRCDecHpList.clear(); }
|
||||||
|
void clearNetworkCRCDecHpList() { }
|
||||||
|
|
||||||
Checksum getCRC();
|
Checksum getCRC();
|
||||||
|
|
||||||
virtual void end(ParticleSystem *particleSystem);
|
virtual void end(ParticleSystem *particleSystem);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addNetworkCRCDecHp(string info) { networkCRCDecHpList.push_back(info); }
|
//void addNetworkCRCDecHp(string info) { networkCRCDecHpList.push_back(info); }
|
||||||
|
void addNetworkCRCDecHp(string info) { }
|
||||||
string getNetworkCRCDecHpList() const;
|
string getNetworkCRCDecHpList() const;
|
||||||
|
|
||||||
float computeHeight(const Vec2i &pos) const;
|
float computeHeight(const Vec2i &pos) const;
|
||||||
|
|
|
@ -49,7 +49,8 @@ public:
|
||||||
void setLastNumber(int value) { lastNumber = value; }
|
void setLastNumber(int value) { lastNumber = value; }
|
||||||
|
|
||||||
std::string getLastCaller() const;
|
std::string getLastCaller() const;
|
||||||
void clearLastCaller() { lastCaller.clear(); }
|
//void clearLastCaller() { lastCaller.clear(); }
|
||||||
|
void clearLastCaller() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
|
|
@ -56,7 +56,7 @@ int RandomGen::rand(string lastCaller) {
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] lastNumber = %d\n",__FILE__,__FUNCTION__,__LINE__,lastNumber);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] lastNumber = %d\n",__FILE__,__FUNCTION__,__LINE__,lastNumber);
|
||||||
|
|
||||||
this->lastNumber = (a*lastNumber + b) % m;
|
this->lastNumber = (a*lastNumber + b) % m;
|
||||||
this->lastCaller.push_back(lastCaller);
|
//this->lastCaller.push_back(lastCaller);
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] lastNumber = %d\n",__FILE__,__FUNCTION__,__LINE__,lastNumber);
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] lastNumber = %d\n",__FILE__,__FUNCTION__,__LINE__,lastNumber);
|
||||||
|
|
||||||
|
@ -65,8 +65,10 @@ int RandomGen::rand(string lastCaller) {
|
||||||
|
|
||||||
std::string RandomGen::getLastCaller() const {
|
std::string RandomGen::getLastCaller() const {
|
||||||
std::string result = "";
|
std::string result = "";
|
||||||
for(unsigned int index = 0; index < lastCaller.size(); ++index) {
|
if(lastCaller.empty() == false) {
|
||||||
result += lastCaller[index] + " ";
|
for(unsigned int index = 0; index < lastCaller.size(); ++index) {
|
||||||
|
result += lastCaller[index] + " ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue