Index: code/branches/cpp11_v3/src/libraries/core/LuaState.cc
===================================================================
--- code/branches/cpp11_v3/src/libraries/core/LuaState.cc	(revision 11053)
+++ code/branches/cpp11_v3/src/libraries/core/LuaState.cc	(revision 11054)
@@ -48,5 +48,5 @@
     LuaState::LuaState()
         : bIsRunning_(false)
-        , includeParseFunction_(NULL)
+        , includeParseFunction_(nullptr)
     {
         // Create new lua state and configure it
@@ -79,10 +79,10 @@
     }
 
-    shared_ptr<ResourceInfo> LuaState::getFileInfo(const std::string& filename)
+    std::shared_ptr<ResourceInfo> LuaState::getFileInfo(const std::string& filename)
     {
         // Look in the current directory first
-        shared_ptr<ResourceInfo> sourceInfo = Resource::getInfo(sourceFileInfo_->path + filename);
+        std::shared_ptr<ResourceInfo> sourceInfo = Resource::getInfo(sourceFileInfo_->path + filename);
         // Continue search in root directories
-        if (sourceInfo == NULL && !sourceFileInfo_->path.empty())
+        if (sourceInfo == nullptr && !sourceFileInfo_->path.empty())
             sourceInfo = Resource::getInfo(filename);
         return sourceInfo;
@@ -91,6 +91,6 @@
     bool LuaState::includeFile(const std::string& filename)
     {
-        shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename);
-        if (sourceInfo != NULL)
+        std::shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename);
+        if (sourceInfo != nullptr)
             return this->includeString(Resource::open(sourceInfo)->getAsString(), sourceInfo);
         else
@@ -101,14 +101,14 @@
     }
 
-    bool LuaState::includeString(const std::string& code, const shared_ptr<ResourceInfo>& sourceFileInfo)
+    bool LuaState::includeString(const std::string& code, const std::shared_ptr<ResourceInfo>& sourceFileInfo)
     {
         // Parse string with provided include parser (otherwise don't preparse at all)
         std::string luaInput;
-        if (includeParseFunction_ != NULL)
+        if (includeParseFunction_ != nullptr)
             luaInput = (*includeParseFunction_)(code);
         else
             luaInput = code;
 
-        if (sourceFileInfo != NULL)
+        if (sourceFileInfo != nullptr)
         {
             // Also fill a map with the actual source code. This is just for the include* commands
@@ -119,8 +119,8 @@
         bool returnValue = this->doString(luaInput, sourceFileInfo);
 
-        if (sourceFileInfo != NULL)
+        if (sourceFileInfo != nullptr)
         {
             // Delete source code entry
-            if (sourceFileInfo != NULL)
+            if (sourceFileInfo != nullptr)
                 this->sourceCodeMap_.erase(sourceFileInfo->filename);
         }
@@ -131,6 +131,6 @@
     bool LuaState::doFile(const std::string& filename)
     {
-        shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename);
-        if (sourceInfo != NULL)
+        std::shared_ptr<ResourceInfo> sourceInfo = this->getFileInfo(filename);
+        if (sourceInfo != nullptr)
             return this->doString(Resource::open(sourceInfo)->getAsString(), sourceInfo);
         else
@@ -141,14 +141,14 @@
     }
 
-    bool LuaState::doString(const std::string& code, const shared_ptr<ResourceInfo>& sourceFileInfo)
+    bool LuaState::doString(const std::string& code, const std::shared_ptr<ResourceInfo>& sourceFileInfo)
     {
         // Save the old source file info
-        shared_ptr<ResourceInfo> oldSourceFileInfo = sourceFileInfo_;
+        std::shared_ptr<ResourceInfo> oldSourceFileInfo = sourceFileInfo_;
         // Only override if sourceFileInfo provides useful information
-        if (sourceFileInfo != NULL)
+        if (sourceFileInfo != nullptr)
             sourceFileInfo_ = sourceFileInfo;
 
         std::string chunkname;
-        if (sourceFileInfo != NULL)
+        if (sourceFileInfo != nullptr)
         {
             // Provide lua_load with the filename for debug purposes
@@ -245,5 +245,5 @@
             //Note: due to newlines etc., it's possible that one line consists of parts of
             //      multiple, different files
-            std::vector<std::vector<std::pair<std::string, size_t> > >::reverse_iterator it = lineTrace_->rbegin();
+            std::vector<std::vector<std::pair<std::string, size_t>>>::reverse_iterator it = lineTrace_->rbegin();
             std::pair<std::string, size_t> temppair = std::make_pair(filename, line);
             //Avoid duplicate entries. This could happen if there were lua blocks on the same line
@@ -259,7 +259,7 @@
             {
                 //Add the new line to the trace map
-                lineTrace_->push_back(std::vector<std::pair<std::string, size_t> >());
+                lineTrace_->emplace_back();
                 //Add the source of the line at the end
-                lineTrace_->rbegin()->push_back(std::make_pair(filename, line + i));
+                lineTrace_->rbegin()->emplace_back(filename, line + i);
             }
         }
@@ -285,6 +285,6 @@
     bool LuaState::fileExists(const std::string& filename)
     {
-        shared_ptr<ResourceInfo> info = this->getFileInfo(filename);
-        if (info == NULL)
+        std::shared_ptr<ResourceInfo> info = this->getFileInfo(filename);
+        if (info == nullptr)
             return false;
         else
@@ -300,6 +300,6 @@
         if (it != this->sourceCodeMap_.end())
             return it->second;
-        shared_ptr<ResourceInfo> info = Resource::getInfo(filename);
-        if (info == NULL)
+        std::shared_ptr<ResourceInfo> info = Resource::getInfo(filename);
+        if (info == nullptr)
             return "";
         else
@@ -326,7 +326,7 @@
     /*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name)
     {
-        for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
-        {
-            if (it->first == name || it->second == function)
+        for (const auto& mapEntry : getToluaInterfaces())
+        {
+            if (mapEntry.first == name || mapEntry.second == function)
             {
                 orxout(internal_warning, context::lua) << "Trying to add a Tolua interface with the same name or function." << endl;
@@ -337,6 +337,6 @@
 
         // Open interface in all LuaStates
-        for (std::vector<LuaState*>::const_iterator it = getInstances().begin(); it != getInstances().end(); ++it)
-            (*function)((*it)->luaState_);
+        for (LuaState* state : getInstances())
+            (*function)(state->luaState_);
 
         // Return dummy bool
@@ -354,8 +354,8 @@
 
         // Close interface in all LuaStates
-        for (std::vector<LuaState*>::const_iterator itState = getInstances().begin(); itState != getInstances().end(); ++itState)
-        {
-            lua_pushnil((*itState)->luaState_);
-            lua_setglobal((*itState)->luaState_, it->first.c_str());
+        for (LuaState* state : getInstances())
+        {
+            lua_pushnil(state->luaState_);
+            lua_setglobal(state->luaState_, it->first.c_str());
         }
 
@@ -369,14 +369,14 @@
     /*static*/ void LuaState::openToluaInterfaces(lua_State* state)
     {
-        for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
-            (*it->second)(state);
+        for (const auto& mapEntry : getToluaInterfaces())
+            (mapEntry.second)(state);
     }
 
     /*static*/ void LuaState::closeToluaInterfaces(lua_State* state)
     {
-        for (ToluaInterfaceMap::const_iterator it = getToluaInterfaces().begin(); it != getToluaInterfaces().end(); ++it)
+        for (const auto& mapEntry : getToluaInterfaces())
         {
             lua_pushnil(state);
-            lua_setglobal(state, it->first.c_str());
+            lua_setglobal(state, mapEntry.first.c_str());
         }
     }
