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

Method OnDelete

editor/WorldTexturesDialog.cpp:1187–1251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1185}
1186
1187void CWorldTexturesDialog::OnDelete() {
1188 int answer, tl;
1189 mngs_Pagelock pl;
1190 int n = D3EditState.texdlg_texture;
1191
1192 if ((tl = mng_FindTrackLock(GameTextures[n].name, PAGETYPE_TEXTURE)) == -1) {
1193 // OutrageMessageBox ("This texture is not yours to delete. Lock first.");
1194 answer = MessageBox("This texture is not locked...do you wish to lock it so you can delete it?",
1195 GameTextures[n].name, MB_YESNO);
1196 if (answer == IDNO)
1197 return;
1198
1199 AutoChecking = 1;
1200 TlockState = 0;
1201
1202 OnLock();
1203 if (!TlockState) {
1204 OutrageMessageBox("Couldn't lock that texture to delete it!");
1205 AutoChecking = 0;
1206 return;
1207 }
1208 AutoChecking = 0;
1209 tl = mng_FindTrackLock(GameTextures[n].name, PAGETYPE_TEXTURE);
1210 ASSERT(tl != -1);
1211
1212 // return;
1213 }
1214 answer = MessageBox("Are you sure you want to delete this texture?", GameTextures[n].name, MB_YESNO);
1215 if (answer == IDNO)
1216 return;
1217
1218 if (!mng_MakeLocker())
1219 return;
1220
1221 strncpy(pl.name, GameTextures[n].name, 30);
1222 pl.pagetype = PAGETYPE_TEXTURE;
1223 if (mng_CheckIfPageOwned(&pl, TableUser) != 1) {
1224 mng_FreeTrackLock(tl);
1225 if (!mng_DeletePage(GameTextures[n].name, PAGETYPE_TEXTURE, 1)) {
1226 mprintf(0, ErrorString);
1227 Int3();
1228 }
1229 } else {
1230 mng_FreeTrackLock(tl);
1231 mng_DeletePage(GameTextures[n].name, PAGETYPE_TEXTURE, 0);
1232 mng_DeletePage(GameTextures[n].name, PAGETYPE_TEXTURE, 1);
1233
1234 mng_DeletePagelock(GameTextures[n].name, PAGETYPE_TEXTURE);
1235 }
1236
1237 if (GameTextures[n].flags & TF_ANIMATED)
1238 FreeVClip(GameTextures[n].bm_handle);
1239 else
1240 bm_FreeBitmap(GameTextures[n].bm_handle);
1241
1242 FreeTexture(n);
1243 mng_EraseLocker();
1244

Callers

nothing calls this directly

Calls 12

mng_FindTrackLockFunction · 0.85
OutrageMessageBoxFunction · 0.85
mng_MakeLockerFunction · 0.85
mng_CheckIfPageOwnedFunction · 0.85
mng_FreeTrackLockFunction · 0.85
mng_DeletePageFunction · 0.85
mng_DeletePagelockFunction · 0.85
FreeVClipFunction · 0.85
bm_FreeBitmapFunction · 0.85
FreeTextureFunction · 0.85
mng_EraseLockerFunction · 0.85
GetNextTextureFunction · 0.85

Tested by

no test coverage detected