fixed:
dragon generation breaking the game seed validation wrong
This commit is contained in:
@ -9,17 +9,18 @@
|
||||
#include "enemies/merchant.h"
|
||||
#include "enemies/orc.h"
|
||||
|
||||
void new_dragon(RNG *rng, std::unique_ptr<enemy_base> &p,
|
||||
const position &pos, const position &fallback,
|
||||
const feature enabled_features, int which_room) {
|
||||
std::unique_ptr<enemy_base> new_dragon(RNG *rng, const position &pos,
|
||||
const position &fallback,
|
||||
const feature enabled_features,
|
||||
int which_room) {
|
||||
const position nil{0, 0};
|
||||
|
||||
if (pos != nil)
|
||||
p = std::make_unique<dragon>(rng, enabled_features,
|
||||
pos, which_room);
|
||||
return std::make_unique<dragon>(rng, enabled_features,
|
||||
pos, which_room);
|
||||
else
|
||||
p = std::make_unique<dragon>(rng, enabled_features,
|
||||
fallback, which_room);
|
||||
return std::make_unique<dragon>(rng, enabled_features,
|
||||
fallback, which_room);
|
||||
}
|
||||
|
||||
const int EXCNT = 6;
|
||||
@ -44,9 +45,9 @@ enum race get_normal_race(RNG *rng) {
|
||||
return CHOICES[rng->rand_under(CNT)];
|
||||
}
|
||||
|
||||
void new_enemy(RNG *rng, std::unique_ptr<enemy_base> &p,
|
||||
const position &pos, const feature enabled_features,
|
||||
int which_room) {
|
||||
std::unique_ptr<enemy_base> new_enemy(RNG *rng, const position &pos,
|
||||
const feature enabled_features,
|
||||
int which_room) {
|
||||
using std::make_unique;
|
||||
|
||||
enum race r;
|
||||
@ -56,34 +57,40 @@ void new_enemy(RNG *rng, std::unique_ptr<enemy_base> &p,
|
||||
else
|
||||
r = get_normal_race(rng);
|
||||
|
||||
p = nullptr;
|
||||
|
||||
switch (r) {
|
||||
case rdwarf:
|
||||
p = make_unique<dwarf>(rng, enabled_features, pos, which_room);
|
||||
return make_unique<dwarf>(rng, enabled_features,
|
||||
pos, which_room);
|
||||
break;
|
||||
|
||||
case rhuman:
|
||||
p = make_unique<human>(rng, enabled_features, pos, which_room);
|
||||
return make_unique<human>(rng, enabled_features,
|
||||
pos, which_room);
|
||||
break;
|
||||
|
||||
case relf:
|
||||
p = make_unique<elf>(rng, enabled_features, pos, which_room);
|
||||
return make_unique<elf>(rng, enabled_features,
|
||||
pos, which_room);
|
||||
break;
|
||||
|
||||
case rorc:
|
||||
p = make_unique<orc>(rng, enabled_features, pos, which_room);
|
||||
return make_unique<orc>(rng, enabled_features,
|
||||
pos, which_room);
|
||||
break;
|
||||
|
||||
case rmerchant:
|
||||
p = make_unique<merchant>(rng, enabled_features, pos, which_room);
|
||||
return make_unique<merchant>(rng, enabled_features,
|
||||
pos, which_room);
|
||||
break;
|
||||
|
||||
case rhalfling:
|
||||
p = make_unique<halfling>(rng, enabled_features, pos, which_room);
|
||||
return make_unique<halfling>(rng, enabled_features,
|
||||
pos, which_room);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
Reference in New Issue
Block a user