diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-12-29 13:43:24 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-12-29 13:43:24 +0000 |
commit | 291ad04d5b5c4ab08d85eadde116f968cd579b77 (patch) | |
tree | e4dced5715a5d9792cfdc0455a6b3ee6d3116079 /src/controller.cpp | |
parent | 3d404e743105bb9168c89e3451cf35d7d59120b1 (diff) | |
download | manaserv-291ad04d5b5c4ab08d85eadde116f968cd579b77.tar.gz manaserv-291ad04d5b5c4ab08d85eadde116f968cd579b77.tar.bz2 manaserv-291ad04d5b5c4ab08d85eadde116f968cd579b77.tar.xz manaserv-291ad04d5b5c4ab08d85eadde116f968cd579b77.zip |
Physically split the server into one tmwserv-acount program (account +
chat + database) and multiple tmwserv-game programs (selected with
respect to the maps). Cleaned the repository by moving server-specific
source files into dedicated directories.
Diffstat (limited to 'src/controller.cpp')
-rw-r--r-- | src/controller.cpp | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/src/controller.cpp b/src/controller.cpp index b6900c48..b70e17e8 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -24,51 +24,23 @@ #include "utils/logger.h" -Controller::Controller(): - mCountDown(0) -{ -} - -void Controller::possess(BeingPtr being) -{ - unPossess(); - - mBeing = being; - - if (mBeing.get()) - mBeing->possessedBy(this); -} - -void Controller::unPossess() -{ - if (mBeing.get()) - mBeing->possessedBy(NULL); - - mBeing = BeingPtr(); -} - -void Controller::update() +void Controlled::update() { /* Temporary "AI" behaviour that is purely artificial and not at all * intelligent. */ if (mCountDown == 0) { - if (mBeing.get()) - { - Point randomPos = { rand() % 320 + 720, - rand() % 320 + 840 }; - - LOG_INFO("Setting new random destination " << randomPos.x << "," - << randomPos.y << " for being " << mBeing->getPublicID(), 2); - mBeing->setDestination(randomPos); - } - + Point randomPos = { rand() % 320 + 720, + rand() % 320 + 840 }; + setDestination(randomPos); mCountDown = 10 + rand() % 10; + + LOG_INFO("Setting new random destination " << randomPos.x << "," + << randomPos.y << " for being " << getPublicID(), 2); } else { mCountDown--; } } - |