Skip to content

Commit

Permalink
Bugfix: load cave tiles correctly
Browse files Browse the repository at this point in the history
* Cave_t should have defaults to true values
* Read lit status correctly
  • Loading branch information
Michael R. Cook committed Oct 1, 2017
1 parent e1d19a6 commit 219f350
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/save.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,10 @@ bool loadGame(bool *generate) {
goto error;
}
c_ptr->feature_id = (uint8_t) (char_tmp & 0xF);
c_ptr->perma_lit_room = (char_tmp >> 4) != 0;
c_ptr->field_mark = (char_tmp >> 5) != 0;
c_ptr->permanent_light = (char_tmp >> 6) != 0;
c_ptr->temporary_light = (char_tmp >> 7) != 0;
c_ptr->perma_lit_room = (bool) ((char_tmp >> 4) & 0x1);
c_ptr->field_mark = (bool) ((char_tmp >> 5) & 0x1);
c_ptr->permanent_light = (bool) ((char_tmp >> 6) & 0x1);
c_ptr->temporary_light = (bool) ((char_tmp >> 7) & 0x1);
c_ptr++;
}
total_count += count;
Expand Down
8 changes: 4 additions & 4 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@ typedef struct {
uint8_t treasure_id; // ID for any treasure item occupying the tile
uint8_t feature_id; // ID of cave feature; walls, floors, open space, etc.

bool perma_lit_room; // Room should be lit with perm light, walls with this set should be perm lit after tunneled out.
bool field_mark; // Field mark, used for traps/doors/stairs, object is hidden if fm is false.
bool permanent_light; // Permanent light, used for walls and lighted rooms.
bool temporary_light; // Temporary light, used for player's lamp light,etc.
bool perma_lit_room : 1; // Room should be lit with perm light, walls with this set should be perm lit after tunneled out.
bool field_mark : 1; // Field mark, used for traps/doors/stairs, object is hidden if fm is false.
bool permanent_light : 1; // Permanent light, used for walls and lighted rooms.
bool temporary_light : 1; // Temporary light, used for player's lamp light,etc.
} Cave_t;


Expand Down

0 comments on commit 219f350

Please sign in to comment.