From d48ae679c482c109641836ed701df2327427cf12 Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Sat, 27 Aug 2011 17:04:02 +0000 Subject: [PATCH] Add default types to modules --- ClientCommand.cpp | 6 +++--- Modules.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ClientCommand.cpp b/ClientCommand.cpp index 01eeddb2..3ac576e4 100644 --- a/ClientCommand.cpp +++ b/ClientCommand.cpp @@ -786,7 +786,7 @@ void CClient::UserCommand(CString& sLine) { } if (sType.Equals("default")) { - eType = ModInfo.DefaultType(); + eType = ModInfo.GetDefaultType(); } if (eType == CModInfo::GlobalModule && !m_pUser->IsAdmin()) { @@ -855,7 +855,7 @@ void CClient::UserCommand(CString& sLine) { } if (sType.Equals("default")) { - eType = ModInfo.DefaultType(); + eType = ModInfo.GetDefaultType(); } if (eType == CModInfo::GlobalModule && !m_pUser->IsAdmin()) { @@ -924,7 +924,7 @@ void CClient::UserCommand(CString& sLine) { } if (sType.Equals("default")) { - eType = ModInfo.DefaultType(); + eType = ModInfo.GetDefaultType(); } if (eType == CModInfo::GlobalModule && !m_pUser->IsAdmin()) { diff --git a/Modules.h b/Modules.h index 2dc2c086..9a330563 100644 --- a/Modules.h +++ b/Modules.h @@ -63,6 +63,7 @@ template CModule* TModLoad(ModHandle p, CUser* pUser, if (dCoreVersion != VERSION) \ return false; \ Info.SetDescription(DESCRIPTION); \ + Info.SetDefaultType(TYPE); \ Info.AddType(TYPE); \ Info.SetLoader(TModLoad); \ TModInfo(Info); \ @@ -199,10 +200,6 @@ public: m_seType.insert(eType); } - EModuleType DefaultType() { - return *m_seType.begin(); - } - static CString ModuleTypeToString(EModuleType eType) { switch (eType) { case GlobalModule: return "Global"; @@ -218,6 +215,7 @@ public: const CString& GetDescription() const { return m_sDescription; } const CString& GetWikiPage() const { return m_sWikiPage; } ModLoader GetLoader() const { return m_fLoader; } + EModuleType GetDefaultType() const { return m_eDefaultType; } // !Getters // Setters @@ -226,10 +224,12 @@ public: void SetDescription(const CString& s) { m_sDescription = s; } void SetWikiPage(const CString& s) { m_sWikiPage = s; } void SetLoader(ModLoader fLoader) { m_fLoader = fLoader; } + void SetDefaultType(EModuleType eType) { m_eDefaultType = eType; } // !Setters private: protected: set m_seType; + EModuleType m_eDefaultType; CString m_sName; CString m_sPath; CString m_sDescription;