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

Function InputSoundName

editor/WorldSoundsDialog.cpp:1100–1125  ·  view source on GitHub ↗

Gets a name from the user, making sure it's unique Returns true if got new name, false if cancelled. the data in buf not changed if cancel is pressed

Source from the content-addressed store, hash-verified

1098// Returns true if got new name, false if cancelled.
1099// the data in buf not changed if cancel is pressed
1100bool InputSoundName(char *buf, int len, char *title, char *prompt, CWnd *wnd) {
1101 if (len > (PAGENAME_LEN - 1))
1102 len = PAGENAME_LEN - 1;
1103
1104 char *tempbuf = (char *)mem_malloc(len);
1105
1106 strncpy(tempbuf, buf, len - 1);
1107 tempbuf[len - 1] = '\0';
1108
1109try_again:
1110
1111 if (!InputString(tempbuf, len, title, prompt, wnd)) {
1112 mem_free(tempbuf);
1113 return 0;
1114 }
1115
1116 if (FindSoundName(tempbuf) != -1) {
1117 OutrageMessageBox("The name you specified is already in use. Enter another name.");
1118 goto try_again;
1119 }
1120
1121 strcpy(buf, tempbuf);
1122 mem_free(tempbuf);
1123
1124 return 1;
1125}
1126
1127void CWorldSoundsDialog::OnSoundChangeName() {
1128 int n = D3EditState.current_sound;

Callers 1

OnSoundChangeNameMethod · 0.85

Calls 3

InputStringFunction · 0.85
FindSoundNameFunction · 0.85
OutrageMessageBoxFunction · 0.85

Tested by

no test coverage detected