Exemplo n.º 1
0
const bool BuildingStatus::canBuildNow(const ActionType & action) const
{
    if (_timeRemaining > 0)
    {
        return false;
    }

    if (!_type.canBuild(action))
    {
        return false;
    }

    if (action.isAddon() && (_addon != ActionTypes::None))
    {
        return false;
    }

    if (action.requiresAddon() && (_addon != action.requiredAddonType()))
    {
        return false;
    }


    return true;
}
Exemplo n.º 2
0
const bool BuildingStatus::canBuildEventually(const ActionType & action) const
{
    if (!_type.canBuild(action))
    {
        return false;
    }

    // if the type is an addon
    if (action.isAddon())
    {
        // if we already have an addon we can't build it
        if (_addon != ActionTypes::None)
        {
            return false;
        }

        // if we are building an addon we can't ever build it
        if (_timeRemaining > 0 && _isConstructing.isAddon())
        {
            return false;
        }
    }

    if (action.requiresAddon() && (_addon != action.requiredAddonType()))
    {
        if (_isConstructing != action.requiredAddonType())
        {
            return false;
        }
    }

    // if the built type is morphed and we are morphing something, we won't be able to build it
    if (action.isMorphed() && (_timeRemaining > 0) && (_isConstructing.isMorphed()))
    {
        return false;
    }

    return true;
}