Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add default types to modules

  • Loading branch information...
commit d48ae679c482c109641836ed701df2327427cf12 1 parent 98777a2
@kylef kylef authored
Showing with 7 additions and 7 deletions.
  1. +3 −3 ClientCommand.cpp
  2. +4 −4 Modules.h
View
6 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()) {
View
8 Modules.h
@@ -63,6 +63,7 @@ template<class M> CModule* TModLoad(ModHandle p, CUser* pUser,
if (dCoreVersion != VERSION) \
return false; \
Info.SetDescription(DESCRIPTION); \
+ Info.SetDefaultType(TYPE); \
Info.AddType(TYPE); \
Info.SetLoader(TModLoad<CLASS>); \
TModInfo<CLASS>(Info); \
@@ -199,10 +200,6 @@ class CModInfo {
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 @@ class CModInfo {
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 @@ class CModInfo {
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<EModuleType> m_seType;
+ EModuleType m_eDefaultType;
CString m_sName;
CString m_sPath;
CString m_sDescription;
Please sign in to comment.
Something went wrong with that request. Please try again.