SAGA2: Rename abort() methods

This commit is contained in:
Eugene Sandulenko 2021-05-27 11:03:05 +02:00
parent 863adf7918
commit b8ab6203e4
No known key found for this signature in database
GPG key ID: 014D387312D34F08
8 changed files with 87 additions and 154 deletions

View file

@ -1368,7 +1368,7 @@ void Actor::deleteActor(void) {
// Kill task
if (curTask != NULL) {
curTask->abort();
curTask->abortTask();
delete curTask;
curTask = NULL;
}
@ -1432,7 +1432,7 @@ void Actor::die(void) {
// Kill task
if (curTask != NULL) {
curTask->abort();
curTask->abortTask();
delete curTask;
curTask = NULL;
}
@ -1533,7 +1533,7 @@ void Actor::deactivateActor(void) {
#endif
// Kill task
if (curTask != NULL) {
curTask->abort();
curTask->abortTask();
delete curTask;
curTask = NULL;
}
@ -1588,7 +1588,7 @@ void Actor::lobotomize(void) {
// Kill task
if (curTask != NULL) {
curTask->abort();
curTask->abortTask();
delete curTask;
curTask = NULL;
}
@ -2275,7 +2275,7 @@ bool Actor::SetAvailableAction(int16 flags, ...) {
void Actor::setGoal(uint8 newGoal) {
if (currentGoal != newGoal) {
if (curTask != NULL) {
curTask->abort();
curTask->abortTask();
delete curTask;
curTask = NULL;
}

View file

@ -33,14 +33,6 @@
namespace Saga2 {
#ifdef _WIN32 // Set structure alignment packing value to 1 byte
#pragma pack( push, 1 )
#endif
/* ===================================================================== *
Constants
* ===================================================================== */
class ActorAssignment;
class Band;
class MotionTask;
@ -138,15 +130,15 @@ struct ActorAttributes {
};
uint8 allSkills[ numSkills ]; // number of skills
uint8 allSkills[numSkills]; // number of skills
};
// Pad byte for alignment
int8 pad;
int8 pad;
// Hit-points
int16 vitality;
int16 vitality;
// Magic energy
union {
@ -159,14 +151,14 @@ struct ActorAttributes {
violetMana;
};
int16 allManas[ numManas ];
int16 allManas[numManas];
};
uint8 &skill(int16 id) {
return allSkills[ id ];
return allSkills[id];
}
int16 &mana(int16 id) {
return allManas[ id ];
return allManas[id];
}
uint8 getSkillLevel(int16 id) {
@ -175,8 +167,8 @@ struct ActorAttributes {
}; // 28 bytes
const int baseCarryingCapacity = 100;
const int carryingCapacityBonusPerBrawn = 200 / ActorAttributes::skillLevels;
const int baseCarryingCapacity = 100;
const int carryingCapacityBonusPerBrawn = 200 / ActorAttributes::skillLevels;
/* ===================================================================== *
ResourceActorProtoExtension structure
@ -512,13 +504,13 @@ struct ResourceActor : public ResourceGameObject {
rightHandObject; // object held in right hand.
// Knowledge packets
uint16 knowledge[ 16 ];
uint16 knowledge[16];
// Schedule script ID
uint16 schedule;
// Pad bytes
uint8 reserved[ 18 ];
uint8 reserved[18];
};
@ -561,14 +553,14 @@ public:
rightHandObject; // object held in right hand.
// Knowledge packets
uint16 knowledge[ 16 ];
uint16 knowledge[16];
// Schedule script ID
uint16 schedule;
// Run-time fields
uint8 conversationMemory[ 4 ];// last things talked about
uint8 conversationMemory[4];// last things talked about
// Sprite animation variables
uint8 currentAnimation, // current action sequence
@ -613,7 +605,7 @@ public:
uint8 deactivationCounter;
// Assignment
uint8 assignmentBuf[ 24 ]; // memory reserved for actor
uint8 assignmentBuf[24]; // memory reserved for actor
// assignments
// Current effective stats
@ -636,11 +628,11 @@ public:
Actor *leader; // This actor's leader
Band *followers; // This actor's band of followers
ObjectID armorObjects[ ARMOR_COUNT ]; // armor objects being worn
ObjectID armorObjects[ARMOR_COUNT]; // armor objects being worn
GameObject *currentTarget;
int16 scriptVar[ actorScriptVars ]; // scratch variables for scripter use
int16 scriptVar[actorScriptVars]; // scratch variables for scripter use
// Member functions
@ -1078,58 +1070,6 @@ void loadFactionTallies(SaveFileReader &saveGame);
// Cleanup the faction tally table
inline void cleanupFactionTallies(void) { /* Nothing to do */ }
/* ============================================================================ *
Magic: Actor Enchantment bits
* ============================================================================ */
// These are are all the enchantment effects that can be represented
// as a single bit.
// THESE ARE NO LONGER VALID SEE EFFECTS.H
#if 0
enum enchantmentEffects {
actorFlamingAura = (1 << 0), // surrounded by damaging aura
actorImmunePhysical = (1 << 1), // immune to physical weapons
actorImmuneProjectile = (1 << 2), // immune to projectiles
actorImmuneHandToHand = (1 << 3), // immune to non-projectiles
actorImmuneMagicMissile = (1 << 4), // immune to magical projectiles
actorImmuneFire = (1 << 5), // immune to fire
actorImmuneFireMagic = (1 << 6), // immune to magical fire
actorImmuneLava = (1 << 7), // immune to hot terrain
actorImmuneCold = (1 << 8), // immune to cold
actorImmuneMental = (1 << 9), // immune to mental attack
actorImmuneDirectMagic = (1 << 10), // immune to direct magic
actorImmuneLifeDrain = (1 << 11), // immune to Life Drain
actorLandWalking = (1 << 12), // can walk on land
actorDesolidified = (1 << 13), // can walk through walls
actorFloating = (1 << 14), // actor is floating
actorFallSlowly = (1 << 15), // protected against falling
actorLevitating = (1 << 16), // actor is levitating
actorWaterWalking = (1 << 17), // can walk on water
actorFlying = (1 << 18), // flying spell
actorBlind = (1 << 19), // actor is blind
actorPanic = (1 << 20), // actor runs away from danger
actorParalyzed = (1 << 21), // actor can not move
actorMoveFast = (1 << 22), // move faster than normal
actorMoveSlow = (1 << 23), // move slower than normal
actorAttackFast = (1 << 24), // attack faster than normal
actorAttackSlow = (1 << 25), // attack slower than normal
actorAsleep = (1 << 26), // actor goes to sleep
actorSoulSight = (1 << 27), // can see invisible
actorClairvoyant = (1 << 28), // player can scroll view
actorDetectPoison = (1 << 29), // poison objects highlighted
actorInvisible = (1 << 30), // no-one can see this actor
actorHasNoSmell = (1 << 31), // can't be tracked
};
#endif
#ifdef _WIN32 // Reset old structure alignment
#pragma pack( pop )
#endif
} // end of namespace Saga2
#endif

View file

@ -62,7 +62,7 @@ ActorAssignment::~ActorAssignment(void) {
if (a->currentGoal == actorGoalFollowAssignment
&& a->curTask != NULL) {
// If so, abort it
a->curTask->abort();
a->curTask->abortTask();
delete a->curTask;
a->curTask = NULL;
}

View file

@ -24,8 +24,6 @@
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
*/
#define FORBIDDEN_SYMBOL_ALLOW_ALL // FIXME: Remove
#include "saga2/std.h"
#include "saga2/gdraw.h"
#include "saga2/gblitter.h"
@ -36,10 +34,6 @@ namespace Saga2 {
#define TempFree free
/* ===================================================================== *
Member functions for gPort
* ===================================================================== */
void gPort::setMap(gPixelMap *newmap, bool inverted) {
map = newmap;
clip = Rect16(0, 0, map->size.x, map->size.y);

View file

@ -189,8 +189,7 @@ public:
// Constructor
gPort(void) {
memset(&map, 0,
offsetof(gPort, textStyles) - offsetof(gPort, map) + sizeof(textStyles));
memset(&map, 0, sizeof(gPort));
}
virtual ~gPort() {}
@ -216,8 +215,8 @@ public:
// Indirect colors
void setPenMap(gPen *map) {
penMap = map;
void setPenMap(gPen *pmap) {
penMap = pmap;
}
void setIndirectColor(uint8 color) {
fgPen = penMap[ color ];

View file

@ -580,7 +580,7 @@ void setCenterActor(PlayerActorID newCenter) {
setEnchantmentDisplay();
if (a->curTask != NULL) {
a->curTask->abort();
a->curTask->abortTask();
delete a->curTask;
a->curTask = NULL;
}

View file

@ -1261,7 +1261,7 @@ int16 WanderTask::getType(void) const {
//----------------------------------------------------------------------
void WanderTask::abort(void) {
void WanderTask::abortTask(void) {
// if the actor has a wander motion, abort it
MotionTask *actorMotion = stack->getActor()->moveTask;
@ -1316,7 +1316,7 @@ TaskResult WanderTask::handleWander(void) {
void WanderTask::pause(void) {
// Call abort to stop the wandering motion
abort();
abortTask();
paused = TRUE;
counter = (rand() % 64 + rand() % 64) / 2;
@ -1424,9 +1424,9 @@ int16 TetheredWanderTask::getType(void) const {
//----------------------------------------------------------------------
void TetheredWanderTask::abort(void) {
void TetheredWanderTask::abortTask(void) {
if (gotoTether != NULL) {
gotoTether->abort();
gotoTether->abortTask();
delete gotoTether;
gotoTether = NULL;
} else {
@ -1467,7 +1467,7 @@ TaskResult TetheredWanderTask::handleWander(void) {
}
} else {
if (gotoTether != NULL) {
gotoTether->abort();
gotoTether->abortTask();
delete gotoTether;
gotoTether = NULL;
}
@ -1590,10 +1590,10 @@ void GotoTask::mark(void) {
//----------------------------------------------------------------------
void GotoTask::abort(void) {
void GotoTask::abortTask(void) {
// If there is a wander subtask, delete it.
if (wander) {
wander->abort();
wander->abortTask();
delete wander;
wander = NULL;
} else {
@ -1608,7 +1608,7 @@ void GotoTask::abort(void) {
TaskResult GotoTask::evaluate(void) {
// Determine if we have reach the target.
if (stack->getActor()->getLocation() == destination()) {
abort();
abortTask();
return taskSucceeded;
}
@ -2274,9 +2274,9 @@ void GoAwayFromTask::mark(void) {
//----------------------------------------------------------------------
// Abort this task
void GoAwayFromTask::abort(void) {
void GoAwayFromTask::abortTask(void) {
if (goTask != NULL) {
goTask->abort();
goTask->abortTask();
delete goTask;
goTask = NULL;
}
@ -2597,14 +2597,14 @@ void HuntTask::mark(void) {
//----------------------------------------------------------------------
void HuntTask::abort(void) {
void HuntTask::abortTask(void) {
if (huntFlags & (huntWander | huntGoto)) {
subTask->abort();
subTask->abortTask();
delete subTask;
}
// If we've reached the target call the atTargetAbort() function
if (atTarget()) atTargetAbort();
// If we've reached the target call the atTargetabortTask() function
if (atTarget()) atTargetabortTask();
}
//----------------------------------------------------------------------
@ -2680,7 +2680,7 @@ TaskResult HuntTask::update(void) {
//----------------------------------------------------------------------
void HuntTask::removeWanderTask(void) {
subTask->abort();
subTask->abortTask();
delete subTask;
huntFlags &= ~huntWander;
}
@ -2688,7 +2688,7 @@ void HuntTask::removeWanderTask(void) {
//----------------------------------------------------------------------
void HuntTask::removeGotoTask(void) {
subTask->abort();
subTask->abortTask();
delete subTask;
huntFlags &= ~huntGoto;
}
@ -2866,7 +2866,7 @@ bool HuntToBeNearLocationTask::atTarget(void) {
//----------------------------------------------------------------------
void HuntToBeNearLocationTask::atTargetAbort(void) {}
void HuntToBeNearLocationTask::atTargetabortTask(void) {}
//----------------------------------------------------------------------
@ -3099,7 +3099,7 @@ bool HuntToBeNearObjectTask::atTarget(void) {
//----------------------------------------------------------------------
void HuntToBeNearObjectTask::atTargetAbort(void) {}
void HuntToBeNearObjectTask::atTargetabortTask(void) {}
//----------------------------------------------------------------------
@ -3238,7 +3238,7 @@ bool HuntToPossessTask::atTarget(void) {
//----------------------------------------------------------------------
void HuntToPossessTask::atTargetAbort(void) {}
void HuntToPossessTask::atTargetabortTask(void) {}
//----------------------------------------------------------------------
@ -3512,7 +3512,7 @@ void HuntToBeNearActorTask::evaluateTarget(void) {
maxSenseRange,
actorArray[ i ])) {
if (currentTarget != actorArray[ i ]) {
if (atTarget()) atTargetAbort();
if (atTarget()) atTargetabortTask();
currentTarget = actorArray[ i ];
}
@ -3539,7 +3539,7 @@ bool HuntToBeNearActorTask::atTarget(void) {
return TRUE;
else {
if (goAway != NULL) {
goAway->abort();
goAway->abortTask();
delete goAway;
goAway = NULL;
}
@ -3550,9 +3550,9 @@ bool HuntToBeNearActorTask::atTarget(void) {
//----------------------------------------------------------------------
void HuntToBeNearActorTask::atTargetAbort(void) {
void HuntToBeNearActorTask::atTargetabortTask(void) {
if (goAway != NULL) {
goAway->abort();
goAway->abortTask();
delete goAway;
goAway = NULL;
}
@ -3568,7 +3568,7 @@ TaskResult HuntToBeNearActorTask::atTargetEvaluate(void) {
return taskNotDone;
if (goAway != NULL) {
goAway->abort();
goAway->abortTask();
delete goAway;
goAway = NULL;
}
@ -3596,7 +3596,7 @@ TaskResult HuntToBeNearActorTask::atTargetUpdate(void) {
// Delete the go away task if it exists
if (goAway != NULL) {
goAway->abort();
goAway->abortTask();
delete goAway;
goAway = NULL;
}
@ -3689,8 +3689,8 @@ bool HuntToKillTask::operator == (const Task &t) const {
//----------------------------------------------------------------------
void HuntToKillTask::abort(void) {
HuntActorTask::abort();
void HuntToKillTask::abortTask(void) {
HuntActorTask::abortTask();
Actor *a = stack->getActor();
@ -3858,7 +3858,7 @@ void HuntToKillTask::evaluateTarget(void) {
if (bestTarget != currentTarget) {
// If the current target has changed, abort any
// action currently taking place
if (atTarget()) atTargetAbort();
if (atTarget()) atTargetabortTask();
currentTarget = bestTarget;
a->currentTarget = currentTarget;
}
@ -3883,7 +3883,7 @@ bool HuntToKillTask::atTarget(void) {
//----------------------------------------------------------------------
void HuntToKillTask::atTargetAbort(void) {
void HuntToKillTask::atTargetabortTask(void) {
// If the task is aborted while at the target actor, abort any
// attack currently taking place
stack->getActor()->stopAttack(currentTarget);
@ -4070,7 +4070,7 @@ bool HuntToGiveTask::atTarget(void) {
//----------------------------------------------------------------------
void HuntToGiveTask::atTargetAbort(void) {}
void HuntToGiveTask::atTargetabortTask(void) {}
//----------------------------------------------------------------------
@ -4355,7 +4355,7 @@ bool BandTask::atTarget(void) {
if ((actorLoc - currentTarget).quickHDistance() > 6
|| abs(actorLoc.z - currentTarget.z) > maxStepHeight) {
if (attend != NULL) {
attend->abort();
attend->abortTask();
delete attend;
attend = NULL;
}
@ -4368,9 +4368,9 @@ bool BandTask::atTarget(void) {
//----------------------------------------------------------------------
void BandTask::atTargetAbort(void) {
void BandTask::atTargetabortTask(void) {
if (attend != NULL) {
attend->abort();
attend->abortTask();
delete attend;
attend = NULL;
}
@ -4641,10 +4641,10 @@ int16 FollowPatrolRouteTask::getType(void) const {
//----------------------------------------------------------------------
void FollowPatrolRouteTask::abort(void) {
void FollowPatrolRouteTask::abortTask(void) {
// If there is a subtask, get rid of it
if (gotoWayPoint) {
gotoWayPoint->abort();
gotoWayPoint->abortTask();
delete gotoWayPoint;
gotoWayPoint = NULL;
}
@ -4693,7 +4693,7 @@ TaskResult FollowPatrolRouteTask::handleFollowPatrolRoute(void) {
&& abs(actorLoc.z - currentWayPoint.z) <= maxStepHeight) {
// Delete the gotoWayPoint task
if (gotoWayPoint != NULL) {
gotoWayPoint->abort();
gotoWayPoint->abortTask();
delete gotoWayPoint;
gotoWayPoint = NULL;
}
@ -4808,7 +4808,7 @@ int16 AttendTask::getType(void) const {
//----------------------------------------------------------------------
void AttendTask::abort(void) {
void AttendTask::abortTask(void) {
MotionTask *actorMotion = stack->getActor()->moveTask;
// Determine if we need to abort the actor motion
@ -4939,10 +4939,10 @@ int16 DefendTask::getType(void) const {
//----------------------------------------------------------------------
void DefendTask::abort(void) {
void DefendTask::abortTask(void) {
// If we have a sub-task, kill it
if (subTask != NULL) {
subTask->abort();
subTask->abortTask();
delete subTask;
subTask = NULL;
}
@ -5101,7 +5101,7 @@ int16 ParryTask::getType(void) const {
//----------------------------------------------------------------------
void ParryTask::abort(void) {
void ParryTask::abortTask(void) {
MotionTask *actorMotion = stack->getActor()->moveTask;
// Kill the defense motion, if there is one
@ -5261,11 +5261,11 @@ void TaskStack::setTask(Task *t) {
//----------------------------------------------------------------------
// Abort all tasks in stack
void TaskStack::abort(void) {
void TaskStack::abortTask(void) {
if (stackBottomID != NoTask) {
Task *stackBottom = getTaskAddress(stackBottomID);
stackBottom->abort();
stackBottom->abortTask();
delete stackBottom;
}
}

View file

@ -204,7 +204,7 @@ public:
// Return an integer representing the type of this task
virtual int16 getType(void) const = 0;
virtual void abort(void) = 0;
virtual void abortTask(void) = 0;
virtual TaskResult evaluate(void) = 0;
virtual TaskResult update(void) = 0;
@ -244,7 +244,7 @@ public:
// Return an integer representing the type of this task
int16 getType(void) const;
void abort();
void abortTask();
TaskResult evaluate(void);
TaskResult update(void);
@ -323,7 +323,7 @@ public:
// Return an integer representing the type of this task
int16 getType(void) const;
void abort(void);
void abortTask(void);
// Determine if the specified task is equivalent to this task
bool operator == (const Task &t) const;
@ -367,7 +367,7 @@ public:
void mark(void);
#endif
void abort(void);
void abortTask(void);
TaskResult evaluate(void);
TaskResult update(void);
@ -664,7 +664,7 @@ public:
void mark(void);
#endif
void abort(void);
void abortTask(void);
TaskResult evaluate(void);
TaskResult update(void);
@ -788,7 +788,7 @@ public:
void mark(void);
#endif
void abort(void);
void abortTask(void);
TaskResult evaluate(void);
TaskResult update(void);
@ -804,7 +804,7 @@ protected:
virtual TilePoint currentTargetLoc(void) = 0;
virtual bool atTarget(void) = 0;
virtual void atTargetAbort(void) = 0;
virtual void atTargetabortTask(void) = 0;
virtual TaskResult atTargetEvaluate(void) = 0;
virtual TaskResult atTargetUpdate(void) = 0;
};
@ -887,7 +887,7 @@ protected:
bool atTarget(void);
void atTargetAbort(void);
void atTargetabortTask(void);
TaskResult atTargetEvaluate(void);
TaskResult atTargetUpdate(void);
@ -978,7 +978,7 @@ protected:
bool atTarget(void);
void atTargetAbort(void);
void atTargetabortTask(void);
TaskResult atTargetEvaluate(void);
TaskResult atTargetUpdate(void);
@ -1031,7 +1031,7 @@ protected:
void evaluateTarget(void);
bool atTarget(void);
void atTargetAbort(void);
void atTargetabortTask(void);
TaskResult atTargetEvaluate(void);
TaskResult atTargetUpdate(void);
};
@ -1147,7 +1147,7 @@ protected:
bool atTarget(void);
void atTargetAbort(void);
void atTargetabortTask(void);
TaskResult atTargetEvaluate(void);
TaskResult atTargetUpdate(void);
@ -1204,14 +1204,14 @@ public:
// Determine if the specified task is equivalent to this task
bool operator == (const Task &t) const;
void abort(void);
void abortTask(void);
TaskResult update(void);
protected:
void evaluateTarget(void);
bool atTarget(void);
void atTargetAbort(void);
void atTargetabortTask(void);
TaskResult atTargetEvaluate(void);
TaskResult atTargetUpdate(void);
@ -1264,7 +1264,7 @@ protected:
void evaluateTarget(void);
bool atTarget(void);
void atTargetAbort(void);
void atTargetabortTask(void);
TaskResult atTargetEvaluate(void);
TaskResult atTargetUpdate(void);
};
@ -1399,7 +1399,7 @@ protected:
bool atTarget(void);
void atTargetAbort(void);
void atTargetabortTask(void);
TaskResult atTargetEvaluate(void);
TaskResult atTargetUpdate(void);
@ -1514,7 +1514,7 @@ public:
// Return an integer representing the type of this task
int16 getType(void) const;
void abort(void);
void abortTask(void);
TaskResult evaluate(void);
TaskResult update(void);
@ -1560,7 +1560,7 @@ public:
// Return an integer representing the type of this task
int16 getType(void) const;
void abort(void);
void abortTask(void);
TaskResult evaluate(void);
TaskResult update(void);
@ -1605,7 +1605,7 @@ public:
// Return an integer representing the type of this task
int16 getType(void) const;
void abort(void);
void abortTask(void);
TaskResult evaluate(void);
TaskResult update(void);
@ -1650,7 +1650,7 @@ public:
// Return an integer representing the type of this task
int16 getType(void) const;
void abort(void);
void abortTask(void);
TaskResult evaluate(void);
TaskResult update(void);
@ -1732,7 +1732,7 @@ public:
}
// Abort all tasks in stack
void abort(void);
void abortTask(void);
// Re-evaluate tasks in stack
TaskResult evaluate(void);
// Update the state of the tasks in stack