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. 31
      RenX.Core/RenX_Server.cpp
  5. 19
      RenX.Core/RenX_Tags.cpp
  6. 70
      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.

31
RenX.Core/RenX_Server.cpp

@ -1924,19 +1924,23 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
this->autoBalanceTeams = tokens.getToken(17).asBool();
this->spawnCrates = tokens.getToken(19).asBool();
this->crateRespawnAfterPickup = tokens.getToken(21).asDouble();
this->competitive = tokens.getToken(23).asBool();
const Jupiter::ReadableString &match_state_token = tokens.getToken(25);
if (match_state_token.equalsi("PendingMatch"_jrs))
this->match_state = 0;
else if (match_state_token.equalsi("MatchInProgress"_jrs))
this->match_state = 1;
else if (match_state_token.equalsi("RoundOver"_jrs) || match_state_token.equalsi("MatchOver"_jrs))
this->match_state = 2;
else if (match_state_token.equalsi("TravelTheWorld"_jrs))
this->match_state = 3;
else // Unknown state -- assume it's in progress
this->match_state = 1;
if (this->rconVersion >= 4)
{
this->competitive = tokens.getToken(23).asBool();
const Jupiter::ReadableString &match_state_token = tokens.getToken(25);
if (match_state_token.equalsi("PendingMatch"_jrs))
this->match_state = 0;
else if (match_state_token.equalsi("MatchInProgress"_jrs))
this->match_state = 1;
else if (match_state_token.equalsi("RoundOver"_jrs) || match_state_token.equalsi("MatchOver"_jrs))
this->match_state = 2;
else if (match_state_token.equalsi("TravelTheWorld"_jrs))
this->match_state = 3;
else // Unknown state -- assume it's in progress
this->match_state = 1;
}
}
}
else if (this->lastCommand.equalsi("mutatorlist"_jrs))
@ -2870,8 +2874,11 @@ void RenX::Server::processLine(const Jupiter::ReadableString &line)
{
// Player | "as" | Type="moderator" / "administrator"
RenX::PlayerInfo *player = parseGetPlayerOrAdd(tokens.getToken(2));
player->adminType.erase();
for (size_t i = 0; i < xPlugins.size(); i++)
xPlugins.get(i)->RenX_OnAdminLogout(this, player);
player->adminType = Jupiter::ReferenceString::empty;
}
else if (subHeader.equals("Granted;"))

19
RenX.Core/RenX_Tags.cpp

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

70
RenX.ModSystem/RenX_ModSystem.cpp

@ -28,15 +28,15 @@ using namespace Jupiter::literals;
bool RenX_ModSystemPlugin::initialize()
{
RenX_ModSystemPlugin::lockSteam = RenX_ModSystemPlugin::modsFile.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::lockName = RenX_ModSystemPlugin::modsFile.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::autoAuthSteam = RenX_ModSystemPlugin::modsFile.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::atmDefault = RenX_ModSystemPlugin::modsFile.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::administratorGroup = RenX_ModSystemPlugin::modsFile.get(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("Administrator"), STRING_LITERAL_AS_REFERENCE("Administrator"));
RenX_ModSystemPlugin::lockSteam = this->config.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("LockSteam"), true);
RenX_ModSystemPlugin::lockIP = this->config.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("LockIP"), false);
RenX_ModSystemPlugin::lockName = this->config.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("LockName"), false);
RenX_ModSystemPlugin::kickLockMismatch = this->config.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("KickLockMismatch"), true);
RenX_ModSystemPlugin::autoAuthSteam = this->config.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("AutoAuthSteam"), true);
RenX_ModSystemPlugin::autoAuthIP = this->config.getBool(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("AutoAuthIP"), false);
RenX_ModSystemPlugin::atmDefault = this->config.get(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("ATMDefault"));
RenX_ModSystemPlugin::moderatorGroup = this->config.get(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("Moderator"), STRING_LITERAL_AS_REFERENCE("Moderator"));
RenX_ModSystemPlugin::administratorGroup = this->config.get(Jupiter::ReferenceString::empty, STRING_LITERAL_AS_REFERENCE("Administrator"), STRING_LITERAL_AS_REFERENCE("Administrator"));
ModGroup *group;
Jupiter::ReferenceString dotLockSteam = ".LockSteam";
@ -50,52 +50,53 @@ bool RenX_ModSystemPlugin::initialize()
Jupiter::ReferenceString dotPrefix = ".Prefix";
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())
{
group = new ModGroup();
group->name = groupName;
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 += 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 += 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 += 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 += 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 += 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 += 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 += 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 += dotGamePrefix;
group->gamePrefix = RenX_ModSystemPlugin::modsFile.get(Jupiter::ReferenceString::empty, groupName);
group->gamePrefix = this->config.get(Jupiter::ReferenceString::empty, groupName);
groupName.truncate(dotGamePrefix.size());
RenX_ModSystemPlugin::groups.add(group);
groupName += dotNext;
groupName = RenX_ModSystemPlugin::modsFile.get(Jupiter::ReferenceString::empty, groupName);
groupName = this->config.get(Jupiter::ReferenceString::empty, groupName);
}
RenX::Core *core = RenX::getCore();
@ -154,17 +155,22 @@ int RenX_ModSystemPlugin::auth(RenX::Server *server, const RenX::PlayerInfo *pla
{
if (player->isBot)
return 0;
ModGroup *group;
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)
{
const Jupiter::ReadableString &groupName = section->get(STRING_LITERAL_AS_REFERENCE("Group"));
if (groupName.isEmpty())
group = RenX_ModSystemPlugin::groups.get(0);
else if ((group = RenX_ModSystemPlugin::getGroupByName(groupName)) == nullptr)
group = RenX_ModSystemPlugin::groups.get(0);
else
{
group = RenX_ModSystemPlugin::getGroupByName(groupName);
if (group == nullptr)
group = RenX_ModSystemPlugin::groups.get(0);
}
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 r = RenX_ModSystemPlugin::modsFile.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));
RenX_ModSystemPlugin::modsFile.set(player->uuid, STRING_LITERAL_AS_REFERENCE("LastIP"), player->ip);
RenX_ModSystemPlugin::modsFile.set(player->uuid, STRING_LITERAL_AS_REFERENCE("Name"), player->name);
RenX_ModSystemPlugin::modsFile.sync();
bool r = this->config.set(player->uuid, STRING_LITERAL_AS_REFERENCE("Group"), group->name);
this->config.set(player->uuid, STRING_LITERAL_AS_REFERENCE("SteamID"), Jupiter::StringS::Format("%llu", player->steamid));
this->config.set(player->uuid, STRING_LITERAL_AS_REFERENCE("LastIP"), player->ip);
this->config.set(player->uuid, STRING_LITERAL_AS_REFERENCE("Name"), player->name);
this->config.sync();
return r;
}
@ -273,7 +279,7 @@ RenX_ModSystemPlugin::ModGroup *RenX_ModSystemPlugin::getGroupByIndex(size_t ind
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)
return RenX_ModSystemPlugin::groups.get(0)->access;
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)
{
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)
{
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_ModSystemPlugin::modsFile.flushData();
while (RenX_ModSystemPlugin::groups.size() != 0)
delete RenX_ModSystemPlugin::groups.remove(0U);
return this->initialize() ? 0 : -1;
}

Loading…
Cancel
Save