MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / OnDeleteRobot

Method OnDeleteRobot

editor/WorldObjectsRobotDialog.cpp:258–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256}
257
258void CWorldObjectsRobotDialog::OnDeleteRobot() {
259#if 0 // LGT: undeclared symbols
260 int answer,tl;
261 mngs_Pagelock pl;
262 int n=D3EditState.current_robot;
263
264 if (Num_robots<1)
265 return;
266
267 // Check to see if we even have it locked
268 if ((tl=mng_FindTrackLock (Robots[n].name,PAGETYPE_ROBOT))==-1)
269 {
270 OutrageMessageBox ("This robot is not yours to delete. Lock first.");
271 return;
272 }
273
274 //Make sure its to be deleted
275 answer=MessageBox ("Are you sure you want to delete this robot?",Robots[n].name,MB_YESNO);
276 if (answer==IDNO)
277 return;
278
279 if (!mng_MakeLocker())
280 {
281 OutrageMessageBox ("Either you have no network support, or someone else has exclusive access to the table files (retry in a 5 seconds)");
282 return;
283 }
284
285
286 strcpy (pl.name,Robots[n].name);
287 pl.pagetype=PAGETYPE_ROBOT;
288
289 // Check to see if this is a local robot only. If so, only delete it locally
290 if (mng_CheckIfPageOwned (&pl,TableUser)!=1)
291 {
292 mng_FreeTrackLock (tl);
293 if (!mng_DeleteRobotPage (Robots[n].name,1))
294 {
295 mprintf(0,ErrorString);
296 Int3();
297 }
298 }
299 else // if its network, delete it from both the net and local drives
300 {
301
302 mng_FreeTrackLock (tl);
303 mng_DeleteRobotPage (Robots[n].name,1);
304 mng_DeleteRobotPage (Robots[n].name,0);
305 mng_DeletePagelock (Robots[n].name,PAGETYPE_ROBOT);
306 }
307
308 // Advance to the next robot
309 D3EditState.current_robot=GetNextRobot (n);
310
311 FreePolyModel (Robots[n].render_handle);
312 FreeRobot (n);
313 mng_EraseLocker();
314
315 OutrageMessageBox ("Robot deleted.");

Callers

nothing calls this directly

Calls 8

mng_FindTrackLockFunction · 0.85
OutrageMessageBoxFunction · 0.85
mng_MakeLockerFunction · 0.85
mng_CheckIfPageOwnedFunction · 0.85
mng_FreeTrackLockFunction · 0.85
mng_DeletePagelockFunction · 0.85
FreePolyModelFunction · 0.85
mng_EraseLockerFunction · 0.85

Tested by

no test coverage detected