diff options
Diffstat (limited to 'src/gui/customserverdialog.cpp')
-rw-r--r-- | src/gui/customserverdialog.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/customserverdialog.cpp b/src/gui/customserverdialog.cpp index 26368c80..d23b9459 100644 --- a/src/gui/customserverdialog.cpp +++ b/src/gui/customserverdialog.cpp @@ -38,8 +38,10 @@ std::string TypeListModel::getElementAt(int elementIndex) { if (elementIndex == 0) return "TmwAthena"; +#ifdef ENABLE_MANASERV else if (elementIndex == 1) return "ManaServ"; +#endif else return "Unknown"; } @@ -54,14 +56,18 @@ CustomServerDialog::CustomServerDialog(ServerDialog *parent, int index): Label *nameLabel = new Label(_("Name:")); Label *serverAdressLabel = new Label(_("Address:")); Label *portLabel = new Label(_("Port:")); +#ifdef ENABLE_MANASERV Label *typeLabel = new Label(_("Server type:")); +#endif Label *descriptionLabel = new Label(_("Description:")); mServerAddressField = new TextField(std::string()); mPortField = new TextField(std::string()); +#ifdef ENABLE_MANASERV mTypeListModel = new TypeListModel(); mTypeField = new DropDown(mTypeListModel); mTypeField->setSelected(0); // TmwAthena by default for now. +#endif mNameField = new TextField(std::string()); mDescriptionField = new TextField(std::string()); @@ -78,8 +84,10 @@ CustomServerDialog::CustomServerDialog(ServerDialog *parent, int index): place(1, 1, mServerAddressField, 4).setPadding(3); place(0, 2, portLabel); place(1, 2, mPortField, 4).setPadding(3); +#ifdef ENABLE_MANASERV place(0, 3, typeLabel); place(1, 3, mTypeField).setPadding(3); +#endif place(0, 4, descriptionLabel); place(1, 4, mDescriptionField, 4).setPadding(3); place(4, 5, mOkButton); @@ -119,8 +127,10 @@ CustomServerDialog::CustomServerDialog(ServerDialog *parent, int index): mDescriptionField->setText(serverInfo.description); mServerAddressField->setText(serverInfo.hostname); mPortField->setText(toString(serverInfo.port)); +#ifdef ENABLE_MANASERV mTypeField->setSelected(serverInfo.type == ServerInfo::TMWATHENA ? 0 : 1); +#endif } setLocationRelativeTo(getParentWindow()); @@ -131,7 +141,9 @@ CustomServerDialog::CustomServerDialog(ServerDialog *parent, int index): CustomServerDialog::~CustomServerDialog() { +#ifdef ENABLE_MANASERV delete mTypeListModel; +#endif } void CustomServerDialog::logic() @@ -167,6 +179,7 @@ void CustomServerDialog::action(const gcn::ActionEvent &event) serverInfo.description = mDescriptionField->getText(); serverInfo.hostname = mServerAddressField->getText(); serverInfo.port = (short) atoi(mPortField->getText().c_str()); +#ifdef ENABLE_MANASERV switch (mTypeField->getSelected()) { case 0: @@ -178,6 +191,9 @@ void CustomServerDialog::action(const gcn::ActionEvent &event) default: serverInfo.type = ServerInfo::UNKNOWN; } +#else + serverInfo.type = ServerInfo::TMWATHENA; +#endif // Tell the server has to be saved serverInfo.save = true; |