- memory leak and a few other minor bug fixes as discovered by coverity scan.
This commit is contained in:
parent
829f23db4e
commit
5e292e931c
|
@ -1033,8 +1033,11 @@ void ScriptManager::shakeCamera(int shakeIntensity, int shakeDuration, bool came
|
|||
|
||||
if (cameraDistanceAffected) {
|
||||
Unit *unit = world->findUnitById(unitId);
|
||||
gameCamera->shake(shakeDuration, shakeIntensity,cameraDistanceAffected, unit->getCurrMidHeightVector());
|
||||
} else {
|
||||
if(unit) {
|
||||
gameCamera->shake(shakeDuration, shakeIntensity,cameraDistanceAffected, unit->getCurrMidHeightVector());
|
||||
}
|
||||
}
|
||||
else {
|
||||
gameCamera->shake(shakeDuration, shakeIntensity,cameraDistanceAffected, Vec3f(0.f,0.f,0.f));
|
||||
}
|
||||
}
|
||||
|
@ -1542,7 +1545,12 @@ int ScriptManager::getUnitFaction(int unitId) {
|
|||
const string ScriptManager::getUnitName(int unitId) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
return world->findUnitById(unitId)->getType()->getName(false);
|
||||
string result = "";
|
||||
Unit *unit = world->findUnitById(unitId);
|
||||
if(unit) {
|
||||
result = world->findUnitById(unitId)->getType()->getName(false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const string ScriptManager::getUnitDisplayName(int unitId) {
|
||||
|
|
|
@ -945,16 +945,16 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
|
|||
projectile= projectileNode->getAttribute("value")->getBoolValue();
|
||||
if(projectile){
|
||||
// create new projectile
|
||||
ProjectileType *projectileType=new ProjectileType();
|
||||
//only add this projectile if there is an enabled particlesystem
|
||||
//projectileTypes.push_back(projectileType);
|
||||
projectileType->setAttackStartTime(attackStartTime);
|
||||
projectileType->setDamagePercentage(100);
|
||||
ProjectileType *projectileType = new ProjectileType();
|
||||
//only add this projectile if there is an enabled particlesystem
|
||||
//projectileTypes.push_back(projectileType);
|
||||
projectileType->setAttackStartTime(attackStartTime);
|
||||
projectileType->setDamagePercentage(100);
|
||||
//proj particle
|
||||
if(projectileNode->hasChild("particle")){
|
||||
const XmlNode *particleNode= projectileNode->getChild("particle");
|
||||
bool particleEnabled= particleNode->getAttribute("value")->getBoolValue();
|
||||
if(particleEnabled){
|
||||
if(particleEnabled) {
|
||||
projectileTypes.push_back(projectileType);
|
||||
string path= particleNode->getAttribute("path")->getRestrictedValue();
|
||||
ParticleSystemTypeProjectile* projectileParticleSystemType= new ParticleSystemTypeProjectile();
|
||||
|
@ -968,6 +968,9 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
|
|||
delete projectileType;
|
||||
}
|
||||
}
|
||||
else {
|
||||
delete projectileType;
|
||||
}
|
||||
//proj sounds
|
||||
const XmlNode *soundNode= projectileNode->getChild("sound");
|
||||
if(soundNode->getAttribute("enabled")->getBoolValue()){
|
||||
|
|
|
@ -2676,10 +2676,10 @@ int UPNP_Tools::upnp_init(void *param) {
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"No UPnP devices found.\n");
|
||||
|
||||
if(ServerSocket::cancelUpnpdiscoverThread == true) {
|
||||
if(devlist != NULL) {
|
||||
freeUPNPDevlist(devlist);
|
||||
}
|
||||
devlist = NULL;
|
||||
//if(devlist != NULL) {
|
||||
// freeUPNPDevlist(devlist);
|
||||
//}
|
||||
//devlist = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue