mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Fix code formatting
This commit is contained in:
parent
c40dcec7cd
commit
2c09bfb22a
@ -110,35 +110,35 @@ void CPrivilegedInfoCallback::getAllTiles(std::unordered_set<int3, ShashInt3> &
|
||||
else
|
||||
floors.push_back(level);
|
||||
|
||||
for (auto zd : floors)
|
||||
for(auto zd: floors)
|
||||
{
|
||||
for (int xd = 0; xd < gs->map->width; xd++)
|
||||
for(int xd = 0; xd < gs->map->width; xd++)
|
||||
{
|
||||
for (int yd = 0; yd < gs->map->height; yd++)
|
||||
for(int yd = 0; yd < gs->map->height; yd++)
|
||||
{
|
||||
bool isTileEligible = false;
|
||||
bool isTileEligible = false;
|
||||
|
||||
switch(tileFilterMode)
|
||||
{
|
||||
case MapTerrainFilterMode::NONE:
|
||||
isTileEligible = true;
|
||||
break;
|
||||
case MapTerrainFilterMode::WATER:
|
||||
isTileEligible = getTile (int3 (xd,yd,zd))->terType->isWater();
|
||||
break;
|
||||
case MapTerrainFilterMode::LAND:
|
||||
isTileEligible = getTile (int3 (xd,yd,zd))->terType->isLand();
|
||||
break;
|
||||
case MapTerrainFilterMode::LAND_CARTOGRAPHER:
|
||||
isTileEligible = getTile(int3 (xd,yd,zd))->terType->isSurfaceCartographerCompatible();
|
||||
break;
|
||||
case MapTerrainFilterMode::UNDERGROUND_CARTOGRAPHER:
|
||||
isTileEligible = getTile(int3 (xd,yd,zd))->terType->isUndergroundCartographerCompatible();
|
||||
break;
|
||||
}
|
||||
switch(tileFilterMode)
|
||||
{
|
||||
case MapTerrainFilterMode::NONE:
|
||||
isTileEligible = true;
|
||||
break;
|
||||
case MapTerrainFilterMode::WATER:
|
||||
isTileEligible = getTile(int3(xd, yd, zd))->terType->isWater();
|
||||
break;
|
||||
case MapTerrainFilterMode::LAND:
|
||||
isTileEligible = getTile(int3(xd, yd, zd))->terType->isLand();
|
||||
break;
|
||||
case MapTerrainFilterMode::LAND_CARTOGRAPHER:
|
||||
isTileEligible = getTile(int3(xd, yd, zd))->terType->isSurfaceCartographerCompatible();
|
||||
break;
|
||||
case MapTerrainFilterMode::UNDERGROUND_CARTOGRAPHER:
|
||||
isTileEligible = getTile(int3(xd, yd, zd))->terType->isUndergroundCartographerCompatible();
|
||||
break;
|
||||
}
|
||||
|
||||
if (isTileEligible)
|
||||
tiles.insert(int3(xd,yd,zd));
|
||||
if(isTileEligible)
|
||||
tiles.insert(int3(xd, yd, zd));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,23 +40,31 @@ namespace scripting
|
||||
class DLL_LINKAGE CPrivilegedInfoCallback : public CGameInfoCallback
|
||||
{
|
||||
public:
|
||||
enum class MapTerrainFilterMode
|
||||
{
|
||||
NONE = 0,
|
||||
LAND = 1,
|
||||
WATER = 2,
|
||||
LAND_CARTOGRAPHER = 3,
|
||||
UNDERGROUND_CARTOGRAPHER = 4
|
||||
};
|
||||
enum class MapTerrainFilterMode
|
||||
{
|
||||
NONE = 0,
|
||||
LAND = 1,
|
||||
WATER = 2,
|
||||
LAND_CARTOGRAPHER = 3,
|
||||
UNDERGROUND_CARTOGRAPHER = 4
|
||||
};
|
||||
|
||||
CGameState * gameState();
|
||||
//used for random spawns
|
||||
void getFreeTiles (std::vector<int3> &tiles) const;
|
||||
//mode 1 - only unrevealed tiles; mode 0 - all, mode -1 - only revealed
|
||||
void getTilesInRange(std::unordered_set<int3, ShashInt3> &tiles, int3 pos, int radious, boost::optional<PlayerColor> player = boost::optional<PlayerColor>(), int mode = 0, int3::EDistanceFormula formula = int3::DIST_2D) const;
|
||||
//returns all tiles on given level (-1 - both levels, otherwise number of level)
|
||||
void getAllTiles (std::unordered_set<int3, ShashInt3> &tiles, boost::optional<PlayerColor> player = boost::optional<PlayerColor>(), int level=-1, MapTerrainFilterMode tileFilterMode = MapTerrainFilterMode::NONE) const;
|
||||
void pickAllowedArtsSet(std::vector<const CArtifact*> &out, CRandomGenerator & rand); //gives 3 treasures, 3 minors, 1 major -> used by Black Market and Artifact Merchant
|
||||
CGameState *gameState();
|
||||
|
||||
//used for random spawns
|
||||
void getFreeTiles(std::vector<int3> &tiles) const;
|
||||
|
||||
//mode 1 - only unrevealed tiles; mode 0 - all, mode -1 - only revealed
|
||||
void getTilesInRange(std::unordered_set<int3, ShashInt3> &tiles, int3 pos, int radious,
|
||||
boost::optional<PlayerColor> player = boost::optional<PlayerColor>(), int mode = 0,
|
||||
int3::EDistanceFormula formula = int3::DIST_2D) const;
|
||||
|
||||
//returns all tiles on given level (-1 - both levels, otherwise number of level)
|
||||
void getAllTiles(std::unordered_set<int3, ShashInt3> &tiles, boost::optional<PlayerColor> player = boost::optional<PlayerColor>(),
|
||||
int level = -1, MapTerrainFilterMode tileFilterMode = MapTerrainFilterMode::NONE) const;
|
||||
|
||||
void pickAllowedArtsSet(std::vector<const CArtifact *> &out,
|
||||
CRandomGenerator &rand); //gives 3 treasures, 3 minors, 1 major -> used by Black Market and Artifact Merchant
|
||||
void getAllowedSpells(std::vector<SpellID> &out, ui16 level);
|
||||
|
||||
template<typename Saver>
|
||||
|
@ -2068,9 +2068,9 @@ void CCartographer::onHeroVisit( const CGHeroInstance * h ) const
|
||||
|
||||
void CCartographer::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const
|
||||
{
|
||||
if (answer) //if hero wants to buy map
|
||||
if(answer) //if hero wants to buy map
|
||||
{
|
||||
cb->giveResource (hero->tempOwner, Res::GOLD, -1000);
|
||||
cb->giveResource(hero->tempOwner, Res::GOLD, -1000);
|
||||
FoWChange fw;
|
||||
fw.mode = 1;
|
||||
fw.player = hero->tempOwner;
|
||||
@ -2078,24 +2078,24 @@ void CCartographer::blockingDialogAnswered(const CGHeroInstance *hero, ui32 answ
|
||||
//subIDs of different types of cartographers:
|
||||
//water = 0; land = 1; underground = 2;
|
||||
|
||||
IGameCallback::MapTerrainFilterMode tileFilterMode = IGameCallback::MapTerrainFilterMode::NONE;
|
||||
IGameCallback::MapTerrainFilterMode tileFilterMode = IGameCallback::MapTerrainFilterMode::NONE;
|
||||
|
||||
switch(subID)
|
||||
{
|
||||
case 0:
|
||||
tileFilterMode = CPrivilegedInfoCallback::MapTerrainFilterMode::WATER;
|
||||
break;
|
||||
case 1:
|
||||
tileFilterMode = CPrivilegedInfoCallback::MapTerrainFilterMode::LAND_CARTOGRAPHER;
|
||||
break;
|
||||
case 2:
|
||||
tileFilterMode = CPrivilegedInfoCallback::MapTerrainFilterMode::UNDERGROUND_CARTOGRAPHER;
|
||||
break;
|
||||
}
|
||||
switch(subID)
|
||||
{
|
||||
case 0:
|
||||
tileFilterMode = CPrivilegedInfoCallback::MapTerrainFilterMode::WATER;
|
||||
break;
|
||||
case 1:
|
||||
tileFilterMode = CPrivilegedInfoCallback::MapTerrainFilterMode::LAND_CARTOGRAPHER;
|
||||
break;
|
||||
case 2:
|
||||
tileFilterMode = CPrivilegedInfoCallback::MapTerrainFilterMode::UNDERGROUND_CARTOGRAPHER;
|
||||
break;
|
||||
}
|
||||
|
||||
cb->getAllTiles (fw.tiles, hero->tempOwner, -1, tileFilterMode); //reveal appropriate tiles
|
||||
cb->sendAndApply (&fw);
|
||||
cb->setObjProperty (id, CCartographer::OBJPROP_VISITED, hero->tempOwner.getNum());
|
||||
cb->getAllTiles(fw.tiles, hero->tempOwner, -1, tileFilterMode); //reveal appropriate tiles
|
||||
cb->sendAndApply(&fw);
|
||||
cb->setObjProperty(id, CCartographer::OBJPROP_VISITED, hero->tempOwner.getNum());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user