| 154 | } |
| 155 | |
| 156 | void RoomPortal::updateActiveSpots() |
| 157 | { |
| 158 | // Room::updateActiveSpots(); <<-- Disabled on purpose. |
| 159 | // We don't update the active spots the same way as only the central tile is needed. |
| 160 | if (getGameMap()->isInEditorMode()) |
| 161 | updatePortalPosition(); |
| 162 | else |
| 163 | { |
| 164 | if(mPortalObject == nullptr) |
| 165 | { |
| 166 | // We check if the portal already exists (that can happen if it has |
| 167 | // been restored after restoring a saved game) |
| 168 | if(mBuildingObjects.empty()) |
| 169 | updatePortalPosition(); |
| 170 | else |
| 171 | { |
| 172 | for(auto& p : mBuildingObjects) |
| 173 | { |
| 174 | if(p.second == nullptr) |
| 175 | continue; |
| 176 | |
| 177 | // We take the first BuildingObject. Note that we cannot use |
| 178 | // the central tile because after saving a game, the central tile may |
| 179 | // not be the same if some tiles have been destroyed |
| 180 | mPortalObject = p.second; |
| 181 | break; |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | void RoomPortal::updatePortalPosition() |
| 189 | { |
nothing calls this directly
no test coverage detected