I am making a grid-based game.
In this game you can place buildings, walls, roads.
When something is placed in a grid, I set the cell id to that objects id. So far so good, this all works.
My problem comes when I need to Bitmask my walls/roads (placed by dragging mouse).
Currently the way I do bitmasking is I check all neighboring cells for a match, and set the correct model accordingly. I.e if there is a match west and north, I create a bend.
My problem comes when I place my wall on top of already occupied cells. I still want to display the wall graphically (tinted red), but I can ofc not overwrite what is currently in that cell.
This means my bitmasking wont work because the wall is not in the actual grid, it's only in world space.
Walls set cells to id 0, and houses set cell to id 1. I cant overwrite the id in the house cell, so bitmasking (correctly) end up breaking.
How can a scenario like this be managed?
Cell:
public class Cell
{
public int x, z;
public int id;
public GameObject go
}