| 450 | } |
| 451 | |
| 452 | void Room::activeSpotCheckChange(ActiveSpotPlace place, const std::vector<Tile*>& originalSpotTiles, |
| 453 | const std::vector<Tile*>& newSpotTiles) |
| 454 | { |
| 455 | // We create the non existing tiles |
| 456 | for(std::vector<Tile*>::const_iterator it = newSpotTiles.begin(); it != newSpotTiles.end(); ++it) |
| 457 | { |
| 458 | Tile* tile = *it; |
| 459 | if(std::find(originalSpotTiles.begin(), originalSpotTiles.end(), tile) == originalSpotTiles.end()) |
| 460 | { |
| 461 | // The tile do not exist |
| 462 | BuildingObject* ro = notifyActiveSpotCreated(place, tile); |
| 463 | if(ro != nullptr) |
| 464 | { |
| 465 | // The room wants to build a room onject. We add it to the gamemap |
| 466 | addBuildingObject(tile, ro); |
| 467 | ro->createMesh(); |
| 468 | } |
| 469 | } |
| 470 | } |
| 471 | // We remove the suppressed tiles |
| 472 | for(std::vector<Tile*>::const_iterator it = originalSpotTiles.begin(); it != originalSpotTiles.end(); ++it) |
| 473 | { |
| 474 | Tile* tile = *it; |
| 475 | if(std::find(newSpotTiles.begin(), newSpotTiles.end(), tile) == newSpotTiles.end()) |
| 476 | { |
| 477 | // The tile has been removed |
| 478 | notifyActiveSpotRemoved(place, tile); |
| 479 | } |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | BuildingObject* Room::notifyActiveSpotCreated(ActiveSpotPlace place, Tile* tile) |
| 484 | { |
nothing calls this directly
no test coverage detected