aboutsummaryrefslogtreecommitdiff
path: root/src/game.c
diff options
context:
space:
mode:
authortaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-07-23 16:37:47 +0000
committertaw27 <taw27@84d2e878-0bd5-11dd-ad15-13eda11d74c5>2008-07-23 16:37:47 +0000
commitc77468a0306b63cef0f5dc8293fb8142479df9c1 (patch)
tree8b7562c6b8d151523cd16eab6750c32d11191f0a /src/game.c
parent5893f7a7f453b4c59d448370b3d8fd009fb82b3d (diff)
Game debug information
General fussiness git-svn-id: svn://cook.msm.cam.ac.uk:745/thrust3d/thrust3d@158 84d2e878-0bd5-11dd-ad15-13eda11d74c5
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/game.c b/src/game.c
index a155c69..8f942a1 100644
--- a/src/game.c
+++ b/src/game.c
@@ -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;