Skip to content
Permalink
Browse files

fix #3310

  • Loading branch information...
rtri
rtri committed Aug 31, 2019
1 parent 05f2222 commit 3ad880651597b7d56a936f96601781bf18280abb
Showing with 4 additions and 26 deletions.
  1. +2 −0 doc/changelog.txt
  2. +2 −26 rts/Sim/Weapons/WeaponDef.cpp
@@ -11,6 +11,8 @@ Sim:
! remove CMD_SET_WANTED_MAX_SPEED ! remove CMD_SET_WANTED_MAX_SPEED
- allow CEG trails for crashing aircraft (engine will randomly select from any generators listed in sfxTypes.crashExplosionGenerators) - allow CEG trails for crashing aircraft (engine will randomly select from any generators listed in sfxTypes.crashExplosionGenerators)
- DGun weapontype: allow leading (leadLimit for DGun defaults to 0 instead of -1 for back-compatibility) - DGun weapontype: allow leading (leadLimit for DGun defaults to 0 instead of -1 for back-compatibility)
- change default ownerExpAccWeight to 0 for all weapon-types
- remove salvoError multiplier hack for positional and out-of-los targets


Lua: Lua:
- add Platform.osVersion; complements Platform.osName - add Platform.osVersion; complements Platform.osName
@@ -406,113 +406,89 @@ WeaponDef::WeaponDef(const LuaTable& wdTable, const std::string& name_, int id_)
// get some weapon specific defaults // get some weapon specific defaults
defInterceptType = 0; defInterceptType = 0;


ownerExpAccWeight = -1.0f;

