diff options
Diffstat (limited to 'src/game.c')
-rw-r--r-- | src/game.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -177,12 +177,15 @@ static void game_load_all_connected(Game *game) { int i; Room *room; + if ( game->debug ) printf("GM: Loading all relevant rooms...\n"); + /* Go down the current list of rooms, setting 'needed_this_time' to 0 */ for ( i=0; i<game->num_rooms; i++ ) { game->rooms[i]->needed_this_time = 0; } /* Is the current room in the list? Load it if not */ + if ( game->debug ) printf("GM: Current: %2i %2i %2i\n", game->cur_room_x, game->cur_room_y, game->cur_room_z); room = game_find_room(game, game->cur_room_x, game->cur_room_y, game->cur_room_z); if ( room == NULL ) { room = room_load(game->cur_room_x, game->cur_room_y, game->cur_room_z, game->models, game->render); @@ -206,10 +209,12 @@ static void game_load_all_connected(Game *game) { rz = room->connected[i].rz; con = game_find_room(game, rx, ry, rz); if ( con == NULL ) { + if ( game->debug ) printf("GM: Loading %2i %2i %2i\n", rx, ry, rz); game->rooms[game->num_rooms] = room_load(rx, ry, rz, game->models, game->render); game->num_rooms++; } else { con->needed_this_time = 1; + if ( game->debug ) printf("GM: %2i %2i %2i is still relevant\n", con->rx, con->ry, con->rz); } } @@ -217,10 +222,14 @@ static void game_load_all_connected(Game *game) { /* Remove any rooms left in the list which are no longer needed */ for ( i=0; i<game->num_rooms; i++ ) { if ( !game->rooms[i]->needed_this_time ) { + if ( game->debug ) printf("GM: %2i %2i %2i no longer needed\n", + game->rooms[i]->rx, game->rooms[i]->ry, game->rooms[i]->rz); game_delete_room(game, i); } } + if ( game->debug ) printf("GM: Done.\n"); + } /* Create a new "game" structure */ @@ -231,6 +240,7 @@ Game *game_new(int width, int height, GameOptions gameopts) { g = malloc(sizeof(Game)); if ( g == NULL ) return NULL; + g->debug = gameopts.game_debug; g->thrusting = 0; g->turn_left = 0; g->turn_right = 0; |