Browse Source

General bug fixes/improvements

pull/3/head
Jessica James 9 years ago
parent
commit
6c2caafa92
  1. 2
      Jupiter
  2. BIN
      Release/Bot.lib
  3. BIN
      Release/Plugins/RenX.Core.lib
  4. 7
      RenX.Core/RenX_Server.cpp
  5. 17
      RenX.Core/RenX_Tags.cpp
  6. 68
      RenX.ModSystem/RenX_ModSystem.cpp

2
Jupiter

@ -1 +1 @@
Subproject commit f52413a0f821f4bec3e1903ba1629023e3231a09 Subproject commit 5a34f8989d4f9bdd3fb44efeb8b8bc90a5dd02b2

BIN
Release/Bot.lib

Binary file not shown.

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

7
RenX.Core/RenX_Server.cpp

@ -1924,6 +1924,9 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
this->autoBalanceTeams = tokens.getToken(17).asBool(); this->autoBalanceTeams = tokens.getToken(17).asBool();
this->spawnCrates = tokens.getToken(19).asBool(); this->spawnCrates = tokens.getToken(19).asBool();
this->crateRespawnAfterPickup = tokens.getToken(21).asDouble(); this->crateRespawnAfterPickup = tokens.getToken(21).asDouble();
if (this->rconVersion >= 4)
{
this->competitive = tokens.getToken(23).asBool(); this->competitive = tokens.getToken(23).asBool();
const Jupiter::ReadableString &match_state_token = tokens.getToken(25); const Jupiter::ReadableString &match_state_token = tokens.getToken(25);
@ -1939,6 +1942,7 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
this->match_state = 1; this->match_state = 1;
} }
} }
}
else if (this->lastCommand.equalsi("mutatorlist"_jrs)) else if (this->lastCommand.equalsi("mutatorlist"_jrs))
{ {
// "The following mutators are loaded:" [ | Mutator [ | Mutator [ ... ] ] ] // "The following mutators are loaded:" [ | Mutator [ | Mutator [ ... ] ] ]
@ -2870,8 +2874,11 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
{ {
// Player | "as" | Type="moderator" / "administrator" // Player | "as" | Type="moderator" / "administrator"
RenX::PlayerInfo *player = parseGetPlayerOrAdd(tokens.getToken(2)); RenX::PlayerInfo *player = parseGetPlayerOrAdd(tokens.getToken(2));
player->adminType.erase();
for (size_t i = 0; i < xPlugins.size(); i++) for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnAdminLogout(this, player); xPlugins.get(i)->RenX_OnAdminLogout(this, player);
player->adminType = Jupiter::ReferenceString::empty; player->adminType = Jupiter::ReferenceString::empty;
} }
else if (subHeader.equals("Granted;")) else if (subHeader.equals("Granted;"))

17
RenX.Core/RenX_Tags.cpp

@ -38,17 +38,7 @@ struct TagsImp : RenX::Tags
const Jupiter::ReadableString &getUniqueInternalTag(); const Jupiter::ReadableString &getUniqueInternalTag();
private: private:
Jupiter::StringS uniqueTag; Jupiter::StringS uniqueTag;
union
{
uint32_t tagItr; uint32_t tagItr;
struct
{
uint8_t tagItrP1;
uint8_t tagItrP2;
uint8_t tagItrP3;
uint8_t tagItrP4;
};
};
size_t bar_width; size_t bar_width;
} _tags; } _tags;
RenX::Tags *RenX::tags = &_tags; RenX::Tags *RenX::tags = &_tags;
@ -885,11 +875,8 @@ void TagsImp::sanitizeTags(Jupiter::StringType &fmt)
const Jupiter::ReadableString &TagsImp::getUniqueInternalTag() const Jupiter::ReadableString &TagsImp::getUniqueInternalTag()
{ {
this->uniqueTag.set(1, this->tagItrP1); this->uniqueTag.set(1, reinterpret_cast<const char *>(&this->tagItr), sizeof(TagsImp::tagItr));
this->uniqueTag.set(2, this->tagItrP2); ++TagsImp::tagItr;
this->uniqueTag.set(3, this->tagItrP3);
this->uniqueTag.set(4, this->tagItrP4);
this->tagItr++;
return this->uniqueTag; return this->uniqueTag;
} }

68
RenX.ModSystem/RenX_ModSystem.cpp

