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

Change variables type

This commit is contained in:
Piotr Wójcik 2017-10-18 21:02:23 +02:00
parent 802680f925
commit 78e5d39ea0
3 changed files with 15 additions and 15 deletions

View File

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

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, int id1, int id2, int 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, std::vector<int> id1, std::vector<int> id2, std::vector<int> val1, const CGHeroInstance *hero = nullptr)=0; virtual void trade(const CGObjectInstance *market, EMarketMode::EMarketMode mode, std::vector<ui32> id1, std::vector<ui32> id2, 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, int id1, int id2, int 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, std::vector<int> id1, std::vector<int> id2, std::vector<int> val1, const CGHeroInstance *hero = nullptr) override; void trade(const CGObjectInstance *market, EMarketMode::EMarketMode mode, std::vector<ui32> id1, std::vector<ui32> id2, 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

@ -1231,8 +1231,8 @@ void CAltarWindow::makeDeal()
blockTrade(); blockTrade();
slider->moveTo(0); slider->moveTo(0);
std::vector<int> ids; std::vector<ui32> ids;
std::vector<int> toSacrifice; std::vector<ui32> toSacrifice;
for (int i = 0; i < sacrificedUnits.size(); i++) for (int i = 0; i < sacrificedUnits.size(); i++)
{ {
@ -1256,7 +1256,7 @@ void CAltarWindow::makeDeal()
} }
else else
{ {
std::vector<int> positions; std::vector<ui32> positions;
for(const CArtifactInstance *art : arts->artifactsOnAltar) //sacrifice each artifact on the list for(const CArtifactInstance *art : arts->artifactsOnAltar) //sacrifice each artifact on the list
{ {
positions.push_back(hero->getArtPos(art)); positions.push_back(hero->getArtPos(art));