Minor flagman cleanups (#442)
* Document disableflagman * Add disabled check, random cleanups
This commit is contained in:
parent
c0011891e6
commit
66cc8dcdaf
|
@ -35,7 +35,7 @@ const int CFlagManager::LoadFile(const int force)
|
||||||
if (!force && !NeedToLoad())
|
if (!force && !NeedToLoad())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
};
|
}
|
||||||
|
|
||||||
this->Clear();
|
this->Clear();
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ const int CFlagManager::LoadFile(const int force)
|
||||||
{
|
{
|
||||||
AMXXLOG_Log("[AMXX] FlagManager: Cannot open file \"%s\" (FILE pointer null!)", GetFile());
|
AMXXLOG_Log("[AMXX] FlagManager: Cannot open file \"%s\" (FILE pointer null!)", GetFile());
|
||||||
return -1;
|
return -1;
|
||||||
};
|
}
|
||||||
|
|
||||||
// Trying to copy this almost exactly as other configs are read...
|
// Trying to copy this almost exactly as other configs are read...
|
||||||
char Line[512];
|
char Line[512];
|
||||||
|
@ -75,7 +75,7 @@ const int CFlagManager::LoadFile(const int force)
|
||||||
{
|
{
|
||||||
nonconst++;
|
nonconst++;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
Command[0]='\0';
|
Command[0]='\0';
|
||||||
Flags[0]='\0';
|
Flags[0]='\0';
|
||||||
|
@ -159,7 +159,7 @@ done_with_flags:
|
||||||
if (*Command == '"' || *Command == '\0')
|
if (*Command == '"' || *Command == '\0')
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
};
|
}
|
||||||
|
|
||||||
// Done sucking the command and flags out of the line
|
// Done sucking the command and flags out of the line
|
||||||
// now insert this command into the linked list
|
// now insert this command into the linked list
|
||||||
|
@ -168,7 +168,7 @@ done_with_flags:
|
||||||
|
|
||||||
nonconst = Line;
|
nonconst = Line;
|
||||||
*nonconst = '\0';
|
*nonconst = '\0';
|
||||||
};
|
}
|
||||||
|
|
||||||
fclose(File);
|
fclose(File);
|
||||||
|
|
||||||
|
@ -183,7 +183,6 @@ done_with_flags:
|
||||||
*/
|
*/
|
||||||
void CFlagManager::AddFromFile(const char *Command, const char *Flags)
|
void CFlagManager::AddFromFile(const char *Command, const char *Flags)
|
||||||
{
|
{
|
||||||
|
|
||||||
CFlagEntry *Entry=new CFlagEntry;
|
CFlagEntry *Entry=new CFlagEntry;
|
||||||
|
|
||||||
Entry->SetName(Command);
|
Entry->SetName(Command);
|
||||||
|
@ -192,8 +191,7 @@ void CFlagManager::AddFromFile(const char *Command, const char *Flags)
|
||||||
// Link it
|
// Link it
|
||||||
m_FlagList.push_back(Entry);
|
m_FlagList.push_back(Entry);
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
void CFlagManager::LookupOrAdd(const char *Command, int &Flags, AMX *Plugin)
|
void CFlagManager::LookupOrAdd(const char *Command, int &Flags, AMX *Plugin)
|
||||||
{
|
{
|
||||||
|
@ -202,7 +200,6 @@ void CFlagManager::LookupOrAdd(const char *Command, int &Flags, AMX *Plugin)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int TempFlags=Flags;
|
int TempFlags=Flags;
|
||||||
if (TempFlags==-1)
|
if (TempFlags==-1)
|
||||||
{
|
{
|
||||||
|
@ -262,8 +259,14 @@ void CFlagManager::LookupOrAdd(const char *Command, int &Flags, AMX *Plugin)
|
||||||
m_FlagList.push_back(Entry);
|
m_FlagList.push_back(Entry);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlagManager::WriteCommands(void)
|
void CFlagManager::WriteCommands(void)
|
||||||
{
|
{
|
||||||
|
if (m_iDisabled)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
List<CFlagEntry *>::iterator iter;
|
List<CFlagEntry *>::iterator iter;
|
||||||
List<CFlagEntry *>::iterator end;
|
List<CFlagEntry *>::iterator end;
|
||||||
FILE *File;
|
FILE *File;
|
||||||
|
@ -311,7 +314,7 @@ void CFlagManager::WriteCommands(void)
|
||||||
(*iter)->SetNeedWritten(0);
|
(*iter)->SetNeedWritten(0);
|
||||||
}
|
}
|
||||||
++iter;
|
++iter;
|
||||||
};
|
}
|
||||||
|
|
||||||
fclose(File);
|
fclose(File);
|
||||||
|
|
||||||
|
@ -331,7 +334,6 @@ void CFlagManager::WriteCommands(void)
|
||||||
|
|
||||||
int CFlagManager::ShouldIAddThisCommand(const AMX *amx, const cell *params, const char *cmdname) const
|
int CFlagManager::ShouldIAddThisCommand(const AMX *amx, const cell *params, const char *cmdname) const
|
||||||
{
|
{
|
||||||
|
|
||||||
// If flagmanager is disabled then ignore this
|
// If flagmanager is disabled then ignore this
|
||||||
if (m_iDisabled)
|
if (m_iDisabled)
|
||||||
{
|
{
|
||||||
|
@ -375,8 +377,7 @@ int CFlagManager::ShouldIAddThisCommand(const AMX *amx, const cell *params, cons
|
||||||
|
|
||||||
// else use it
|
// else use it
|
||||||
return 1;
|
return 1;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
void CFlagManager::Clear(void)
|
void CFlagManager::Clear(void)
|
||||||
{
|
{
|
||||||
|
@ -394,7 +395,7 @@ void CFlagManager::Clear(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_FlagList.clear();
|
m_FlagList.clear();
|
||||||
};
|
}
|
||||||
|
|
||||||
void CFlagManager::CheckIfDisabled(void)
|
void CFlagManager::CheckIfDisabled(void)
|
||||||
{
|
{
|
||||||
|
@ -406,4 +407,4 @@ void CFlagManager::CheckIfDisabled(void)
|
||||||
{
|
{
|
||||||
m_iDisabled=1;
|
m_iDisabled=1;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
|
@ -40,3 +40,8 @@ max_binlog_size 20
|
||||||
; 2 - float comparisons
|
; 2 - float comparisons
|
||||||
; 4 - float rounding
|
; 4 - float rounding
|
||||||
optimizer 7
|
optimizer 7
|
||||||
|
|
||||||
|
; Admin commnand flag manager
|
||||||
|
; 0 - enabled
|
||||||
|
; 1 - disabled
|
||||||
|
disableflagman 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user