summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-01-08 17:32:49 +0100
committerTreeki <treeki@gmail.com>2012-01-08 17:32:49 +0100
commitac69cf874d619722b1d93526702ea81aa24c7e48 (patch)
treec1f763edb12f1cfbcf30f8ae312275b16c4ced03 /include
parent14fc0d0f71e1cb682473b7f7bbc959cfa70d163d (diff)
downloadkamek-ac69cf874d619722b1d93526702ea81aa24c7e48.tar.gz
kamek-ac69cf874d619722b1d93526702ea81aa24c7e48.zip
states fixed, now compiles
Diffstat (limited to '')
-rwxr-xr-xinclude/game.h37
-rw-r--r--include/statelib.h14
2 files changed, 34 insertions, 17 deletions
diff --git a/include/game.h b/include/game.h
index 3b2876d..e5a4813 100755
--- a/include/game.h
+++ b/include/game.h
@@ -1095,6 +1095,12 @@ class dActorMultiState_c;
template <class TOwner>
class dStateWrapperBase_c {
public:
+ dStateWrapperBase_c() :
+ manager(&pointless, &executor, &dStateBase_c::mNoState) { }
+
+ dStateWrapperBase_c(dState_c<TOwner> *pInitState) :
+ manager(&pointless, &executor, pInitState) { }
+
virtual ~dStateWrapperBase_c() { }
dStatePointless_c pointless;
@@ -1102,21 +1108,27 @@ public:
dStateMgr_c manager;
- // All these are passed straight through to the manager, todo: name them and arguments
- virtual void ensureStateHasBegun();
- virtual void execute();
- virtual void endCurrentState();
- virtual void setState(dStateBase_c *pNewState);
- virtual void executeNextStateThisTick();
- virtual dStateMethodExecutorBase_c *getCurrentStateMethodExecutor();
- virtual dStateBase_c *getNextState();
- virtual dStateBase_c *getCurrentState();
- virtual dStateBase_c *getPreviousState();
+ // All these are passed straight through to the manager
+ virtual void ensureStateHasBegun() { manager.ensureStateHasBegun(); }
+ virtual void execute() { manager.execute(); }
+ virtual void endCurrentState() { manager.endCurrentState(); }
+ virtual void setState(dStateBase_c *pNewState) { manager.setState(pNewState); }
+ virtual void executeNextStateThisTick() { manager.executeNextStateThisTick(); }
+ virtual dStateMethodExecutorBase_c *getCurrentStateMethodExecutor() { return manager.getCurrentStateMethodExecutor(); }
+ virtual dStateBase_c *getNextState() { return manager.getNextState(); }
+ virtual dStateBase_c *getCurrentState() { return manager.getCurrentState(); }
+ virtual dStateBase_c *getPreviousState() { return manager.getPreviousState(); }
};
template <class TOwner>
class dStateWrapper_c : public dStateWrapperBase_c<TOwner> {
public:
+ dStateWrapper_c() :
+ dStateWrapperBase_c() { }
+
+ dStateWrapper_c(dState_c<TOwner> *pInitState) :
+ dStateWrapperBase_c(pInitState) { }
+
~dStateWrapper_c() { }
};
@@ -1164,6 +1176,11 @@ public:
&CLASS::executeState_##NAME, \
&CLASS::endState_##NAME);
+#define CREATE_STATE_E(CLASS, NAME) \
+ CREATE_STATE(CLASS, NAME) \
+ void CLASS::beginState_##NAME() { } \
+ void CLASS::endState_##NAME() { }
+
#define USING_STATES(CLASS) \
typedef dState_c<CLASS> State;
diff --git a/include/statelib.h b/include/statelib.h
index d387f02..092ef6a 100644
--- a/include/statelib.h
+++ b/include/statelib.h
@@ -90,8 +90,8 @@ void dState_c<TOwner>::doEnd(TOwner *owner) {
/******************************************************************************/
class dStatePointless_c {
public:
- virtual ~dStatePointless_c();
- virtual int returnsOne(); // Does exactly what it says on the tin.
+ virtual ~dStatePointless_c() { };
+ virtual int returnsOne() { return 1; }
};
/******************************************************************************/
@@ -99,7 +99,7 @@ class dStatePointless_c {
/******************************************************************************/
class dStateMethodExecutorBase_c {
public:
- virtual ~dStateMethodExecutorBase_c() = 0;
+ virtual ~dStateMethodExecutorBase_c() { }
virtual void callBegin() = 0;
virtual void callExecute() = 0;
@@ -108,7 +108,7 @@ class dStateMethodExecutorBase_c {
class dStateExecutorBase_c {
public:
- virtual ~dStateExecutorBase_c() = 0;
+ virtual ~dStateExecutorBase_c() { }
virtual dStateMethodExecutorBase_c *getMethodExecutorForState(dStateBase_c *state) = 0;
virtual void clearMethodExecutor(dStateMethodExecutorBase_c **ptrToPtrToExecutor) = 0;
@@ -120,7 +120,7 @@ class dStateExecutorBase_c {
template <class TOwner>
class dStateMethodExecutor_c : public dStateMethodExecutorBase_c {
public:
- ~dStateMethodExecutor_c();
+ ~dStateMethodExecutor_c() { }
void callBegin();
void callExecute();
@@ -133,7 +133,7 @@ class dStateMethodExecutor_c : public dStateMethodExecutorBase_c {
template <class TOwner>
class dStateExecutor_c : public dStateExecutorBase_c {
public:
- ~dStateExecutor_c();
+ ~dStateExecutor_c() { }
dStateMethodExecutorBase_c *getMethodExecutorForState(dStateBase_c *state);
void clearMethodExecutor(dStateMethodExecutorBase_c **ptrToPtrToExecutor);
@@ -225,7 +225,7 @@ protected:
class dStateMgr_c : public dStateMgrBase_c {
public:
dStateMgr_c(dStatePointless_c *pPointlessClass, dStateExecutorBase_c *pStateExecutor, dStateBase_c *pInitState);
- ~dStateMgr_c();
+ ~dStateMgr_c() { }
bool callBeginOnState();
void callExecuteOnState();