Weird behaviour in weapon types
Posted: 23 Nov 2006, 19:26
In the code that loads weapons in:
https://taspring.clan-sy.com/svn/spring ... andler.cpp
We have this:
The weird thing is that if you define a cannon by omission (that is, without RenderType=4; or anything else that defines it as another type), the weapon will behave very oddly. It will allow you to attack some friendly units, some will attack if it get's close enough, others won't just attack.
If i add to the weapon "RenderType=4;", it will stop doing that.
Somewhere in the behaviour of weapons, must be a incongruence of, some times checking for weapon type others checking for RenderType!?
https://taspring.clan-sy.com/svn/spring ... andler.cpp
We have this:
Code: Select all
if (weaponDefs[id].dropped) {
weaponDefs[id].type = "AircraftBomb";
} else if (weaponDefs[id].vlaunch) {
weaponDefs[id].type = "StarburstLauncher";
} else if (beamlaser){
weaponDefs[id].type = "BeamLaser";
} else if (weaponDefs[id].isShield){
weaponDefs[id].type = "Shield";
} else if (weaponDefs[id].waterweapon) {
weaponDefs[id].type = "TorpedoLauncher";
} else if (weaponDefs[id].name.find("disintegrator")!=string::npos) {
weaponDefs[id].type = "DGun";
} else if (lineofsight) {
if (rendertype==7)
weaponDefs[id].type = "LightingCannon";
else if (beamweapon)
weaponDefs[id].type = "LaserCannon";
else if (weaponDefs[id].visuals.modelName.find("laser")!=std::string::npos)
weaponDefs[id].type = "LaserCannon"; //swta fix
else if (weaponDefs[id].visuals.smokeTrail)
weaponDefs[id].type = "MissileLauncher";
else if (rendertype == 4 && color == 2)
weaponDefs[id].type = "EmgCannon";
else if (rendertype == 5)
weaponDefs[id].type = "Flame";
else
weaponDefs[id].type = "Cannon";
}
else
weaponDefs[id].type = "Cannon";If i add to the weapon "RenderType=4;", it will stop doing that.
Somewhere in the behaviour of weapons, must be a incongruence of, some times checking for weapon type others checking for RenderType!?