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

Method OnTextureChangeName

editor/WorldTexturesDialog.cpp:2023–2072  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2021}
2022
2023void CWorldTexturesDialog::OnTextureChangeName() {
2024 int n = D3EditState.texdlg_texture;
2025 char name[PAGENAME_LEN];
2026 mngs_Pagelock pl;
2027
2028 // Make sure we have this texture locked, if not reset name and bail
2029 int p = mng_FindTrackLock(GameTextures[n].name, PAGETYPE_TEXTURE);
2030 if (p == -1) {
2031 OutrageMessageBox("You must lock this texture if you wish to change its name.");
2032 return;
2033 }
2034
2035 // Get new name
2036 strcpy(name, GameTextures[n].name);
2037 if (!InputTextureName(name, sizeof(name), "Texture name", "Enter a new name for this texture:", this))
2038 return;
2039
2040 if (!mng_MakeLocker())
2041 return;
2042
2043 // Check to see if this page exists on the network. If so, we have to
2044 // rename it so we can prevent havoc
2045 strcpy(pl.name, GameTextures[n].name);
2046 pl.pagetype = PAGETYPE_TEXTURE;
2047
2048 int ret = mng_CheckIfPageOwned(&pl, TableUser);
2049 if (ret < 0)
2050 OutrageMessageBox(ErrorString);
2051 else if (ret == 1)
2052 mng_RenamePage(GameTextures[n].name, name, PAGETYPE_TEXTURE);
2053 else if (ret == 2) {
2054 // This page has never been checked in, replace only local copy
2055
2056 char oldname[PAGENAME_LEN];
2057 strcpy(oldname, GameTextures[n].name);
2058 strcpy(GameTextures[n].name, name);
2059 mng_ReplacePage(oldname, GameTextures[n].name, n, PAGETYPE_TEXTURE, 1);
2060
2061 } else if (ret == 0) {
2062 OutrageMessageBox("You don't own this page. Get Jason now!");
2063 mng_FreeTrackLock(p);
2064 return;
2065 }
2066
2067 // Finally, copy our new name to the appropriate arrays
2068 strcpy(GlobalTrackLocks[p].name, name);
2069 strcpy(GameTextures[n].name, name);
2070 UpdateDialog();
2071 mng_EraseLocker();
2072}
2073
2074void CWorldTexturesDialog::OnSelendokDestroyPulldown() {
2075 int i, cur;

Callers

nothing calls this directly

Calls 9

mng_FindTrackLockFunction · 0.85
OutrageMessageBoxFunction · 0.85
InputTextureNameFunction · 0.85
mng_MakeLockerFunction · 0.85
mng_CheckIfPageOwnedFunction · 0.85
mng_RenamePageFunction · 0.85
mng_ReplacePageFunction · 0.85
mng_FreeTrackLockFunction · 0.85
mng_EraseLockerFunction · 0.85

Tested by

no test coverage detected