瀏覽代碼

Lookout Tower support

DjWarmonger 16 年之前
父節點
當前提交
f9881af0a6
共有 1 個文件被更改,包括 16 次插入0 次删除
  1. 16 0
      hch/CObjectHandler.cpp

+ 16 - 0
hch/CObjectHandler.cpp

@@ -1173,6 +1173,8 @@ void CGDwelling::fightOver(const CGHeroInstance *h, BattleResult *result) const
 
 int CGTownInstance::getSightRadious() const //returns sight distance
 {
+	if (subID == 2 && (builtBuildings.find(21))!=builtBuildings.end())
+		return 20;
 	return 5;
 }
 
@@ -2660,6 +2662,20 @@ void CGBonusingObject::onHeroVisit( const CGHeroInstance * h ) const
 		break;
 	case 94: //Stables TODO: upgrade Cavaliers
 		sound = soundBase::horse20;
+		std::set<ui32> slots;
+		for (std::map<si32,std::pair<ui32,si32> >::const_iterator i = h->army.slots.begin(); i != h->army.slots.end(); ++i)
+		{
+			if(i->second.first == 10)
+				slots.insert(i->first);
+		}
+		if (!slots.empty())
+		{
+			for (std::set<ui32>::const_iterator i = slots.begin(); i != slots.end(); i++)
+			{
+				UpgradeCreature uc(*i, id, 11);
+				 //uc.applyGh (&gh);
+			}
+		}
 		messageID = 137;
 		gbonus.bonus.type = HeroBonus::LAND_MOVEMENT;
 		gbonus.bonus.val = 600;