فهرست منبع

- Fixed uninitialized guarding creature positions
- Fix for guard placement

DjWarmonger 11 سال پیش
والد
کامیت
75cea9206d
3فایلهای تغییر یافته به همراه9 افزوده شده و 6 حذف شده
  1. 2 0
      lib/CGameState.cpp
  2. 0 2
      lib/rmg/CMapGenerator.cpp
  3. 7 4
      lib/rmg/CRmgTemplateZone.cpp

+ 2 - 0
lib/CGameState.cpp

@@ -1909,6 +1909,8 @@ void CGameState::initMapObjects()
 		}
 	}
 	CGTeleport::postInit(); //pairing subterranean gates
+
+	map->calculateGuardingGreaturePositions(); //calculate once again when all the guards are placed and initialized
 }
 
 void CGameState::initVisitingAndGarrisonedHeroes()

+ 0 - 2
lib/rmg/CMapGenerator.cpp

@@ -43,8 +43,6 @@ std::unique_ptr<CMap> CMapGenerator::generate()
 	{
 		logGlobal->errorStream() << "Random map generation received exception: " << e.what();
 	}
-
-	map->calculateGuardingGreaturePositions(); //calculate once again when all the guards are placed
 	return std::move(map);
 }
 

+ 7 - 4
lib/rmg/CRmgTemplateZone.cpp

@@ -544,11 +544,14 @@ bool CRmgTemplateZone::guardObject(CMapGenerator* gen, CGObjectInstance* object,
 			auto it = tileinfo.find(visitable + int3(i, j, 0));
 			if (it != tileinfo.end())
 			{
-				logGlobal->infoStream() << boost::format("Block at %d %d") % it->first.x % it->first.y;
-				if ( ! it->second.isOccupied() &&  ! it->second.isObstacle())
+				if (it->first != visitable)
 				{
-					tiles.push_back(it->first);
-					it->second.setObstacle(true);
+					logGlobal->infoStream() << boost::format("Block at %d %d") % it->first.x % it->first.y;
+					if (!it->second.isOccupied() &&  !it->second.isObstacle())
+					{
+						tiles.push_back(it->first);
+						it->second.setObstacle(true);
+					}
 				}
 			}
 		}