Turns out I don't need to remove so much when I simply don't want to display something. Closes #82.

master
Zed A. Shaw 1 day ago
parent 20fa95bd93
commit 25a143cf22
  1. 5
      gui/fsm.cpp
  2. 2
      gui/fsm.hpp
  3. 8
      systems.cpp

@ -24,7 +24,6 @@ namespace gui {
$combat_ui($level),
$status_ui($level),
$map_ui($level),
$mini_map($level),
$loot_ui($level),
$font{FONT_FILE_NAME},
$dnd_loot($status_ui, $loot_ui, $window, $router)
@ -64,7 +63,6 @@ namespace gui {
$map_ui.init();
$map_ui.log(L"Welcome to the game!");
$mini_map.init($main_ui.$overlay_ui.$gui);
run_systems();
@ -405,8 +403,6 @@ namespace gui {
if($map_open) {
$map_ui.render($window, $main_ui.$compass_dir);
} else {
// $mini_map.render($window, $main_ui.$compass_dir);
}
}
}
@ -552,7 +548,6 @@ namespace gui {
$status_ui.update_level($level);
$map_ui.update_level($level);
$mini_map.update_level($level);
$combat_ui.update_level($level);
$main_ui.update_level($level);
$loot_ui.update_level($level);

@ -10,7 +10,6 @@
#include "gui/loot_ui.hpp"
#include "gui/boss_fight_ui.hpp"
#include "gui/map_view.hpp"
#include "gui/mini_map.hpp"
#include "events.hpp"
#include "gui/event_router.hpp"
#include "gui/dnd_loot.hpp"
@ -44,7 +43,6 @@ namespace gui {
CombatUI $combat_ui;
StatusUI $status_ui;
MapViewUI $map_ui;
MiniMapUI $mini_map;
LootUI $loot_ui;
sf::Font $font;
gui::routing::Router $router;

@ -24,6 +24,8 @@ using namespace DinkyECS;
using lighting::LightSource;
void System::set_position(World& world, SpatialMap& collision, Entity entity, Position pos) {
dbc::check(world.has<Tile>(entity), "entity doesn't have tile");
world.set<Position>(entity, pos);
bool has_collision = world.has<Collision>(entity);
collision.insert(pos.location, entity, has_collision);
@ -146,14 +148,14 @@ void System::distribute_loot(GameLevel &level, Position target_pos) {
if(inventory_count > 0) {
auto pile = ritual::random_junk(config, inventory_count);
auto entity_data = config.devices["DEAD_BODY_LOOTABLE"];
auto& entity_data = config.devices["DEAD_BODY_LOOTABLE"];
components::configure_entity(world, loot_entity, entity_data["components"]);
world.set<ritual::JunkPile>(loot_entity, pile);
// BUG: inventory_count here isn't really used to remove it
world.set<InventoryItem>(loot_entity, {inventory_count, entity_data});
} else {
// this creates a dead body on the ground
auto entity_data = config.devices["DEAD_BODY"];
auto& entity_data = config.devices["DEAD_BODY"];
components::configure_entity(world, loot_entity, entity_data["components"]);
}
@ -309,7 +311,7 @@ void System::collision(GameLevel &level) {
void System::remove_from_world(GameLevel &level, Entity entity) {
auto& item_pos = level.world->get<Position>(entity);
level.collision->remove(item_pos.location, entity);
level.world->remove<Tile>(entity);
// level.world->remove<Tile>(entity);
// if you don't do this you get the bug that you can pickup
// an item and it'll also be in your inventory
level.world->remove<Position>(entity);

Loading…
Cancel
Save