View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000140 | Spring engine | General | public | 2006-03-21 23:29 | 2014-01-30 14:21 |
| Reporter | Nemo | Assigned To | abma | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | won't fix | ||
| Summary | 0000140: Damage values of 0 rounded up to 1 | ||||
| Description | All weapons with damage 0, or doing a special damage of 0, actually do 1hp of damage. This isn't much of an issue on its own, but for mods with weapons that use burstfire, or rapidfire weapons, that 1 damage is added to each round of the burst, even if it shouldn't be doing any damage. This quickly adds up (and breaks AATA pretty badly, since it depends heavily on certain units being immune to certain weapons). We can work around this for now by simply scaling unit HPs way up so that the damage from machine guns that shouldn't be there is negligable, but a fix would really be great - even if we scale things up, swarms of infantry with rapid fire machine guns can put a nasty dent in very heavily armored units (which shouldn't take any damage at all from these sorts of weapons). I tested in a completely seperate mod (XTA standard edition v.66) as well, so its not AATA specific. | ||||
| Additional Information | To test, simply set the EMG weapon of XTA to do zero damage, then zip it up and have a peewee attack anything. The attacked unit will still be hurt. | ||||
| Tags | No tags attached. | ||||
| Checked infolog.txt for Errors | |||||
|
|
for anyone looking into this: for(int a=0;a<damageArrayHandler->numTypes;++a) { sunparser->GetDef(weaponDefs[id].damages[a], "0", weaponname + "\\DAMAGE\\default"); if(weaponDefs[id].damages[a]==0) //avoid division by zeroes weaponDefs[id].damages[a]=1; } std::map<std::string, std::string> damages=sunparser->GetAllValues(weaponname + "\\DAMAGE"); for(std::map<std::string, std::string>::iterator di=damages.begin();di!=damages.end();++di){ int type=damageArrayHandler->GetTypeFromName(di->first); float damage=atof(di->second.c_str()); if(damage==0) damage=1; if(type!=0){ weaponDefs[id].damages[type]=damage; // info->AddLine("Weapon %s has damage %f against type %i",weaponname.c_str(),damage,type); } } the prevention of division by zero here might cause it... it's in WeaponDefHandler.cpp, around line 180 |
|
|
this is still in the engine: rts/Sim/Weapons/WeaponDefHandler.cpp:172 [code] // setup the default damages const LuaTable dmgTable = wdTable.SubTable("damage"); float defDamage = dmgTable.GetFloat("default", 0.0f); if (defDamage == 0.0f) { defDamage = 1.0f; //avoid division by zeroes } for (int a = 0; a < damageArrayHandler->GetNumTypes(); ++a) { wd.damages[a] = defDamage; } [/code] I see this as a hax/logic bug, and it should be fixed. Now.. i would do it this way: remove this code (damgage 0 really is 0, not 1), and then add checks in the right places in the code. Two problems: * i would need a (mini-)mod for testing, with a unit & weapon with damage 0 * i have no idea how much it would break widgets |
|
|
easy workaround in the form of UnitPreDamaged now exists, and it's probably a better solution for special weapons anyway. there's a lot of hunting for nans otherwise. |
|
|
Presumably a won't-fix now, due to the reasons baczek stated. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2006-03-21 23:29 | Nemo | New Issue | |
| 2006-03-22 22:59 | tvo | Note Added: 0000139 | |
| 2006-03-22 22:59 | tvo | Note Edited: 0000139 | |
| 2009-08-10 15:20 | hoijui | Note Added: 0003869 | |
| 2009-08-10 15:20 | hoijui | Status | new => feedback |
| 2010-02-10 16:29 | tvo | Status | feedback => confirmed |
| 2010-02-10 16:30 | tvo | Status | confirmed => feedback |
| 2010-02-11 17:07 | imbaczek | Note Added: 0004645 | |
| 2014-01-30 00:06 | FLOZi | Note Added: 0012781 | |
| 2014-01-30 14:21 | abma | Status | feedback => closed |
| 2014-01-30 14:21 | abma | Assigned To | => abma |
| 2014-01-30 14:21 | abma | Resolution | open => won't fix |