- bugfixes from windows unicode work to compile in Linux
This commit is contained in:
parent
1085f24c6f
commit
adb7ec4a6a
|
@ -235,13 +235,15 @@ void IntField::createControl(wxWindow *parent, wxSizer *sizer){
|
|||
|
||||
void IntField::updateValue(){
|
||||
//#if defined(__MINGW32__)
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(textCtrl->GetValue()));
|
||||
value = tmp_buf;
|
||||
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
|
||||
value = utf8_encode(wstr.get());
|
||||
#endif
|
||||
#else
|
||||
value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
#endif
|
||||
|
||||
//#else
|
||||
//value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
|
@ -274,12 +276,15 @@ void FloatField::createControl(wxWindow *parent, wxSizer *sizer){
|
|||
void FloatField::updateValue(){
|
||||
|
||||
//#if defined(__MINGW32__)
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(textCtrl->GetValue()));
|
||||
value = tmp_buf;
|
||||
#ifdef WIN32
|
||||
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
|
||||
value = utf8_encode(wstr.get());
|
||||
#endif
|
||||
#else
|
||||
value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
#endif
|
||||
|
||||
//#else
|
||||
// value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
|
@ -313,12 +318,15 @@ void StringField::createControl(wxWindow *parent, wxSizer *sizer){
|
|||
void StringField::updateValue(){
|
||||
|
||||
//#if defined(__MINGW32__)
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(textCtrl->GetValue()));
|
||||
value = tmp_buf;
|
||||
#ifdef WIN32
|
||||
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
|
||||
value = utf8_encode(wstr.get());
|
||||
#endif
|
||||
#else
|
||||
value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
#endif
|
||||
|
||||
//#else
|
||||
// value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
|
@ -348,13 +356,16 @@ void EnumField::createControl(wxWindow *parent, wxSizer *sizer){
|
|||
|
||||
void EnumField::updateValue(){
|
||||
//#if defined(__MINGW32__)
|
||||
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(comboBox->GetValue()));
|
||||
value = tmp_buf;
|
||||
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
|
||||
value = utf8_encode(wstr.get());
|
||||
#endif
|
||||
#else
|
||||
value= (const char*)wxFNCONV(comboBox->GetValue());
|
||||
#endif
|
||||
|
||||
//#else
|
||||
// value= (const char*)wxFNCONV(comboBox->GetValue());
|
||||
|
@ -428,13 +439,16 @@ void FloatRangeField::createControl(wxWindow *parent, wxSizer *sizer){
|
|||
|
||||
void FloatRangeField::updateValue(){
|
||||
//#if defined(__MINGW32__)
|
||||
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(textCtrl->GetValue()));
|
||||
value = tmp_buf;
|
||||
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
|
||||
value = utf8_encode(wstr.get());
|
||||
#endif
|
||||
#else
|
||||
value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
#endif
|
||||
|
||||
//#else
|
||||
// value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
|
|
|
@ -213,12 +213,15 @@ bool App::OnInit(){
|
|||
string appPath = "";
|
||||
wxString exe_path = wxStandardPaths::Get().GetExecutablePath();
|
||||
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
||||
appPath = tmp_buf;
|
||||
#ifdef WIN32
|
||||
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
||||
appPath = utf8_encode(wstr.get());
|
||||
#endif
|
||||
#else
|
||||
appPath = wxFNCONV(exe_path);
|
||||
#endif
|
||||
|
||||
//#if defined(__MINGW32__)
|
||||
// const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
||||
|
|
|
@ -14,6 +14,10 @@
|
|||
#include "game_constants.h"
|
||||
#include <wx/stdpaths.h>
|
||||
#include <platform_util.h>
|
||||
#ifndef WIN32
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
//#include <wx/filename.h>
|
||||
|
||||
#ifndef WIN32
|
||||
|
@ -670,12 +674,16 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event){
|
|||
|
||||
if(fileDialog->ShowModal()==wxID_OK){
|
||||
modelPathList.clear();
|
||||
string file = "";
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||
string file = tmp_buf;
|
||||
#ifdef WIN32
|
||||
file = tmp_buf;
|
||||
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
||||
file = utf8_encode(wstr.get());
|
||||
#endif
|
||||
#else
|
||||
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||
#endif
|
||||
|
||||
//loadModel((const char*)wxFNCONV(fileDialog->GetPath().c_str()));
|
||||
loadModel(file);
|
||||
|
@ -702,12 +710,15 @@ void MainWindow::onMenuFileLoadParticleXML(wxCommandEvent &event){
|
|||
|
||||
if(fileDialog->ShowModal()==wxID_OK){
|
||||
//string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||
string file = "";
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||
string file = tmp_buf;
|
||||
#ifdef WIN32
|
||||
file = tmp_buf;
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
||||
file = utf8_encode(wstr.get());
|
||||
#endif
|
||||
#else
|
||||
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||
#endif
|
||||
|
||||
loadParticle(file);
|
||||
}
|
||||
|
@ -733,12 +744,15 @@ void MainWindow::onMenuFileLoadProjectileParticleXML(wxCommandEvent &event){
|
|||
|
||||
if(fileDialog->ShowModal()==wxID_OK){
|
||||
//string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||
string file = "";
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||
string file = tmp_buf;
|
||||
#ifdef WIN32
|
||||
file = tmp_buf;
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
||||
file = utf8_encode(wstr.get());
|
||||
#endif
|
||||
#else
|
||||
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||
#endif
|
||||
|
||||
loadProjectileParticle(file);
|
||||
}
|
||||
|
@ -764,12 +778,16 @@ void MainWindow::onMenuFileLoadSplashParticleXML(wxCommandEvent &event){
|
|||
|
||||
if(fileDialog->ShowModal()==wxID_OK){
|
||||
//string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||
string file = "";
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||
string file = tmp_buf;
|
||||
#ifdef WIN32
|
||||
file = tmp_buf;
|
||||
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
||||
file = utf8_encode(wstr.get());
|
||||
#endif
|
||||
#else
|
||||
file = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||
#endif
|
||||
|
||||
loadSplashParticle(file);
|
||||
}
|
||||
|
@ -2190,12 +2208,14 @@ bool App::OnInit() {
|
|||
if(argc == 2 && argv[1][0] != '-') {
|
||||
|
||||
//#if defined(__MINGW32__)
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(argv[1]));
|
||||
modelPath = tmp_buf;
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(modelPath.c_str()));
|
||||
modelPath = utf8_encode(wstr.get());
|
||||
#endif
|
||||
#else
|
||||
modelPath = wxFNCONV(argv[1]);
|
||||
#endif
|
||||
|
||||
//#else
|
||||
// modelPath = wxFNCONV(argv[1]);
|
||||
|
@ -2219,12 +2239,15 @@ bool App::OnInit() {
|
|||
//exe_path += path_separator;
|
||||
|
||||
//#if defined(__MINGW32__)
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
||||
appPath = tmp_buf;
|
||||
#ifdef WIN32
|
||||
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
||||
appPath = utf8_encode(wstr.get());
|
||||
#endif
|
||||
#else
|
||||
appPath = wxFNCONV(exe_path);
|
||||
#endif
|
||||
|
||||
//#else
|
||||
// appPath = wxFNCONV(exe_path);
|
||||
|
|
|
@ -2531,6 +2531,21 @@ int glestMain(int argc, char** argv) {
|
|||
|
||||
lang.loadStrings(language);
|
||||
|
||||
if( lang.hasString("FONT_CHARCOUNT") &&
|
||||
lang.hasString("FONT_TYPENAME") &&
|
||||
lang.hasString("FONT_CHARSET")) {
|
||||
// 256 for English
|
||||
// 30000 for Chinese
|
||||
Font::charCount = strToInt(lang.get("FONT_CHARCOUNT"));
|
||||
Font::fontTypeName = lang.get("FONT_TYPENAME");
|
||||
// Example values:
|
||||
// DEFAULT_CHARSET (English) = 1
|
||||
// GB2312_CHARSET (Chinese) = 134
|
||||
Shared::Platform::charSet = strToInt(lang.get("FONT_CHARSET"));
|
||||
}
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::charSet = %d\n",__FILE__,__FUNCTION__,__LINE__,Font::charCount,Font::fontTypeName.c_str(),Shared::Platform::charSet);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Using Font::charCount = %d, Font::fontTypeName [%s] Shared::Platform::charSet = %d\n",Font::charCount,Font::fontTypeName.c_str(),Shared::Platform::charSet);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_SHOW_MAP_CRC]) == true) {
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
#include <iostream>
|
||||
#include"platform_util.h"
|
||||
#include <wx/stdpaths.h>
|
||||
#ifndef WIN32
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
using namespace Shared::Util;
|
||||
using namespace Shared::PlatformCommon;
|
||||
|
@ -580,11 +583,14 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event) {
|
|||
fileDialog->SetMessage(wxT("Select Glestmap to load"));
|
||||
fileDialog->SetWildcard(wxT("Glest&Mega Map (*.gbm *.mgm)|*.gbm;*.mgm|Glest Map (*.gbm)|*.gbm|Mega Map (*.mgm)|*.mgm"));
|
||||
if (fileDialog->ShowModal() == wxID_OK) {
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(fileDialog->GetPath()));
|
||||
currentFile = tmp_buf;
|
||||
#ifdef WIN32
|
||||
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(currentFile.c_str()));
|
||||
currentFile = utf8_encode(wstr.get());
|
||||
#else
|
||||
currentFile = fileDialog->GetPath().ToAscii();
|
||||
#endif
|
||||
|
||||
program->loadMap(currentFile);
|
||||
|
@ -645,11 +651,14 @@ void MainWindow::onMenuFileSaveAs(wxCommandEvent &event) {
|
|||
|
||||
fd.SetWildcard(wxT("Glest Map (*.gbm)|*.gbm|MegaGlest Map (*.mgm)|*.mgm"));
|
||||
if (fd.ShowModal() == wxID_OK) {
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(fd.GetPath()));
|
||||
currentFile = tmp_buf;
|
||||
#ifdef WIN32
|
||||
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(currentFile.c_str()));
|
||||
currentFile = utf8_encode(wstr.get());
|
||||
#else
|
||||
currentFile = fd.GetPath().ToAscii();
|
||||
#endif
|
||||
|
||||
fileDialog->SetPath(fd.GetPath());
|
||||
|
@ -1402,8 +1411,12 @@ bool SimpleDialog::show(const string &title, bool wide) {
|
|||
if(m_returnCode==wxID_CANCEL) return false; // don't change values if canceled
|
||||
|
||||
for (unsigned int i = 0; i < texts.size(); ++i) {
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(texts[i]->GetValue()));
|
||||
values[i].second = tmp_buf;
|
||||
#else
|
||||
values[i].second = texts[i]->GetValue().ToAscii();
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1452,12 +1465,15 @@ bool App::OnInit() {
|
|||
|
||||
string appPath = "";
|
||||
//#if defined(__MINGW32__)
|
||||
|
||||
#ifdef WIN32
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
||||
appPath = tmp_buf;
|
||||
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
||||
appPath = utf8_encode(wstr.get());
|
||||
#else
|
||||
appPath = wxFNCONV(exe_path);
|
||||
#endif
|
||||
|
||||
//#else
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
#include "platform_util.h"
|
||||
#include "conversion.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
using namespace Shared::Util;
|
||||
using namespace std;
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ void Properties::load(const string &path, bool clearCurrentProperties) {
|
|||
while(!fileStream.eof()){
|
||||
fileStream.getline(lineBuffer, maxLine);
|
||||
lineBuffer[maxLine-1]='\0';
|
||||
//printf("\n[%s]\n",lineBuffer);
|
||||
|
||||
//process line if it it not a comment
|
||||
if(lineBuffer[0]!=';'){
|
||||
|
|
|
@ -30,6 +30,10 @@
|
|||
#include "conversion.h"
|
||||
#include "simple_threads.h"
|
||||
#include "platform_util.h"
|
||||
#ifndef WIN32
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#include "leak_dumper.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
Loading…
Reference in New Issue