From be49084ba59b89c14f8b9f9e1274b013428d7205 Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Sat, 17 Sep 2016 09:58:15 +0200 Subject: Clean up process_dungeon_file_aux() a little bit --- src/init1.cc | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/init1.cc b/src/init1.cc index 9fac93c9..c0835da0 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -6837,29 +6837,32 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst /* Layout of the wilderness */ if (buf[2] == 'D') { - int x; - char i; - /* Acquire the text */ char *s = buf + 4; int y = *yval; - for (x = 0; x < max_wild_x; x++) + for (int x = 0; x < max_wild_x; x++) { - if (1 != sscanf(s + x, "%c", &i)) return (1); - wild_map[y][x].feat = wildc2i[(int)i]; + char i; + if (1 != sscanf(s + x, "%c", &i)) + { + return (1); + } + + auto const wi = wildc2i[(int)i]; + + wild_map[y][x].feat = wi; /* * If this is a town/dungeon entrance, note * its coordinates. (Have to check for * duplicate Morias...) */ - if (wf_info[wildc2i[(int)i]].entrance && - wf_info[wildc2i[(int)i]].wild_x == 0) + if (wf_info[wi].entrance && wf_info[wi].wild_x == 0) { - wf_info[wildc2i[(int)i]].wild_x = x; - wf_info[wildc2i[(int)i]].wild_y = y; + wf_info[wi].wild_x = x; + wf_info[wi].wild_y = y; } } -- cgit v1.2.3