Differential D4900 Diff 21471 ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp
/* Copyright (C) 2022 Wildfire Games. | /* Copyright (C) 2023 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 703 Lines • ▼ Show 20 Lines | void MapSidebar::OnRandomGenerate(wxCommandEvent& WXUNUSED(evt)) | ||||
wxBusyInfo busy(_("Generating map")); | wxBusyInfo busy(_("Generating map")); | ||||
wxBusyCursor busyc; | wxBusyCursor busyc; | ||||
wxString scriptName = wxString::FromUTF8(settings["Script"]); | wxString scriptName = wxString::FromUTF8(settings["Script"]); | ||||
// Copy the old map settings, so we don't lose them if the map generation fails | // Copy the old map settings, so we don't lose them if the map generation fails | ||||
AtObj oldSettings = settings; | AtObj oldSettings = settings; | ||||
// Deactivate tools, so they don't carry forwards into the new CWorld | |||||
// and crash. | |||||
m_ScenarioEditor.GetToolManager().SetCurrentTool(_T("")); | |||||
// TODO: clear the undo buffer, etc | |||||
AtlasMessage::qGenerateMap qry((std::wstring)scriptName.wc_str(), json); | AtlasMessage::qGenerateMap qry((std::wstring)scriptName.wc_str(), json); | ||||
qry.Post(); | qry.Post(); | ||||
if (qry.status < 0) | if (qry.status < 0) | ||||
{ | { | ||||
// Display error message and revert to old map settings | // Display error message and revert to old map settings | ||||
wxLogError(_("Random map script '%s' failed"), scriptName.c_str()); | wxLogError(_("Random map script '%s' failed"), scriptName.c_str()); | ||||
m_MapSettingsCtrl->SetMapSettings(oldSettings); | m_MapSettingsCtrl->SetMapSettings(oldSettings); | ||||
} | } | ||||
m_ScenarioEditor.NotifyOnMapReload(); | m_ScenarioEditor.NotifyOnMapReload(); | ||||
m_ScenarioEditor.GetCommandProc().ClearCommands(); | |||||
} | } | ||||
void MapSidebar::OnOpenPlayerPanel(wxCommandEvent& WXUNUSED(evt)) | void MapSidebar::OnOpenPlayerPanel(wxCommandEvent& WXUNUSED(evt)) | ||||
{ | { | ||||
m_ScenarioEditor.SelectPage(_T("PlayerSidebar")); | m_ScenarioEditor.SelectPage(_T("PlayerSidebar")); | ||||
} | } | ||||
void MapSidebar::OnResizeMap(wxCommandEvent& WXUNUSED(evt)) | void MapSidebar::OnResizeMap(wxCommandEvent& WXUNUSED(evt)) | ||||
Show All 21 Lines |
Wildfire Games · Phabricator