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

Function InputWeaponName

editor/WorldWeaponsDialog.cpp:1580–1601  ·  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

1578// Returns true if got new name, false if cancelled.
1579// the data in buf not changed if cancel is pressed
1580bool InputWeaponName(char *buf, int len, char *title, char *prompt, CWnd *wnd) {
1581 char *tempbuf = (char *)mem_malloc(len);
1582
1583 strcpy(tempbuf, buf);
1584
1585try_again:
1586
1587 if (!InputString(tempbuf, len, title, prompt, wnd)) {
1588 mem_free(tempbuf);
1589 return 0;
1590 }
1591
1592 if (FindWeaponName(tempbuf) != -1) {
1593 OutrageMessageBox("The name you specified is already in use. Enter another name.");
1594 goto try_again;
1595 }
1596
1597 strcpy(buf, tempbuf);
1598 mem_free(tempbuf);
1599
1600 return 1;
1601}
1602
1603void CWorldWeaponsDialog::OnChangeName() {
1604 char name[PAGENAME_LEN];

Callers 1

OnChangeNameMethod · 0.85

Calls 3

InputStringFunction · 0.85
FindWeaponNameFunction · 0.85
OutrageMessageBoxFunction · 0.85

Tested by

no test coverage detected