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

Function InputTextureName

editor/WorldTexturesDialog.cpp:2000–2021  ·  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

1998// Returns true if got new name, false if cancelled.
1999// the data in buf not changed if cancel is pressed
2000bool InputTextureName(char *buf, int len, char *title, char *prompt, CWnd *wnd) {
2001 char *tempbuf = (char *)mem_malloc(len);
2002
2003 strcpy(tempbuf, buf);
2004
2005try_again:
2006
2007 if (!InputString(tempbuf, len, title, prompt, wnd)) {
2008 mem_free(tempbuf);
2009 return 0;
2010 }
2011
2012 if (FindTextureName(tempbuf) != -1) {
2013 OutrageMessageBox("The name you specified is already in use. Enter another name.");
2014 goto try_again;
2015 }
2016
2017 strcpy(buf, tempbuf);
2018 mem_free(tempbuf);
2019
2020 return 1;
2021}
2022
2023void CWorldTexturesDialog::OnTextureChangeName() {
2024 int n = D3EditState.texdlg_texture;

Callers 2

OnWtexdlgAddnewMethod · 0.85
OnTextureChangeNameMethod · 0.85

Calls 3

InputStringFunction · 0.85
FindTextureNameFunction · 0.85
OutrageMessageBoxFunction · 0.85

Tested by

no test coverage detected