From 4bc473548096a90775fdd2ce78c1e6035087bd8f Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sat, 27 Dec 2014 20:39:30 +0000 Subject: [PATCH] If you save over an autonamed savegame and change the name, don't overwrite your edit with another autofill. git-svn-id: https://svn.eduke32.com/eduke32@4858 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/menus.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 0c9d186e8..8158329aa 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -2635,14 +2635,18 @@ static int32_t M_MenuEntryStringSubmit(MenuEntry_t *entry, char *input) case MENU_SAVE: // dirty hack... char 127 in last position indicates an auto-filled name if (input[0] == 0 || (ud.savegame[M_SAVE.currentEntry][MAXSAVEGAMENAME-2] == 127 && - save_xxh == XXH32((uint8_t *)&ud.savegame[M_SAVE.currentEntry][0], 19, 0xDEADBEEF))) + Bstrncmp(&ud.savegame[M_SAVE.currentEntry][0], input, MAXSAVEGAMENAME-3) == 0 && + save_xxh == XXH32((uint8_t *)&ud.savegame[M_SAVE.currentEntry][0], MAXSAVEGAMENAME-3, 0xDEADBEEF))) { - Bstrncpy(&ud.savegame[M_SAVE.currentEntry][0], MapInfo[ud.volume_number * MAXLEVELS + ud.level_number].name, 19); + Bstrncpy(&ud.savegame[M_SAVE.currentEntry][0], MapInfo[ud.volume_number * MAXLEVELS + ud.level_number].name, MAXSAVEGAMENAME-3); ud.savegame[M_SAVE.currentEntry][MAXSAVEGAMENAME-2] = 127; returnvar = -1; } else + { + ud.savegame[M_SAVE.currentEntry][MAXSAVEGAMENAME-2] = 0; Bstrncpy(object->variable, input, object->maxlength); + } G_SavePlayerMaybeMulti(M_SAVE.currentEntry);