mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Renamed LibClasses * VLC to GameLibrary * LIBRARY
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
#include "../mapObjects/CGObjectInstance.h"
|
||||
#include "../mapObjects/ObjectTemplate.h"
|
||||
#include "../mapObjects/ObstacleSetHandler.h"
|
||||
#include "../VCMI_Lib.h"
|
||||
#include "../GameLibrary.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
@@ -25,11 +25,11 @@ VCMI_LIB_NAMESPACE_BEGIN
|
||||
void ObstacleProxy::collectPossibleObstacles(TerrainId terrain)
|
||||
{
|
||||
//get all possible obstacles for this terrain
|
||||
for(auto primaryID : VLC->objtypeh->knownObjects())
|
||||
for(auto primaryID : LIBRARY->objtypeh->knownObjects())
|
||||
{
|
||||
for(auto secondaryID : VLC->objtypeh->knownSubObjects(primaryID))
|
||||
for(auto secondaryID : LIBRARY->objtypeh->knownSubObjects(primaryID))
|
||||
{
|
||||
auto handler = VLC->objtypeh->getHandlerFor(primaryID, secondaryID);
|
||||
auto handler = LIBRARY->objtypeh->getHandlerFor(primaryID, secondaryID);
|
||||
if(handler->isStaticObject())
|
||||
{
|
||||
for(const auto & temp : handler->getTemplates())
|
||||
@@ -71,7 +71,7 @@ bool ObstacleProxy::prepareBiome(const ObstacleSetFilter & filter, vstd::RNG & r
|
||||
auto localFilter = filter;
|
||||
localFilter.setType(ObstacleSet::EObstacleType::MOUNTAINS);
|
||||
|
||||
TObstacleTypes mountainSets = VLC->biomeHandler->getObstacles(localFilter);
|
||||
TObstacleTypes mountainSets = LIBRARY->biomeHandler->getObstacles(localFilter);
|
||||
|
||||
if (!mountainSets.empty())
|
||||
{
|
||||
@@ -86,7 +86,7 @@ bool ObstacleProxy::prepareBiome(const ObstacleSetFilter & filter, vstd::RNG & r
|
||||
}
|
||||
|
||||
localFilter.setType(ObstacleSet::EObstacleType::TREES);
|
||||
TObstacleTypes treeSets = VLC->biomeHandler->getObstacles(localFilter);
|
||||
TObstacleTypes treeSets = LIBRARY->biomeHandler->getObstacles(localFilter);
|
||||
|
||||
// 1 or 2 tree sets
|
||||
size_t treeSetsCount = std::min<size_t>(treeSets.size(), rand.nextInt(1, 2));
|
||||
@@ -99,7 +99,7 @@ bool ObstacleProxy::prepareBiome(const ObstacleSetFilter & filter, vstd::RNG & r
|
||||
|
||||
// Some obstacle types may be completely missing from water, but it's not a problem
|
||||
localFilter.setTypes({ObstacleSet::EObstacleType::LAKES, ObstacleSet::EObstacleType::CRATERS});
|
||||
TObstacleTypes largeSets = VLC->biomeHandler->getObstacles(localFilter);
|
||||
TObstacleTypes largeSets = LIBRARY->biomeHandler->getObstacles(localFilter);
|
||||
|
||||
// We probably don't want to have lakes and craters at the same time, choose one of them
|
||||
|
||||
@@ -113,7 +113,7 @@ bool ObstacleProxy::prepareBiome(const ObstacleSetFilter & filter, vstd::RNG & r
|
||||
}
|
||||
|
||||
localFilter.setType(ObstacleSet::EObstacleType::ROCKS);
|
||||
TObstacleTypes rockSets = VLC->biomeHandler->getObstacles(localFilter);
|
||||
TObstacleTypes rockSets = LIBRARY->biomeHandler->getObstacles(localFilter);
|
||||
|
||||
size_t rockSetsCount = std::min<size_t>(rockSets.size(), rand.nextInt(1, 2));
|
||||
for (size_t i = 0; i < rockSetsCount; i++)
|
||||
@@ -124,7 +124,7 @@ bool ObstacleProxy::prepareBiome(const ObstacleSetFilter & filter, vstd::RNG & r
|
||||
logGlobal->info("Added %d rock sets", rockSetsCount);
|
||||
|
||||
localFilter.setType(ObstacleSet::EObstacleType::PLANTS);
|
||||
TObstacleTypes plantSets = VLC->biomeHandler->getObstacles(localFilter);
|
||||
TObstacleTypes plantSets = LIBRARY->biomeHandler->getObstacles(localFilter);
|
||||
|
||||
// 1 or 2 sets (3 - rock sets)
|
||||
size_t plantSetsCount = std::min<size_t>(plantSets.size(), rand.nextInt(1, std::max<size_t>(3 - rockSetsCount, 2)));
|
||||
@@ -145,11 +145,11 @@ bool ObstacleProxy::prepareBiome(const ObstacleSetFilter & filter, vstd::RNG & r
|
||||
size_t smallSets = rand.nextInt(MIN_SMALL_SETS, maxSmallSets);
|
||||
|
||||
localFilter.setTypes({ObstacleSet::EObstacleType::STRUCTURES, ObstacleSet::EObstacleType::ANIMALS});
|
||||
TObstacleTypes smallObstacleSets = VLC->biomeHandler->getObstacles(localFilter);
|
||||
TObstacleTypes smallObstacleSets = LIBRARY->biomeHandler->getObstacles(localFilter);
|
||||
RandomGeneratorUtil::randomShuffle(smallObstacleSets, rand);
|
||||
|
||||
localFilter.setType(ObstacleSet::EObstacleType::OTHER);
|
||||
TObstacleTypes otherSets = VLC->biomeHandler->getObstacles(localFilter);
|
||||
TObstacleTypes otherSets = LIBRARY->biomeHandler->getObstacles(localFilter);
|
||||
RandomGeneratorUtil::randomShuffle(otherSets, rand);
|
||||
|
||||
while (smallSets > 0)
|
||||
@@ -243,7 +243,7 @@ int ObstacleProxy::getWeightedObjects(const int3 & tile, vstd::RNG & rand, IGame
|
||||
|
||||
for(const auto & temp : shuffledObstacles)
|
||||
{
|
||||
auto handler = VLC->objtypeh->getHandlerFor(temp->id, temp->subid);
|
||||
auto handler = LIBRARY->objtypeh->getHandlerFor(temp->id, temp->subid);
|
||||
auto * obj = handler->create(nullptr, temp);
|
||||
allObjects.emplace_back(*obj);
|
||||
rmg::Object * rmgObject = &allObjects.back();
|
||||
|
||||
Reference in New Issue
Block a user