Refactor some code to have better naming and move Point and related point things into their own .hpp.

This commit is contained in:
Zed A. Shaw 2024-10-26 18:26:42 -04:00
parent c19cd707d1
commit 5a123ae74c
7 changed files with 45 additions and 40 deletions

View file

@ -26,7 +26,7 @@ void System::enemy_pathing(DinkyECS::World &world, Map &game_map, Player &player
}
void System::init_positions(DinkyECS::World &world) {
auto &collider = world.get<SpatialHashTable>();
auto &collider = world.get<spatial_map>();
world.system<Position>([&](const auto &ent, auto &pos) {
collider.insert(pos.location, ent);
@ -34,7 +34,7 @@ void System::init_positions(DinkyECS::World &world) {
}
void System::motion(DinkyECS::World &world, Map &game_map) {
auto &collider = world.get<SpatialHashTable>();
auto &collider = world.get<spatial_map>();
world.system<Position, Motion>([&](const auto &ent, auto &position, auto &motion) {
// don't process entities that don't move
@ -58,7 +58,7 @@ void System::motion(DinkyECS::World &world, Map &game_map) {
void System::combat(DinkyECS::World &world, Player &player) {
const auto& collider = world.get<SpatialHashTable>();
const auto& collider = world.get<spatial_map>();
const auto& player_position = world.component<Position>(player.entity);
auto& player_combat = world.component<Combat>(player.entity);
auto& log = world.get<ActionLog>();