#ifndef GRID_H
#define GRID_H

#include <stdint.h>
#include <stdbool.h>

#include "entity.h"

typedef struct {
    Entity *entity;

    uint16_t x;
    uint16_t y;
} Grid_Cell;

typedef struct {
    uint16_t width;
    uint16_t height;

    Grid_Cell *cells;
} Grid;

bool grid_initialize(Grid *grid, uint16_t width, uint16_t height);
void grid_dispose(Grid *grid);

Grid_Cell *grid_get_cell(Grid *grid, uint16_t x, uint16_t y);

bool grid_try_add_entity_to_cell(Grid_Cell *cell, Entity *entity);
bool grid_try_remove_entity_from_cell(Grid_Cell *cell);

void grid_move_entity_from_cell_to_cell(Grid_Cell *cell_a, Grid_Cell *cell_b);

#endif