Browse Source

Fixed broken town`s marketplace

AlexVinS 7 years ago
parent
commit
db60983b5a
1 changed files with 2 additions and 9 deletions
  1. 2 9
      CCallback.cpp

+ 2 - 9
CCallback.cpp

@@ -208,21 +208,14 @@ void CCallback::buyArtifact(const CGHeroInstance *hero, ArtifactID aid)
 
 
 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.marketId = market->id;
-	pack.heroId = hero->id;
-	pack.mode = mode;
-	pack.r1 = {id1};
-	pack.r2 = {id2};
-	pack.val = {val1};
-	sendRequest(&pack);
+	trade(market, mode, std::vector<ui32>(1, id1), std::vector<ui32>(1, id2), std::vector<ui32>(1, val1), 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)
 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.marketId = market->id;
 	pack.marketId = market->id;
-	pack.heroId = hero->id;
+	pack.heroId = hero ? hero->id : ObjectInstanceID();
 	pack.mode = mode;
 	pack.mode = mode;
 	pack.r1 = id1;
 	pack.r1 = id1;
 	pack.r2 = id2;
 	pack.r2 = id2;