[colobot] 246/390: Fixed saving files from CBot

Didier Raboud odyx at moszumanska.debian.org
Fri Jun 12 14:21:51 UTC 2015


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch upstream/latest
in repository colobot.

commit af9960d41e0b19c8b844509c320576157efb49c8
Author: krzys-h <krzys_h at interia.pl>
Date:   Sat Dec 20 18:16:21 2014 +0100

    Fixed saving files from CBot
---
 src/object/robotmain.cpp |  2 +-
 src/script/script.cpp    | 13 ++++---------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp
index c6bf7c0..8ae92b9 100644
--- a/src/object/robotmain.cpp
+++ b/src/object/robotmain.cpp
@@ -277,7 +277,7 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
         m_showLimit[i].link = 0;
     }
     
-    CScript::m_filesDir = m_dialog->GetFilesDir();
+    CScript::m_filesDir = CResourceManager::GetSaveLocation()+"/"+m_dialog->GetFilesDir(); //TODO: Refactor to PHYSFS while rewriting CBot engine
     CScript::InitFonctions();
 }
 
diff --git a/src/script/script.cpp b/src/script/script.cpp
index 463f940..b5a314e 100644
--- a/src/script/script.cpp
+++ b/src/script/script.cpp
@@ -3493,13 +3493,7 @@ void PrepareFilename(CBotString &filename)
     int pos = filename.ReverseFind('/');
     if ( pos > 0 )
     {
-        filename = filename.Mid(pos+1);  // Remove files with
-    }
-    
-    pos = filename.ReverseFind('/');
-    if ( pos > 0 )
-    {
-        filename = filename.Mid(pos+1);  // also with /
+        filename = filename.Mid(pos+1);  // Remove files with /
     }
     
     pos = filename.ReverseFind(':');
@@ -3509,6 +3503,7 @@ void PrepareFilename(CBotString &filename)
     }
     
     filename = CBotString(CScript::m_filesDir.c_str()) + CBotString("/") + filename;
+    CLogger::GetInstancePointer()->Debug("CBot accessing file '%s'\n", static_cast<const char*>(filename));
 }
 
 
@@ -3553,7 +3548,7 @@ bool CScript::rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int&
         
         m_CompteurFileOpen ++;
         
-        // save the channel file
+        // save the file handle
         pVar = pThis->GetItem("handle");
         pVar->SetValInt(reinterpret_cast<long>(pFile));
     }
@@ -3663,7 +3658,7 @@ bool CScript::rfopen (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exce
     
     m_CompteurFileOpen ++;
     
-    // Registered the channel file
+    // save file handle
     pVar = pThis->GetItem("handle");
     pVar->SetValInt(reinterpret_cast<long>(pFile));
     

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list