Properly limit the save title size in IHNM

svn-id: r28728
This commit is contained in:
Filippos Karapetis 2007-08-25 17:10:31 +00:00
parent 8f2e600601
commit 3d823b250b

View File

@ -1154,6 +1154,10 @@ bool Interface::processTextInput(uint16 ascii) {
uint tempWidth;
memset(tempString, 0, SAVE_TITLE_SIZE);
ch[1] = 0;
// ITE has a maximum save title size of SAVE_TITLE_SIZE (28), but IHNM has a slightly smaller
// save title size (21). We only limit the save title size during text input, to preserve
// backwards compatibility with older save games
uint save_title_size = _vm->getGameType() == GType_ITE ? SAVE_TITLE_SIZE : SAVE_TITLE_SIZE - 6;
switch (ascii) {
case 13:
@ -1193,7 +1197,7 @@ bool Interface::processTextInput(uint16 ascii) {
((ascii >= '0') && (ascii <='9')) ||
((ascii >= 'A') && (ascii <='Z')) ||
(ascii == ' ') || (ascii == '-') || (ascii == '_')) {
if (_textInputStringLength < SAVE_TITLE_SIZE - 1) {
if (_textInputStringLength < save_title_size - 1) {
ch[0] = ascii;
tempWidth = _vm->_font->getStringWidth(kKnownFontSmall, ch, 0, kFontNormal);
tempWidth += _vm->_font->getStringWidth(kKnownFontSmall, _textInputString, 0, kFontNormal);