mirror of
https://github.com/glest/glest-source.git
synced 2025-08-22 16:02:50 +02:00
- memory leak and a few other minor bug fixes as discovered by coverity scan.
This commit is contained in:
@@ -1033,8 +1033,11 @@ void ScriptManager::shakeCamera(int shakeIntensity, int shakeDuration, bool came
|
|||||||
|
|
||||||
if (cameraDistanceAffected) {
|
if (cameraDistanceAffected) {
|
||||||
Unit *unit = world->findUnitById(unitId);
|
Unit *unit = world->findUnitById(unitId);
|
||||||
gameCamera->shake(shakeDuration, shakeIntensity,cameraDistanceAffected, unit->getCurrMidHeightVector());
|
if(unit) {
|
||||||
} else {
|
gameCamera->shake(shakeDuration, shakeIntensity,cameraDistanceAffected, unit->getCurrMidHeightVector());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
gameCamera->shake(shakeDuration, shakeIntensity,cameraDistanceAffected, Vec3f(0.f,0.f,0.f));
|
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) {
|
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__);
|
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) {
|
const string ScriptManager::getUnitDisplayName(int unitId) {
|
||||||
|
@@ -945,16 +945,16 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
|
|||||||
projectile= projectileNode->getAttribute("value")->getBoolValue();
|
projectile= projectileNode->getAttribute("value")->getBoolValue();
|
||||||
if(projectile){
|
if(projectile){
|
||||||
// create new projectile
|
// create new projectile
|
||||||
ProjectileType *projectileType=new ProjectileType();
|
ProjectileType *projectileType = new ProjectileType();
|
||||||
//only add this projectile if there is an enabled particlesystem
|
//only add this projectile if there is an enabled particlesystem
|
||||||
//projectileTypes.push_back(projectileType);
|
//projectileTypes.push_back(projectileType);
|
||||||
projectileType->setAttackStartTime(attackStartTime);
|
projectileType->setAttackStartTime(attackStartTime);
|
||||||
projectileType->setDamagePercentage(100);
|
projectileType->setDamagePercentage(100);
|
||||||
//proj particle
|
//proj particle
|
||||||
if(projectileNode->hasChild("particle")){
|
if(projectileNode->hasChild("particle")){
|
||||||
const XmlNode *particleNode= projectileNode->getChild("particle");
|
const XmlNode *particleNode= projectileNode->getChild("particle");
|
||||||
bool particleEnabled= particleNode->getAttribute("value")->getBoolValue();
|
bool particleEnabled= particleNode->getAttribute("value")->getBoolValue();
|
||||||
if(particleEnabled){
|
if(particleEnabled) {
|
||||||
projectileTypes.push_back(projectileType);
|
projectileTypes.push_back(projectileType);
|
||||||
string path= particleNode->getAttribute("path")->getRestrictedValue();
|
string path= particleNode->getAttribute("path")->getRestrictedValue();
|
||||||
ParticleSystemTypeProjectile* projectileParticleSystemType= new ParticleSystemTypeProjectile();
|
ParticleSystemTypeProjectile* projectileParticleSystemType= new ParticleSystemTypeProjectile();
|
||||||
@@ -968,6 +968,9 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
|
|||||||
delete projectileType;
|
delete projectileType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
delete projectileType;
|
||||||
|
}
|
||||||
//proj sounds
|
//proj sounds
|
||||||
const XmlNode *soundNode= projectileNode->getChild("sound");
|
const XmlNode *soundNode= projectileNode->getChild("sound");
|
||||||
if(soundNode->getAttribute("enabled")->getBoolValue()){
|
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(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"No UPnP devices found.\n");
|
||||||
|
|
||||||
if(ServerSocket::cancelUpnpdiscoverThread == true) {
|
if(ServerSocket::cancelUpnpdiscoverThread == true) {
|
||||||
if(devlist != NULL) {
|
//if(devlist != NULL) {
|
||||||
freeUPNPDevlist(devlist);
|
// freeUPNPDevlist(devlist);
|
||||||
}
|
//}
|
||||||
devlist = NULL;
|
//devlist = NULL;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user