summaryrefslogtreecommitdiff
path: root/src/gui/models
diff options
context:
space:
mode:
authorFedja Beader <fedja@protonmail.ch>2024-10-11 23:14:15 +0000
committerFedja Beader <fedja@protonmail.ch>2024-10-11 23:14:15 +0000
commit38baa32f47092ef0a140a3aa94bf50f89786ec86 (patch)
treefff9e184ec2e578b44ac70e0959c6c373472c791 /src/gui/models
parent9c7c7093b94e908efff0798004c2595a8b5c0fcd (diff)
downloadplus-38baa32f47092ef0a140a3aa94bf50f89786ec86.tar.gz
plus-38baa32f47092ef0a140a3aa94bf50f89786ec86.tar.bz2
plus-38baa32f47092ef0a140a3aa94bf50f89786ec86.tar.xz
plus-38baa32f47092ef0a140a3aa94bf50f89786ec86.zip
Introduce a kludge to deduplicate server type strings.
**** mana/plus!104
Diffstat (limited to 'src/gui/models')
-rw-r--r--src/gui/models/typelistmodel.h31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/gui/models/typelistmodel.h b/src/gui/models/typelistmodel.h
index 52b9afeed..9b0b9deb8 100644
--- a/src/gui/models/typelistmodel.h
+++ b/src/gui/models/typelistmodel.h
@@ -25,6 +25,14 @@
#include "gui/models/listmodel.h"
+// Yes, I could've swapped TMWA and Evol2 in type list, but Hello=)
+// would've screamed at me.
+#ifdef TMWA_SUPPORT
+#define SERVER_TYPE_INDEX_OFFSET 0
+#else // TMWA_SUPPORT
+#define SERVER_TYPE_INDEX_OFFSET 1
+#endif // TMWA_SUPPORT
+
/**
* Server Type List Model
*/
@@ -53,22 +61,15 @@ class TypeListModel final : public ListModel
std::string getElementAt(int elementIndex)
override final A_WARN_UNUSED
{
+ switch (elementIndex)
+ {
#ifdef TMWA_SUPPORT
- if (elementIndex == 0)
- return "TMW Athena";
- else if (elementIndex == 1)
- return "Hercules";
- else if (elementIndex == 2)
- return "Evol2 Hercules";
- else
-#else // TMWA_SUPPORT
- if (elementIndex == 0)
- return "Hercules";
- else if (elementIndex == 1)
- return "Evol2 Hercules";
- else
-#endif // TMWA_SUPPORT
- return "Unknown";
+ case 0: return "TMW Athena"; break;
+#endif // defined(TMWA_SUPPORT)
+ case 1 - SERVER_TYPE_INDEX_OFFSET: return "Hercules"; break;
+ case 2 - SERVER_TYPE_INDEX_OFFSET: return "Evol2 Hercules"; break;
+ default: return "Unknown"; break;
+ }
}
};