[ogs-changes] dist/c++/ogs/combat Combatant.cpp,1.4,1.5 Combatant.h,1.2,1.3 Encounter.cpp,1.4,1.5 En
Status: Alpha
Brought to you by:
elemings
|
From: <ele...@us...> - 2003-03-29 02:11:01
|
Update of /cvsroot/ogs/dist/c++/ogs/combat
In directory sc8-pr-cvs1:/tmp/cvs-serv24985/combat
Modified Files:
Combatant.cpp Combatant.h Encounter.cpp Encounter.h
Log Message:
See C++ ChangeLog (Mar 28) for details.
Index: Combatant.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/combat/Combatant.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Combatant.cpp 25 Mar 2003 06:13:10 -0000 1.4
--- Combatant.cpp 29 Mar 2003 02:10:26 -0000 1.5
***************
*** 21,24 ****
--- 21,25 ----
*/
+ #include "ogs/core/Creature.h"
#include "ogs/combat/Combatant.h"
***************
*** 34,39 ****
*/
Combatant::Combatant (Creature& combatant):
! creature (combatant), specificActions (), initiative (0),
! defaultAction (NULL), currentAction (NULL) {
// empty
}
--- 35,40 ----
*/
Combatant::Combatant (Creature& combatant):
! creature (&combatant), initiative (0), defaultAction (NULL),
! specificActions (), currentAction (NULL) {
// empty
}
***************
*** 50,73 ****
specificActions.pop ();
}
- }
-
- /**
- * Assign a Combatant object to another Combatant object. This operator
- * is explicitly defined so that STL containers can copy Combatant
- * objects.
- *
- * @param combatant Right-hand value of assignment operator.
- * @return This object.
- */
- Combatant& Combatant::operator= (const Combatant& combatant) {
- if (this != &combatant) {
- this->creature = combatant.creature;
- this->initiative = combatant.initiative;
- this->defaultAction = combatant.defaultAction;
- this->specificActions = combatant.specificActions;
- this->currentAction = combatant.currentAction;
- }
-
- return (*this);
}
--- 51,54 ----
Index: Combatant.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/combat/Combatant.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Combatant.h 5 Feb 2003 06:01:27 -0000 1.2
--- Combatant.h 29 Mar 2003 02:10:26 -0000 1.3
***************
*** 28,32 ****
# include <queue>
- # include <ogs/core/Creature.h>
# include <ogs/core/Die.h>
# include <ogs/combat/Action.h>
--- 28,31 ----
***************
*** 35,38 ****
--- 34,39 ----
OGS_BEGIN_COMBAT_NAMESPACE
+ class ogs::core::Creature;
+
/**
* A participant in a combat encounter.
***************
*** 42,46 ****
typedef std::queue<Action*> Actions;
! ogs::core::Creature& creature;
ogs::core::Die::Value initiative;
Action* defaultAction;
--- 43,47 ----
typedef std::queue<Action*> Actions;
! ogs::core::Creature* creature;
ogs::core::Die::Value initiative;
Action* defaultAction;
***************
*** 49,54 ****
Combatant (ogs::core::Creature& creature);
- //Combatant (const Combatant& combatant);
- Combatant& operator= (const Combatant& combatant);
~Combatant ();
--- 50,53 ----
***************
*** 61,65 ****
*/
inline bool Combatant::isNormal () const {
! return (creature.getCurrentHealth () > 0);
}
--- 60,64 ----
*/
inline bool Combatant::isNormal () const {
! return (creature->getCurrentHealth () > 0);
}
Index: Encounter.cpp
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/combat/Encounter.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Encounter.cpp 25 Mar 2003 06:13:11 -0000 1.4
--- Encounter.cpp 29 Mar 2003 02:10:27 -0000 1.5
***************
*** 23,26 ****
--- 23,27 ----
#include <algorithm>
+ #include "ogs/core/Creature.h"
#include "ogs/combat/Encounter.h"
***************
*** 56,60 ****
Combatants::iterator itor = combatants.begin ();
while (itor != combatants.end ()) {
! itor->initiative = itor->creature.rollInitiative ();
itor++;
}
--- 57,61 ----
Combatants::iterator itor = combatants.begin ();
while (itor != combatants.end ()) {
! itor->initiative = itor->creature->rollInitiative ();
itor++;
}
***************
*** 77,81 ****
for (int i = 0; i < s; ++i) {
Combatant& combatantRef = combatants [i];
! Creature* creaturePtr = &(combatantRef.creature);
if (creaturePtr == &creature) {
combatant = &combatantRef;
--- 78,82 ----
for (int i = 0; i < s; ++i) {
Combatant& combatantRef = combatants [i];
! Creature* creaturePtr = combatantRef.creature;
if (creaturePtr == &creature) {
combatant = &combatantRef;
Index: Encounter.h
===================================================================
RCS file: /cvsroot/ogs/dist/c++/ogs/combat/Encounter.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Encounter.h 5 Feb 2003 06:01:27 -0000 1.2
--- Encounter.h 29 Mar 2003 02:10:27 -0000 1.3
***************
*** 28,32 ****
# include <list>
- # include <ogs/core/Creature.h>
# include <ogs/combat/Combatant.h>
# include <ogs/combat/Namespace.h>
--- 28,31 ----
***************
*** 34,37 ****
--- 33,37 ----
OGS_BEGIN_COMBAT_NAMESPACE
+ class ogs::core::Creature;
using ogs::core::Creature;
|