mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Formatting
This commit is contained in:
parent
58b427345f
commit
7171fa7ad4
@ -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<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;
|
||||
pack.market = market;
|
||||
|
@ -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<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, 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 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<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, 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 setFormation(const CGHeroInstance * hero, bool tight) override;
|
||||
void recruitHero(const CGObjectInstance *townOrTavern, const CGHeroInstance *hero) override;
|
||||
void save(const std::string &fname) override;
|
||||
|
@ -1234,7 +1234,7 @@ void CAltarWindow::makeDeal()
|
||||
std::vector<ui32> ids;
|
||||
std::vector<ui32> toSacrifice;
|
||||
|
||||
for (int i = 0; i < sacrificedUnits.size(); i++)
|
||||
for(int i = 0; i < sacrificedUnits.size(); i++)
|
||||
{
|
||||
if(sacrificedUnits[i])
|
||||
{
|
||||
|
@ -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)
|
||||
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<ArtifactPosition> &slot)
|
||||
bool CGameHandler::sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, const std::vector<ArtifactPosition> & 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!");
|
||||
|
@ -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<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 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<ArtifactPosition> &slot);
|
||||
bool sacrificeArtifact(const IMarket * m, const CGHeroInstance * hero, const std::vector<ArtifactPosition> & slot);
|
||||
void spawnWanderingMonsters(CreatureID creatureID);
|
||||
void handleCheatCode(std::string & cheat, PlayerColor player, const CGHeroInstance * hero, const CGTownInstance * town, bool & cheated);
|
||||
friend class CVCMIServer;
|
||||
|
@ -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<Res::ERes>(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<Res::ERes>(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<Res::ERes>(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<Res::ERes>(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:
|
||||
|
Loading…
Reference in New Issue
Block a user