Differential D4191 Diff 18493 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
Show All 33 Lines | #define CREATE_CHECKBOX(window, parentSizer, name, description, ID) \ | ||||
parentSizer->Add(new wxStaticText(window, wxID_ANY, _(name)), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT)); \ | parentSizer->Add(new wxStaticText(window, wxID_ANY, _(name)), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT)); \ | ||||
parentSizer->Add(Tooltipped(new wxCheckBox(window, ID, wxEmptyString), _(description))); | parentSizer->Add(Tooltipped(new wxCheckBox(window, ID, wxEmptyString), _(description))); | ||||
enum | enum | ||||
{ | { | ||||
ID_MapName, | ID_MapName, | ||||
ID_MapDescription, | ID_MapDescription, | ||||
ID_MapReveal, | ID_MapReveal, | ||||
ID_MapAlly, | |||||
ID_MapType, | ID_MapType, | ||||
ID_MapPreview, | ID_MapPreview, | ||||
ID_MapTeams, | ID_MapTeams, | ||||
ID_MapKW_Demo, | ID_MapKW_Demo, | ||||
ID_MapKW_Naval, | ID_MapKW_Naval, | ||||
ID_MapKW_New, | ID_MapKW_New, | ||||
ID_MapKW_Trigger, | ID_MapKW_Trigger, | ||||
ID_RandomScript, | ID_RandomScript, | ||||
▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | void MapSettingsControl::CreateWidgets() | ||||
wxFlexGridSizer* gridSizer = new wxFlexGridSizer(2, 5, 5); | wxFlexGridSizer* gridSizer = new wxFlexGridSizer(2, 5, 5); | ||||
gridSizer->AddGrowableCol(1); | gridSizer->AddGrowableCol(1); | ||||
// TODO: have preview selector tool? | // TODO: have preview selector tool? | ||||
gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Preview")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT)); | gridSizer->Add(new wxStaticText(this, wxID_ANY, _("Preview")), wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT)); | ||||
gridSizer->Add(Tooltipped(new wxTextCtrl(this, ID_MapPreview, wxEmptyString), | gridSizer->Add(Tooltipped(new wxTextCtrl(this, ID_MapPreview, wxEmptyString), | ||||
_("Texture used for map preview")), wxSizerFlags().Expand()); | _("Texture used for map preview")), wxSizerFlags().Expand()); | ||||
CREATE_CHECKBOX(this, gridSizer, "Reveal map", "If checked, players won't need to explore", ID_MapReveal); | CREATE_CHECKBOX(this, gridSizer, "Reveal map", "If checked, players won't need to explore", ID_MapReveal); | ||||
CREATE_CHECKBOX(this, gridSizer, "Ally view", "If checked, players will be able to see what their teammates see and won't need to research cartography", ID_MapAlly); | |||||
CREATE_CHECKBOX(this, gridSizer, "Lock teams", "If checked, teams will be locked", ID_MapTeams); | CREATE_CHECKBOX(this, gridSizer, "Lock teams", "If checked, teams will be locked", ID_MapTeams); | ||||
sizer->Add(gridSizer, wxSizerFlags().Expand()); | sizer->Add(gridSizer, wxSizerFlags().Expand()); | ||||
sizer->AddSpacer(5); | sizer->AddSpacer(5); | ||||
wxStaticBoxSizer* victoryConditionSizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Victory Conditions")); | wxStaticBoxSizer* victoryConditionSizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Victory Conditions")); | ||||
wxFlexGridSizer* vcGridSizer = new wxFlexGridSizer(2, 0, 5); | wxFlexGridSizer* vcGridSizer = new wxFlexGridSizer(2, 0, 5); | ||||
vcGridSizer->AddGrowableCol(1); | vcGridSizer->AddGrowableCol(1); | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | void MapSettingsControl::ReadFromEngine() | ||||
wxDynamicCast(FindWindow(ID_MapDescription), wxTextCtrl)->ChangeValue(wxString::FromUTF8(m_MapSettings["Description"])); | wxDynamicCast(FindWindow(ID_MapDescription), wxTextCtrl)->ChangeValue(wxString::FromUTF8(m_MapSettings["Description"])); | ||||
// map preview | // map preview | ||||
wxDynamicCast(FindWindow(ID_MapPreview), wxTextCtrl)->ChangeValue(wxString::FromUTF8(m_MapSettings["Preview"])); | wxDynamicCast(FindWindow(ID_MapPreview), wxTextCtrl)->ChangeValue(wxString::FromUTF8(m_MapSettings["Preview"])); | ||||
// reveal map | // reveal map | ||||
wxDynamicCast(FindWindow(ID_MapReveal), wxCheckBox)->SetValue(wxString::FromUTF8(m_MapSettings["RevealMap"]) == "true"); | wxDynamicCast(FindWindow(ID_MapReveal), wxCheckBox)->SetValue(wxString::FromUTF8(m_MapSettings["RevealMap"]) == "true"); | ||||
// ally view | |||||
wxDynamicCast(FindWindow(ID_MapAlly), wxCheckBox)->SetValue(wxString::FromUTF8(m_MapSettings["AllyView"]) == "true"); | |||||
// victory conditions | // victory conditions | ||||
m_MapSettingsVictoryConditions.clear(); | m_MapSettingsVictoryConditions.clear(); | ||||
for (AtIter victoryCondition = m_MapSettings["VictoryConditions"]["item"]; victoryCondition.defined(); ++victoryCondition) | for (AtIter victoryCondition = m_MapSettings["VictoryConditions"]["item"]; victoryCondition.defined(); ++victoryCondition) | ||||
m_MapSettingsVictoryConditions.insert(std::string(victoryCondition)); | m_MapSettingsVictoryConditions.insert(std::string(victoryCondition)); | ||||
// Clear Checkboxes before loading data. We don't update victory condition just yet because it might reenable some of the checkboxes. | // Clear Checkboxes before loading data. We don't update victory condition just yet because it might reenable some of the checkboxes. | ||||
for (const std::pair<const long, AtObj>& vc : m_VictoryConditions) | for (const std::pair<const long, AtObj>& vc : m_VictoryConditions) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | AtObj MapSettingsControl::UpdateSettingsObject() | ||||
m_MapSettings.set("Description", wxDynamicCast(FindWindow(ID_MapDescription), wxTextCtrl)->GetValue().utf8_str()); | m_MapSettings.set("Description", wxDynamicCast(FindWindow(ID_MapDescription), wxTextCtrl)->GetValue().utf8_str()); | ||||
// map preview | // map preview | ||||
m_MapSettings.set("Preview", wxDynamicCast(FindWindow(ID_MapPreview), wxTextCtrl)->GetValue().utf8_str()); | m_MapSettings.set("Preview", wxDynamicCast(FindWindow(ID_MapPreview), wxTextCtrl)->GetValue().utf8_str()); | ||||
// reveal map | // reveal map | ||||
m_MapSettings.setBool("RevealMap", wxDynamicCast(FindWindow(ID_MapReveal), wxCheckBox)->GetValue()); | m_MapSettings.setBool("RevealMap", wxDynamicCast(FindWindow(ID_MapReveal), wxCheckBox)->GetValue()); | ||||
// ally view | |||||
m_MapSettings.setBool("AllyView", wxDynamicCast(FindWindow(ID_MapAlly), wxCheckBox)->GetValue()); | |||||
// victory conditions | // victory conditions | ||||
#define INSERT_VICTORY_CONDITION_CHECKBOX(name, ID) \ | #define INSERT_VICTORY_CONDITION_CHECKBOX(name, ID) \ | ||||
if (wxDynamicCast(FindWindow(ID), wxCheckBox)->GetValue()) \ | if (wxDynamicCast(FindWindow(ID), wxCheckBox)->GetValue()) \ | ||||
m_MapSettingsVictoryConditions.insert(name); \ | m_MapSettingsVictoryConditions.insert(name); \ | ||||
else \ | else \ | ||||
m_MapSettingsVictoryConditions.erase(name); | m_MapSettingsVictoryConditions.erase(name); | ||||
for (const std::pair<const long, AtObj>& vc : m_VictoryConditions) | for (const std::pair<const long, AtObj>& vc : m_VictoryConditions) | ||||
▲ Show 20 Lines • Show All 373 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator