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

Formatting

This commit is contained in:
Piotr Wójcik 2017-10-28 11:04:55 +02:00
parent 58b427345f
commit 7171fa7ad4
6 changed files with 25 additions and 25 deletions

View File

@ -212,7 +212,7 @@ void CCallback::buyArtifact(const CGHeroInstance *hero, ArtifactID aid)
sendRequest(&pack); 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; TradeOnMarketplace pack;
pack.market = market; pack.market = market;
@ -224,7 +224,7 @@ void CCallback::trade(const CGObjectInstance *market, EMarketMode::EMarketMode m
sendRequest(&pack); sendRequest(&pack);
} }
void CCallback::trade(const CGObjectInstance *market, EMarketMode::EMarketMode mode, const std::vector<ui32> &id1, const std::vector<ui32> &id2, const std::vector<ui32> &val1, const CGHeroInstance *hero) void CCallback::trade(const CGObjectInstance * market, EMarketMode::EMarketMode mode, const std::vector<ui32> & id1, const std::vector<ui32> & id2, const std::vector<ui32> & val1, const CGHeroInstance * hero)
{ {
TradeOnMarketplace pack; TradeOnMarketplace pack;
pack.market = market; pack.market = market;

View File

@ -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 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 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, 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<ui32> &id1, const std::vector<ui32> &id2, const std::vector<ui32> &val1, const CGHeroInstance *hero = nullptr)=0; virtual void trade(const CGObjectInstance * market, EMarketMode::EMarketMode mode, const std::vector<ui32> & id1, const std::vector<ui32> & id2, const std::vector<ui32> & val1, const CGHeroInstance * hero = nullptr)=0;
virtual int selectionMade(int selection, QueryID queryID) =0; virtual int selectionMade(int selection, QueryID queryID) =0;
virtual int sendQueryReply(const JsonNode & reply, QueryID queryID) =0; virtual int sendQueryReply(const JsonNode & reply, QueryID queryID) =0;
@ -139,8 +139,8 @@ public:
void endTurn() override; void endTurn() override;
void swapGarrisonHero(const CGTownInstance *town) override; void swapGarrisonHero(const CGTownInstance *town) override;
void buyArtifact(const CGHeroInstance *hero, ArtifactID aid) 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, ui32 id1, ui32 id2, ui32 val1, const CGHeroInstance * hero = nullptr) override;
void trade(const CGObjectInstance *market, EMarketMode::EMarketMode mode, const std::vector<ui32> &id1, const std::vector<ui32> &id2, const std::vector<ui32> &val1, const CGHeroInstance *hero = nullptr) override; void trade(const CGObjectInstance * market, EMarketMode::EMarketMode mode, const std::vector<ui32> & id1, const std::vector<ui32> & id2, const std::vector<ui32> & val1, const CGHeroInstance * hero = nullptr) override;
void setFormation(const CGHeroInstance * hero, bool tight) override; void setFormation(const CGHeroInstance * hero, bool tight) override;
void recruitHero(const CGObjectInstance *townOrTavern, const CGHeroInstance *hero) override; void recruitHero(const CGObjectInstance *townOrTavern, const CGHeroInstance *hero) override;
void save(const std::string &fname) override; void save(const std::string &fname) override;

View File

