From 61d14b94d558e25105b6d8c2620b83f6d9b53d52 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 7 Nov 2016 21:39:25 -0500 Subject: TITANIC: Fix entering slot name & saving using in-game PET --- engines/titanic/pet_control/pet_real_life.h | 5 ----- engines/titanic/pet_control/pet_save.cpp | 13 ++++++++++++- engines/titanic/pet_control/pet_save.h | 5 +++++ 3 files changed, 17 insertions(+), 6 deletions(-) (limited to 'engines') diff --git a/engines/titanic/pet_control/pet_real_life.h b/engines/titanic/pet_control/pet_real_life.h index b359d285c8..7c7101a84b 100644 --- a/engines/titanic/pet_control/pet_real_life.h +++ b/engines/titanic/pet_control/pet_real_life.h @@ -86,11 +86,6 @@ public: */ virtual CGameObject *dragEnd(const Point &pt) const { return nullptr; } - /** - * Display a message - */ - virtual void displayMessage(const CString &msg) {} - /** * Returns true if the object is in a valid state */ diff --git a/engines/titanic/pet_control/pet_save.cpp b/engines/titanic/pet_control/pet_save.cpp index d344c8cd14..60afa11ab4 100644 --- a/engines/titanic/pet_control/pet_save.cpp +++ b/engines/titanic/pet_control/pet_save.cpp @@ -49,6 +49,16 @@ bool CPetSave::MouseButtonUpMsg(const Point &pt) { } } +bool CPetSave::KeyCharMsg(int key) { + if (CPetLoadSave::KeyCharMsg(key)) + return true; + + if (_savegameSlotNum != -1) + _slotNames[_savegameSlotNum].handleKey(key); + + return true; +} + void CPetSave::highlightCurrent(const Point &pt) { resetSlots(); highlightSave(_savegameSlotNum); @@ -71,11 +81,12 @@ void CPetSave::unhighlightSave(int index) { void CPetSave::execute() { CPetControl *pet = getPetControl(); if (_savegameSlotNum >= 0) { + int slotNumber = _savegameSlotNum; highlightSlot(-1); CProjectItem *project = pet ? pet->getRoot() : nullptr; if (project) { - project->saveGame(_savegameSlotNum, _slotNames[_savegameSlotNum].getText()); + project->saveGame(slotNumber, _slotNames[slotNumber].getText()); pet->displayMessage(BLANK); } } else if (pet) { diff --git a/engines/titanic/pet_control/pet_save.h b/engines/titanic/pet_control/pet_save.h index e5e956403f..39a25eb087 100644 --- a/engines/titanic/pet_control/pet_save.h +++ b/engines/titanic/pet_control/pet_save.h @@ -39,6 +39,11 @@ public: */ virtual bool MouseButtonUpMsg(const Point &pt); + /** + * Handles keypresses when the glyph is focused + */ + virtual bool KeyCharMsg(int key); + /** * Unhighlight any currently highlighted element */ -- cgit v1.2.3