Results of today's code review session.
This commit is contained in:
parent
14b3ea7676
commit
f35b74f335
21 changed files with 64 additions and 59 deletions
14
systems.cpp
14
systems.cpp
|
@ -3,7 +3,7 @@
|
|||
#include <string>
|
||||
#include <cmath>
|
||||
#include "rand.hpp"
|
||||
#include "collider.hpp"
|
||||
#include "spatialmap.hpp"
|
||||
#include "events.hpp"
|
||||
#include "ftxui/screen/color.hpp"
|
||||
#include "ftxui/screen/terminal.hpp" // for SetColorSupport, Color, TrueColor
|
||||
|
@ -23,7 +23,6 @@ void System::lighting(DinkyECS::World &world, Map &game_map, LightRender &light,
|
|||
light.set_light_target(position.location);
|
||||
});
|
||||
|
||||
// BUG: some light doesn't move, can I not path those?
|
||||
light.path_light(game_map.walls());
|
||||
|
||||
world.query<Position, LightSource>([&](const auto &ent, auto &position, auto &lightsource) {
|
||||
|
@ -42,7 +41,6 @@ void System::enemy_pathing(DinkyECS::World &world, Map &game_map, Player &player
|
|||
if(ent != player.entity) {
|
||||
Point out = position.location; // copy
|
||||
if(game_map.distance(out) < config.HEARING_DISTANCE) {
|
||||
// BUG: is neighbors really the best name for this?
|
||||
game_map.neighbors(out);
|
||||
motion = { int(out.x - position.location.x), int(out.y - position.location.y)};
|
||||
}
|
||||
|
@ -52,7 +50,7 @@ void System::enemy_pathing(DinkyECS::World &world, Map &game_map, Player &player
|
|||
}
|
||||
|
||||
void System::init_positions(DinkyECS::World &world) {
|
||||
auto &collider = world.get_the<spatial_map>();
|
||||
auto &collider = world.get_the<SpatialMap>();
|
||||
|
||||
// BUG: instead of separate things maybe just one
|
||||
// BUG: Collision component that references what is collide
|
||||
|
@ -67,7 +65,7 @@ void System::init_positions(DinkyECS::World &world) {
|
|||
});
|
||||
}
|
||||
|
||||
inline void move_entity(spatial_map &collider, Map &game_map, Position &position, Motion &motion, DinkyECS::Entity ent) {
|
||||
inline void move_entity(SpatialMap &collider, Map &game_map, Position &position, Motion &motion, DinkyECS::Entity ent) {
|
||||
Point move_to = {
|
||||
position.location.x + motion.dx,
|
||||
position.location.y + motion.dy
|
||||
|
@ -85,7 +83,7 @@ inline void move_entity(spatial_map &collider, Map &game_map, Position &position
|
|||
}
|
||||
|
||||
void System::motion(DinkyECS::World &world, Map &game_map) {
|
||||
auto &collider = world.get_the<spatial_map>();
|
||||
auto &collider = world.get_the<SpatialMap>();
|
||||
|
||||
world.query<Position, Motion>([&](const auto &ent, auto &position, auto &motion) {
|
||||
// don't process entities that don't move
|
||||
|
@ -100,7 +98,7 @@ void System::death(DinkyECS::World &world) {
|
|||
// BUG: eachother and overlap their corpse
|
||||
// BUG: maybe that can be allowed and looting just shows
|
||||
// BUG: all dead things there?
|
||||
auto &collider = world.get_the<spatial_map>();
|
||||
auto &collider = world.get_the<SpatialMap>();
|
||||
|
||||
world.query<Position, Combat>([&](const auto &ent, auto &position, auto &combat) {
|
||||
// bring out yer dead
|
||||
|
@ -116,7 +114,7 @@ void System::death(DinkyECS::World &world) {
|
|||
}
|
||||
|
||||
void System::collision(DinkyECS::World &world, Player &player) {
|
||||
auto& collider = world.get_the<spatial_map>();
|
||||
auto& collider = world.get_the<SpatialMap>();
|
||||
const auto& player_position = world.get<Position>(player.entity);
|
||||
auto& player_combat = world.get<Combat>(player.entity);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue