Fixed map editor bug

This commit is contained in:
mathusummut
2019-01-30 16:11:22 +01:00
parent e173d95d7e
commit 94493ab109
4 changed files with 26 additions and 25 deletions

View File

@@ -1001,15 +1001,12 @@ namespace Game {
string map_path = pathList[idx];
endPathWithSlash(map_path);
const string zeta = map_path + mapName + ".zgm";
const string mega = map_path + mapName + ".mgm";
const string glest = map_path + mapName + ".gbm";
if (fileExists(mega)) {
return mega;
} else if (fileExists(glest)) {
return glest;
} else if (fileExists(zeta)) {
return zeta;
}
}

View File

@@ -301,19 +301,23 @@ namespace Game {
serverInitError = false;
try {
networkManager.init(nrServer, openNetworkSlots);
} catch (const std::exception & ex) {
serverInitError = true;
char szBuf[8096] = "";
snprintf(szBuf, 8096, "In [%s::%s %d]\nNetwork init error:\n%s\n",
extractFileFromDirectoryPath(__FILE__).c_str(),
__FUNCTION__, __LINE__, ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError, szBuf);
if (SystemFlags::
getSystemSettingType(SystemFlags::debugSystem).enabled)
SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf);
} catch (const std::exception & e) {
try {
networkManager.init(nrServer, openNetworkSlots);
} catch (const std::exception & ex) {
serverInitError = true;
char szBuf[8096] = "";
snprintf(szBuf, 8096, "In [%s::%s %d]\nNetwork init error:\n%s\n",
extractFileFromDirectoryPath(__FILE__).c_str(),
__FUNCTION__, __LINE__, ex.what());
SystemFlags::OutputDebug(SystemFlags::debugError, szBuf);
if (SystemFlags::
getSystemSettingType(SystemFlags::debugSystem).enabled)
SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf);
showGeneralError = true;
generalErrorToShow = szBuf;
showGeneralError = true;
generalErrorToShow = szBuf;
}
}
if (SystemFlags::

View File

@@ -563,7 +563,7 @@ namespace MapEditor {
}
void MainWindow::setExtension() {
if (currentFile.empty() || program == NULL) {
/*if (currentFile.empty() || program == NULL) {
return;
}
@@ -571,11 +571,11 @@ namespace MapEditor {
//printf("#A currentFile [%s] extnsn [%s]\n",currentFile.c_str(),extnsn.c_str());
if (extnsn == "gbm" || extnsn == "mgm" || extnsn == "zgm") {
if (extnsn == "gbm" || extnsn == "mgm") {
currentFile = cutLastExt(currentFile);
}
SetStatusText(wxT(".zgm"), siFILE_TYPE);
currentFile += ".zgm";
currentFile += ".zgm";*/
}
void MainWindow::onMouseDown(wxMouseEvent &event, int x, int y) {
@@ -722,8 +722,8 @@ namespace MapEditor {
}
try {
fileDialog->SetMessage(wxT("Select Glestmap to load"));
fileDialog->SetWildcard(wxT("Glest&Mega Map (*.gbm *.mgm *.zgm)|*.gbm;*.mgm;*.zgm|Glest Map (*.gbm)|*.gbm|Mega Map (*.mgm)|*.mgm|Zeta Map (*.zgm)|*.zgm"));
fileDialog->SetMessage(wxT("Select map to load"));
fileDialog->SetWildcard(wxT("Supported Map Formats|*.gbm;*.mgm"));
if (fileDialog->ShowModal() == wxID_OK) {
#ifdef WIN32
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(fileDialog->GetPath()));
@@ -778,9 +778,9 @@ namespace MapEditor {
}
#if wxCHECK_VERSION(2, 9, 1)
wxFileDialog fd(this, wxT("Select file"), wxT(""), wxT(""), wxT("*.mgm|*.gbm|*.zgm"), wxFD_SAVE);
wxFileDialog fd(this, wxT("Select file"), wxT(""), wxT(""), wxT("*.mgm"), wxFD_SAVE);
#else
wxFileDialog fd(this, wxT("Select file"), wxT(""), wxT(""), wxT("*.mgm|*.gbm|*.zgm"), wxSAVE);
wxFileDialog fd(this, wxT("Select file"), wxT(""), wxT(""), wxT("*.mgm"), wxSAVE);
#endif
if (fileDialog->GetPath() != ToUnicode("")) {
@@ -795,7 +795,7 @@ namespace MapEditor {
fd.SetDirectory(ToUnicode(defaultPath));
}
fd.SetWildcard(wxT("ZetaGlest Map (*.zgm)|MegaGlest Map (*.mgm)|*.mgm|Glest Map (*.gbm)|*.gbm"));
fd.SetWildcard(wxT("Map File *.mgm"));
if (fd.ShowModal() == wxID_OK) {
#ifdef WIN32
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(fd.GetPath()));
@@ -1645,7 +1645,7 @@ wxT("Help")).ShowModal();
if (argc == 2) {
if (argv[1][0] == '-') { // any flag gives help and exits program.
std::cout << std::endl << "ZetaGlest Map Editor " << MapEditorVersionString << " [Using " << (const char *) wxConvCurrent->cWX2MB(wxVERSION_STRING) << "]" << std::endl << std::endl;
std::cout << "Creates or edits zetaglest/glest maps. [.zgm/.mgm/.gbm]" << std::endl << std::endl;
std::cout << "Creates or edits ZetaGlest maps. [.mgm]" << std::endl << std::endl;
std::cout << "Draw with left mouse button." << std::endl;
std::cout << "Move map with right mouse button." << std::endl;
std::cout << "Zoom with middle mouse button or mousewheel." << std::endl;

View File

@@ -164,7 +164,7 @@ namespace MapEditor {
void shiftUp();
void shiftDown();
void randomizeMapHeights(bool withReset, int minimumHeight, int maximumHeight, int chanceDivider, int smoothRecursions);;
void randomizeMapHeights(bool withReset, int minimumHeight, int maximumHeight, int chanceDivider, int smoothRecursions);
void randomizeFactions();
void switchMapSurfaces(int surf1, int surf2);
void loadMap(const string &path);