MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / updateActiveSpots

Method updateActiveSpots

source/rooms/RoomPortal.cpp:156–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156void 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
188void RoomPortal::updatePortalPosition()
189{

Callers

nothing calls this directly

Calls 1

isInEditorModeMethod · 0.80

Tested by

no test coverage detected