Mercurial > hg > early-roguelike
comparison srogue/monsters.c @ 177:7bdac632ab9d
srogue: fix an uninitialized variable.
In wanderer(), if rp == hr, the loop could test ch before its value has
been set. Initializing ch to '-' now causes the loop to repeat until
a location is found.
| author | John "Elwin" Edwards |
|---|---|
| date | Tue, 04 Aug 2015 11:39:49 -0400 |
| parents | 2128c7dc8a40 |
| children | 94a0d9dd5ce1 |
comparison
equal
deleted
inserted
replaced
| 176:db1c9a21a7c3 | 177:7bdac632ab9d |
|---|---|
| 191 * wanderer: | 191 * wanderer: |
| 192 * A wandering monster has awakened and is headed for the player | 192 * A wandering monster has awakened and is headed for the player |
| 193 */ | 193 */ |
| 194 wanderer() | 194 wanderer() |
| 195 { | 195 { |
| 196 reg int ch; | 196 reg int ch = '-'; |
| 197 reg struct room *rp, *hr = player.t_room; | 197 reg struct room *rp, *hr = player.t_room; |
| 198 reg struct linked_list *item; | 198 reg struct linked_list *item; |
| 199 reg struct thing *tp; | 199 reg struct thing *tp; |
| 200 struct coord mp; | 200 struct coord mp; |
| 201 | 201 |
