URL:
<http://gna.org/task/?4028>
Summary: Use a common interface for all physical object in
Wormux to manage damage and life points.
Project: Wormux
Submitted by: drayan
Submitted on: mardi 24.10.2006 à 23:46
Should Start On: mardi 24.10.2006 à 00:00
Should be Finished on: mardi 24.10.2006 à 00:00
Category: physical engine
Priority: 5 - Normal
Status: None
Assigned to: drayan
Percent Complete: 20%
Open/Closed: Open
_______________________________________________________
Details:
Move all SetEnergy/life_points related code from Character to PhysicalObj.
This kind of things will enable mine explosion with weapon projectile and
remove all if(typeid() == typeid(Character)) related code.
A example :
void Anvil::SignalObjectCollision(PhysicalObj * obj)
{
if(typeid(*obj) == typeid(Character)) {
Character * tmp = (Character *)(obj);
tmp -> SetEnergyDelta (-200);
}
}
become :
void Anvil::SignalObjectCollision(PhysicalObj * obj)
{
obj -> AddDamage (-200);
}
No cast, no segfault when obj is not a Character. No brain damage. Just keep
it simple stupid !
_______________________________________________________
Reply to this item at:
<http://gna.org/task/?4028>
_______________________________________________
Message posté via/par Gna!
http://gna.org/
_______________________________________________
Wormux-gna mailing list
[email protected]
https://mail.gna.org/listinfo/wormux-gna