mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 09:39:43 +01:00
Disable typing pipes in script names
This disables typing the pipe character in the data fields of terminals and script boxes. Care has been taken to make sure that it's still possible to type pipes in room text. This is because pipes are the line separator in the big XML tag that stores every single script line, and thus a script name with pipes would end up being split up after the level file has been saved and loaded again.
This commit is contained in:
parent
f1bf1f683c
commit
13d6b2d64c
1 changed files with 15 additions and 0 deletions
|
@ -3472,6 +3472,21 @@ void editorinput(void)
|
|||
|
||||
case EditorSubState_DRAW_INPUT:
|
||||
// We're taking input!
|
||||
if (INBOUNDS_VEC(ed.text_entity, customentities)
|
||||
&& (customentities[ed.text_entity].t == 18 || customentities[ed.text_entity].t == 19))
|
||||
{
|
||||
// This is a terminal or script box, so this is a script name.
|
||||
// Remove all pipes, they are the line separator in the XML.
|
||||
// When this loop reaches the end, it wraps to SIZE_MAX; SIZE_MAX + 1 is 0
|
||||
for (size_t i = key.keybuffer.length() - 1; i + 1 > 0; i--)
|
||||
{
|
||||
if (key.keybuffer[i] == '|')
|
||||
{
|
||||
key.keybuffer.erase(key.keybuffer.begin() + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (escape_pressed)
|
||||
{
|
||||
// Cancel it, and remove the enemy it's tied to if necessary
|
||||
|
|
Loading…
Reference in a new issue