From 150a240098c3b45799ff04411715866b9dc58f4f Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 19 Jun 2009 22:46:29 -0400 Subject: Fixed solver wrapping issue Previously, the generated mazes didn't wrap and it would be very difficult to wrap. This has been fixed. Plus, titles have been added to all states and the "gameSleep" variable has been removed due to it's not-usefulness. --- gamestate.cpp | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'gamestate.cpp') diff --git a/gamestate.cpp b/gamestate.cpp index 39d589d..c312bfe 100644 --- a/gamestate.cpp +++ b/gamestate.cpp @@ -39,15 +39,7 @@ void GameState::input(SDLKey key) break; case SDLK_ESCAPE: - newGame = false; - - info.playerx = 1; - info.playery = 1; - info.level = Level(); - info.doneMaking = false; - board = Board(&info); - - SDL_WM_SetCaption("Maze Of Life - Level 1", NULL); + changeState(new TitleState()); break; } @@ -241,14 +233,14 @@ void GameState::Board::tick() int neighbors = 0; - if ((x>0)&&(y>0)) incrementIfNeighbor(x-1,y-1,temp,&neighbors); - if ((x>0)) incrementIfNeighbor(x-1,y,temp,&neighbors); - if ((x>0)&&(y0)) incrementIfNeighbor(x,y-1,temp,&neighbors); - if ((y0)) incrementIfNeighbor(x+1,y-1,temp,&neighbors); - if ((xplayerx==x)&&(info->playery==y))||((x==15)&&(y==15))) + if (!((nx!=x)&&(ny!=y))) { - ++*tick; + if ((temp[x][y])||((info->playerx==x)&&(info->playery==y))||((x==15)&&(y==15))) + { + ++*tick; + } } } -- cgit 1.4.1