@ -28,15 +28,15 @@ using namespace Jupiter::literals;
bool RenX_ModSystemPlugin::initialize() bool RenX_ModSystemPlugin::initialize()
{ {
RenX_ModSystemPlugin::lockSteam = RenX_ModSystemPlugin::modsFile.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("LockSteam"), true); RenX_ModSystemPlugin::lockSteam = this->config.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("LockSteam"), true);
RenX_ModSystemPlugin::lockIP = RenX_ModSystemPlugin::modsFile.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("LockIP"), false); RenX_ModSystemPlugin::lockIP = this->config.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("LockIP"), false);
RenX_ModSystemPlugin::lockName = RenX_ModSystemPlugin::modsFile.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("LockName"), false); RenX_ModSystemPlugin::lockName = this->config.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("LockName"), false);
RenX_ModSystemPlugin::kickLockMismatch = RenX_ModSystemPlugin::modsFile.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("KickLockMismatch"), true); RenX_ModSystemPlugin::kickLockMismatch = this->config.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("KickLockMismatch"), true);
RenX_ModSystemPlugin::autoAuthSteam = RenX_ModSystemPlugin::modsFile.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("AutoAuthSteam"), true); RenX_ModSystemPlugin::autoAuthSteam = this->config.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("AutoAuthSteam"), true);
RenX_ModSystemPlugin::autoAuthIP = RenX_ModSystemPlugin::modsFile.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("AutoAuthIP"), false); RenX_ModSystemPlugin::autoAuthIP = this->config.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("AutoAuthIP"), false);
RenX_ModSystemPlugin::atmDefault = RenX_ModSystemPlugin::modsFile.get(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("ATMDefault")); RenX_ModSystemPlugin::atmDefault = this->config.get(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("ATMDefault"));
RenX_ModSystemPlugin::moderatorGroup = RenX_ModSystemPlugin::modsFile.get(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("Moderator"), STRING_LITERAL_AS_REFERENCE("Moderator")); RenX_ModSystemPlugin::moderatorGroup = this->config.get(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("Moderator"), STRING_LITERAL_AS_REFERENCE("Moderator"));
RenX_ModSystemPlugin::administratorGroup = RenX_ModSystemPlugin::modsFile.get(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("Administrator"), STRING_LITERAL_AS_REFERENCE("Administrator")); RenX_ModSystemPlugin::administratorGroup = this->config.get(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("Administrator"), STRING_LITERAL_AS_REFERENCE("Administrator"));
ModGroup *group; ModGroup *group;
Jupiter::ReferenceString dotLockSteam = ".LockSteam"; Jupiter::ReferenceString dotLockSteam = ".LockSteam";
@ -50,52 +50,53 @@ bool RenX_ModSystemPlugin::initialize()
Jupiter::ReferenceString dotPrefix = ".Prefix"; Jupiter::ReferenceString dotPrefix = ".Prefix";
Jupiter::ReferenceString dotGamePrefix = ".GamePrefix"; Jupiter::ReferenceString dotGamePrefix = ".GamePrefix";
Jupiter::String groupName = RenX_ModSystemPlugin::modsFile.get(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("Default")); Jupiter::String groupName = this->config.get(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("Default"));
while (groupName.isNotEmpty()) while (groupName.isNotEmpty())
{ {
group = new ModGroup(); group = new ModGroup();
group->name = groupName; group->name = groupName;
groupName += dotLockSteam; groupName += dotLockSteam;
group->lockSteam = RenX_ModSystemPlugin::modsFile.getBool(Jupiter::ReferenceString::empty, groupName, RenX_ModSystemPlugin::lockSteam); group->lockSteam = this->config.getBool(Jupiter::ReferenceString::empty, groupName, RenX_ModSystemPlugin::lockSteam);
groupName.truncate(dotLockSteam.size()); groupName.truncate(dotLockSteam.size());
groupName += dotLockIP; groupName += dotLockIP;
group->lockIP = RenX_ModSystemPlugin::modsFile.getBool(Jupiter::ReferenceString::empty, groupName, RenX_ModSystemPlugin::lockIP); group->lockIP = this->config.getBool(Jupiter::ReferenceString::empty, groupName, RenX_ModSystemPlugin::lockIP);
groupName.truncate(dotLockIP.size()); groupName.truncate(dotLockIP.size());
groupName += dotLockName; groupName += dotLockName;
group->lockName = RenX_ModSystemPlugin::modsFile.getBool(Jupiter::ReferenceString::empty, groupName, RenX_ModSystemPlugin::lockName); group->lockName = this->config.getBool(Jupiter::ReferenceString::empty, groupName, RenX_ModSystemPlugin::lockName);
groupName.truncate(dotLockName.size()); groupName.truncate(dotLockName.size());
groupName += dotKickLockMismatch; groupName += dotKickLockMismatch;
group->kickLockMismatch = RenX_ModSystemPlugin::modsFile.getBool(Jupiter::ReferenceString::empty, groupName, RenX_ModSystemPlugin::kickLockMismatch); group->kickLockMismatch = this->config.getBool(Jupiter::ReferenceString::empty, groupName, RenX_ModSystemPlugin::kickLockMismatch);
groupName.truncate(dotKickLockMismatch.size()); groupName.truncate(dotKickLockMismatch.size());
groupName += dotAutoAuthSteam; groupName += dotAutoAuthSteam;
group->autoAuthSteam = RenX_ModSystemPlugin::modsFile.getBool(Jupiter::ReferenceString::empty, groupName, RenX_ModSystemPlugin::autoAuthSteam); group->autoAuthSteam = this->config.getBool(Jupiter::ReferenceString::empty, groupName, RenX_ModSystemPlugin::autoAuthSteam);
groupName.truncate(dotAutoAuthSteam.size()); groupName.truncate(dotAutoAuthSteam.size());
groupName += dotAutoAuthIP; groupName += dotAutoAuthIP;
group->autoAuthIP = RenX_ModSystemPlugin::modsFile.getBool(Jupiter::ReferenceString::empty, groupName, RenX_ModSystemPlugin::autoAuthIP); group->autoAuthIP = this->config.getBool(Jupiter::ReferenceString::empty, groupName, RenX_ModSystemPlugin::autoAuthIP);
groupName.truncate(dotAutoAuthIP.size()); groupName.truncate(dotAutoAuthIP.size());
groupName += dotAccess; groupName += dotAccess;
group->access = RenX_ModSystemPlugin::modsFile.getInt(Jupiter::ReferenceString::empty, groupName); group->access = this->config.getInt(Jupiter::ReferenceString::empty, groupName);
groupName.truncate(dotAccess.size()); groupName.truncate(dotAccess.size());
groupName += dotPrefix; groupName += dotPrefix;
group->prefix = RenX_ModSystemPlugin::modsFile.get(Jupiter::ReferenceString::empty, groupName); group->prefix = this->config.get(Jupiter::ReferenceString::empty, groupName);
groupName.truncate(dotPrefix.size()); groupName.truncate(dotPrefix.size());
groupName += dotGamePrefix; groupName += dotGamePrefix;
group->gamePrefix = RenX_ModSystemPlugin::modsFile.get(Jupiter::ReferenceString::empty, groupName); group->gamePrefix = this->config.get(Jupiter::ReferenceString::empty, groupName);
groupName.truncate(dotGamePrefix.size()); groupName.truncate(dotGamePrefix.size());
RenX_ModSystemPlugin::groups.add(group); RenX_ModSystemPlugin::groups.add(group);
groupName += dotNext; groupName += dotNext;
groupName = RenX_ModSystemPlugin::modsFile.get(Jupiter::ReferenceString::empty, groupName); groupName = this->config.get(Jupiter::ReferenceString::empty, groupName);
} }
RenX::Core *core = RenX::getCore(); RenX::Core *core = RenX::getCore();
@ -154,17 +155,22 @@ int RenX_ModSystemPlugin::auth(RenX::Server *server, const RenX::PlayerInfo *pla
{ {
if (player->isBot) if (player->isBot)
return 0; return 0;
ModGroup *group; ModGroup *group;
if (player->uuid.isNotEmpty()) if (player->uuid.isNotEmpty())
{ {
Jupiter::INIFile::Section *section = RenX_ModSystemPlugin::modsFile.getSection(player->uuid); Jupiter::INIFile::Section *section = this->config.getSection(player->uuid);
if (section != nullptr) if (section != nullptr)
{ {
const Jupiter::ReadableString &groupName = section->get(STRING_LITERAL_AS_REFERENCE("Group")); const Jupiter::ReadableString &groupName = section->get(STRING_LITERAL_AS_REFERENCE("Group"));
if (groupName.isEmpty()) if (groupName.isEmpty())
group = RenX_ModSystemPlugin::groups.get(0); group = RenX_ModSystemPlugin::groups.get(0);
else if ((group = RenX_ModSystemPlugin::getGroupByName(groupName)) == nullptr) else
{
group = RenX_ModSystemPlugin::getGroupByName(groupName);
if (group == nullptr)
group = RenX_ModSystemPlugin::groups.get(0); group = RenX_ModSystemPlugin::groups.get(0);
}
auto sectionAuth = [&] auto sectionAuth = [&]
{ {
@ -236,11 +242,11 @@ void RenX_ModSystemPlugin::tempAuth(RenX::Server *server, const RenX::PlayerInfo
bool RenX_ModSystemPlugin::set(RenX::PlayerInfo *player, RenX_ModSystemPlugin::ModGroup *group) bool RenX_ModSystemPlugin::set(RenX::PlayerInfo *player, RenX_ModSystemPlugin::ModGroup *group)
{ {
bool r = RenX_ModSystemPlugin::modsFile.set(player->uuid, STRING_LITERAL_AS_REFERENCE("Group"), group->name); bool r = this->config.set(player->uuid, STRING_LITERAL_AS_REFERENCE("Group"), group->name);
RenX_ModSystemPlugin::modsFile.set(player->uuid, STRING_LITERAL_AS_REFERENCE("SteamID"), Jupiter::StringS::Format("%llu", player->steamid)); this->config.set(player->uuid, STRING_LITERAL_AS_REFERENCE("SteamID"), Jupiter::StringS::Format("%llu", player->steamid));
RenX_ModSystemPlugin::modsFile.set(player->uuid, STRING_LITERAL_AS_REFERENCE("LastIP"), player->ip); this->config.set(player->uuid, STRING_LITERAL_AS_REFERENCE("LastIP"), player->ip);
RenX_ModSystemPlugin::modsFile.set(player->uuid, STRING_LITERAL_AS_REFERENCE("Name"), player->name); this->config.set(player->uuid, STRING_LITERAL_AS_REFERENCE("Name"), player->name);
RenX_ModSystemPlugin::modsFile.sync(); this->config.sync();
return r; return r;
} }
@ -273,7 +279,7 @@ RenX_ModSystemPlugin::ModGroup *RenX_ModSystemPlugin::getGroupByIndex(size_t ind
int RenX_ModSystemPlugin::getConfigAccess(const Jupiter::ReadableString &uuid) const int RenX_ModSystemPlugin::getConfigAccess(const Jupiter::ReadableString &uuid) const
{ {
Jupiter::INIFile::Section *section = RenX_ModSystemPlugin::modsFile.getSection(uuid); Jupiter::INIFile::Section *section = this->config.getSection(uuid);
if (section == nullptr) if (section == nullptr)
return RenX_ModSystemPlugin::groups.get(0)->access; return RenX_ModSystemPlugin::groups.get(0)->access;
RenX_ModSystemPlugin::ModGroup *group = RenX_ModSystemPlugin::getGroupByName(section->get(STRING_LITERAL_AS_REFERENCE("Group")), groups.get(0)); RenX_ModSystemPlugin::ModGroup *group = RenX_ModSystemPlugin::getGroupByName(section->get(STRING_LITERAL_AS_REFERENCE("Group")), groups.get(0));
@ -344,9 +350,9 @@ void RenX_ModSystemPlugin::RenX_OnPlayerCreate(RenX::Server *server, const RenX:
void RenX_ModSystemPlugin::RenX_OnPlayerDelete(RenX::Server *server, const RenX::PlayerInfo *player) void RenX_ModSystemPlugin::RenX_OnPlayerDelete(RenX::Server *server, const RenX::PlayerInfo *player)
{ {
if (RenX_ModSystemPlugin::groups.size() != 0 && player->isBot == false) if (RenX_ModSystemPlugin::groups.size() != 0 && player->isBot == false && player->uuid.isNotEmpty())
{ {
Jupiter::INIFile::Section *section = RenX_ModSystemPlugin::modsFile.getSection(player->uuid); Jupiter::INIFile::Section *section = this->config.getSection(player->uuid);
if (section != nullptr) if (section != nullptr)
{ {
section->set(STRING_LITERAL_AS_REFERENCE("SteamID"), Jupiter::StringS::Format("%llu", player->steamid)); section->set(STRING_LITERAL_AS_REFERENCE("SteamID"), Jupiter::StringS::Format("%llu", player->steamid));
@ -409,9 +415,9 @@ int RenX_ModSystemPlugin::OnRehash()
{ {
RenX::Plugin::OnRehash(); RenX::Plugin::OnRehash();
RenX_ModSystemPlugin::modsFile.flushData();
while (RenX_ModSystemPlugin::groups.size() != 0) while (RenX_ModSystemPlugin::groups.size() != 0)
delete RenX_ModSystemPlugin::groups.remove(0U); delete RenX_ModSystemPlugin::groups.remove(0U);
return this->initialize() ? 0 : -1; return this->initialize() ? 0 : -1;
} }

Loading…
Cancel
Save