… | |
… | |
54 | maptile *hdoors; |
54 | maptile *hdoors; |
55 | char doorpath[128]; |
55 | char doorpath[128]; |
56 | |
56 | |
57 | if (!strcmp (doorstyle, "none")) |
57 | if (!strcmp (doorstyle, "none")) |
58 | return; |
58 | return; |
|
|
59 | |
59 | vdoors = find_style ("/styles/doorstyles", doorstyle, -1); |
60 | vdoors = find_style ("/styles/doorstyles", doorstyle, -1); |
|
|
61 | |
60 | if (vdoors) |
62 | if (vdoors) |
61 | hdoors = vdoors; |
63 | hdoors = vdoors; |
62 | else |
64 | else |
63 | { |
65 | { |
64 | vdoors = find_style ("/styles/doorstyles/vdoors", doorstyle, -1); |
66 | vdoors = find_style ("/styles/doorstyles/vdoors", doorstyle, -1); |
65 | if (!vdoors) |
67 | if (!vdoors) |
66 | return; |
68 | return; |
67 | sprintf (doorpath, "/styles/doorstyles/hdoors%s", strrchr (vdoors->path, '/')); |
69 | sprintf (doorpath, "/styles/doorstyles/hdoors%s", strrchr (vdoors->path, '/')); |
68 | hdoors = find_style (doorpath, 0, -1); |
70 | hdoors = find_style (doorpath, 0, -1); |
69 | } |
71 | } |
|
|
72 | |
70 | for (i = 0; i < RP->Xsize; i++) |
73 | for (i = 0; i < RP->Xsize; i++) |
71 | for (j = 0; j < RP->Ysize; j++) |
74 | for (j = 0; j < RP->Ysize; j++) |
72 | { |
75 | { |
73 | if (maze[i][j] == 'D') |
76 | if (maze[i][j] == 'D') |
74 | { |
77 | { |
… | |
… | |
78 | sindex = surround_check2 (maze, i, j, RP->Xsize, RP->Ysize); |
81 | sindex = surround_check2 (maze, i, j, RP->Xsize, RP->Ysize); |
79 | if (sindex == 3) |
82 | if (sindex == 3) |
80 | this_door = pick_random_object (hdoors); |
83 | this_door = pick_random_object (hdoors); |
81 | else |
84 | else |
82 | this_door = pick_random_object (vdoors); |
85 | this_door = pick_random_object (vdoors); |
|
|
86 | |
|
|
87 | if (!this_door) |
|
|
88 | abort (); |
|
|
89 | |
83 | new_door = arch_to_object (this_door->arch); |
90 | new_door = arch_to_object (this_door->arch); |
84 | this_door->copy_to (new_door); |
91 | this_door->copy_to (new_door); |
85 | new_door->x = i; |
92 | new_door->x = i; |
86 | new_door->y = j; |
93 | new_door->y = j; |
87 | insert_ob_in_map (new_door, the_map, NULL, 0); |
94 | insert_ob_in_map (new_door, the_map, NULL, 0); |