~chuckw20/widelands/Animated_Barbarian_carrier_idle_cycle

« back to all changes in this revision

Viewing changes to src/scripting/scripting.cc

  • Committer: Holger Rapp
  • Date: 2010-04-19 19:35:23 UTC
  • Revision ID: sirver@gmx.de-20100419193523-zssk3buf5mi8s06v
Fixed a mistake in lua script registering on windows

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
                size_t length;
149
149
                std::string data(static_cast<char *>(fs.Load(path, length)));
150
150
                std::string name = path.substr(0, path.size() - 4); // strips '.lua'
151
 
                size_t pos = name.rfind('/');
152
 
                if (pos == std::string::npos)
153
 
                        pos = name.rfind("\\");
154
 
                if (pos != std::string::npos)
155
 
                        name = name.substr(pos + 1, name.size());
 
151
 
 
152
                for (size_t i = name.size() - 1; i; i--) {
 
153
                        if (name[i] == '/' or name[i] == '\\') {
 
154
                                name = name.substr(i + 1, name.size());
 
155
                                break;
 
156
                        }
 
157
                }
156
158
 
157
159
                log("Registering script: (%s,%s)\n", ns.c_str(), name.c_str());
158
160
                m_scripts[ns][name] = data;