diff options
author | Didier Raboud <odyx@debian.org> | 2014-07-02 11:33:47 +0200 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2014-07-02 11:33:47 +0200 |
commit | 2e136acd34c45e5e6d105cabf91c67e5865c38fe (patch) | |
tree | 8561603160cce0b41ba31250539a22d37a2951de /src/ui/edit.cpp | |
parent | 562be6fe765d7742f7c38fbd82f8cc26369e238b (diff) | |
parent | d9fee8b2adad613cf8c10d153cd5cd7b261b7863 (diff) | |
download | colobot-2e136acd34c45e5e6d105cabf91c67e5865c38fe.tar.gz colobot-2e136acd34c45e5e6d105cabf91c67e5865c38fe.tar.bz2 colobot-2e136acd34c45e5e6d105cabf91c67e5865c38fe.zip |
Merge tag 'colobot-gold-0.1.3-alpha' into debian
Diffstat (limited to 'src/ui/edit.cpp')
-rw-r--r-- | src/ui/edit.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp index a187688..e2df62b 100644 --- a/src/ui/edit.cpp +++ b/src/ui/edit.cpp @@ -19,6 +19,7 @@ #include "ui/edit.h" #include "app/app.h" +#include "app/gamedata.h" #include "clipboard/clipboard.h" @@ -1224,11 +1225,7 @@ void CEdit::DrawPart(Math::Point pos, Math::Point dim, int icon) Math::Point uv1, uv2; float dp; -#if _POLISH - m_engine->SetTexture("textp.png"); -#else m_engine->SetTexture("text.png"); -#endif m_engine->SetState(Gfx::ENG_RSTATE_NORMAL); uv1.x = (16.0f/256.0f)*(icon%16); @@ -1462,11 +1459,14 @@ bool CEdit::ReadText(std::string filename, int addSize) std::string path = filename; if (!fs::exists(path)) { - path = CApplication::GetInstancePointer()->GetDataDirPath() + "/" + filename; + path = CGameData::GetInstancePointer()->GetDataPath(filename); } file = fopen(fs::path(path).make_preferred().string().c_str(), "rb"); - if ( file == NULL ) return false; + if ( file == NULL ) { + CLogger::GetInstancePointer()->Error("Unable to read text from file \"%s\"\n", path.c_str()); + return false; + } fseek(file, 0, SEEK_END); len = ftell(file); @@ -1669,12 +1669,14 @@ bool CEdit::ReadText(std::string filename, int addSize) buffer[i+6] == 'n' && buffer[i+7] == ' ' ) { + /* TODO: \button X; isn't working. Issue #232 if ( m_bSoluce || !bInSoluce ) { m_text[j] = GetValueParam(buffer+i+8, 0); m_format[j] = font|Gfx::FONT_BUTTON; j ++; } + */ i += strchr(buffer+i, ';')-(buffer+i)+1; } else if ( //m_format.size() > 0 && @@ -1798,8 +1800,10 @@ bool CEdit::ReadText(std::string filename, int addSize) res = main->GetInputBinding(slot).primary; if ( res != 0 ) { - if ( GetResource(RES_KEY, res, iName) ) + std::string iNameStr; + if ( GetResource(RES_KEY, res, iNameStr) ) { + strcpy(iName, iNameStr.c_str()); m_text[j] = ' '; m_format[j] = font; j ++; @@ -1817,9 +1821,13 @@ bool CEdit::ReadText(std::string filename, int addSize) res = main->GetInputBinding(slot).secondary; if ( res != 0 ) { - if ( GetResource(RES_KEY, res, iName) ) + if ( GetResource(RES_KEY, res, iNameStr) ) { - GetResource(RES_TEXT, RT_KEY_OR, text); + strcpy(iName, iNameStr.c_str()); + + std::string textStr; + GetResource(RES_TEXT, RT_KEY_OR, textStr); + strcpy(text, textStr.c_str()); n = 0; while ( text[n] != 0 ) { |