Had to refactor the GameDB to use a list of levels instead of a vector of levels. If you get a _reference_ to an element of a vector, and then resize the vector, you'll get a crash if the realoc moves the data buffer. Using a list is actually what we want.
This commit is contained in:
parent
bf8ce7e16b
commit
0456c73e4f
6 changed files with 53 additions and 37 deletions
|
|
@ -9,9 +9,11 @@ namespace boss {
|
|||
$boss_id(boss_id),
|
||||
$battle(System::create_battle($world, $boss_id)),
|
||||
$ui(world, boss_id, player_id),
|
||||
$host(player_id),
|
||||
$host_combat($world->get<components::Combat>(player_id))
|
||||
$host(player_id)
|
||||
{
|
||||
$host_combat = $world->get_if<components::Combat>(player_id);
|
||||
dbc::check($host_combat,
|
||||
fmt::format("No combat for host with player_id={}", player_id));
|
||||
$ui.init();
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +68,7 @@ namespace boss {
|
|||
case ATTACK:
|
||||
if($battle.player_request("kill_enemy")) {
|
||||
fmt::println("player requests kill_enemy {} vs. {}",
|
||||
$host_combat.ap, $battle.player_pending_ap());
|
||||
$host_combat->ap, $battle.player_pending_ap());
|
||||
} else {
|
||||
fmt::println("NO MORE ACTION!");
|
||||
}
|
||||
|
|
@ -138,7 +140,7 @@ namespace boss {
|
|||
$ui.update_stats();
|
||||
$battle.set($host, "tough_personality", false);
|
||||
$battle.set($host, "have_healing", false);
|
||||
$battle.set($host, "health_good", $host_combat.hp > 100);
|
||||
$battle.set($host, "health_good", $host_combat->hp > 100);
|
||||
}
|
||||
|
||||
void Fight::render(sf::RenderWindow& window) {
|
||||
|
|
@ -175,7 +177,7 @@ namespace boss {
|
|||
}
|
||||
|
||||
bool Fight::player_dead() {
|
||||
return $host_combat.hp <= 0;
|
||||
return $host_combat->hp <= 0;
|
||||
}
|
||||
|
||||
void Fight::init_fight() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue