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

Method OnSoundChangeName

editor/WorldSoundsDialog.cpp:1127–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1125}
1126
1127void CWorldSoundsDialog::OnSoundChangeName() {
1128 int n = D3EditState.current_sound;
1129
1130 char name[PAGENAME_LEN];
1131 mngs_Pagelock pl;
1132
1133 // Make sure we have this ship locked, if not reset name and bail
1134 int p = mng_FindTrackLock(Sounds[n].name, PAGETYPE_SOUND);
1135 if (p == -1) {
1136 OutrageMessageBox("You must lock this sound if you wish to change its name.");
1137 return;
1138 }
1139
1140 if (!mng_MakeLocker())
1141 return;
1142
1143 // Get new name
1144 strcpy(name, Sounds[n].name);
1145 if (!InputSoundName(name, sizeof(name), "Sound name", "Enter a new name for this sound:", this))
1146 return;
1147
1148 // Check to see if this page exists on the network. If so, we have to
1149 // rename it so we can prevent havoc
1150 strcpy(pl.name, Sounds[n].name);
1151 pl.pagetype = PAGETYPE_SOUND;
1152
1153 int ret = mng_CheckIfPageOwned(&pl, TableUser);
1154 if (ret < 0)
1155 OutrageMessageBox(ErrorString);
1156 else if (ret == 1)
1157 mng_RenamePage(Sounds[n].name, name, PAGETYPE_SOUND);
1158 else if (ret == 2) {
1159 // This page has never been checked in, replace only local copy
1160
1161 char oldname[PAGENAME_LEN];
1162 strcpy(oldname, Sounds[n].name);
1163 strcpy(Sounds[n].name, name);
1164
1165 mng_ReplacePage(oldname, Sounds[n].name, n, PAGETYPE_SOUND, 1);
1166 } else if (ret == 0) {
1167 OutrageMessageBox("You don't own this page. Get Jason now!");
1168 mng_FreeTrackLock(p);
1169 return;
1170 }
1171
1172 // Finally, copy our new name to the appropriate arrays
1173 strcpy(GlobalTrackLocks[p].name, name);
1174 strcpy(Sounds[n].name, name);
1175 mng_EraseLocker();
1176
1177 UpdateDialog();
1178}
1179
1180void CWorldSoundsDialog::OnOverride() {
1181 int n = D3EditState.current_sound;

Callers

nothing calls this directly

Calls 9

mng_FindTrackLockFunction · 0.85
OutrageMessageBoxFunction · 0.85
mng_MakeLockerFunction · 0.85
InputSoundNameFunction · 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