From 7171fa7ad4ed054f4146a5426ea3cf99875bf700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= Date: Sat, 28 Oct 2017 11:04:55 +0200 Subject: [PATCH] Formatting --- CCallback.cpp | 4 ++-- CCallback.h | 8 ++++---- client/windows/CTradeWindow.cpp | 2 +- server/CGameHandler.cpp | 18 +++++++++--------- server/CGameHandler.h | 4 ++-- server/NetPacksServer.cpp | 14 +++++++------- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/CCallback.cpp b/CCallback.cpp index 3b3ff165a..d5db3435a 100644 --- a/CCallback.cpp +++ b/CCallback.cpp @@ -212,7 +212,7 @@ void CCallback::buyArtifact(const CGHeroInstance *hero, ArtifactID aid) sendRequest(&pack); } -void CCallback::trade(const CGObjectInstance *market, EMarketMode::EMarketMode mode, ui32 id1, ui32 id2, ui32 val1, const CGHeroInstance *hero) +void CCallback::trade(const CGObjectInstance * market, EMarketMode::EMarketMode mode, ui32 id1, ui32 id2, ui32 val1, const CGHeroInstance * hero) { TradeOnMarketplace pack; pack.market = market; @@ -224,7 +224,7 @@ void CCallback::trade(const CGObjectInstance *market, EMarketMode::EMarketMode m sendRequest(&pack); } -void CCallback::trade(const CGObjectInstance *market, EMarketMode::EMarketMode mode, const std::vector &id1, const std::vector &id2, const std::vector &val1, const CGHeroInstance *hero) +void CCallback::trade(const CGObjectInstance * market, EMarketMode::EMarketMode mode, const std::vector & id1, const std::vector & id2, const std::vector & val1, const CGHeroInstance * hero) { TradeOnMarketplace pack; pack.market = market; diff --git a/CCallback.h b/CCallback.h index 625405396..4cb06a675 100644 --- a/CCallback.h +++ b/CCallback.h @@ -56,8 +56,8 @@ public: virtual bool upgradeCreature(const CArmedInstance *obj, SlotID stackPos, CreatureID newID=CreatureID::NONE)=0; //if newID==-1 then best possible upgrade will be made virtual void swapGarrisonHero(const CGTownInstance *town)=0; - virtual void trade(const CGObjectInstance *market, EMarketMode::EMarketMode mode, ui32 id1, ui32 id2, ui32 val1, const CGHeroInstance *hero = nullptr)=0; //mode==0: sell val1 units of id1 resource for id2 resiurce - virtual void trade(const CGObjectInstance *market, EMarketMode::EMarketMode mode, const std::vector &id1, const std::vector &id2, const std::vector &val1, const CGHeroInstance *hero = nullptr)=0; + virtual void trade(const CGObjectInstance * market, EMarketMode::EMarketMode mode, ui32 id1, ui32 id2, ui32 val1, const CGHeroInstance * hero = nullptr)=0; //mode==0: sell val1 units of id1 resource for id2 resiurce + virtual void trade(const CGObjectInstance * market, EMarketMode::EMarketMode mode, const std::vector & id1, const std::vector & id2, const std::vector & val1, const CGHeroInstance * hero = nullptr)=0; virtual int selectionMade(int selection, QueryID queryID) =0; virtual int sendQueryReply(const JsonNode & reply, QueryID queryID) =0; @@ -139,8 +139,8 @@ public: void endTurn() override; void swapGarrisonHero(const CGTownInstance *town) override; void buyArtifact(const CGHeroInstance *hero, ArtifactID aid) override; - void trade(const CGObjectInstance *market, EMarketMode::EMarketMode mode, ui32 id1, ui32 id2, ui32 val1, const CGHeroInstance *hero = nullptr) override; - void trade(const CGObjectInstance *market, EMarketMode::EMarketMode mode, const std::vector &id1, const std::vector &id2, const std::vector &val1, const CGHeroInstance *hero = nullptr) override; + void trade(const CGObjectInstance * market, EMarketMode::EMarketMode mode, ui32 id1, ui32 id2, ui32 val1, const CGHeroInstance * hero = nullptr) override; + void trade(const CGObjectInstance * market, EMarketMode::EMarketMode mode, const std::vector & id1, const std::vector & id2, const std::vector & val1, const CGHeroInstance * hero = nullptr) override; void setFormation(const CGHeroInstance * hero, bool tight) override; void recruitHero(const CGObjectInstance *townOrTavern, const CGHeroInstance *hero) override; void save(const std::string &fname) override; diff --git a/client/windows/CTradeWindow.cpp b/client/windows/CTradeWindow.cpp index e10765b70..3b03998bc 100644 --- a/client/windows/CTradeWindow.cpp +++ b/client/windows/CTradeWindow.cpp @@ -1234,7 +1234,7 @@ void CAltarWindow::makeDeal() std::vector ids; std::vector toSacrifice; - for (int i = 0; i < sacrificedUnits.size(); i++) + for(int i = 0; i < sacrificedUnits.size(); i++) { if(sacrificedUnits[i]) { diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index c0adc75dd..d9fa6d836 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -5418,7 +5418,7 @@ void CGameHandler::visitObjectOnTile(const TerrainTile &t, const CGHeroInstance } } -bool CGameHandler::sacrificeCreatures(const IMarket *market, const CGHeroInstance *hero, const std::vector &slot, const std::vector &count) +bool CGameHandler::sacrificeCreatures(const IMarket * market, const CGHeroInstance * hero, const std::vector & slot, const std::vector & count) { if (!hero) COMPLAIN_RET("You need hero to sacrifice creature!"); @@ -5429,16 +5429,16 @@ bool CGameHandler::sacrificeCreatures(const IMarket *market, const CGHeroInstanc changePrimSkill(hero, PrimarySkill::EXPERIENCE, hero->calculateXp(expSum)); }; - for (int i = 0; i < slot.size(); ++i) + for(int i = 0; i < slot.size(); ++i) { int oldCount = hero->getStackCount(slot[i]); - if (oldCount < count[i]) + if(oldCount < count[i]) { finish(); COMPLAIN_RET("Not enough creatures to sacrifice!") } - else if (oldCount == count[i] && hero->stacksCount() == 1 && hero->needsLastStack()) + else if(oldCount == count[i] && hero->stacksCount() == 1 && hero->needsLastStack()) { finish(); COMPLAIN_RET("Cannot sacrifice last creature!"); @@ -5459,7 +5459,7 @@ bool CGameHandler::sacrificeCreatures(const IMarket *market, const CGHeroInstanc return true; } -bool CGameHandler::sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, const std::vector &slot) +bool CGameHandler::sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, const std::vector & slot) { if (!hero) COMPLAIN_RET("You need hero to sacrifice artifact!"); @@ -5470,12 +5470,12 @@ bool CGameHandler::sacrificeArtifact(const IMarket * m, const CGHeroInstance * h changePrimSkill(hero, PrimarySkill::EXPERIENCE, hero->calculateXp(expSum)); }; - for (int i = 0; i < slot.size(); ++i) + for(int i = 0; i < slot.size(); ++i) { ArtifactLocation al(hero, slot[i]); - const CArtifactInstance *a = al.getArt(); + const CArtifactInstance * a = al.getArt(); - if (!a) + if(!a) { finish(); COMPLAIN_RET("Cannot find artifact to sacrifice!"); @@ -5483,7 +5483,7 @@ bool CGameHandler::sacrificeArtifact(const IMarket * m, const CGHeroInstance * h const CArtifactInstance * art = hero->getArt(slot[i]); - if (!art) + if(!art) { finish(); COMPLAIN_RET("No artifact at position to sacrifice!"); diff --git a/server/CGameHandler.h b/server/CGameHandler.h index cdc882472..6698f5a0a 100644 --- a/server/CGameHandler.h +++ b/server/CGameHandler.h @@ -204,7 +204,7 @@ public: bool buildBoat( ObjectInstanceID objid ); bool setFormation( ObjectInstanceID hid, ui8 formation ); bool tradeResources(const IMarket *market, ui32 val, PlayerColor player, ui32 id1, ui32 id2); - bool sacrificeCreatures(const IMarket *market, const CGHeroInstance *hero, const std::vector &slot, const std::vector &count); + bool sacrificeCreatures(const IMarket * market, const CGHeroInstance * hero, const std::vector & slot, const std::vector & count); bool sendResources(ui32 val, PlayerColor player, Res::ERes r1, PlayerColor r2); bool sellCreatures(ui32 count, const IMarket *market, const CGHeroInstance * hero, SlotID slot, Res::ERes resourceID); bool transformInUndead(const IMarket *market, const CGHeroInstance * hero, SlotID slot); @@ -287,7 +287,7 @@ public: void handleAttackBeforeCasting(BattleAttack *bat); void handleAfterAttackCasting (const BattleAttack & bat); void attackCasting(const BattleAttack & bat, Bonus::BonusType attackMode, const CStack * attacker); - bool sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, const std::vector &slot); + bool sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, const std::vector & slot); void spawnWanderingMonsters(CreatureID creatureID); void handleCheatCode(std::string & cheat, PlayerColor player, const CGHeroInstance * hero, const CGTownInstance * town, bool & cheated); friend class CVCMIServer; diff --git a/server/NetPacksServer.cpp b/server/NetPacksServer.cpp index 09e8d5be1..cf1e79ec1 100644 --- a/server/NetPacksServer.cpp +++ b/server/NetPacksServer.cpp @@ -183,31 +183,31 @@ bool TradeOnMarketplace::applyGh( CGameHandler *gh ) switch(mode) { case EMarketMode::RESOURCE_RESOURCE: - for (int i = 0; i < r1.size(); ++i) + for(int i = 0; i < r1.size(); ++i) result &= gh->tradeResources(m, val[i], player, r1[i], r2[i]); break; case EMarketMode::RESOURCE_PLAYER: - for (int i = 0; i < r1.size(); ++i) + for(int i = 0; i < r1.size(); ++i) result &= gh->sendResources(val[i], player, static_cast(r1[i]), PlayerColor(r2[i])); break; case EMarketMode::CREATURE_RESOURCE: - for (int i = 0; i < r1.size(); ++i) + for(int i = 0; i < r1.size(); ++i) result &= gh->sellCreatures(val[i], m, hero, SlotID(r1[i]), static_cast(r2[i])); break; case EMarketMode::RESOURCE_ARTIFACT: - for (int i = 0; i < r1.size(); ++i) + for(int i = 0; i < r1.size(); ++i) result &= gh->buyArtifact(m, hero, static_cast(r1[i]), ArtifactID(r2[i])); break; case EMarketMode::ARTIFACT_RESOURCE: - for (int i = 0; i < r1.size(); ++i) + for(int i = 0; i < r1.size(); ++i) result &= gh->sellArtifact(m, hero, ArtifactInstanceID(r1[i]), static_cast(r2[i])); break; case EMarketMode::CREATURE_UNDEAD: - for (int i = 0; i < r1.size(); ++i) + for(int i = 0; i < r1.size(); ++i) result &= gh->transformInUndead(m, hero, SlotID(r1[i])); break; case EMarketMode::RESOURCE_SKILL: - for (int i = 0; i < r2.size(); ++i) + for(int i = 0; i < r2.size(); ++i) result &= gh->buySecSkill(m, hero, SecondarySkill(r2[i])); break; case EMarketMode::CREATURE_EXP: