diff options
author | Bardur Arantsson <bardur@scientician.net> | 2015-06-18 19:44:46 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2015-09-14 05:58:27 +0200 |
commit | a1d1d2b84a65e6ec518f864b40eb58e413b5497b (patch) | |
tree | 22acdb22c2939d0e2418aecd67cba8ec1f1347c9 /src | |
parent | 84dba55744fcbad40d4e79a41834bd472cc58a86 (diff) |
Fix undefined behavior in dungeon generation code
I'm not 100% sure that this is the correct fix, but I've tested quite
a bit with this new code and haven't observed any effects on the
actual dungeon generation -- aside from not producing UB warnings from
the sanitizer.
Diffstat (limited to 'src')
-rw-r--r-- | src/wild.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/wild.cc b/src/wild.cc index e87648c4..e9def091 100644 --- a/src/wild.cc +++ b/src/wild.cc @@ -189,15 +189,12 @@ static int generate_area(int y, int x, bool_ border, bool_ corner) /* Hack -- Induce consistant town layout */ Rand_value = wild_map[y][x].seed; - if (!corner) + /* Create level background */ + for (y1 = 0; y1 < MAX_HGT; y1++) { - /* Create level background */ - for (y1 = 0; y1 < MAX_HGT; y1++) + for (x1 = 0; x1 < MAX_WID; x1++) { - for (x1 = 0; x1 < MAX_WID; x1++) - { - cave_set_feat(y1, x1, MAX_WILD_TERRAIN / 2); - } + cave_set_feat(y1, x1, MAX_WILD_TERRAIN / 2); } } |