What are the main problems?
- Currently an object must find its owner by comparing its color with a list.
- takeDamage(double, Tile*) needs a Tile as a parameter and is currently always simply called with coveredTiles[0].
- Attacking is a mix-up procedure of finding tiles and GameEntities at different code places.
- Current system will be extremly hard to convert to Angelscript
- An object should just know its owner (Player* or Seat*, don't know which is the right one here). A pointer to the owner needs 4 bytes just like the color, so technically nothing to worry about. And only the owner knows his color (so the object knows it through its owner). Enemies/allies can identify simply if they have the same owner.
- An object already knows where it is standing (getPosition(), when refactoring is done also sth. like getTiles()). The attacked tile from big objects (Buildings) should always be the nearest to the attacker.
- A GameEntity "One" should just be able to attack GameEntity "Two" if its in range: if(Two->isInRange()){One->attack(Two)}, everything else like damage and nearest Tile has to be calculated in attack().
- GameEntity::attack() should later ideally just pass references to the two fighters to a script function -> can easily be registered to AS