mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
Change space indentation to tabs
This commit is contained in:
+31
-66
@@ -1,19 +1,19 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "rulesys.h"
|
||||
@@ -26,7 +26,7 @@
|
||||
/*
|
||||
|
||||
FatherNitwit: Added new rules subsystem to allow game rules to be changed
|
||||
at runtime. more about this will come as time goes on.
|
||||
at runtime. more about this will come as time goes on.
|
||||
FatherNitwit: Added #rules command to manage rules data from in game.
|
||||
FatherNitwit: Renamed old #rules to #serverrules
|
||||
FatherNitwit: Moved max level into the rules system (Character:MaxLevel)
|
||||
@@ -54,18 +54,15 @@ CREATE TABLE rule_values (
|
||||
|
||||
Commands:
|
||||
#rules:
|
||||
- current -> lists current set name
|
||||
- switch (set name) -> change set in the DB, but dont reload
|
||||
- load (set name) -> load set into this zone without changing the world
|
||||
- wload (set name) -> tell world and all zones to load this rule set
|
||||
- store [set name] -> store the current rules in this zone to the set (or
|
||||
active if not specified)
|
||||
- reset -> reset all rule values to their defaults.
|
||||
- list [catname]
|
||||
- set (cat) (rule) (value)
|
||||
- values [catname] -> show the values of all rules in the specified category/
|
||||
|
||||
|
||||
current -> lists current set name
|
||||
switch (set name) -> change set in the DB, but dont reload
|
||||
load (set name) -> load set into this zone without changing the world
|
||||
wload (set name) -> tell world and all zones to load this rule set
|
||||
store [set name] -> store the current rules in this zone to the set (or active if not specified)
|
||||
reset -> reset all rule values to their defaults.
|
||||
list [catname]
|
||||
set (cat) (rule) (value)
|
||||
values [catname] -> show the values of all rules in the specified category/
|
||||
*/
|
||||
|
||||
const char *RuleManager::s_categoryNames[_CatCount+1] = {
|
||||
@@ -76,9 +73,9 @@ const char *RuleManager::s_categoryNames[_CatCount+1] = {
|
||||
};
|
||||
|
||||
const RuleManager::RuleInfo RuleManager::s_RuleInfo[_IntRuleCount+_RealRuleCount+_BoolRuleCount+1] = {
|
||||
/* this is done in three steps so we can reliably get to them by index*/
|
||||
/* this is done in three steps so we can reliably get to them by index*/
|
||||
#define RULE_INT(cat, rule, default_value) \
|
||||
{ #cat ":" #rule, Category__##cat, IntRule, Int__##rule },
|
||||
{ #cat ":" #rule, Category__##cat, IntRule, Int__##rule },
|
||||
#include "ruletypes.h"
|
||||
#define RULE_REAL(cat, rule, default_value) \
|
||||
{ #cat ":" #rule, Category__##cat, RealRule, Real__##rule },
|
||||
@@ -90,8 +87,8 @@ const RuleManager::RuleInfo RuleManager::s_RuleInfo[_IntRuleCount+_RealRuleCount
|
||||
};
|
||||
|
||||
RuleManager::RuleManager()
|
||||
: m_activeRuleset(0),
|
||||
m_activeName("default")
|
||||
: m_activeRuleset(0),
|
||||
m_activeName("default")
|
||||
{
|
||||
ResetRules();
|
||||
}
|
||||
@@ -195,7 +192,7 @@ bool RuleManager::SetRule(const char *rule_name, const char *rule_value, Databas
|
||||
void RuleManager::ResetRules() {
|
||||
_log(RULES__CHANGE, "Resetting running rules to default values");
|
||||
#define RULE_INT(cat, rule, default_value) \
|
||||
m_RuleIntValues[ Int__##rule ] = default_value;
|
||||
m_RuleIntValues[ Int__##rule ] = default_value;
|
||||
#define RULE_REAL(cat, rule, default_value) \
|
||||
m_RuleRealValues[ Real__##rule ] = default_value;
|
||||
#define RULE_BOOL(cat, rule, default_value) \
|
||||
@@ -321,7 +318,7 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) {
|
||||
}
|
||||
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
char* query = 0;
|
||||
if (!db->RunQuery(query, MakeAnyLenString(&query,
|
||||
"REPLACE INTO rule_values (ruleset_id, rule_name, rule_value) "
|
||||
" VALUES(%d, '%s', '%s')",
|
||||
@@ -376,7 +373,7 @@ int RuleManager::_FindOrCreateRuleset(Database *db, const char *ruleset) {
|
||||
|
||||
uint32 new_id;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
char* query = 0;
|
||||
if (!db->RunQuery(query, MakeAnyLenString(&query,
|
||||
"INSERT INTO rule_sets (ruleset_id, name) "
|
||||
" VALUES(0, '%s')",
|
||||
@@ -445,48 +442,16 @@ bool RuleManager::ListRulesets(Database *db, std::map<int, std::string> &into) {
|
||||
|
||||
int32 RuleManager::GetIntRule(RuleManager::IntType t) const
|
||||
{
|
||||
return(m_RuleIntValues[t]);
|
||||
return(m_RuleIntValues[t]);
|
||||
}
|
||||
|
||||
float RuleManager::GetRealRule(RuleManager::RealType t) const
|
||||
{
|
||||
return(m_RuleRealValues[t]);
|
||||
return(m_RuleRealValues[t]);
|
||||
}
|
||||
|
||||
bool RuleManager::GetBoolRule(RuleManager::BoolType t) const
|
||||
{
|
||||
return (m_RuleBoolValues[t] == 1);
|
||||
return (m_RuleBoolValues[t] == 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user