Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6051 for code/branches/menu


Ignore:
Timestamp:
Nov 12, 2009, 7:41:20 PM (15 years ago)
Author:
rgrieder
Message:

Fix for the resource group problem in the GUIManager. This should fix the lua require function (though I could not test it).

Location:
code/branches/menu/src/libraries/core
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/menu/src/libraries/core/GUIManager.cc

    r6048 r6051  
    121121        // setup scripting
    122122        luaState_.reset(new LuaState());
     123        rootFileInfo_ = Resource::getInfo("InitialiseGUI.lua", "GUI");
     124        // This is necessary to ensure that input events also use the right resource info when triggering lua functions
     125        luaState_->setDefaultResourceInfo(this->rootFileInfo_);
    123126        scriptModule_.reset(new LuaScriptModule(luaState_->getInternalLuaState()));
    124127
     
    135138
    136139        // Initialise the basic lua code
    137         rootFileInfo_ = Resource::getInfo("InitialiseGUI.lua", "GUI");
    138140        this->luaState_->doFile("InitialiseGUI.lua", "GUI", false);
    139141
  • code/branches/menu/src/libraries/core/LuaState.cc

    r6024 r6051  
    116116    }
    117117
    118     void LuaState::includeString(const std::string& code, shared_ptr<ResourceInfo> sourceFileInfo)
     118    void LuaState::includeString(const std::string& code, const shared_ptr<ResourceInfo>& sourceFileInfo)
    119119    {
    120120        // Parse string with provided include parser (otherwise don't preparse at all)
     
    138138    }
    139139
    140     void LuaState::doString(const std::string& code, shared_ptr<ResourceInfo> sourceFileInfo)
     140    void LuaState::doString(const std::string& code, const shared_ptr<ResourceInfo>& sourceFileInfo)
    141141    {
    142142        // Save the oold source file info
  • code/branches/menu/src/libraries/core/LuaState.h

    r5781 r6051  
    5757
    5858        void doFile(const std::string& filename, const std::string& resourceGroup = "General", bool bSearchOtherPaths = true); // tolua_export
    59         void doString(const std::string& code, shared_ptr<ResourceInfo> sourceFileInfo = shared_ptr<ResourceInfo>());
     59        void doString(const std::string& code, const shared_ptr<ResourceInfo>& sourceFileInfo = shared_ptr<ResourceInfo>());
    6060
    6161        void includeFile(const std::string& filename, const std::string& resourceGroup = "General", bool bSearchOtherPaths = true); // tolua_export
    62         void includeString(const std::string& code, shared_ptr<ResourceInfo> sourceFileInfo = shared_ptr<ResourceInfo>());
     62        void includeString(const std::string& code, const shared_ptr<ResourceInfo>& sourceFileInfo = shared_ptr<ResourceInfo>());
    6363
    6464        void luaPrint(const std::string& str); // tolua_export
     
    7171        void setIncludeParser(std::string (*function)(const std::string&)) { includeParseFunction_ = function; }
    7272        lua_State* getInternalLuaState() { return luaState_; }
     73
     74        void setDefaultResourceInfo(const shared_ptr<ResourceInfo>& sourceFileInfo) { this->sourceFileInfo_ = sourceFileInfo; }
     75        const shared_ptr<ResourceInfo>& getDefaultResourceInfo() { return this->sourceFileInfo_; }
    7376
    7477        static bool addToluaInterface(int (*function)(lua_State*), const std::string& name);
Note: See TracChangeset for help on using the changeset viewer.