Jelajahi Sumber

Minor changes (visitdir organization)

Michał W. Urbańczyk 16 tahun lalu
induk
melakukan
3a1e252895
4 mengubah file dengan 8 tambahan dan 10 penghapusan
  1. 1 1
      hch/CDefObjInfoHandler.cpp
  2. 4 8
      hch/CObjectHandler.cpp
  3. 2 0
      lib/map.cpp
  4. 1 1
      server/CGameHandler.cpp

+ 1 - 1
hch/CDefObjInfoHandler.cpp

@@ -90,7 +90,7 @@ void CDefObjInfoHandler::load()
 		}
 		else 
 		{
-			static int visitableFromTop[] = {111,33,81,12,9,212,215,22}; //whirlpool, garrison, scholar, campfire, borderguard, bordergate, questguard, corpse
+			static int visitableFromTop[] = {29, 82, 86, 11, 59, 8, 111,33,81,12,9,212,215,22}; //sea chest, flotsam, shipwreck survivor, buoy, ocean bottle, boat, whirlpool, garrison, scholar, campfire, borderguard, bordergate, questguard, corpse
 			for(int i=0; i < ARRAY_COUNT(visitableFromTop); i++)
 			{
 				if(visitableFromTop[i] == nobj->id)

+ 4 - 8
hch/CObjectHandler.cpp

@@ -2627,12 +2627,7 @@ const std::string & CGBonusingObject::getHoverText() const
 
 void CGBonusingObject::initObj()
 {
-	if(ID == 11) //Buoy
-	{
-		defInfo->visitDir = 0xff;
-		blockVisit = true;
-	}
-	else if(ID == 52) //Mermaid
+	if(ID == 11 || ID == 52) //Buoy / Mermaid
 	{
 		blockVisit = true;
 	}
@@ -3065,7 +3060,6 @@ void CGSignBottle::initObj()
 
 	if(ID == 59)
 	{
-		defInfo->visitDir = 0xff;
 		blockVisit = true;
 	}
 }
@@ -3077,6 +3071,9 @@ void CGSignBottle::onHeroVisit( const CGHeroInstance * h ) const
 	iw.player = h->getOwner();
 	iw.text << message;
 	cb->showInfoDialog(&iw);
+
+	if(ID == 59)
+		cb->removeObject(id);
 }
 
 void CGScholar::giveAnyBonus( const CGHeroInstance * h ) const
@@ -3358,7 +3355,6 @@ void CGOnceVisitable::searchTomb(const CGHeroInstance *h, ui32 accept) const
 
 void CGBoat::initObj()
 {
-	defInfo->visitDir = 0xff;
 	hero = NULL;
 }
 

+ 2 - 0
lib/map.cpp

@@ -1354,7 +1354,9 @@ void Mapa::readDefInfo( unsigned char * bufor, int &i)
 			}
 		}
 		else
+		{
 			vinya->visitDir = 0xff;
+		}
 
 		if(vinya->id == 26)
 			std::memset(vinya->blockMap,255,6);

+ 1 - 1
server/CGameHandler.cpp

@@ -1951,7 +1951,7 @@ bool CGameHandler::garrisonSwap( si32 tid )
 bool CGameHandler::swapArtifacts( si32 hid1, si32 hid2, ui16 slot1, ui16 slot2 )
 {
 	CGHeroInstance *h1 = gs->getHero(hid1), *h2 = gs->getHero(hid2);
-	if((distance(h1->pos,h2->pos) > 1.0)   ||   (h1->tempOwner != h2->tempOwner))
+	if((distance(h1->pos,h2->pos) > 1.5)   ||   (h1->tempOwner != h2->tempOwner))
 		return false;
 
 	const CArtifact *a1 = h1->getArt(slot1),