bool CreateSeaWorld::operator()(GameWorldGame& world) const
{
    // For consistent results
    initGameRNG(0);

    loadGameData(world.GetDescriptionWriteable());
    world.Init(size_);
    // Set everything to water
    DescIdx<TerrainDesc> t(0);
    const WorldDescription& desc = world.GetDescription();
    for(; t.value < desc.terrain.size(); t.value++)
    {
        if(desc.get(t).Is(ETerrain::Shippable) && desc.get(t).kind == TerrainKind::WATER) //-V807
            break;
    }
    RTTR_FOREACH_PT(MapPoint, size_)
    {
        MapNode& node = world.GetNodeWriteable(pt);
        node.t1 = node.t2 = t;
    }
Пример #2
0
void SetRightTerrain(GameWorldGame& world, const MapPoint& pt, Direction dir, TerrainType t)
{
    switch(Direction::Type(dir))
    {
    case Direction::WEST:
        world.GetNodeWriteable(world.GetNeighbour(pt, Direction::NORTHWEST)).t1 = t;
        break;
    case Direction::NORTHWEST:
        world.GetNodeWriteable(world.GetNeighbour(pt, Direction::NORTHWEST)).t2 = t;
        break;
    case Direction::NORTHEAST:
        world.GetNodeWriteable(world.GetNeighbour(pt, Direction::NORTHEAST)).t1 = t;
        break;
    case Direction::EAST:
        world.GetNodeWriteable(pt).t2 = t;
        break;
    case Direction::SOUTHEAST:
        world.GetNodeWriteable(pt).t1 = t;
        break;
    case Direction::SOUTHWEST:
        world.GetNodeWriteable(world.GetNeighbour(pt, Direction::WEST)).t2 = t;
        break;
    }
}