… | |
… | |
73 | int number_monsters = 0; |
73 | int number_monsters = 0; |
74 | archetype *at; |
74 | archetype *at; |
75 | |
75 | |
76 | sprintf (styledirname, "%s", "/styles/monsterstyles"); |
76 | sprintf (styledirname, "%s", "/styles/monsterstyles"); |
77 | style_map = find_style (styledirname, monsterstyle, difficulty); |
77 | style_map = find_style (styledirname, monsterstyle, difficulty); |
78 | if (style_map == 0) |
78 | if (!style_map) |
79 | return; |
79 | return; |
80 | |
80 | |
81 | /* fill up the map with random monsters from the monster style */ |
81 | /* fill up the map with random monsters from the monster style */ |
82 | |
82 | |
83 | total_experience = 0; |
83 | total_experience = 0; |
… | |
… | |
89 | int x, y, freeindex; |
89 | int x, y, freeindex; |
90 | |
90 | |
91 | if (this_monster == NULL) |
91 | if (this_monster == NULL) |
92 | return; /* no monster?? */ |
92 | return; /* no monster?? */ |
93 | |
93 | |
94 | x = RANDOM () % RP->Xsize; |
94 | x = rndm (RP->Xsize); |
95 | y = RANDOM () % RP->Ysize; |
95 | y = rndm (RP->Ysize); |
96 | freeindex = find_first_free_spot (this_monster, map, x, y); |
96 | freeindex = find_first_free_spot (this_monster, map, x, y); |
97 | if (freeindex != -1) |
97 | if (freeindex != -1) |
98 | { |
98 | { |
99 | object *new_monster = arch_to_object (this_monster->arch); |
99 | object *new_monster = arch_to_object (this_monster->arch); |
100 | |
100 | |
… | |
… | |
102 | y += freearr_y[freeindex]; |
102 | y += freearr_y[freeindex]; |
103 | copy_object_with_inv (this_monster, new_monster); |
103 | copy_object_with_inv (this_monster, new_monster); |
104 | new_monster->x = x; |
104 | new_monster->x = x; |
105 | new_monster->y = y; |
105 | new_monster->y = y; |
106 | insert_multisquare_ob_in_map (new_monster, map); |
106 | insert_multisquare_ob_in_map (new_monster, map); |
107 | total_experience += this_monster->stats.exp; |
|
|
108 | |
107 | |
109 | for (at = new_monster->arch; at; at = at->more) |
108 | if (new_monster->is_alive ()) |
110 | number_monsters++; |
109 | { |
|
|
110 | total_experience += this_monster->stats.exp; |
111 | |
111 | |
|
|
112 | for (at = new_monster->arch; at; at = at->more) |
|
|
113 | number_monsters++; |
|
|
114 | |
|
|
115 | assert (new_monster->stats.hp >= 0); |
112 | RP->total_map_hp += new_monster->stats.hp; /* a global count */ |
116 | RP->total_map_hp += new_monster->stats.hp; /* a global count */ |
|
|
117 | } |
|
|
118 | else |
|
|
119 | failed_placements++; |
113 | } |
120 | } |
114 | else |
121 | else |
115 | failed_placements++; |
122 | failed_placements++; |
116 | |
123 | |
117 | exp_per_sq = (sint64) (((double) 1000 * total_experience) / (map->width * map->height + 1)); |
124 | exp_per_sq = (sint64) (((double) 1000 * total_experience) / (map->width * map->height + 1)); |