Undo the console portion of 84657271c7 because it results in the console forgetting its object on opening

pull/303/head
scrawl 7 years ago
parent 717e68fab2
commit 36c192a1dd

@ -151,6 +151,8 @@ namespace MWBase
virtual void updateSpellWindow() = 0; virtual void updateSpellWindow() = 0;
virtual void setConsoleSelectedObject(const MWWorld::Ptr& object) = 0;
/// Set value for the given ID. /// Set value for the given ID.
virtual void setValue (const std::string& id, const MWMechanics::AttributeValue& value) = 0; virtual void setValue (const std::string& id, const MWMechanics::AttributeValue& value) = 0;
virtual void setValue (int parSkill, const MWMechanics::SkillValue& value) = 0; virtual void setValue (int parSkill, const MWMechanics::SkillValue& value) = 0;

@ -417,7 +417,7 @@ namespace MWGui
setCoord(10,10, width-10, height/2); setCoord(10,10, width-10, height/2);
} }
void Console::setPtr(const MWWorld::Ptr& object) void Console::setSelectedObject(const MWWorld::Ptr& object)
{ {
if (!object.isEmpty()) if (!object.isEmpty())
{ {
@ -443,12 +443,12 @@ namespace MWGui
void Console::onReferenceUnavailable() void Console::onReferenceUnavailable()
{ {
setPtr(MWWorld::Ptr()); setSelectedObject(MWWorld::Ptr());
} }
void Console::resetReference() void Console::resetReference()
{ {
ReferenceInterface::resetReference(); ReferenceInterface::resetReference();
setPtr(MWWorld::Ptr()); setSelectedObject(MWWorld::Ptr());
} }
} }

@ -25,7 +25,7 @@ namespace MWGui
{ {
public: public:
/// Set the implicit object for script execution /// Set the implicit object for script execution
void setPtr(const MWWorld::Ptr& object); void setSelectedObject(const MWWorld::Ptr& object);
MyGUI::EditBox* mCommandLine; MyGUI::EditBox* mCommandLine;
MyGUI::EditBox* mHistory; MyGUI::EditBox* mHistory;
@ -42,12 +42,9 @@ namespace MWGui
virtual void onOpen(); virtual void onOpen();
virtual void onClose(); virtual void onClose();
void onFrame(float dt) { checkReferenceAvailable(); }
void setFont(const std::string &fntName); void setFont(const std::string &fntName);
void onResChange(int width, int height); void onResChange(int width, int height);
void clear() { resetReference(); }
// Print a message to the console, in specified color. // Print a message to the console, in specified color.
void print(const std::string &msg, const std::string& color = "#FFFFFF"); void print(const std::string &msg, const std::string& color = "#FFFFFF");

@ -260,7 +260,7 @@ namespace MWGui
MWWorld::Ptr object = MWBase::Environment::get().getWorld()->getFacedObject(); MWWorld::Ptr object = MWBase::Environment::get().getWorld()->getFacedObject();
if (mode == GM_Console) if (mode == GM_Console)
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Console, object); MWBase::Environment::get().getWindowManager()->setConsoleSelectedObject(object);
else if ((mode == GM_Container) || (mode == GM_Inventory)) else if ((mode == GM_Container) || (mode == GM_Inventory))
{ {
// pick up object // pick up object

@ -1884,6 +1884,11 @@ namespace MWGui
mSpellWindow->updateSpells(); mSpellWindow->updateSpells();
} }
void WindowManager::setConsoleSelectedObject(const MWWorld::Ptr &object)
{
mConsole->setSelectedObject(object);
}
std::string WindowManager::correctIconPath(const std::string& path) std::string WindowManager::correctIconPath(const std::string& path)
{ {
return Misc::ResourceHelpers::correctIconPath(path, mResourceSystem->getVFS()); return Misc::ResourceHelpers::correctIconPath(path, mResourceSystem->getVFS());

@ -190,6 +190,8 @@ namespace MWGui
virtual void updateSpellWindow(); virtual void updateSpellWindow();
virtual void setConsoleSelectedObject(const MWWorld::Ptr& object);
///< Set value for the given ID. ///< Set value for the given ID.
virtual void setValue (const std::string& id, const MWMechanics::AttributeValue& value); virtual void setValue (const std::string& id, const MWMechanics::AttributeValue& value);
virtual void setValue (int parSkill, const MWMechanics::SkillValue& value); virtual void setValue (int parSkill, const MWMechanics::SkillValue& value);

Loading…
Cancel
Save