1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Code style: use parentheses for creating heap-based objects (#344)

This commit is contained in:
ArseniyShestakov 2017-07-16 12:58:05 +03:00 committed by GitHub
parent 21c0c95049
commit b52cfe5283
26 changed files with 59 additions and 59 deletions

View File

@ -13,7 +13,7 @@
int AttackPossibility::damageDiff() const int AttackPossibility::damageDiff() const
{ {
if (!priorities) if (!priorities)
priorities = new Priorities; priorities = new Priorities();
const auto dealtDmgValue = priorities->stackEvaluator(enemy) * damageDealt; const auto dealtDmgValue = priorities->stackEvaluator(enemy) * damageDealt;
const auto receivedDmgValue = priorities->stackEvaluator(attack.attacker) * damageReceived; const auto receivedDmgValue = priorities->stackEvaluator(attack.attacker) * damageReceived;
return dealtDmgValue - receivedDmgValue; return dealtDmgValue - receivedDmgValue;

View File

@ -352,7 +352,7 @@ SDL_Surface * CDefHandler::getSprite (int SIndex, const ui8 * FDef, const SDL_Co
CDefEssential * CDefHandler::essentialize() CDefEssential * CDefHandler::essentialize()
{ {
auto ret = new CDefEssential; auto ret = new CDefEssential();
ret->ourImages = ourImages; ret->ourImages = ourImages;
notFreeImgs = true; notFreeImgs = true;
return ret; return ret;

View File

@ -175,7 +175,7 @@ void init()
if(!settings["session"]["headless"].Bool()) if(!settings["session"]["headless"].Bool())
{ {
pomtime.getDiff(); pomtime.getDiff();
CCS->curh = new CCursorHandler; CCS->curh = new CCursorHandler();
graphics = new Graphics(); // should be before curh->init() graphics = new Graphics(); // should be before curh->init()
CCS->curh->initCursor(); CCS->curh->initCursor();
@ -313,7 +313,7 @@ int main(int argc, char** argv)
// Init old logging system and new (temporary) logging system // Init old logging system and new (temporary) logging system
CStopWatch total, pomtime; CStopWatch total, pomtime;
std::cout.flags(std::ios::unitbuf); std::cout.flags(std::ios::unitbuf);
console = new CConsoleHandler; console = new CConsoleHandler();
*console->cb = processCommand; *console->cb = processCommand;
console->start(); console->start();
@ -456,25 +456,25 @@ int main(int argc, char** argv)
logGlobal->infoStream() <<"\tInitializing screen: "<<pomtime.getDiff(); logGlobal->infoStream() <<"\tInitializing screen: "<<pomtime.getDiff();
} }
CCS = new CClientState; CCS = new CClientState();
CGI = new CGameInfo; //contains all global informations about game (texts, lodHandlers, map handler etc.) CGI = new CGameInfo(); //contains all global informations about game (texts, lodHandlers, map handler etc.)
// Initialize video // Initialize video
#ifdef DISABLE_VIDEO #ifdef DISABLE_VIDEO
CCS->videoh = new CEmptyVideoPlayer; CCS->videoh = new CEmptyVideoPlayer();
#else #else
if (!settings["session"]["headless"].Bool() && !vm.count("disable-video")) if (!settings["session"]["headless"].Bool() && !vm.count("disable-video"))
CCS->videoh = new CVideoPlayer; CCS->videoh = new CVideoPlayer();
else else
CCS->videoh = new CEmptyVideoPlayer; CCS->videoh = new CEmptyVideoPlayer();
#endif #endif
logGlobal->infoStream()<<"\tInitializing video: "<<pomtime.getDiff(); logGlobal->infoStream()<<"\tInitializing video: "<<pomtime.getDiff();
//initializing audio //initializing audio
CCS->soundh = new CSoundHandler; CCS->soundh = new CSoundHandler();
CCS->soundh->init(); CCS->soundh->init();
CCS->soundh->setVolume(settings["general"]["sound"].Float()); CCS->soundh->setVolume(settings["general"]["sound"].Float());
CCS->musich = new CMusicHandler; CCS->musich = new CMusicHandler();
CCS->musich->init(); CCS->musich->init();
CCS->musich->setVolume(settings["general"]["music"].Float()); CCS->musich->setVolume(settings["general"]["music"].Float());
logGlobal->infoStream()<<"Initializing screen and sound handling: "<<pomtime.getDiff(); logGlobal->infoStream()<<"Initializing screen and sound handling: "<<pomtime.getDiff();

View File

@ -124,7 +124,7 @@ CPlayerInterface::CPlayerInterface(PlayerColor Player)
battleInt = nullptr; battleInt = nullptr;
makingTurn = false; makingTurn = false;
showingDialog = new CondSh<bool>(false); showingDialog = new CondSh<bool>(false);
cingconsole = new CInGameConsole; cingconsole = new CInGameConsole();
GH.terminate_cond.set(false); GH.terminate_cond.set(false);
firstCall = 1; //if loading will be overwritten in serialize firstCall = 1; //if loading will be overwritten in serialize
autosaveCount = 0; autosaveCount = 0;

View File

@ -190,7 +190,7 @@ public:
virtual ~CBaseForPGApply(){}; virtual ~CBaseForPGApply(){};
template<typename U> static CBaseForPGApply *getApplier(const U * t=nullptr) template<typename U> static CBaseForPGApply *getApplier(const U * t=nullptr)
{ {
return new CApplyOnPG<U>; return new CApplyOnPG<U>();
} }
}; };
@ -573,7 +573,7 @@ CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EGameM
CServerHandler *sh = nullptr; CServerHandler *sh = nullptr;
if(isHost()) if(isHost())
{ {
sh = new CServerHandler; sh = new CServerHandler();
sh->startServer(); sh->startServer();
} }
@ -722,7 +722,7 @@ CSelectionScreen::CSelectionScreen(CMenuScreen::EState Type, CMenuScreen::EGameM
*serv << &uso; *serv << &uso;
} }
applier = new CApplier<CBaseForPGApply>; applier = new CApplier<CBaseForPGApply>();
registerTypesPregamePacks(*applier); registerTypesPregamePacks(*applier);
serverHandlingThread = new boost::thread(&CSelectionScreen::handleConnection, this); serverHandlingThread = new boost::thread(&CSelectionScreen::handleConnection, this);
} }

View File

@ -71,7 +71,7 @@ public:
template<typename U> static CBaseForCLApply *getApplier(const U * t=nullptr) template<typename U> static CBaseForCLApply *getApplier(const U * t=nullptr)
{ {
return new CApplyOnCL<U>; return new CApplyOnCL<U>();
} }
}; };
@ -117,7 +117,7 @@ void CClient::init()
connectionHandler.reset(); connectionHandler.reset();
} }
pathInfo = nullptr; pathInfo = nullptr;
applier = new CApplier<CBaseForCLApply>; applier = new CApplier<CBaseForCLApply>();
registerTypesClientPacks1(*applier); registerTypesClientPacks1(*applier);
registerTypesClientPacks2(*applier); registerTypesClientPacks2(*applier);
IObjectInterface::cb = this; IObjectInterface::cb = this;