switch (hashString(type.c_str())) { switch (hashString(type.c_str())) {
case hashString("Cannon"): { case hashString("Cannon"): {
// CExplosiveProjectile // CExplosiveProjectile
defInterceptType = 1; defInterceptType = 1;
projectileType = WEAPON_EXPLOSIVE_PROJECTILE; projectileType = WEAPON_EXPLOSIVE_PROJECTILE;


ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.9f);
intensity = wdTable.GetFloat("intensity", 0.2f); intensity = wdTable.GetFloat("intensity", 0.2f);
} break; } break;
case hashString("Rifle"): { case hashString("Rifle"): {
// no projectile or intercept type // no projectile or intercept type
defInterceptType = 128; defInterceptType = 128;

ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.9f);
} break; } break;
case hashString("Melee"): { case hashString("Melee"): {
// no projectile or intercept type // no projectile or intercept type
defInterceptType = 256; defInterceptType = 256;

ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.9f);
} break; } break;
case hashString("Flame"): { case hashString("Flame"): {
// CFlameProjectile // CFlameProjectile
projectileType = WEAPON_FLAME_PROJECTILE; projectileType = WEAPON_FLAME_PROJECTILE;
defInterceptType = 16; defInterceptType = 16;


ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.2f); collisionSize = wdTable.GetFloat("collisionSize", 0.5f);
collisionSize = wdTable.GetFloat("collisionSize", 0.5f);
} break; } break;
case hashString("MissileLauncher"): { case hashString("MissileLauncher"): {
// CMissileProjectile // CMissileProjectile
projectileType = WEAPON_MISSILE_PROJECTILE; projectileType = WEAPON_MISSILE_PROJECTILE;
defInterceptType = 4; defInterceptType = 4;

ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.5f);
} break; } break;
case hashString("LaserCannon"): { case hashString("LaserCannon"): {
// CLaserProjectile // CLaserProjectile
projectileType = WEAPON_LASER_PROJECTILE; projectileType = WEAPON_LASER_PROJECTILE;
defInterceptType = 2; defInterceptType = 2;


ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.7f);
collisionSize = wdTable.GetFloat("collisionSize", 0.5f); collisionSize = wdTable.GetFloat("collisionSize", 0.5f);
} break; } break;
case hashString("BeamLaser"): { case hashString("BeamLaser"): {
projectileType = largeBeamLaser? WEAPON_LARGEBEAMLASER_PROJECTILE: WEAPON_BEAMLASER_PROJECTILE; projectileType = largeBeamLaser? WEAPON_LARGEBEAMLASER_PROJECTILE: WEAPON_BEAMLASER_PROJECTILE;
defInterceptType = 2; defInterceptType = 2;

ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.7f);
} break; } break;
case hashString("LightningCannon"): { case hashString("LightningCannon"): {
projectileType = WEAPON_LIGHTNING_PROJECTILE; projectileType = WEAPON_LIGHTNING_PROJECTILE;
defInterceptType = 64; defInterceptType = 64;

ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.5f);
} break; } break;
case hashString("EmgCannon"): { case hashString("EmgCannon"): {
// CEmgProjectile // CEmgProjectile
projectileType = WEAPON_EMG_PROJECTILE; projectileType = WEAPON_EMG_PROJECTILE;
defInterceptType = 1; defInterceptType = 1;


ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.5f);
size = wdTable.GetFloat("size", 3.0f); size = wdTable.GetFloat("size", 3.0f);
} break; } break;
case hashString("TorpedoLauncher"): { case hashString("TorpedoLauncher"): {
// WeaponLoader will create either BombDropper with dropTorpedoes = true // WeaponLoader will create either BombDropper with dropTorpedoes = true
// (owner->unitDef->canfly && !weaponDef->submissile) or TorpedoLauncher // (owner->unitDef->canfly && !weaponDef->submissile) or TorpedoLauncher
// (both types of weapons will spawn TorpedoProjectile's) // (both types of weapons will spawn TorpedoProjectile's)
//
projectileType = WEAPON_TORPEDO_PROJECTILE; projectileType = WEAPON_TORPEDO_PROJECTILE;
defInterceptType = 32; defInterceptType = 32;


ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.5f);
waterweapon = true; waterweapon = true;
} break; } break;
case hashString("DGun"): { case hashString("DGun"): {
// CFireBallProjectile // CFireBallProjectile
projectileType = WEAPON_FIREBALL_PROJECTILE; projectileType = WEAPON_FIREBALL_PROJECTILE;


ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.5f);
collisionSize = wdTable.GetFloat("collisionSize", 10.0f); collisionSize = wdTable.GetFloat("collisionSize", 10.0f);
leadLimit = wdTable.GetFloat("leadLimit", 0.0f); leadLimit = wdTable.GetFloat("leadLimit", 0.0f);
} break; } break;
case hashString("StarburstLauncher"): { case hashString("StarburstLauncher"): {
// CStarburstProjectile // CStarburstProjectile
projectileType = WEAPON_STARBURST_PROJECTILE; projectileType = WEAPON_STARBURST_PROJECTILE;
defInterceptType = 4; defInterceptType = 4;

ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.7f);
} break; } break;
case hashString("AircraftBomb"): { case hashString("AircraftBomb"): {
// WeaponLoader will create BombDropper with dropTorpedoes = false // WeaponLoader will create BombDropper with dropTorpedoes = false
// BombDropper with dropTorpedoes=false spawns ExplosiveProjectile's // BombDropper with dropTorpedoes=false spawns ExplosiveProjectile's
// //
projectileType = WEAPON_EXPLOSIVE_PROJECTILE; projectileType = WEAPON_EXPLOSIVE_PROJECTILE;
defInterceptType = 8; defInterceptType = 8;

ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.9f);
} break; } break;
default: { default: {
ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.0f);
} break; } break;
} }


if (ownerExpAccWeight < 0.0f) if ((ownerExpAccWeight = wdTable.GetFloat("ownerExpAccWeight", 0.0f)) < 0.0f)
LOG_L(L_ERROR, "[%s] weaponDef %s has negative ownerExpAccWeight %f", __func__, name.c_str(), ownerExpAccWeight); LOG_L(L_ERROR, "[%s] weaponDef %s has negative ownerExpAccWeight %f", __func__, name.c_str(), ownerExpAccWeight);


interceptedByShieldType = wdTable.GetInt("interceptedByShieldType", defInterceptType); interceptedByShieldType = wdTable.GetInt("interceptedByShieldType", defInterceptType);

0 comments on commit 3ad8806

Please sign in to comment.
You can’t perform that action at this time.