@ -1234,7 +1234,7 @@ void CAltarWindow::makeDeal()
std::vector<ui32> ids; std::vector<ui32> ids;
std::vector<ui32> toSacrifice; std::vector<ui32> toSacrifice;
for (int i = 0; i < sacrificedUnits.size(); i++) for(int i = 0; i < sacrificedUnits.size(); i++)
{ {
if(sacrificedUnits[i]) if(sacrificedUnits[i])
{ {

View File

@ -5418,7 +5418,7 @@ void CGameHandler::visitObjectOnTile(const TerrainTile &t, const CGHeroInstance
} }
} }
bool CGameHandler::sacrificeCreatures(const IMarket *market, const CGHeroInstance *hero, const std::vector<SlotID> &slot, const std::vector<ui32> &count) bool CGameHandler::sacrificeCreatures(const IMarket * market, const CGHeroInstance * hero, const std::vector<SlotID> & slot, const std::vector<ui32> & count)
{ {
if (!hero) if (!hero)
COMPLAIN_RET("You need hero to sacrifice creature!"); 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)); 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]); int oldCount = hero->getStackCount(slot[i]);
if (oldCount < count[i]) if(oldCount < count[i])
{ {
finish(); finish();
COMPLAIN_RET("Not enough creatures to sacrifice!") 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(); finish();
COMPLAIN_RET("Cannot sacrifice last creature!"); COMPLAIN_RET("Cannot sacrifice last creature!");
@ -5459,7 +5459,7 @@ bool CGameHandler::sacrificeCreatures(const IMarket *market, const CGHeroInstanc
return true; return true;
} }
bool CGameHandler::sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, const std::vector<ArtifactPosition> &slot) bool CGameHandler::sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, const std::vector<ArtifactPosition> & slot)
{ {
if (!hero) if (!hero)
COMPLAIN_RET("You need hero to sacrifice artifact!"); 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)); 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]); ArtifactLocation al(hero, slot[i]);
const CArtifactInstance *a = al.getArt(); const CArtifactInstance * a = al.getArt();
if (!a) if(!a)
{ {
finish(); finish();
COMPLAIN_RET("Cannot find artifact to sacrifice!"); 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]); const CArtifactInstance * art = hero->getArt(slot[i]);
if (!art) if(!art)
{ {
finish(); finish();
COMPLAIN_RET("No artifact at position to sacrifice!"); COMPLAIN_RET("No artifact at position to sacrifice!");

View File

@ -204,7 +204,7 @@ public:
bool buildBoat( ObjectInstanceID objid ); bool buildBoat( ObjectInstanceID objid );
bool setFormation( ObjectInstanceID hid, ui8 formation ); bool setFormation( ObjectInstanceID hid, ui8 formation );
bool tradeResources(const IMarket *market, ui32 val, PlayerColor player, ui32 id1, ui32 id2); bool tradeResources(const IMarket *market, ui32 val, PlayerColor player, ui32 id1, ui32 id2);
bool sacrificeCreatures(const IMarket *market, const CGHeroInstance *hero, const std::vector<SlotID> &slot, const std::vector<ui32> &count); bool sacrificeCreatures(const IMarket * market, const CGHeroInstance * hero, const std::vector<SlotID> & slot, const std::vector<ui32> & count);
bool sendResources(ui32 val, PlayerColor player, Res::ERes r1, PlayerColor r2); 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 sellCreatures(ui32 count, const IMarket *market, const CGHeroInstance * hero, SlotID slot, Res::ERes resourceID);
bool transformInUndead(const IMarket *market, const CGHeroInstance * hero, SlotID slot); bool transformInUndead(const IMarket *market, const CGHeroInstance * hero, SlotID slot);
@ -287,7 +287,7 @@ public:
void handleAttackBeforeCasting(BattleAttack *bat); void handleAttackBeforeCasting(BattleAttack *bat);
void handleAfterAttackCasting (const BattleAttack & bat); void handleAfterAttackCasting (const BattleAttack & bat);
void attackCasting(const BattleAttack & bat, Bonus::BonusType attackMode, const CStack * attacker); void attackCasting(const BattleAttack & bat, Bonus::BonusType attackMode, const CStack * attacker);
bool sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, const std::vector<ArtifactPosition> &slot); bool sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, const std::vector<ArtifactPosition> & slot);
void spawnWanderingMonsters(CreatureID creatureID); void spawnWanderingMonsters(CreatureID creatureID);
void handleCheatCode(std::string & cheat, PlayerColor player, const CGHeroInstance * hero, const CGTownInstance * town, bool & cheated); void handleCheatCode(std::string & cheat, PlayerColor player, const CGHeroInstance * hero, const CGTownInstance * town, bool & cheated);
friend class CVCMIServer; friend class CVCMIServer;

View File

@ -183,31 +183,31 @@ bool TradeOnMarketplace::applyGh( CGameHandler *gh )
switch(mode) switch(mode)
{ {
case EMarketMode::RESOURCE_RESOURCE: 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]); result &= gh->tradeResources(m, val[i], player, r1[i], r2[i]);
break; break;
case EMarketMode::RESOURCE_PLAYER: 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<Res::ERes>(r1[i]), PlayerColor(r2[i])); result &= gh->sendResources(val[i], player, static_cast<Res::ERes>(r1[i]), PlayerColor(r2[i]));
break; break;
case EMarketMode::CREATURE_RESOURCE: 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<Res::ERes>(r2[i])); result &= gh->sellCreatures(val[i], m, hero, SlotID(r1[i]), static_cast<Res::ERes>(r2[i]));
break; break;
case EMarketMode::RESOURCE_ARTIFACT: 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<Res::ERes>(r1[i]), ArtifactID(r2[i])); result &= gh->buyArtifact(m, hero, static_cast<Res::ERes>(r1[i]), ArtifactID(r2[i]));
break; break;
case EMarketMode::ARTIFACT_RESOURCE: 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<Res::ERes>(r2[i])); result &= gh->sellArtifact(m, hero, ArtifactInstanceID(r1[i]), static_cast<Res::ERes>(r2[i]));
break; break;
case EMarketMode::CREATURE_UNDEAD: 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])); result &= gh->transformInUndead(m, hero, SlotID(r1[i]));
break; break;
case EMarketMode::RESOURCE_SKILL: 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])); result &= gh->buySecSkill(m, hero, SecondarySkill(r2[i]));
break; break;
case EMarketMode::CREATURE_EXP: case EMarketMode::CREATURE_EXP: