SAGA2: Rename class viariables in weapons.h

This commit is contained in:
Eugene Sandulenko 2021-06-13 18:11:36 +02:00
parent 9d8887f297
commit c9d0eb45d0
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
2 changed files with 41 additions and 41 deletions

View File

@ -143,15 +143,15 @@ GameObject *getShieldItem(GameObject *defender) {
WeaponProtoEffect member functions
* ===================================================================== */
WeaponProtoEffect::~WeaponProtoEffect(void) {
if (effect != NULL)
delete effect;
if (_effect != NULL)
delete _effect;
}
void WeaponProtoEffect::implement(Actor *enactor, GameObject *target, GameObject *, uint8) {
SpellTarget targ(target);
if (effect != NULL)
effect->implement(enactor, &targ);
if (_effect != NULL)
_effect->implement(enactor, &targ);
}
/* ===================================================================== *
@ -164,44 +164,44 @@ void WeaponStrikeEffect::implement(Actor *enactor, GameObject *target, GameObjec
int8 totalDice, totalBase;
totalDice = dice + strength * skillDice;
totalBase = base + strength * skillBase;
totalDice = _dice + strength * _skillDice;
totalBase = _base + strength * _skillBase;
target->acceptDamage(enactor->thisID(), totalBase, type, totalDice, sides);
target->acceptDamage(enactor->thisID(), totalBase, _type, totalDice, _sides);
}
WeaponStuff::WeaponStuff() {
effects = NULL;
master = nullWeapon;
_effects = NULL;
_master = nullWeapon;
}
WeaponStuff::~WeaponStuff() {
while (effects != NULL) {
WeaponEffect *curEffect = effects;
while (_effects != NULL) {
WeaponEffect *curEffect = _effects;
effects = effects->next;
_effects = _effects->_next;
delete curEffect;
}
master = nullWeapon;
_master = nullWeapon;
}
void WeaponStuff::killEffects(void) {
while (effects != NULL) {
WeaponEffect *curEffect = effects;
while (_effects != NULL) {
WeaponEffect *curEffect = _effects;
effects = effects->next;
_effects = _effects->_next;
delete curEffect;
}
}
void WeaponStuff::addEffect(WeaponEffect *we) {
WeaponEffect *e = effects;
if (effects) {
while (e->next)
e = e->next;
e->next = we;
WeaponEffect *e = _effects;
if (_effects) {
while (e->_next)
e = e->_next;
e->_next = we;
} else {
effects = we;
_effects = we;
}
}
@ -234,18 +234,18 @@ void WeaponStuff::addEffect(Common::SeekableReadStream *stream) {
if (we == NULL)
error("failed to alloc weapon effect");
if (effects == NULL)
effects = we;
if (_effects == NULL)
_effects = we;
else {
WeaponEffect *tail;
for (tail = effects; tail->next; tail = tail->next)
for (tail = _effects; tail->_next; tail = tail->_next)
;
tail->next = we;
tail->_next = we;
}
}
void WeaponStuff::implement(Actor *enactor, GameObject *target, GameObject *strikingObj, uint8 strength) {
for (WeaponEffect *we = effects; we != NULL; we = we->next)
for (WeaponEffect *we = _effects; we != NULL; we = we->_next)
we->implement(enactor, target, strikingObj, strength);
}

View File

@ -41,9 +41,9 @@ ProtoEffect *createNewProtoEffect(Common::SeekableReadStream *stream);
class WeaponEffect {
public:
WeaponEffect *next; // pointer to additional effects
WeaponEffect *_next; // pointer to additional effects
WeaponEffect(void) : next(NULL) {}
WeaponEffect(void) : _next(NULL) {}
virtual ~WeaponEffect(void) {}
virtual void implement(Actor *enactor, GameObject *target, GameObject *strikingObj, uint8 strength) = 0;
};
@ -51,10 +51,10 @@ public:
//-----------------------------------------------------------------------
class WeaponProtoEffect : public WeaponEffect {
ProtoEffect *effect;
ProtoEffect *_effect;
public:
WeaponProtoEffect(Common::SeekableReadStream *stream) : effect(createNewProtoEffect(stream)) {
WeaponProtoEffect(Common::SeekableReadStream *stream) : _effect(createNewProtoEffect(stream)) {
}
~WeaponProtoEffect(void);
@ -64,16 +64,16 @@ public:
//-----------------------------------------------------------------------
class WeaponStrikeEffect : public WeaponEffect {
effectDamageTypes type; // damage type
int8 dice; // # of dice to roll
int8 sides; // # of sides on dice
int8 skillDice; // multiply additional dice
int8 base; // absolute damage amount
int8 skillBase;
effectDamageTypes _type;// damage type
int8 _dice; // # of dice to roll
int8 _sides; // # of sides on dice
int8 _skillDice; // multiply additional dice
int8 _base; // absolute damage amount
int8 _skillBase;
public:
WeaponStrikeEffect(effectDamageTypes t, int8 d, int8 s, int8 sd, int8 b, int8 sb) :
type(t), dice(d), sides(s), skillDice(sd), base(b), skillBase(sb) {
_type(t), _dice(d), _sides(s), _skillDice(sd), _base(b), _skillBase(sb) {
}
void implement(Actor *enactor, GameObject *target, GameObject *strikingObj, uint8 trength);
@ -82,14 +82,14 @@ public:
//-----------------------------------------------------------------------
class WeaponStuff {
weaponID master; // index in array
WeaponEffect *effects; // the effects of this weapon
weaponID _master; // index in array
WeaponEffect *_effects; // the effects of this weapon
public:
WeaponStuff();
~WeaponStuff();
void setID(weaponID id) {
master = id;
_master = id;
}
void addEffect(WeaponEffect *we);
void addEffect(Common::SeekableReadStream *stream);