diff options
-rw-r--r-- | libmultimc/include/instversionlist.h | 2 | ||||
-rw-r--r-- | libmultimc/include/minecraftversionlist.h | 2 | ||||
-rw-r--r-- | libmultimc/src/instversionlist.cpp | 2 | ||||
-rw-r--r-- | libmultimc/src/minecraftversionlist.cpp | 11 |
4 files changed, 15 insertions, 2 deletions
diff --git a/libmultimc/include/instversionlist.h b/libmultimc/include/instversionlist.h index 61b459d7..5abfb91d 100644 --- a/libmultimc/include/instversionlist.h +++ b/libmultimc/include/instversionlist.h @@ -98,7 +98,7 @@ public: * This is the version that will be selected by default. * By default, this is simply the first version in the list. */ - virtual const InstVersion *getLatestStable(); + virtual const InstVersion *getLatestStable() const; /*! * Sorts the version list. diff --git a/libmultimc/include/minecraftversionlist.h b/libmultimc/include/minecraftversionlist.h index 0a9b9a67..81d5ac2f 100644 --- a/libmultimc/include/minecraftversionlist.h +++ b/libmultimc/include/minecraftversionlist.h @@ -47,6 +47,8 @@ public: virtual void printToStdOut() const; virtual void sort(); + virtual InstVersion *getLatestStable() const; + /*! * Gets the main version list instance. */ diff --git a/libmultimc/src/instversionlist.cpp b/libmultimc/src/instversionlist.cpp index fa05efdd..74a8c898 100644 --- a/libmultimc/src/instversionlist.cpp +++ b/libmultimc/src/instversionlist.cpp @@ -31,7 +31,7 @@ const InstVersion *InstVersionList::findVersion(const QString &descriptor) return NULL; } -const InstVersion *InstVersionList::getLatestStable() +const InstVersion *InstVersionList::getLatestStable() const { if (count() <= 0) return NULL; diff --git a/libmultimc/src/minecraftversionlist.cpp b/libmultimc/src/minecraftversionlist.cpp index abbae991..bb8b0f7a 100644 --- a/libmultimc/src/minecraftversionlist.cpp +++ b/libmultimc/src/minecraftversionlist.cpp @@ -92,6 +92,17 @@ void MinecraftVersionList::sort() endResetModel(); } +InstVersion *MinecraftVersionList::getLatestStable() const +{ + for (int i = 0; i < m_vlist.length(); i++) + { + if (((MinecraftVersion *)m_vlist.at(i))->versionType() == MinecraftVersion::CurrentStable) + { + return m_vlist.at(i); + } + } +} + MinecraftVersionList &MinecraftVersionList::getMainList() { return mcVList; |