fixed bug where merchants are not moving
reading map data from file will now generate only the specified entities (if none are specified, randomly generate them
This commit is contained in:
@ -91,7 +91,7 @@ character *game::move_enemies() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch->get_race() == MERCHANT) {
|
if (the_world && ch->get_race() == MERCHANT) {
|
||||||
if (!hostile_merchants)
|
if (!hostile_merchants)
|
||||||
continue;
|
continue;
|
||||||
} else if (the_world &&
|
} else if (the_world &&
|
||||||
|
12
src/level.cc
12
src/level.cc
@ -41,6 +41,12 @@ level::level(const level_data &lvl, character *player, RNG *rng,
|
|||||||
if (enabled_features & FEATURE_READ_MAP)
|
if (enabled_features & FEATURE_READ_MAP)
|
||||||
fill(lvl, tiles, rng);
|
fill(lvl, tiles, rng);
|
||||||
|
|
||||||
|
if (enabled_features & FEATURE_READ_MAP &&
|
||||||
|
(lvl.enemies.size() ||
|
||||||
|
lvl.potions.size() ||
|
||||||
|
lvl.gold_piles.size()))
|
||||||
|
return;
|
||||||
|
|
||||||
gen_potions(rng, tiles);
|
gen_potions(rng, tiles);
|
||||||
gen_gold(rng, tiles);
|
gen_gold(rng, tiles);
|
||||||
gen_enemies(lvl, rng, tiles);
|
gen_enemies(lvl, rng, tiles);
|
||||||
@ -109,9 +115,9 @@ bool level::is_in_glist(gold &g, const gold_list &gl) {
|
|||||||
void level::gen_enemies(const level_data &lvl, RNG *rng,
|
void level::gen_enemies(const level_data &lvl, RNG *rng,
|
||||||
std::vector<position_list> &tiles) {
|
std::vector<position_list> &tiles) {
|
||||||
auto dhoard = dragon_hoard(lvl);
|
auto dhoard = dragon_hoard(lvl);
|
||||||
int cnt = enabled_features & FEATURE_EXTRA_STUFF ?
|
int cnt = (enabled_features & FEATURE_EXTRA_STUFF ?
|
||||||
rng->rand_between(MIN_ENEMIE_CNT, MAX_ENEMIE_CNT + 1) :
|
rng->rand_between(MIN_ENEMIE_CNT, MAX_ENEMIE_CNT + 1) :
|
||||||
MIN_ENEMIE_CNT + dhoard.size();
|
MIN_ENEMIE_CNT) + dhoard.size();
|
||||||
|
|
||||||
elist.reserve(cnt);
|
elist.reserve(cnt);
|
||||||
pelist.reserve(cnt);
|
pelist.reserve(cnt);
|
||||||
|
@ -29,9 +29,13 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
CC3K game_proc(enabled_features, in.get(), out.get(), rng.get(), data);
|
CC3K game_proc(enabled_features, in.get(), out.get(), rng.get(), data);
|
||||||
|
|
||||||
while (1)
|
while (true) {
|
||||||
if (game_proc.run() == game_status::TERMINATED)
|
if (game_proc.run() == game_status::TERMINATED)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (enabled_features & FEATURE_IN_FILE)
|
||||||
|
getchar();
|
||||||
|
}
|
||||||
|
|
||||||
return RETURN_FINE;
|
return RETURN_FINE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user