Beispiel #1
0
void REGNRecord::REGNEntry::IsLand(bool value)
    {
    if(value)
        RDAT.value.entryType = eLand;
    else if(IsLand())
        RDAT.value.entryType = eObject;
    }
Beispiel #2
0
bool World::IsGFComputed(bool is_choke_land, MapPoint const & pos) const
{
    return is_choke_land == (IsLand (pos) || IsMountain (pos));
}
Beispiel #3
0
void BLMap::Step(int step)
{
    m_oTypeMapTmp = m_oTypeMap;

    uint w = m_oTypeMapTmp.GetWidth();
    uint h = m_oTypeMapTmp.GetHeight();

    for (uint i=0 ; i<w ; ++i)
    {
        for (uint j=0 ; j<h ; ++j)
        {
            BLZone zone;
            CaseType type = m_oTypeMapTmp.GetCase(i, j);
            for (int k=(int)i-1 ; k<=(int)i+1 ; ++k)
            {
                for (int l=(int)j-1 ; l<=(int)j+1 ; ++l)
                {
                    if (k>=0 && k<(int)w && l>=0 && l<(int)h)
                    {
                        zone.AddType(m_oTypeMapTmp.GetCase(k, l));
                    }
                }
            }

            if (step == 0)
            {
                if (i<2 || j<2 || i>=w-2 || j>=h-2)
                    //if (zone.GetMax() < 9)
                {
                    m_oTypeMap.GetCase(i, j) = LightWater;// (zone.IsWater() ? DarkWater : LightWater);
                }
            }
            else if (step < 5)
            {
                if (zone.GetWaterCount() > Rand(3,5))
                {
                    m_oTypeMap.GetCase(i, j) = LightWater;
                }
                else if (IsWater(type) && zone.GetLandCount() > Rand(3,5))
                {
                    m_oTypeMap.GetCase(i, j) = LightDirt;
                }
                else if (IsLand(type) && zone.GetCount(Tree) > Rand(3,4))
                {
                    m_oTypeMap.GetCase(i, j) = Tree;
                }
                else
                {
                    if (zone.GetCount(type) == 1)
                        m_oTypeMap.GetCase(i, j) = zone.GetMajorType();
                }
            }
            else if (step < 8)
            {
                if (IsLand(type) && zone.GetWaterCount() > 0)
                {
                    m_oTypeMap.GetCase(i, j) = LightDirt;
                }
                else if (IsLand(type) && type != Stone && zone.GetCount(Stone) > 0)
                {
                    m_oTypeMap.GetCase(i, j) = LightDirt;
                }
                else if (zone.IsDirt())
                {
                    m_oTypeMap.GetCase(i, j) = (Rand(2) == 0 ? LightDirt : Stone);
                }
                else if (IsDirt(type) && zone.GetWaterCount() == 0)
                {
                    m_oTypeMap.GetCase(i, j) = LightGrass;
                }
                else if (type == Tree && zone.GetDirtCount() > 0)
                {
                    m_oTypeMap.GetCase(i, j) = LightGrass;
                }
            }
            else if (step < 12)
            {
                if (IsGrass(type) && zone.GetDirtCount() >= 3 && zone.GetCount(Tree) == 0 && Rand(2) == 0)
                {
                    m_oTypeMap.GetCase(i, j) = LightDirt;
                }
            }
            else if (step < 17)
            {
                if (zone.IsWater() && Rand(2) == 0)
                {
                    m_oTypeMap.GetCase(i, j) = DarkWater;
                }
                else if (zone.IsGrass() && Rand(2) == 0)
                {
                    m_oTypeMap.GetCase(i, j) = DarkGrass;
                }
                else if (zone.IsDirt() && Rand(2) == 0)
                {
                    m_oTypeMap.GetCase(i, j) = DarkDirt;
                }
                //else
                //{
                //	if (zone.GetCount(type) == 1)
                //		m_oMap.GetCase(i, j) = zone.GetMajorType();
                //}
            }
        }
    }
}