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
| 634 | // Returns true if got new name, false if cancelled. |
| 635 | // the data in buf not changed if cancel is pressed |
| 636 | bool InputDoorName(char *buf, int len, char *title, char *prompt, CWnd *wnd) { |
| 637 | char *tempbuf = (char *)mem_malloc(len); |
| 638 | |
| 639 | strcpy(tempbuf, buf); |
| 640 | |
| 641 | try_again: |
| 642 | |
| 643 | if (!InputString(tempbuf, len, title, prompt, wnd)) { |
| 644 | mem_free(tempbuf); |
| 645 | return 0; |
| 646 | } |
| 647 | |
| 648 | if (FindDoorName(tempbuf) != -1) { |
| 649 | OutrageMessageBox("The name you specified is already in use. Enter another name."); |
| 650 | goto try_again; |
| 651 | } |
| 652 | |
| 653 | strcpy(buf, tempbuf); |
| 654 | mem_free(tempbuf); |
| 655 | |
| 656 | return 1; |
| 657 | } |
| 658 | |
| 659 | void CWorldObjectsDoorDialog::OnDoorChangeName() { |
| 660 | int n = D3EditState.current_door; |
no test coverage detected