summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorKrzysztof Dermont <erihel@gmail.com>2014-06-20 23:41:38 +0200
committerKrzysztof Dermont <erihel@gmail.com>2014-06-20 23:51:28 +0200
commit2260f6bf4feb62929e32a1bea9cd3f403aa034b1 (patch)
treea9f830fe8ddfa57598a0802ced6540befb8c8c75 /src/script
parentba62e6f8be5f7008939677ce70799ecc26adf420 (diff)
downloadcolobot-2260f6bf4feb62929e32a1bea9cd3f403aa034b1.tar.gz
colobot-2260f6bf4feb62929e32a1bea9cd3f403aa034b1.tar.bz2
colobot-2260f6bf4feb62929e32a1bea9cd3f403aa034b1.zip
Big part of PhysFS support
* removed -mod argument * removed -datadir argument * removed -lang argument * removed some dead ui code * added resource manager and file loaders (stream and SDL) * changed interface textures location to match new directory structure * removed CGameData for mod support * added PhysFS support
Diffstat (limited to 'src/script')
-rw-r--r--src/script/script.cpp31
1 files changed, 4 insertions, 27 deletions
diff --git a/src/script/script.cpp b/src/script/script.cpp
index f97ed08..11aa5c1 100644
--- a/src/script/script.cpp
+++ b/src/script/script.cpp
@@ -18,7 +18,6 @@
#include "script/script.h"
#include "app/app.h"
-#include "app/gamedata.h"
#include "common/global.h"
#include "common/iman.h"
@@ -4407,7 +4406,7 @@ void CScript::New(Ui::CEdit* edit, const char* name)
sf = m_main->GetScriptFile();
if ( sf[0] != 0 ) // Load an empty program specific?
{
- std::string filename = CGameData::GetInstancePointer()->GetFilePath(DIR_AI, sf);
+ std::string filename = sf;
file = fopen(filename.c_str(), "rb");
if ( file != NULL )
{
@@ -4497,20 +4496,8 @@ bool CScript::ReadScript(const char* filename)
{
FILE* file;
Ui::CEdit* edit;
- std::string name;
- if ( strchr(filename, '/') == 0 ) //we're reading non user script
- {
- name = CGameData::GetInstancePointer()->GetFilePath(DIR_AI, filename);
- }
- else
- {
- name = filename;
- //TODO: is this needed?
- // UserDir(name, filename, "");
- }
-
- file = fopen(name.c_str(), "rb");
+ file = fopen(filename, "rb");
if ( file == NULL ) return false;
fclose(file);
@@ -4520,7 +4507,7 @@ bool CScript::ReadScript(const char* filename)
edit = m_interface->CreateEdit(Math::Point(0.0f, 0.0f), Math::Point(0.0f, 0.0f), 0, EVENT_EDIT9);
edit->SetMaxChar(Ui::EDITSTUDIOMAX);
edit->SetAutoIndent(m_engine->GetEditIndentMode());
- edit->ReadText(name.c_str());
+ edit->ReadText(filename);
GetScript(edit);
m_interface->DeleteControl(EVENT_EDIT9);
return true;
@@ -4531,16 +4518,6 @@ bool CScript::ReadScript(const char* filename)
bool CScript::WriteScript(const char* filename)
{
Ui::CEdit* edit;
- std::string name;
-
- if ( strchr(filename, '/') == 0 ) //we're writing non user script
- {
- name = CGameData::GetInstancePointer()->GetFilePath(DIR_AI, filename);
- }
- else
- {
- name = filename;
- }
if ( m_script == nullptr )
{
@@ -4552,7 +4529,7 @@ bool CScript::WriteScript(const char* filename)
edit->SetMaxChar(Ui::EDITSTUDIOMAX);
edit->SetAutoIndent(m_engine->GetEditIndentMode());
edit->SetText(m_script);
- edit->WriteText(name);
+ edit->WriteText(filename);
m_interface->DeleteControl(EVENT_EDIT9);
return true;
}