Rewrite VarCache_Struct

Basically just remove manual memory management
This commit is contained in:
Michael Cook (mackal)
2016-05-09 14:23:27 -04:00
parent 59728c5115
commit c159b89e79
16 changed files with 146 additions and 239 deletions
+12 -8
View File
@@ -1406,8 +1406,9 @@ bool GuildApproval::ProcessApproval()
GuildApproval::GuildApproval(const char* guildname, Client* owner,uint32 id)
{
database.GetVariable("GuildCreation", founders, 3);
uint8 tmp = atoi(founders);
std::string founders;
database.GetVariable("GuildCreation", founders);
uint8 tmp = atoi(founders.c_str());
deletion_timer = new Timer(1800000);
strcpy(guild,guildname);
this->owner = owner;
@@ -1425,8 +1426,9 @@ GuildApproval::~GuildApproval()
bool GuildApproval::AddMemberApproval(Client* addition)
{
database.GetVariable("GuildCreation", founders, 3);
uint8 tmp = atoi(founders);
std::string founders;
database.GetVariable("GuildCreation", founders);
uint8 tmp = atoi(founders.c_str());
for(int i=0;i<tmp;i++)
{
if(members[i] && members[i] == addition)
@@ -1455,8 +1457,9 @@ bool GuildApproval::AddMemberApproval(Client* addition)
void GuildApproval::ApprovedMembers(Client* requestee)
{
database.GetVariable("GuildCreation", founders, 3);
uint8 tmp = atoi(founders);
std::string founders;
database.GetVariable("GuildCreation", founders);
uint8 tmp = atoi(founders.c_str());
for(int i=0;i<tmp;i++)
{
if(members[i])
@@ -1471,8 +1474,9 @@ void GuildApproval::GuildApproved()
if(!owner)
return;
database.GetVariable("GuildCreation", founders, 3);
uint8 tmp = atoi(founders);
std::string founders;
database.GetVariable("GuildCreation", founders);
uint8 tmp = atoi(founders.c_str());
uint32 tmpeq = guild_mgr.CreateGuild(guild, owner->CharacterID());
guild_mgr.SetGuild(owner->CharacterID(),tmpeq,2);
owner->SendAppearancePacket(AT_GuildID,true,false);