parent
33fcdbbef5
commit
8cc74002cf
|
@ -64,6 +64,7 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
//TODO Get rid of all sprintf's
|
//TODO Get rid of all sprintf's
|
||||||
|
|
||||||
|
@ -3967,59 +3968,34 @@ void CMainDialog::IOReadName()
|
||||||
{
|
{
|
||||||
CWindow* pw;
|
CWindow* pw;
|
||||||
CEdit* pe;
|
CEdit* pe;
|
||||||
std::string filename;
|
std::string resume;
|
||||||
char op[100];
|
char line[100];
|
||||||
char op_i18n[100];
|
|
||||||
char line[500];
|
|
||||||
char resume[100];
|
|
||||||
char name[100];
|
char name[100];
|
||||||
time_t now;
|
time_t now;
|
||||||
int i;
|
|
||||||
|
|
||||||
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
||||||
if ( pw == nullptr ) return;
|
if ( pw == nullptr ) return;
|
||||||
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_IONAME));
|
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_IONAME));
|
||||||
if ( pe == nullptr ) return;
|
if ( pe == nullptr ) return;
|
||||||
|
|
||||||
//TODO: CLevelParser
|
resume = std::string(m_sceneName) + " " + boost::lexical_cast<std::string>(m_chap[m_index]+1);
|
||||||
sprintf(resume, "%s %d", m_sceneName, m_chap[m_index]+1);
|
|
||||||
BuildScenePath(filename, m_sceneName, (m_chap[m_index]+1)*100);
|
|
||||||
sprintf(op, "Title.E");
|
|
||||||
sprintf(op_i18n, "Title.%c", m_app->GetLanguageChar() );
|
|
||||||
|
|
||||||
CInputStream stream;
|
CLevelParser* level = new CLevelParser(m_sceneName, m_chap[m_index]+1, 0);
|
||||||
stream.open(filename);
|
try
|
||||||
|
|
||||||
if (stream.is_open())
|
|
||||||
{
|
{
|
||||||
while (stream.getline(line, 500))
|
level->Load();
|
||||||
{
|
resume = level->Get("Title")->GetParam("resume")->AsString();
|
||||||
for ( i=0 ; i<500 ; i++ )
|
|
||||||
{
|
|
||||||
if ( line[i] == '\t' ) line[i] = ' '; // replaces tab by space
|
|
||||||
if ( line[i] == '/' && line[i+1] == '/' )
|
|
||||||
{
|
|
||||||
line[i] = 0;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
catch(CLevelParserException& e)
|
||||||
|
|
||||||
if ( Cmd(line, op) )
|
|
||||||
{
|
{
|
||||||
OpString(line, "resume", resume);
|
CLogger::GetInstancePointer()->Warn("%s\n", e.what());
|
||||||
}
|
|
||||||
if ( Cmd(line, op_i18n) )
|
|
||||||
{
|
|
||||||
OpString(line, "resume", resume);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stream.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
time(&now);
|
time(&now);
|
||||||
TimeToAsciiClean(now, line);
|
TimeToAsciiClean(now, line);
|
||||||
sprintf(name, "%s - %s %d", line, resume, m_sel[m_index]+1);
|
sprintf(name, "%s - %s %d", line, resume.c_str(), m_sel[m_index]+1);
|
||||||
|
delete level;
|
||||||
|
|
||||||
pe->SetText(name);
|
pe->SetText(name);
|
||||||
pe->SetCursor(strlen(name), 0);
|
pe->SetCursor(strlen(name), 0);
|
||||||
pe->SetFocus(true);
|
pe->SetFocus(true);
|
||||||
|
|
Loading…
Reference in New Issue