From 06115c652382d81bb25ce1dc3ad40e14f00ee273 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 11 May 2009 20:05:55 +0200 Subject: Fixed the memory issues with the pointers to item stat modifiers It was a list of pointers to Stat instances that had long been popped off the stack and deleted. --- src/net/tmwserv/generalhandler.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'src/net/tmwserv/generalhandler.cpp') diff --git a/src/net/tmwserv/generalhandler.cpp b/src/net/tmwserv/generalhandler.cpp index 8a47e6f9..d283729d 100644 --- a/src/net/tmwserv/generalhandler.cpp +++ b/src/net/tmwserv/generalhandler.cpp @@ -52,8 +52,6 @@ Net::Connection *gameServerConnection = 0; Net::Connection *chatServerConnection = 0; Net::Connection *accountServerConnection = 0; -std::list stats; - namespace TmwServ { GeneralHandler::GeneralHandler(): @@ -79,19 +77,13 @@ GeneralHandler::GeneralHandler(): generalHandler = this; - ItemDB::Stat stat; - stat.tag = "str"; stat.format = N_("Strength: %d"); - stats.push_back(&stat); - stat.tag = "agi"; stat.format = N_("Agility: %d"); - stats.push_back(&stat); - stat.tag = "dex"; stat.format = N_("Dexterity: %d"); - stats.push_back(&stat); - stat.tag = "vit"; stat.format = N_("Vitality: %d"); - stats.push_back(&stat); - stat.tag = "int"; stat.format = N_("Intelligence: %d"); - stats.push_back(&stat); - stat.tag = "will"; stat.format = N_("Willpower: %d"); - stats.push_back(&stat); + std::list stats; + stats.push_back(ItemDB::Stat("str", N_("Strength: %d"))); + stats.push_back(ItemDB::Stat("agi", N_("Agility: %d"))); + stats.push_back(ItemDB::Stat("dex", N_("Dexterity: %d"))); + stats.push_back(ItemDB::Stat("vit", N_("Vitality: %d"))); + stats.push_back(ItemDB::Stat("int", N_("Intelligence: %d"))); + stats.push_back(ItemDB::Stat("will", N_("Willpower: %d"))); ItemDB::setStatsList(stats); } -- cgit v1.2.3-70-g09d2