Skip to content

Commit

Permalink
WAGE: Implement getValidMoveDirections()
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Feb 14, 2016
1 parent 9713e26 commit 851c2d6
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions engines/wage/combat.cpp
Expand Up @@ -285,10 +285,26 @@ void WageEngine::performTake(Chr *npc, Obj *obj) {
_world->move(obj, npc);
}

static const int directionsX[] = { 0, 0, 1, -1 };
static const int directionsY[] = { -1, 1, 0, 0 };

int WageEngine::getValidMoveDirections(Chr *npc) {
warning("STUB: getValidMoveDirections()");
int directions = 0;
Scene *currentScene = npc->_currentScene;
for (int dir = 0; dir < 4; dir++) {
if (!currentScene->_blocked[dir]) {
int destX = currentScene->_worldX + directionsX[dir];
int destY = currentScene->_worldY + directionsY[dir];

return 0;
Scene *scene = _world->getSceneAt(destX, destY);

if (scene != NULL && scene->_chrs.size() == 0) {
directions |= (1 << dir);
}
}
}

return directions;
}

void WageEngine::regen() {
Expand Down Expand Up @@ -331,9 +347,6 @@ void WageEngine::takeObj(Obj *obj) {
}
}

static const int directionsX[] = { 0, 0, 1, -1 };
static const int directionsY[] = { -1, 1, 0, 0 };

bool WageEngine::handleMoveCommand(Directions dir, const char *dirName) {
Scene *playerScene = _world->_player->_currentScene;
const char *msg = playerScene->_messages[dir].c_str();
Expand Down

0 comments on commit 851c2d6

Please sign in to comment.