diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2012-02-07 01:30:31 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-02-12 21:03:36 +0100 |
commit | 56490c86949135687e1ab0dd43d605c653f26c45 (patch) | |
tree | 77b0b19099ae0b8eb04646b62df5a35cd6c2be72 /src/gui | |
parent | 137ade7226af37d073a5755b90181275664dd65c (diff) | |
download | mana-56490c86949135687e1ab0dd43d605c653f26c45.tar.gz mana-56490c86949135687e1ab0dd43d605c653f26c45.tar.bz2 mana-56490c86949135687e1ab0dd43d605c653f26c45.tar.xz mana-56490c86949135687e1ab0dd43d605c653f26c45.zip |
Restored manaserv-less builds
I made sure the manaserv based custom server don't get deleted
when running a manaserv-less client session.
Reviewed-by: Thorbjørn Lindeijer
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/customserverdialog.cpp | 16 | ||||
-rw-r--r-- | src/gui/customserverdialog.h | 4 | ||||
-rw-r--r-- | src/gui/serverdialog.cpp | 14 |
3 files changed, 29 insertions, 5 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; diff --git a/src/gui/customserverdialog.h b/src/gui/customserverdialog.h index 25c320e8..37a3b823 100644 --- a/src/gui/customserverdialog.h +++ b/src/gui/customserverdialog.h @@ -86,10 +86,10 @@ class CustomServerDialog : public Window, TextField *mDescriptionField; Button *mOkButton; Button *mCancelButton; - +#ifdef ENABLE_MANASERV DropDown *mTypeField; TypeListModel *mTypeListModel; - +#endif ServerDialog *mServerDialog; // The index of the entry to modify, -1 when only adding a new entry. int mIndex; diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 91e5fdeb..66afe912 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -281,10 +281,14 @@ void ServerDialog::action(const gcn::ActionEvent &event) int index = mServersList->getSelected(); // Check login - if (index < 0) + if (index < 0 +#ifndef ENABLE_MANASERV + || mServersListModel->getServer(index).type == ServerInfo::MANASERV +#endif + ) { OkDialog *dlg = new OkDialog(_("Error"), - _("Please select a server.")); + _("Please select a valid server.")); dlg->addActionListener(this); } else @@ -470,7 +474,11 @@ void ServerDialog::loadServers() server.type = ServerInfo::parseType(type); // Ignore unknown server types - if (server.type == ServerInfo::UNKNOWN) + if (server.type == ServerInfo::UNKNOWN +#ifndef ENABLE_MANASERV + || server.type == ServerInfo::MANASERV +#endif + ) { logger->log("Ignoring server entry with unknown type: %s", type.c_str()); |