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

Method OnDeletePowerup

editor/WorldObjectsPowerupDialog.cpp:282–342  ·  view source on GitHub ↗

Deletes the current powerup If the user has it checked out, will delete it from the net pagefile If its local only, it will get deleted from the local pagefile

Source from the content-addressed store, hash-verified

280// If the user has it checked out, will delete it from the net pagefile
281// If its local only, it will get deleted from the local pagefile
282void CWorldObjectsPowerupDialog::OnDeletePowerup() {
283#if 0
284 int answer,tl;
285 mngs_Pagelock pl;
286 int n=D3EditState.current_powerup;
287
288 if (Num_powerups<1)
289 return;
290
291 // Check to see if we even have it locked
292 if ((tl=mng_FindTrackLock (Powerups[n].name,PAGETYPE_POWERUP))==-1)
293 {
294 OutrageMessageBox ("This powerup is not yours to delete. Lock first.");
295 return;
296 }
297
298 //Make sure its to be deleted
299 answer=MessageBox ("Are you sure you want to delete this powerup?",Powerups[n].name,MB_YESNO);
300 if (answer==IDNO)
301 return;
302
303 if (!mng_MakeLocker())
304 return;
305
306 strcpy (pl.name,Powerups[n].name);
307 pl.pagetype=PAGETYPE_POWERUP;
308
309 // Check to see if this is a local powerup only. If so, only delete it locally
310 if (mng_CheckIfPageOwned (&pl,TableUser)!=1)
311 {
312 mng_FreeTrackLock (tl);
313 if (!mng_DeletePowPage (Powerups[n].name,1))
314 {
315 mprintf(0,ErrorString);
316 Int3();
317 }
318 }
319 else // if its network, delete it from both the net and local drives
320 {
321 mng_FreeTrackLock (tl);
322 mng_DeletePowPage (Powerups[n].name,1);
323 mng_DeletePowPage (Powerups[n].name,0);
324 mng_DeletePagelock (Powerups[n].name,PAGETYPE_POWERUP);
325 }
326
327 // Advance to the next powerup
328 D3EditState.current_powerup=GetNextPowerup (n);
329
330 if (Powerups[n].flags & PF_IMAGE_BITMAP)
331 FreeVClip (Powerups[n].image_handle);
332 else
333 FreePolyModel (Powerups[n].image_handle);
334
335 FreePowerup (n);
336 mng_EraseLocker();
337 RemapPowerups();
338
339 OutrageMessageBox ("Powerup deleted.");

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected