diff options
Diffstat (limited to 'tools/mapedit/src/frame.cpp')
| -rw-r--r-- | tools/mapedit/src/frame.cpp | 188 |
1 files changed, 100 insertions, 88 deletions
| diff --git a/tools/mapedit/src/frame.cpp b/tools/mapedit/src/frame.cpp index cc45c29..06102f7 100644 --- a/tools/mapedit/src/frame.cpp +++ b/tools/mapedit/src/frame.cpp | |||
| @@ -190,22 +190,22 @@ MapeditFrame::MapeditFrame(World* world) : wxFrame(NULL, wxID_ANY, "Map Editor") | |||
| 190 | wxStaticText* leftmapLabel = new wxStaticText(propertyEditor, wxID_ANY, "Leftmap Action:"); | 190 | wxStaticText* leftmapLabel = new wxStaticText(propertyEditor, wxID_ANY, "Leftmap Action:"); |
| 191 | wxChoice* leftmapChoice = new wxChoice(propertyEditor, LEFTMAP_TYPE_CHOICE); | 191 | wxChoice* leftmapChoice = new wxChoice(propertyEditor, LEFTMAP_TYPE_CHOICE); |
| 192 | wxComboCtrl* leftmapCombo = new wxComboCtrl(propertyEditor, LEFTMAP_MAP_CHOICE, "", wxDefaultPosition, wxDefaultSize, wxCB_READONLY); | 192 | wxComboCtrl* leftmapCombo = new wxComboCtrl(propertyEditor, LEFTMAP_MAP_CHOICE, "", wxDefaultPosition, wxDefaultSize, wxCB_READONLY); |
| 193 | leftmapCombo->SetPopupControl(new MapSelectComboPopup(mapTree, currentMap->getLeftMoveMapID())); | 193 | leftmapCombo->SetPopupControl(new MapSelectComboPopup(mapTree, currentMap->getAdjacent(Map::MoveDir::Left).map)); |
| 194 | 194 | ||
| 195 | wxStaticText* rightmapLabel = new wxStaticText(propertyEditor, wxID_ANY, "Rightmap Action:"); | 195 | wxStaticText* rightmapLabel = new wxStaticText(propertyEditor, wxID_ANY, "Rightmap Action:"); |
| 196 | wxChoice* rightmapChoice = new wxChoice(propertyEditor, RIGHTMAP_TYPE_CHOICE); | 196 | wxChoice* rightmapChoice = new wxChoice(propertyEditor, RIGHTMAP_TYPE_CHOICE); |
| 197 | wxComboCtrl* rightmapCombo = new wxComboCtrl(propertyEditor, RIGHTMAP_MAP_CHOICE, "", wxDefaultPosition, wxDefaultSize, wxCB_READONLY); | 197 | wxComboCtrl* rightmapCombo = new wxComboCtrl(propertyEditor, RIGHTMAP_MAP_CHOICE, "", wxDefaultPosition, wxDefaultSize, wxCB_READONLY); |
| 198 | rightmapCombo->SetPopupControl(new MapSelectComboPopup(mapTree, currentMap->getRightMoveMapID())); | 198 | rightmapCombo->SetPopupControl(new MapSelectComboPopup(mapTree, currentMap->getAdjacent(Map::MoveDir::Right).map)); |
| 199 | 199 | ||
| 200 | wxStaticText* upmapLabel = new wxStaticText(propertyEditor, wxID_ANY, "Upmap Action:"); | 200 | wxStaticText* upmapLabel = new wxStaticText(propertyEditor, wxID_ANY, "Upmap Action:"); |
| 201 | wxChoice* upmapChoice = new wxChoice(propertyEditor, UPMAP_TYPE_CHOICE); | 201 | wxChoice* upmapChoice = new wxChoice(propertyEditor, UPMAP_TYPE_CHOICE); |
| 202 | wxComboCtrl* upmapCombo = new wxComboCtrl(propertyEditor, UPMAP_MAP_CHOICE, "", wxDefaultPosition, wxDefaultSize, wxCB_READONLY); | 202 | wxComboCtrl* upmapCombo = new wxComboCtrl(propertyEditor, UPMAP_MAP_CHOICE, "", wxDefaultPosition, wxDefaultSize, wxCB_READONLY); |
| 203 | upmapCombo->SetPopupControl(new MapSelectComboPopup(mapTree, currentMap->getUpMoveMapID())); | 203 | upmapCombo->SetPopupControl(new MapSelectComboPopup(mapTree, currentMap->getAdjacent(Map::MoveDir::Up).map)); |
| 204 | 204 | ||
| 205 | wxStaticText* downmapLabel = new wxStaticText(propertyEditor, wxID_ANY, "Downmap Action:"); | 205 | wxStaticText* downmapLabel = new wxStaticText(propertyEditor, wxID_ANY, "Downmap Action:"); |
| 206 | wxChoice* downmapChoice = new wxChoice(propertyEditor, DOWNMAP_TYPE_CHOICE); | 206 | wxChoice* downmapChoice = new wxChoice(propertyEditor, DOWNMAP_TYPE_CHOICE); |
| 207 | wxComboCtrl* downmapCombo = new wxComboCtrl(propertyEditor, DOWNMAP_MAP_CHOICE, "", wxDefaultPosition, wxDefaultSize, wxCB_READONLY); | 207 | wxComboCtrl* downmapCombo = new wxComboCtrl(propertyEditor, DOWNMAP_MAP_CHOICE, "", wxDefaultPosition, wxDefaultSize, wxCB_READONLY); |
| 208 | downmapCombo->SetPopupControl(new MapSelectComboPopup(mapTree, currentMap->getDownMoveMapID())); | 208 | downmapCombo->SetPopupControl(new MapSelectComboPopup(mapTree, currentMap->getAdjacent(Map::MoveDir::Down).map)); |
| 209 | 209 | ||
| 210 | for (auto type : Map::listMoveTypes()) | 210 | for (auto type : Map::listMoveTypes()) |
| 211 | { | 211 | { |
| @@ -674,157 +674,169 @@ void MapeditFrame::OnThreeMovingSash(wxSplitterEvent& event) | |||
| 674 | 674 | ||
| 675 | void MapeditFrame::OnSetLeftmapType(wxCommandEvent&) | 675 | void MapeditFrame::OnSetLeftmapType(wxCommandEvent&) |
| 676 | { | 676 | { |
| 677 | wxChoice* leftmapChoice = (wxChoice*) wxWindow::FindWindowById(LEFTMAP_TYPE_CHOICE, this); | 677 | wxChoice* choice = (wxChoice*) wxWindow::FindWindowById(LEFTMAP_TYPE_CHOICE, this); |
| 678 | wxComboCtrl* leftmapCombo = (wxComboCtrl*) wxWindow::FindWindowById(LEFTMAP_MAP_CHOICE, this); | 678 | wxComboCtrl* combo = (wxComboCtrl*) wxChoice::FindWindowById(LEFTMAP_MAP_CHOICE, this); |
| 679 | 679 | Map::MoveDir dir = Map::MoveDir::Left; | |
| 680 | Map::MoveType old = currentMap->getLeftMoveType(); | ||
| 681 | Map::MoveType newt = ((MoveTypeCtr*) leftmapChoice->GetClientData(leftmapChoice->GetSelection()))->type; | ||
| 682 | 680 | ||
| 681 | Map::Adjacent adjacent = currentMap->getAdjacent(dir); | ||
| 682 | Map::MoveType newt = ((MoveTypeCtr*) choice->GetClientData(choice->GetSelection()))->type; | ||
| 683 | commitAction(std::make_shared<Undoable>("Set Leftmap Action", [=] () { | 683 | commitAction(std::make_shared<Undoable>("Set Leftmap Action", [=] () { |
| 684 | leftmapChoice->SetSelection(leftmapChoice->FindString(Map::stringForMoveType(newt))); | 684 | choice->SetSelection(choice->FindString(Map::stringForMoveType(newt))); |
| 685 | currentMap->setLeftMoveType(newt); | 685 | currentMap->setAdjacent(dir, newt); |
| 686 | leftmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getLeftMoveType())); | 686 | combo->Enable(Map::moveTypeTakesMap(newt)); |
| 687 | }, [=] () { | 687 | }, [=] () { |
| 688 | leftmapChoice->SetSelection(leftmapChoice->FindString(Map::stringForMoveType(old))); | 688 | choice->SetSelection(choice->FindString(Map::stringForMoveType(adjacent.type))); |
| 689 | currentMap->setLeftMoveType(old); | 689 | currentMap->setAdjacent(dir, adjacent.type); |
| 690 | leftmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getLeftMoveType())); | 690 | combo->Enable(Map::moveTypeTakesMap(adjacent.type)); |
| 691 | })); | 691 | })); |
| 692 | } | 692 | } |
| 693 | 693 | ||
| 694 | void MapeditFrame::OnSetLeftmapMap(wxCommandEvent&) | 694 | void MapeditFrame::OnSetLeftmapMap(wxCommandEvent&) |
| 695 | { | 695 | { |
| 696 | wxComboCtrl* leftmapCombo = (wxComboCtrl*) wxWindow::FindWindowById(LEFTMAP_MAP_CHOICE, this); | 696 | wxComboCtrl* combo = (wxComboCtrl*) wxWindow::FindWindowById(LEFTMAP_MAP_CHOICE, this); |
| 697 | MapSelectComboPopup* popup = (MapSelectComboPopup*) leftmapCombo->GetPopupControl(); | 697 | Map::MoveDir dir = Map::MoveDir::Left; |
| 698 | int old = currentMap->getLeftMoveMapID(); | 698 | |
| 699 | Map::Adjacent adjacent = currentMap->getAdjacent(dir); | ||
| 700 | MapSelectComboPopup* popup = (MapSelectComboPopup*) combo->GetPopupControl(); | ||
| 701 | int old = adjacent.map; | ||
| 699 | int newt = popup->GetSelectedMapID(); | 702 | int newt = popup->GetSelectedMapID(); |
| 700 | 703 | ||
| 701 | if (old == newt) return; | 704 | if (old == newt) return; |
| 702 | 705 | ||
| 703 | commitAction(std::make_shared<Undoable>("Set Leftmap Map", [=] () { | 706 | commitAction(std::make_shared<Undoable>("Set Leftmap Map", [=] () { |
| 704 | popup->SetSelectedMapID(newt); | 707 | popup->SetSelectedMapID(newt); |
| 705 | leftmapCombo->SetValue(world->getMap(newt)->getTitle()); | 708 | combo->SetValue(world->getMap(newt)->getTitle()); |
| 706 | currentMap->setLeftMoveMapID(newt); | 709 | currentMap->setAdjacent(dir, adjacent.type, newt); |
| 707 | }, [=] () { | 710 | }, [=] () { |
| 708 | popup->SetSelectedMapID(old); | 711 | popup->SetSelectedMapID(old); |
| 709 | leftmapCombo->SetValue(world->getMap(old)->getTitle()); | 712 | combo->SetValue(world->getMap(old)->getTitle()); |
| 710 | currentMap->setLeftMoveMapID(old); | 713 | currentMap->setAdjacent(dir, adjacent.type, old); |
| 711 | })); | 714 | })); |
| 712 | } | 715 | } |
| 713 | 716 | ||
| 714 | void MapeditFrame::OnSetRightmapType(wxCommandEvent&) | 717 | void MapeditFrame::OnSetRightmapType(wxCommandEvent&) |
| 715 | { | 718 | { |
| 716 | wxChoice* rightmapChoice = (wxChoice*) wxWindow::FindWindowById(RIGHTMAP_TYPE_CHOICE, this); | 719 | wxChoice* choice = (wxChoice*) wxWindow::FindWindowById(RIGHTMAP_TYPE_CHOICE, this); |
| 717 | wxComboCtrl* rightmapCombo = (wxComboCtrl*) wxWindow::FindWindowById(RIGHTMAP_MAP_CHOICE, this); | 720 | wxComboCtrl* combo = (wxComboCtrl*) wxChoice::FindWindowById(RIGHTMAP_MAP_CHOICE, this); |
| 718 | 721 | Map::MoveDir dir = Map::MoveDir::Right; | |
| 719 | Map::MoveType old = currentMap->getRightMoveType(); | ||
| 720 | Map::MoveType newt = ((MoveTypeCtr*) rightmapChoice->GetClientData(rightmapChoice->GetSelection()))->type; | ||
| 721 | 722 | ||
| 723 | Map::Adjacent adjacent = currentMap->getAdjacent(dir); | ||
| 724 | Map::MoveType newt = ((MoveTypeCtr*) choice->GetClientData(choice->GetSelection()))->type; | ||
| 722 | commitAction(std::make_shared<Undoable>("Set Rightmap Action", [=] () { | 725 | commitAction(std::make_shared<Undoable>("Set Rightmap Action", [=] () { |
| 723 | rightmapChoice->SetSelection(rightmapChoice->FindString(Map::stringForMoveType(newt))); | 726 | choice->SetSelection(choice->FindString(Map::stringForMoveType(newt))); |
| 724 | currentMap->setRightMoveType(newt); | 727 | currentMap->setAdjacent(dir, newt); |
| 725 | rightmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getRightMoveType())); | 728 | combo->Enable(Map::moveTypeTakesMap(newt)); |
| 726 | }, [=] () { | 729 | }, [=] () { |
| 727 | rightmapChoice->SetSelection(rightmapChoice->FindString(Map::stringForMoveType(old))); | 730 | choice->SetSelection(choice->FindString(Map::stringForMoveType(adjacent.type))); |
| 728 | currentMap->setRightMoveType(old); | 731 | currentMap->setAdjacent(dir, adjacent.type); |
| 729 | rightmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getRightMoveType())); | 732 | combo->Enable(Map::moveTypeTakesMap(adjacent.type)); |
| 730 | })); | 733 | })); |
| 731 | } | 734 | } |
| 732 | 735 | ||
| 733 | void MapeditFrame::OnSetRightmapMap(wxCommandEvent&) | 736 | void MapeditFrame::OnSetRightmapMap(wxCommandEvent&) |
| 734 | { | 737 | { |
| 735 | wxComboCtrl* rightmapCombo = (wxComboCtrl*) wxWindow::FindWindowById(RIGHTMAP_MAP_CHOICE, this); | 738 | wxComboCtrl* combo = (wxComboCtrl*) wxWindow::FindWindowById(RIGHTMAP_MAP_CHOICE, this); |
| 736 | MapSelectComboPopup* popup = (MapSelectComboPopup*) rightmapCombo->GetPopupControl(); | 739 | Map::MoveDir dir = Map::MoveDir::Right; |
| 737 | int old = currentMap->getRightMoveMapID(); | 740 | |
| 741 | Map::Adjacent adjacent = currentMap->getAdjacent(dir); | ||
| 742 | MapSelectComboPopup* popup = (MapSelectComboPopup*) combo->GetPopupControl(); | ||
| 743 | int old = adjacent.map; | ||
| 738 | int newt = popup->GetSelectedMapID(); | 744 | int newt = popup->GetSelectedMapID(); |
| 739 | 745 | ||
| 740 | if (old == newt) return; | 746 | if (old == newt) return; |
| 741 | 747 | ||
| 742 | commitAction(std::make_shared<Undoable>("Set Rightmap Map", [=] () { | 748 | commitAction(std::make_shared<Undoable>("Set Rightmap Map", [=] () { |
| 743 | popup->SetSelectedMapID(newt); | 749 | popup->SetSelectedMapID(newt); |
| 744 | rightmapCombo->SetValue(world->getMap(newt)->getTitle()); | 750 | combo->SetValue(world->getMap(newt)->getTitle()); |
| 745 | currentMap->setRightMoveMapID(newt); | 751 | currentMap->setAdjacent(dir, adjacent.type, newt); |
| 746 | }, [=] () { | 752 | }, [=] () { |
| 747 | popup->SetSelectedMapID(old); | 753 | popup->SetSelectedMapID(old); |
| 748 | rightmapCombo->SetValue(world->getMap(old)->getTitle()); | 754 | combo->SetValue(world->getMap(old)->getTitle()); |
| 749 | currentMap->setRightMoveMapID(old); | 755 | currentMap->setAdjacent(dir, adjacent.type, old); |
| 750 | })); | 756 | })); |
| 751 | } | 757 | } |
| 752 | 758 | ||
| 753 | void MapeditFrame::OnSetUpmapType(wxCommandEvent&) | 759 | void MapeditFrame::OnSetUpmapType(wxCommandEvent&) |
| 754 | { | 760 | { |
| 755 | wxChoice* upmapChoice = (wxChoice*) wxWindow::FindWindowById(UPMAP_TYPE_CHOICE, this); | 761 | wxChoice* choice = (wxChoice*) wxWindow::FindWindowById(UPMAP_TYPE_CHOICE, this); |
| 756 | wxComboCtrl* upmapCombo = (wxComboCtrl*) wxWindow::FindWindowById(UPMAP_MAP_CHOICE, this); | 762 | wxComboCtrl* combo = (wxComboCtrl*) wxChoice::FindWindowById(UPMAP_MAP_CHOICE, this); |
| 757 | 763 | Map::MoveDir dir = Map::MoveDir::Up; | |
| 758 | Map::MoveType old = currentMap->getUpMoveType(); | ||
| 759 | Map::MoveType newt = ((MoveTypeCtr*) upmapChoice->GetClientData(upmapChoice->GetSelection()))->type; | ||
| 760 | 764 | ||
| 765 | Map::Adjacent adjacent = currentMap->getAdjacent(dir); | ||
| 766 | Map::MoveType newt = ((MoveTypeCtr*) choice->GetClientData(choice->GetSelection()))->type; | ||
| 761 | commitAction(std::make_shared<Undoable>("Set Upmap Action", [=] () { | 767 | commitAction(std::make_shared<Undoable>("Set Upmap Action", [=] () { |
| 762 | upmapChoice->SetSelection(upmapChoice->FindString(Map::stringForMoveType(newt))); | 768 | choice->SetSelection(choice->FindString(Map::stringForMoveType(newt))); |
| 763 | currentMap->setUpMoveType(newt); | 769 | currentMap->setAdjacent(dir, newt); |
| 764 | upmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getUpMoveType())); | 770 | combo->Enable(Map::moveTypeTakesMap(newt)); |
| 765 | }, [=] () { | 771 | }, [=] () { |
| 766 | upmapChoice->SetSelection(upmapChoice->FindString(Map::stringForMoveType(old))); | 772 | choice->SetSelection(choice->FindString(Map::stringForMoveType(adjacent.type))); |
| 767 | currentMap->setUpMoveType(old); | 773 | currentMap->setAdjacent(dir, adjacent.type); |
| 768 | upmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getUpMoveType())); | 774 | combo->Enable(Map::moveTypeTakesMap(adjacent.type)); |
| 769 | })); | 775 | })); |
| 770 | } | 776 | } |
| 771 | 777 | ||
| 772 | void MapeditFrame::OnSetUpmapMap(wxCommandEvent&) | 778 | void MapeditFrame::OnSetUpmapMap(wxCommandEvent&) |
| 773 | { | 779 | { |
| 774 | wxComboCtrl* upmapCombo = (wxComboCtrl*) wxWindow::FindWindowById(UPMAP_MAP_CHOICE, this); | 780 | wxComboCtrl* combo = (wxComboCtrl*) wxWindow::FindWindowById(UPMAP_MAP_CHOICE, this); |
| 775 | MapSelectComboPopup* popup = (MapSelectComboPopup*) upmapCombo->GetPopupControl(); | 781 | Map::MoveDir dir = Map::MoveDir::Up; |
| 776 | int old = currentMap->getUpMoveMapID(); | 782 | |
| 783 | Map::Adjacent adjacent = currentMap->getAdjacent(dir); | ||
| 784 | MapSelectComboPopup* popup = (MapSelectComboPopup*) combo->GetPopupControl(); | ||
| 785 | int old = adjacent.map; | ||
| 777 | int newt = popup->GetSelectedMapID(); | 786 | int newt = popup->GetSelectedMapID(); |
| 778 | 787 | ||
| 779 | if (old == newt) return; | 788 | if (old == newt) return; |
| 780 | 789 | ||
| 781 | commitAction(std::make_shared<Undoable>("Set Upmap Map", [=] () { | 790 | commitAction(std::make_shared<Undoable>("Set Upmap Map", [=] () { |
| 782 | popup->SetSelectedMapID(newt); | 791 | popup->SetSelectedMapID(newt); |
| 783 | upmapCombo->SetValue(world->getMap(newt)->getTitle()); | 792 | combo->SetValue(world->getMap(newt)->getTitle()); |
| 784 | currentMap->setUpMoveMapID(newt); | 793 | currentMap->setAdjacent(dir, adjacent.type, newt); |
| 785 | }, [=] () { | 794 | }, [=] () { |
| 786 | popup->SetSelectedMapID(old); | 795 | popup->SetSelectedMapID(old); |
| 787 | upmapCombo->SetValue(world->getMap(old)->getTitle()); | 796 | combo->SetValue(world->getMap(old)->getTitle()); |
| 788 | currentMap->setUpMoveMapID(old); | 797 | currentMap->setAdjacent(dir, adjacent.type, old); |
| 789 | })); | 798 | })); |
| 790 | } | 799 | } |
| 791 | 800 | ||
| 792 | void MapeditFrame::OnSetDownmapType(wxCommandEvent&) | 801 | void MapeditFrame::OnSetDownmapType(wxCommandEvent&) |
| 793 | { | 802 | { |
| 794 | wxChoice* downmapChoice = (wxChoice*) wxWindow::FindWindowById(DOWNMAP_TYPE_CHOICE, this); | 803 | wxChoice* choice = (wxChoice*) wxWindow::FindWindowById(DOWNMAP_TYPE_CHOICE, this); |
| 795 | wxComboCtrl* downmapCombo = (wxComboCtrl*) wxWindow::FindWindowById(DOWNMAP_MAP_CHOICE, this); | 804 | wxComboCtrl* combo = (wxComboCtrl*) wxChoice::FindWindowById(DOWNMAP_MAP_CHOICE, this); |
| 796 | 805 | Map::MoveDir dir = Map::MoveDir::Down; | |
| 797 | Map::MoveType old = currentMap->getDownMoveType(); | ||
| 798 | Map::MoveType newt = ((MoveTypeCtr*) downmapChoice->GetClientData(downmapChoice->GetSelection()))->type; | ||
| 799 | 806 | ||
| 807 | Map::Adjacent adjacent = currentMap->getAdjacent(dir); | ||
| 808 | Map::MoveType newt = ((MoveTypeCtr*) choice->GetClientData(choice->GetSelection()))->type; | ||
| 800 | commitAction(std::make_shared<Undoable>("Set Downmap Action", [=] () { | 809 | commitAction(std::make_shared<Undoable>("Set Downmap Action", [=] () { |
| 801 | downmapChoice->SetSelection(downmapChoice->FindString(Map::stringForMoveType(newt))); | 810 | choice->SetSelection(choice->FindString(Map::stringForMoveType(newt))); |
| 802 | currentMap->setDownMoveType(newt); | 811 | currentMap->setAdjacent(dir, newt); |
| 803 | downmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getDownMoveType())); | 812 | combo->Enable(Map::moveTypeTakesMap(newt)); |
| 804 | }, [=] () { | 813 | }, [=] () { |
| 805 | downmapChoice->SetSelection(downmapChoice->FindString(Map::stringForMoveType(old))); | 814 | choice->SetSelection(choice->FindString(Map::stringForMoveType(adjacent.type))); |
| 806 | currentMap->setDownMoveType(old); | 815 | currentMap->setAdjacent(dir, adjacent.type); |
| 807 | downmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getDownMoveType())); | 816 | combo->Enable(Map::moveTypeTakesMap(adjacent.type)); |
| 808 | })); | 817 | })); |
| 809 | } | 818 | } |
| 810 | 819 | ||
| 811 | void MapeditFrame::OnSetDownmapMap(wxCommandEvent&) | 820 | void MapeditFrame::OnSetDownmapMap(wxCommandEvent&) |
| 812 | { | 821 | { |
| 813 | wxComboCtrl* downmapCombo = (wxComboCtrl*) wxWindow::FindWindowById(DOWNMAP_MAP_CHOICE, this); | 822 | wxComboCtrl* combo = (wxComboCtrl*) wxWindow::FindWindowById(DOWNMAP_MAP_CHOICE, this); |
| 814 | MapSelectComboPopup* popup = (MapSelectComboPopup*) downmapCombo->GetPopupControl(); | 823 | Map::MoveDir dir = Map::MoveDir::Down; |
| 815 | int old = currentMap->getDownMoveMapID(); | 824 | |
| 825 | Map::Adjacent adjacent = currentMap->getAdjacent(dir); | ||
| 826 | MapSelectComboPopup* popup = (MapSelectComboPopup*) combo->GetPopupControl(); | ||
| 827 | int old = adjacent.map; | ||
| 816 | int newt = popup->GetSelectedMapID(); | 828 | int newt = popup->GetSelectedMapID(); |
| 817 | 829 | ||
| 818 | if (old == newt) return; | 830 | if (old == newt) return; |
| 819 | 831 | ||
| 820 | commitAction(std::make_shared<Undoable>("Set Downmap Map", [=] () { | 832 | commitAction(std::make_shared<Undoable>("Set Downmap Map", [=] () { |
| 821 | popup->SetSelectedMapID(newt); | 833 | popup->SetSelectedMapID(newt); |
| 822 | downmapCombo->SetValue(world->getMap(newt)->getTitle()); | 834 | combo->SetValue(world->getMap(newt)->getTitle()); |
| 823 | currentMap->setDownMoveMapID(newt); | 835 | currentMap->setAdjacent(dir, adjacent.type, newt); |
| 824 | }, [=] () { | 836 | }, [=] () { |
| 825 | popup->SetSelectedMapID(old); | 837 | popup->SetSelectedMapID(old); |
| 826 | downmapCombo->SetValue(world->getMap(old)->getTitle()); | 838 | combo->SetValue(world->getMap(old)->getTitle()); |
| 827 | currentMap->setDownMoveMapID(old); | 839 | currentMap->setAdjacent(dir, adjacent.type, old); |
| 828 | })); | 840 | })); |
| 829 | } | 841 | } |
| 830 | 842 | ||
| @@ -924,20 +936,20 @@ void MapeditFrame::SelectMap(Map* map) | |||
| 924 | wxComboCtrl* upmapCombo = (wxComboCtrl*) wxWindow::FindWindowById(UPMAP_MAP_CHOICE, this); | 936 | wxComboCtrl* upmapCombo = (wxComboCtrl*) wxWindow::FindWindowById(UPMAP_MAP_CHOICE, this); |
| 925 | wxComboCtrl* downmapCombo = (wxComboCtrl*) wxWindow::FindWindowById(DOWNMAP_MAP_CHOICE, this); | 937 | wxComboCtrl* downmapCombo = (wxComboCtrl*) wxWindow::FindWindowById(DOWNMAP_MAP_CHOICE, this); |
| 926 | 938 | ||
| 927 | leftmapChoice->SetSelection(leftmapChoice->FindString(Map::stringForMoveType(currentMap->getLeftMoveType()))); | 939 | leftmapChoice->SetSelection(leftmapChoice->FindString(Map::stringForMoveType(currentMap->getAdjacent(Map::MoveDir::Left).type))); |
| 928 | rightmapChoice->SetSelection(rightmapChoice->FindString(Map::stringForMoveType(currentMap->getRightMoveType()))); | 940 | rightmapChoice->SetSelection(rightmapChoice->FindString(Map::stringForMoveType(currentMap->getAdjacent(Map::MoveDir::Right).type))); |
| 929 | upmapChoice->SetSelection(upmapChoice->FindString(Map::stringForMoveType(currentMap->getUpMoveType()))); | 941 | upmapChoice->SetSelection(upmapChoice->FindString(Map::stringForMoveType(currentMap->getAdjacent(Map::MoveDir::Up).type))); |
| 930 | downmapChoice->SetSelection(downmapChoice->FindString(Map::stringForMoveType(currentMap->getDownMoveType()))); | 942 | downmapChoice->SetSelection(downmapChoice->FindString(Map::stringForMoveType(currentMap->getAdjacent(Map::MoveDir::Down).type))); |
| 931 | 943 | ||
| 932 | leftmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getLeftMoveType())); | 944 | leftmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getAdjacent(Map::MoveDir::Left).type)); |
| 933 | rightmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getRightMoveType())); | 945 | rightmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getAdjacent(Map::MoveDir::Right).type)); |
| 934 | upmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getUpMoveType())); | 946 | upmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getAdjacent(Map::MoveDir::Up).type)); |
| 935 | downmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getDownMoveType())); | 947 | downmapCombo->Enable(Map::moveTypeTakesMap(currentMap->getAdjacent(Map::MoveDir::Down).type)); |
| 936 | 948 | ||
| 937 | leftmapCombo->SetValue(world->getMap(currentMap->getLeftMoveMapID())->getTitle()); | 949 | leftmapCombo->SetValue(world->getMap(currentMap->getAdjacent(Map::MoveDir::Left).map)->getTitle()); |
| 938 | rightmapCombo->SetValue(world->getMap(currentMap->getRightMoveMapID())->getTitle()); | 950 | rightmapCombo->SetValue(world->getMap(currentMap->getAdjacent(Map::MoveDir::Right).map)->getTitle()); |
| 939 | upmapCombo->SetValue(world->getMap(currentMap->getUpMoveMapID())->getTitle()); | 951 | upmapCombo->SetValue(world->getMap(currentMap->getAdjacent(Map::MoveDir::Up).map)->getTitle()); |
| 940 | downmapCombo->SetValue(world->getMap(currentMap->getDownMoveMapID())->getTitle()); | 952 | downmapCombo->SetValue(world->getMap(currentMap->getAdjacent(Map::MoveDir::Down).map)->getTitle()); |
| 941 | } | 953 | } |
| 942 | 954 | ||
| 943 | wxTreeItemId MapeditFrame::MoveTreeNode(wxTreeItemId toCopy, wxTreeItemId newParent) | 955 | wxTreeItemId MapeditFrame::MoveTreeNode(wxTreeItemId toCopy, wxTreeItemId newParent) |
