Browse Source

Removed const_cast instances; no longer necessary (see previous commit a4607f0b).

pull/3/head
JustinAJ 10 years ago
parent
commit
68464d947f
  1. 2
      RenX.DNS/RenX_DNS.cpp
  2. 10
      RenX.Medals/RenX_Medals.cpp
  3. 4
      RenX.Medals/RenX_Medals.h

2
RenX.DNS/RenX_DNS.cpp

@ -31,7 +31,7 @@ void RenX_DNSPlugin::RenX_OnPlayerCreate(RenX::Server *server, const RenX::Playe
if (player->isBot == false) if (player->isBot == false)
{ {
Jupiter::ReferenceString host = Jupiter::ReferenceString(Jupiter::Socket::resolveHostname(Jupiter::CStringS(player->ip).c_str(), 0)); Jupiter::ReferenceString host = Jupiter::ReferenceString(Jupiter::Socket::resolveHostname(Jupiter::CStringS(player->ip).c_str(), 0));
const_cast<RenX::PlayerInfo *>(player)->varData.set(RenX_DNSPlugin::name, STRING_LITERAL_AS_REFERENCE("Host"), host); player->varData.set(RenX_DNSPlugin::name, STRING_LITERAL_AS_REFERENCE("Host"), host);
} }
} }

10
RenX.Medals/RenX_Medals.cpp

@ -84,8 +84,8 @@ void RenX_MedalsPlugin::RenX_OnPlayerCreate(RenX::Server *server, const RenX::Pl
{ {
if (player->isBot == false) if (player->isBot == false)
{ {
const_cast<RenX::PlayerInfo *>(player)->varData.set(this->getName(), STRING_LITERAL_AS_REFERENCE("Recs"), RenX_MedalsPlugin::medalsFile.get(player->uuid, STRING_LITERAL_AS_REFERENCE("Recs"))); player->varData.set(this->getName(), STRING_LITERAL_AS_REFERENCE("Recs"), RenX_MedalsPlugin::medalsFile.get(player->uuid, STRING_LITERAL_AS_REFERENCE("Recs")));
const_cast<RenX::PlayerInfo *>(player)->varData.set(this->getName(), STRING_LITERAL_AS_REFERENCE("Noobs"), RenX_MedalsPlugin::medalsFile.get(player->uuid, STRING_LITERAL_AS_REFERENCE("Noobs"))); player->varData.set(this->getName(), STRING_LITERAL_AS_REFERENCE("Noobs"), RenX_MedalsPlugin::medalsFile.get(player->uuid, STRING_LITERAL_AS_REFERENCE("Noobs")));
} }
} }
@ -207,7 +207,7 @@ void RenX_MedalsPlugin::RenX_OnDestroy(RenX::Server *server, const RenX::PlayerI
{ {
if (type == RenX::ObjectType::Building) if (type == RenX::ObjectType::Building)
{ {
addRec(const_cast<RenX::PlayerInfo *>(player)); // -whistles- addRec(player); // -whistles-
const Jupiter::ReadableString &translated = RenX::translateName(objectName); const Jupiter::ReadableString &translated = RenX::translateName(objectName);
server->sendMessage(Jupiter::StringS::Format("%.*s has been recommended for destroying the %.*s!", player->name.size(), player->name.ptr(), translated.size(), translated.ptr())); server->sendMessage(Jupiter::StringS::Format("%.*s has been recommended for destroying the %.*s!", player->name.size(), player->name.ptr(), translated.size(), translated.ptr()));
@ -393,13 +393,13 @@ const Jupiter::ReadableString &NoobGameCommand::getHelp(const Jupiter::ReadableS
GAME_COMMAND_INIT(NoobGameCommand) GAME_COMMAND_INIT(NoobGameCommand)
void addRec(RenX::PlayerInfo *player, int amount) void addRec(const RenX::PlayerInfo *player, int amount)
{ {
if (player->uuid.matchi("Player*") == false) if (player->uuid.matchi("Player*") == false)
player->varData.set(pluginInstance.getName(), STRING_LITERAL_AS_REFERENCE("Recs"), Jupiter::StringS::Format("%u", getRecs(player) + amount)); player->varData.set(pluginInstance.getName(), STRING_LITERAL_AS_REFERENCE("Recs"), Jupiter::StringS::Format("%u", getRecs(player) + amount));
} }
void addNoob(RenX::PlayerInfo *player, int amount) void addNoob(const RenX::PlayerInfo *player, int amount)
{ {
if (player->uuid.matchi("Player*") == false) if (player->uuid.matchi("Player*") == false)
player->varData.set(pluginInstance.getName(), STRING_LITERAL_AS_REFERENCE("Noobs"), Jupiter::StringS::Format("%u", getNoobs(player) + amount)); player->varData.set(pluginInstance.getName(), STRING_LITERAL_AS_REFERENCE("Noobs"), Jupiter::StringS::Format("%u", getNoobs(player) + amount));

4
RenX.Medals/RenX_Medals.h

@ -25,10 +25,10 @@
#include "RenX_GameCommand.h" #include "RenX_GameCommand.h"
/** Adds a recommendation to the player's medal data */ /** Adds a recommendation to the player's medal data */
void addRec(RenX::PlayerInfo *player, int amount = 1); void addRec(const RenX::PlayerInfo *player, int amount = 1);
/** Adds a noob to the player's medal data */ /** Adds a noob to the player's medal data */
void addNoob(RenX::PlayerInfo *player, int amount = 1); void addNoob(const RenX::PlayerInfo *player, int amount = 1);
/** Fetches a player's recommendation count */ /** Fetches a player's recommendation count */
unsigned long getRecs(const RenX::PlayerInfo *player); unsigned long getRecs(const RenX::PlayerInfo *player);

Loading…
Cancel
Save