View File

@ -1383,7 +1383,7 @@ CBattleInterface::PossibleActions CBattleInterface::getCasterAction(const CSpell
void CBattleInterface::castThisSpell(SpellID spellID) void CBattleInterface::castThisSpell(SpellID spellID)
{ {
auto ba = new BattleAction; auto ba = new BattleAction();
ba->actionType = Battle::HERO_SPELL; ba->actionType = Battle::HERO_SPELL;
ba->additionalInfo = spellID; //spell number ba->additionalInfo = spellID; //spell number
ba->destinationTile = -1; ba->destinationTile = -1;

View File

@ -715,7 +715,7 @@ CAdvMapInt::~CAdvMapInt()
void CAdvMapInt::fshowOverview() void CAdvMapInt::fshowOverview()
{ {
GH.pushInt(new CKingdomInterface); GH.pushInt(new CKingdomInterface());
} }
void CAdvMapInt::fworldViewBack() void CAdvMapInt::fworldViewBack()
@ -808,7 +808,7 @@ void CAdvMapInt::fshowSpellbok()
void CAdvMapInt::fadventureOPtions() void CAdvMapInt::fadventureOPtions()
{ {
GH.pushInt(new CAdventureOptions); GH.pushInt(new CAdventureOptions());
} }
void CAdvMapInt::fsystemOptions() void CAdvMapInt::fsystemOptions()

View File

@ -1323,7 +1323,7 @@ CHallInterface::CHallInterface(const CGTownInstance *Town):
{ {
OBJ_CONSTRUCTION_CAPTURING_ALL; OBJ_CONSTRUCTION_CAPTURING_ALL;
resdatabar = new CMinorResDataBar; resdatabar = new CMinorResDataBar();
resdatabar->pos.x += pos.x; resdatabar->pos.x += pos.x;
resdatabar->pos.y += pos.y; resdatabar->pos.y += pos.y;
Rect barRect(5, 556, 740, 18); Rect barRect(5, 556, 740, 18);
@ -1498,7 +1498,7 @@ CFortScreen::CFortScreen(const CGTownInstance * town):
recAreas.push_back(new RecruitArea(positions[i].x, positions[i].y, town, i)); recAreas.push_back(new RecruitArea(positions[i].x, positions[i].y, town, i));
} }
resdatabar = new CMinorResDataBar; resdatabar = new CMinorResDataBar();
resdatabar->pos.x += pos.x; resdatabar->pos.x += pos.x;
resdatabar->pos.y += pos.y; resdatabar->pos.y += pos.y;
@ -1671,7 +1671,7 @@ CMageGuildScreen::CMageGuildScreen(CCastleInterface * owner,std::string imagem)
window = new CPicture(owner->town->town->clientInfo.guildWindow , 332, 76); window = new CPicture(owner->town->town->clientInfo.guildWindow , 332, 76);
resdatabar = new CMinorResDataBar; resdatabar = new CMinorResDataBar();
resdatabar->pos.x += pos.x; resdatabar->pos.x += pos.x;
resdatabar->pos.y += pos.y; resdatabar->pos.y += pos.y;
Rect barRect(7, 556, 737, 18); Rect barRect(7, 556, 737, 18);

View File

@ -40,7 +40,7 @@
const TBonusListPtr CHeroWithMaybePickedArtifact::getAllBonuses(const CSelector &selector, const CSelector &limit, const CBonusSystemNode *root, const std::string & cachingStr) const const TBonusListPtr CHeroWithMaybePickedArtifact::getAllBonuses(const CSelector &selector, const CSelector &limit, const CBonusSystemNode *root, const std::string & cachingStr) const
{ {
TBonusListPtr out(new BonusList); TBonusListPtr out(new BonusList());
TBonusListPtr heroBonuses = hero->getAllBonuses(selector, limit, hero); TBonusListPtr heroBonuses = hero->getAllBonuses(selector, limit, hero);
TBonusListPtr bonusesFromPickedUpArtifact; TBonusListPtr bonusesFromPickedUpArtifact;
@ -50,7 +50,7 @@ const TBonusListPtr CHeroWithMaybePickedArtifact::getAllBonuses(const CSelector
bonusesFromPickedUpArtifact = cp->src.art->getAllBonuses(selector, limit, hero); bonusesFromPickedUpArtifact = cp->src.art->getAllBonuses(selector, limit, hero);
} }
else else
bonusesFromPickedUpArtifact = TBonusListPtr(new BonusList); bonusesFromPickedUpArtifact = TBonusListPtr(new BonusList());
for(auto b : *bonusesFromPickedUpArtifact) for(auto b : *bonusesFromPickedUpArtifact)
*heroBonuses -= b; *heroBonuses -= b;

View File

@ -73,7 +73,7 @@ InfoBox::InfoBox(Point position, InfoPos Pos, InfoSize Size, IInfoBoxData *Data)
if (value) if (value)
pos = pos | value->pos; pos = pos | value->pos;
hover = new CHoverableArea; hover = new CHoverableArea();
hover->hoverText = data->getHoverText(); hover->hoverText = data->getHoverText();
hover->pos = pos; hover->pos = pos;
} }
@ -599,7 +599,7 @@ void CKingdomInterface::generateMinesList(const std::vector<const CGObjectInstan
minesBox[i]->removeUsedEvents(LCLICK|RCLICK); //fixes #890 - mines boxes ignore clicks minesBox[i]->removeUsedEvents(LCLICK|RCLICK); //fixes #890 - mines boxes ignore clicks
} }
incomeArea = new CHoverableArea; incomeArea = new CHoverableArea();
incomeArea->pos = Rect(pos.x+580, pos.y+31+footerPos, 136, 68); incomeArea->pos = Rect(pos.x+580, pos.y+31+footerPos, 136, 68);
incomeArea->hoverText = CGI->generaltexth->allTexts[255]; incomeArea->hoverText = CGI->generaltexth->allTexts[255];
incomeAmount = new CLabel(628, footerPos + 70, FONT_SMALL, TOPLEFT, Colors::WHITE, boost::lexical_cast<std::string>(totalIncome)); incomeAmount = new CLabel(628, footerPos + 70, FONT_SMALL, TOPLEFT, Colors::WHITE, boost::lexical_cast<std::string>(totalIncome));
@ -866,9 +866,9 @@ CHeroItem::CHeroItem(const CGHeroInstance* Hero):
OBJ_CONSTRUCTION_CAPTURING_ALL; OBJ_CONSTRUCTION_CAPTURING_ALL;
artTabs.resize(3); artTabs.resize(3);
auto arts1 = new ArtSlotsTab; auto arts1 = new ArtSlotsTab();
auto arts2 = new ArtSlotsTab; auto arts2 = new ArtSlotsTab();
auto backpack = new BackpackTab; auto backpack = new BackpackTab();
artTabs[0] = arts1; artTabs[0] = arts1;
artTabs[1] = arts2; artTabs[1] = arts2;
artTabs[2] = backpack; artTabs[2] = backpack;

View File

@ -215,7 +215,7 @@ void CWindowObject::setShadow(bool on)
blitAlphaRow(shadowRight, 0); blitAlphaRow(shadowRight, 0);
//generate "shadow" object with these 3 pieces in it //generate "shadow" object with these 3 pieces in it
shadow = new CIntObject; shadow = new CIntObject();
shadow->addChild(new CPicture(shadowCorner, shadowPos.x, shadowPos.y)); shadow->addChild(new CPicture(shadowCorner, shadowPos.x, shadowPos.y));
shadow->addChild(new CPicture(shadowRight, shadowPos.x, shadowStart.y)); shadow->addChild(new CPicture(shadowRight, shadowPos.x, shadowStart.y));
shadow->addChild(new CPicture(shadowBottom, shadowStart.x, shadowPos.y)); shadow->addChild(new CPicture(shadowBottom, shadowStart.x, shadowPos.y));

View File

@ -21,7 +21,7 @@
void MainWindow::load() void MainWindow::load()
{ {
console = new CConsoleHandler; console = new CConsoleHandler();
CBasicLogConfigurator logConfig(VCMIDirs::get().userCachePath() / "VCMI_Launcher_log.txt", console); CBasicLogConfigurator logConfig(VCMIDirs::get().userCachePath() / "VCMI_Launcher_log.txt", console);
logConfig.configureDefault(); logConfig.configureDefault();

View File

@ -55,7 +55,7 @@ public:
virtual ~CBaseForGSApply(){}; virtual ~CBaseForGSApply(){};
template<typename U> static CBaseForGSApply *getApplier(const U * t=nullptr) template<typename U> static CBaseForGSApply *getApplier(const U * t=nullptr)
{ {
return new CApplyOnGS<U>; return new CApplyOnGS<U>();
} }
}; };
@ -295,10 +295,10 @@ static CGObjectInstance * createObject(Obj id, int subid, int3 pos, PlayerColor
break; break;
} }
case Obj::TOWN: case Obj::TOWN:
nobj = new CGTownInstance; nobj = new CGTownInstance();
break; break;
default: //rest of objects default: //rest of objects
nobj = new CGObjectInstance; nobj = new CGObjectInstance();
break; break;
} }
nobj->ID = id; nobj->ID = id;
@ -679,10 +679,10 @@ int CGameState::getDate(Date::EDateType mode) const
CGameState::CGameState() CGameState::CGameState()
{ {
gs = this; gs = this;
applierGs = new CApplier<CBaseForGSApply>; applierGs = new CApplier<CBaseForGSApply>();
registerTypesClientPacks1(*applierGs); registerTypesClientPacks1(*applierGs);
registerTypesClientPacks2(*applierGs); registerTypesClientPacks2(*applierGs);
//objCaller = new CObjectCallersHandler; //objCaller = new CObjectCallersHandler();
globalEffects.setDescription("Global effects"); globalEffects.setDescription("Global effects");
globalEffects.setNodeType(CBonusSystemNode::GLOBAL_EFFECTS); globalEffects.setNodeType(CBonusSystemNode::GLOBAL_EFFECTS);
day = 0; day = 0;
@ -2968,7 +2968,7 @@ void InfoAboutHero::initFromHero(const CGHeroInstance *h, InfoAboutHero::EInfoLe
if(detailed) if(detailed)
{ {
//include details about hero //include details about hero
details = new Details; details = new Details();
details->luck = h->LuckVal(); details->luck = h->LuckVal();
details->morale = h->MoraleVal(); details->morale = h->MoraleVal();
details->mana = h->mana; details->mana = h->mana;
@ -3022,7 +3022,7 @@ void InfoAboutTown::initFromTown(const CGTownInstance *t, bool detailed)
if(detailed) if(detailed)
{ {
//include details about hero //include details about hero
details = new Details; details = new Details();
TResources income = t->dailyIncome(); TResources income = t->dailyIncome();
details->goldIncome = income[Res::GOLD]; details->goldIncome = income[Res::GOLD];
details->customRes = t->hasBuilt(BuildingID::RESOURCE_SILO); details->customRes = t->hasBuilt(BuildingID::RESOURCE_SILO);

View File

@ -269,8 +269,8 @@ float CLegacyConfigParser::readNumber()
std::istringstream stream(input); std::istringstream stream(input);
if (input.find(',') != std::string::npos) // code to handle conversion with comma as decimal separator if(input.find(',') != std::string::npos) // code to handle conversion with comma as decimal separator
stream.imbue(std::locale(std::locale(), new LocaleWithComma)); stream.imbue(std::locale(std::locale(), new LocaleWithComma()));
float result; float result;
if ( !(stream >> result) ) if ( !(stream >> result) )

View File

@ -294,7 +294,7 @@ CHeroHandler::CHeroHandler()
CHero * CHeroHandler::loadFromJson(const JsonNode & node, const std::string & identifier) CHero * CHeroHandler::loadFromJson(const JsonNode & node, const std::string & identifier)
{ {
auto hero = new CHero; auto hero = new CHero();
hero->identifier = identifier; hero->identifier = identifier;
hero->sex = node["female"].Bool(); hero->sex = node["female"].Bool();
hero->special = node["special"].Bool(); hero->special = node["special"].Bool();

View File

@ -327,7 +327,7 @@ void CTownHandler::loadBuildingRequirements(CBuilding * building, const JsonNode
void CTownHandler::loadBuilding(CTown * town, const std::string & stringID, const JsonNode & source) void CTownHandler::loadBuilding(CTown * town, const std::string & stringID, const JsonNode & source)
{ {
auto ret = new CBuilding; auto ret = new CBuilding();
static const std::string modes [] = {"normal", "auto", "special", "grail"}; static const std::string modes [] = {"normal", "auto", "special", "grail"};
@ -406,7 +406,7 @@ void CTownHandler::loadBuildings(CTown * town, const JsonNode & source)
void CTownHandler::loadStructure(CTown &town, const std::string & stringID, const JsonNode & source) void CTownHandler::loadStructure(CTown &town, const std::string & stringID, const JsonNode & source)
{ {
auto ret = new CStructure; auto ret = new CStructure();
ret->building = nullptr; ret->building = nullptr;
ret->buildable = nullptr; ret->buildable = nullptr;
@ -706,7 +706,7 @@ CFaction * CTownHandler::loadFromJson(const JsonNode &source, const std::string
if (!source["town"].isNull()) if (!source["town"].isNull())
{ {
faction->town = new CTown; faction->town = new CTown();
faction->town->faction = faction; faction->town->faction = faction;
loadTown(*faction->town, source["town"]); loadTown(*faction->town, source["town"]);
} }

View File

@ -35,7 +35,7 @@ LibClasses * VLC = nullptr;
DLL_LINKAGE void preinitDLL(CConsoleHandler *Console) DLL_LINKAGE void preinitDLL(CConsoleHandler *Console)
{ {
console = Console; console = Console;
VLC = new LibClasses; VLC = new LibClasses();
try try
{ {
VLC->loadFilesystem(); VLC->loadFilesystem();
@ -169,8 +169,8 @@ LibClasses::LibClasses()
void LibClasses::callWhenDeserializing() void LibClasses::callWhenDeserializing()
{ {
// FIXME: check if any of these are needed //FIXME: check if any of these are needed
//generaltexth = new CGeneralTextHandler; //generaltexth = new CGeneralTextHandler();
//generaltexth->load(); //generaltexth->load();
//arth->load(true); //arth->load(true);
//modh->recreateHandlers(); //modh->recreateHandlers();

View File

@ -93,7 +93,7 @@ CCompressedStream::CCompressedStream(std::unique_ptr<CInputStream> stream, bool
assert(gzipStream); assert(gzipStream);
// Allocate inflate state // Allocate inflate state
inflateState = new z_stream; inflateState = new z_stream();
inflateState->zalloc = Z_NULL; inflateState->zalloc = Z_NULL;
inflateState->zfree = Z_NULL; inflateState->zfree = Z_NULL;
inflateState->opaque = Z_NULL; inflateState->opaque = Z_NULL;

View File

@ -126,7 +126,7 @@ ISimpleResourceLoader * CResourceHandler::createInitial()
{ {
//temporary filesystem that will be used to initialize main one. //temporary filesystem that will be used to initialize main one.
//used to solve several case-sensivity issues like Mp3 vs MP3 //used to solve several case-sensivity issues like Mp3 vs MP3
auto initialLoader = new CFilesystemList; auto initialLoader = new CFilesystemList();
//recurse only into specific directories //recurse only into specific directories
auto recurseInDir = [&](std::string URI, int depth) auto recurseInDir = [&](std::string URI, int depth)

View File

@ -26,7 +26,7 @@
CObjectClassesHandler::CObjectClassesHandler() CObjectClassesHandler::CObjectClassesHandler()
{ {
#define SET_HANDLER_CLASS(STRING, CLASSNAME) handlerConstructors[STRING] = std::make_shared<CLASSNAME>; #define SET_HANDLER_CLASS(STRING, CLASSNAME) handlerConstructors[STRING] = std::make_shared<CLASSNAME>;
#define SET_HANDLER(STRING, TYPENAME) handlerConstructors[STRING] = std::make_shared<CDefaultObjectTypeHandler<TYPENAME> > #define SET_HANDLER(STRING, TYPENAME) handlerConstructors[STRING] = std::make_shared<CDefaultObjectTypeHandler<TYPENAME>>
// list of all known handlers, hardcoded for now since the only way to add new objects is via C++ code // list of all known handlers, hardcoded for now since the only way to add new objects is via C++ code
//Note: should be in sync with registerTypesMapObjectTypes function //Note: should be in sync with registerTypesMapObjectTypes function

View File

@ -50,8 +50,8 @@ void CConnection::init()
oser & std::string("Aiya!\n") & name & myEndianess; //identify ourselves oser & std::string("Aiya!\n") & name & myEndianess; //identify ourselves
iser & pom & pom & contactEndianess; iser & pom & pom & contactEndianess;
logNetwork->infoStream() << "Established connection with "<<pom; logNetwork->infoStream() << "Established connection with "<<pom;
wmx = new boost::mutex; wmx = new boost::mutex();
rmx = new boost::mutex; rmx = new boost::mutex();
handler = nullptr; handler = nullptr;
receivedStop = sendStop = false; receivedStop = sendStop = false;

View File

@ -382,7 +382,7 @@ void ERMInterpreter::scanForScripts()
if (ext == ".ERM" || ext == ".VERM") if (ext == ".ERM" || ext == ".VERM")
{ {
ERMParser ep(dir->path().string()); ERMParser ep(dir->path().string());
FileInfo * finfo = new FileInfo; FileInfo * finfo = new FileInfo();
finfo->filename = dir->path().string(); finfo->filename = dir->path().string();
std::vector<LineInfo> buf = ep.parseFile(); std::vector<LineInfo> buf = ep.parseFile();

View File

@ -86,7 +86,7 @@ public:
virtual ~CBaseForGHApply(){} virtual ~CBaseForGHApply(){}
template<typename U> static CBaseForGHApply *getApplier(const U * t=nullptr) template<typename U> static CBaseForGHApply *getApplier(const U * t=nullptr)
{ {
return new CApplyOnGH<U>; return new CApplyOnGH<U>();
} }
}; };
@ -1397,7 +1397,7 @@ CGameHandler::CGameHandler(void)
QID = 1; QID = 1;
//gs = nullptr; //gs = nullptr;
IObjectInterface::cb = this; IObjectInterface::cb = this;
applier = new CApplier<CBaseForGHApply>; applier = new CApplier<CBaseForGHApply>();
registerTypesServerPacks(*applier); registerTypesServerPacks(*applier);
visitObjectAfterVictory = false; visitObjectAfterVictory = false;
@ -6057,7 +6057,7 @@ void CGameHandler::setBattleResult(BattleResult::EResult resultType, int victori
% battleResult.data->result % resultType).str()); % battleResult.data->result % resultType).str());
return; return;
} }
auto br = new BattleResult; auto br = new BattleResult();
br->result = resultType; br->result = resultType;
br->winner = victoriusSide; //surrendering side loses br->winner = victoriusSide; //surrendering side loses
gs->curB->calculateCasualties(br->casualties); gs->curB->calculateCasualties(br->casualties);

View File

@ -615,7 +615,7 @@ int main(int argc, char** argv)
signal(SIGSEGV, handleLinuxSignal); signal(SIGSEGV, handleLinuxSignal);
#endif #endif
console = new CConsoleHandler; console = new CConsoleHandler();
CBasicLogConfigurator logConfig(VCMIDirs::get().userCachePath() / "VCMI_Server_log.txt", console); CBasicLogConfigurator logConfig(VCMIDirs::get().userCachePath() / "VCMI_Server_log.txt", console);
logConfig.configureDefault(); logConfig.configureDefault();
logGlobal->info(NAME); logGlobal->info(NAME);

View File

@ -23,7 +23,7 @@
CVcmiTestConfig::CVcmiTestConfig() CVcmiTestConfig::CVcmiTestConfig()
{ {
console = new CConsoleHandler; console = new CConsoleHandler();
CBasicLogConfigurator logConfig(VCMIDirs::get().userCachePath() / "VCMI_Test_log.txt", console); CBasicLogConfigurator logConfig(VCMIDirs::get().userCachePath() / "VCMI_Test_log.txt", console);
logConfig.configureDefault(); logConfig.configureDefault();
preinitDLL(console); preinitDLL(console);