djenner%arthur@Sun.COM (Doug Jenner) (03/02/90)
An nasty bug where you suddenly go blind-
Because of the scheme (albiet, a clever one) for indexing the 'screens' using
a 7 character id string (e.g. "1011101" is a straight corridor) it is possible
to go suddenly blind. Since the above string is built from indiviual chars,
there is no terminating null. Therefore, the atoi(walls) call generates a
completely bogus index value as it runs right past the end of the description
string.
The fix is simple:
Make "walls" terminate in a null by adding the line:
walls[wall] = '\0';
right after the loop which sets all the initial characters of walls to '0'.
The code segment will then look like this:
for(wall=0;wall<=6;wall++)
walls[wall] = '0';
walls[wall] = '\0';
switch (p->face){