aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/game.c b/src/game.c
index ae9ff2c..e8d69b9 100644
--- a/src/game.c
+++ b/src/game.c
@@ -162,8 +162,8 @@ static void game_delete_room(Game *game, int idx) {
free(room);
/* Shift the list up one place */
- for ( i=idx+1; i<game->num_rooms; i++ ) {
- game->rooms[i-1] = game->rooms[i];
+ for ( i=idx; i<game->num_rooms-1; i++ ) {
+ game->rooms[i] = game->rooms[i+1];
}
game->num_rooms--;
@@ -256,14 +256,9 @@ static void game_load_all_relevant(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 ) {
- int j;
if ( game->debug ) printf("GM: %2i %2i %2i is no longer needed\n",
game->rooms[i]->rx, game->rooms[i]->ry, game->rooms[i]->rz);
game_delete_room(game, i);
- for ( j=i; j<game->num_rooms-1; j++ ) {
- game->rooms[j] = game->rooms[j+1];
- }
- game->num_rooms--;
}
}