From: Laszlo T. <ave...@us...> - 2006-11-14 19:17:15
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/Core In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv30671 Modified Files: Actions.cpp Actor.cpp Actor.h ActorBlock.cpp ActorBlock.h GSUtils.cpp Log Message: Moveble->Movable cleaned ClearPath Index: Actor.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Actor.cpp,v retrieving revision 1.218 retrieving revision 1.219 diff -C2 -d -r1.218 -r1.219 *** Actor.cpp 6 Oct 2006 23:01:09 -0000 1.218 --- Actor.cpp 14 Nov 2006 19:17:08 -0000 1.219 *************** *** 141,145 **** Actor::Actor() ! : Moveble( ST_ACTOR ) { int i; --- 141,145 ---- Actor::Actor() ! : Movable( ST_ACTOR ) { int i; *************** *** 2052,2056 **** Point tmp = Destination; ClearPath(); ! Moveble::WalkTo(tmp, size ); } --- 2052,2056 ---- Point tmp = Destination; ClearPath(); ! Movable::WalkTo(tmp, size ); } *************** *** 2065,2071 **** if (Des.x==-2 && Des.y==-2) { Point p((ieWord) Modified[IE_SAVEDXPOS], (ieWord) Modified[IE_SAVEDYPOS] ); ! Moveble::WalkTo(p, MinDistance); } else { ! Moveble::WalkTo(Des, MinDistance); } } --- 2065,2071 ---- if (Des.x==-2 && Des.y==-2) { Point p((ieWord) Modified[IE_SAVEDXPOS], (ieWord) Modified[IE_SAVEDYPOS] ); ! Movable::WalkTo(p, MinDistance); } else { ! Movable::WalkTo(Des, MinDistance); } } Index: Actor.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Actor.h,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** Actor.h 2 Sep 2006 21:24:47 -0000 1.129 --- Actor.h 14 Nov 2006 19:17:09 -0000 1.130 *************** *** 104,108 **** typedef std::vector< ScriptedAnimation*> vvcVector; ! class GEM_EXPORT Actor : public Moveble { public: //CRE DATA FIELDS --- 104,108 ---- typedef std::vector< ScriptedAnimation*> vvcVector; ! class GEM_EXPORT Actor : public Movable { public: //CRE DATA FIELDS Index: GSUtils.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/GSUtils.cpp,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** GSUtils.cpp 11 Nov 2006 12:18:29 -0000 1.74 --- GSUtils.cpp 14 Nov 2006 19:17:09 -0000 1.75 *************** *** 710,714 **** case ST_ACTOR: //if there are other moveables, put them here ! position = ((Moveble *) scr)->GetMostLikelyPosition(); break; case ST_TRIGGER: case ST_PROXIMITY: case ST_TRAVEL: --- 710,714 ---- case ST_ACTOR: //if there are other moveables, put them here ! position = ((Movable *) scr)->GetMostLikelyPosition(); break; case ST_TRIGGER: case ST_PROXIMITY: case ST_TRAVEL: Index: Actions.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/Actions.cpp,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** Actions.cpp 11 Nov 2006 12:18:28 -0000 1.93 --- Actions.cpp 14 Nov 2006 19:17:08 -0000 1.94 *************** *** 3588,3592 **** return; } ! Moveble *movable = (Moveble *) tar; //not actor, though it is the only moveable movable->Destination = parameters->pointParameter; //no movement should be started here, i think --- 3588,3592 ---- return; } ! Movable *movable = (Movable *) tar; //not actor, though it is the only moveable movable->Destination = parameters->pointParameter; //no movement should be started here, i think Index: ActorBlock.h =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/ActorBlock.h,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -d -r1.116 -r1.117 *** ActorBlock.h 2 Sep 2006 10:29:25 -0000 1.116 --- ActorBlock.h 14 Nov 2006 19:17:09 -0000 1.117 *************** *** 26,30 **** class Highlightable; class Actor; ! class Moveble; class Door; class SpriteCover; --- 26,30 ---- class Highlightable; class Actor; ! class Movable; class Door; class SpriteCover; *************** *** 285,289 **** }; ! class GEM_EXPORT Moveble : public Selectable { private: //these seem to be sensitive, so get protection unsigned char StanceID; --- 285,289 ---- }; ! class GEM_EXPORT Movable : public Selectable { private: //these seem to be sensitive, so get protection unsigned char StanceID; *************** *** 292,297 **** PathNode* step; //actual step public: ! Moveble(ScriptableType type); ! virtual ~Moveble(void); Point Destination; ieDword timeStartStep; --- 292,297 ---- PathNode* step; //actual step public: ! Movable(ScriptableType type); ! virtual ~Movable(void); Point Destination; ieDword timeStartStep; Index: ActorBlock.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/Core/ActorBlock.cpp,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** ActorBlock.cpp 11 Nov 2006 12:18:28 -0000 1.157 --- ActorBlock.cpp 14 Nov 2006 19:17:09 -0000 1.158 *************** *** 307,311 **** playDeadCounter--; if (!playDeadCounter) { ! Moveble* mov = ( Moveble* ) this; mov->SetStance( IE_ANI_GET_UP ); } --- 307,311 ---- playDeadCounter--; if (!playDeadCounter) { ! Movable* mov = ( Movable* ) this; mov->SetStance( IE_ANI_GET_UP ); } *************** *** 357,361 **** return false; } ! Moveble *me = (Moveble *) this; return me->GetNextStep()!=NULL; } --- 357,361 ---- return false; } ! Movable *me = (Movable *) this; return me->GetNextStep()!=NULL; } *************** *** 621,628 **** /***************** ! * Moveble Class * *****************/ ! Moveble::Moveble(ScriptableType type) : Selectable( type ) { --- 621,628 ---- /***************** ! * Movable Class * *****************/ ! Movable::Movable(ScriptableType type) : Selectable( type ) { *************** *** 638,642 **** } ! Moveble::~Moveble(void) { if (path) { --- 638,642 ---- } ! Movable::~Movable(void) { if (path) { *************** *** 645,649 **** } ! int Moveble::GetPathLength() { PathNode *node = GetNextStep(0); --- 645,649 ---- } ! int Movable::GetPathLength() { PathNode *node = GetNextStep(0); *************** *** 656,660 **** } ! PathNode *Moveble::GetNextStep(int x) { if (!step) { --- 656,660 ---- } ! PathNode *Movable::GetNextStep(int x) { if (!step) { *************** *** 668,672 **** } ! Point Moveble::GetMostLikelyPosition() { if (!path) { --- 668,672 ---- } ! Point Movable::GetMostLikelyPosition() { if (!path) { *************** *** 684,688 **** } ! void Moveble::SetStance(unsigned int arg) { if (arg<MAX_ANIMS) { --- 684,688 ---- } ! void Movable::SetStance(unsigned int arg) { if (arg<MAX_ANIMS) { *************** *** 695,699 **** //this could be used for WingBuffet as well ! void Moveble::MoveLine(int steps, int Pass, ieDword orient) { //remove previous path --- 695,699 ---- //this could be used for WingBuffet as well ! void Movable::MoveLine(int steps, int Pass, ieDword orient) { //remove previous path *************** *** 704,708 **** } ! void Moveble::DoStep(unsigned int walk_speed) { if (!path) { --- 704,708 ---- } ! void Movable::DoStep(unsigned int walk_speed) { if (!path) { *************** *** 749,753 **** } ! void Moveble::AddWayPoint(Point &Des) { if (!path) { --- 749,753 ---- } ! void Movable::AddWayPoint(Point &Des) { if (!path) { *************** *** 756,759 **** --- 756,761 ---- } Destination = Des; + //it is tempting to use 'step' here, as it could + //be about half of the current path already PathNode *endNode=path; while(endNode->Next) { *************** *** 764,770 **** PathNode *path2 = area->FindPath( p, Des ); endNode->Next=path2; } ! void Moveble::FixPosition() { if (Type!=ST_ACTOR) { --- 766,774 ---- PathNode *path2 = area->FindPath( p, Des ); endNode->Next=path2; + //probably it is wise to connect it both ways? + path2->Parent=endNode; } ! void Movable::FixPosition() { if (Type!=ST_ACTOR) { *************** *** 782,786 **** } ! void Moveble::WalkTo(Point &Des, int distance) { ClearPath(); --- 786,790 ---- } ! void Movable::WalkTo(Point &Des, int distance) { ClearPath(); *************** *** 795,799 **** } ! void Moveble::RunAwayFrom(Point &Des, int PathLength, int flags) { ClearPath(); --- 799,803 ---- } ! void Movable::RunAwayFrom(Point &Des, int PathLength, int flags) { ClearPath(); *************** *** 802,806 **** } ! void Moveble::RandomWalk(bool can_stop) { if (path) { --- 806,810 ---- } ! void Movable::RandomWalk(bool can_stop) { if (path) { *************** *** 819,823 **** } ! void Moveble::MoveTo(Point &Des) { Pos = Des; --- 823,827 ---- } ! void Movable::MoveTo(Point &Des) { Pos = Des; *************** *** 826,830 **** } ! void Moveble::ClearPath() { //this is to make sure attackers come to us --- 830,834 ---- } ! void Movable::ClearPath() { //this is to make sure attackers come to us *************** *** 836,850 **** } InternalFlags&=~IF_NORECTICLE; - if (!path) { - return; - } - PathNode* nextNode = path->Next; PathNode* thisNode = path; ! while (true) { delete( thisNode ); - if (!nextNode) - break; thisNode = nextNode; - nextNode = thisNode->Next; } path = NULL; --- 840,848 ---- } InternalFlags&=~IF_NORECTICLE; PathNode* thisNode = path; ! while (thisNode) { ! PathNode* nextNode = thisNode->Next; delete( thisNode ); thisNode = nextNode; } path = NULL; *************** *** 855,859 **** static unsigned long tp_steps[8]={3,2,1,0,1,2,3,4}; ! void Moveble::DrawTargetPoint(Region &vp) { if (!path || !Selected || (InternalFlags&IF_NORECTICLE) ) --- 853,857 ---- static unsigned long tp_steps[8]={3,2,1,0,1,2,3,4}; ! void Movable::DrawTargetPoint(Region &vp) { if (!path || !Selected || (InternalFlags&IF_NORECTICLE) ) |