Exemple #1
0
void Tile::blitNonInfantryGroundUnits(int xPos, int yPos) {
    if(hasANonInfantryGroundObject() && !isFogged(pLocalHouse->getHouseID())) {
        std::list<Uint32>::const_iterator iter;
        for(iter = assignedNonInfantryGroundObjectList.begin(); iter != assignedNonInfantryGroundObjectList.end() ; ++iter) {
            ObjectBase* current =  currentGame->getObjectManager().getObject(*iter);

            if(current->isAUnit() && current->isVisible(pLocalHouse->getTeam())) {
                if(location == current->getLocation()) {
                    current->blitToScreen();
                }
            }
        }
    }
}
Exemple #2
0
void Tile::blitSelectionRects(int xPos, int yPos) {
    // draw underground selection rectangles
    if(hasAnUndergroundUnit() && !isFogged(pLocalHouse->getHouseID())) {
        UnitBase* current = getUndergroundUnit();

        if(current != NULL) {
            if(current->isVisible(pLocalHouse->getTeam()) && (location == current->getLocation())) {
                if(current->isSelected()) {
                    current->drawSelectionBox();
                }

                if(current->isSelectedByOtherPlayer()) {
                    current->drawOtherPlayerSelectionBox();
                }
            }
        }
    }


    // draw infantry selection rectangles
    if(hasInfantry() && !isFogged(pLocalHouse->getHouseID())) {
        std::list<Uint32>::const_iterator iter;
        for(iter = assignedInfantryList.begin(); iter != assignedInfantryList.end() ; ++iter) {
            InfantryBase* current = dynamic_cast<InfantryBase*>(currentGame->getObjectManager().getObject(*iter));

            if(current == NULL) {
                continue;
            }

            if(current->isVisible(pLocalHouse->getTeam()) && (location == current->getLocation())) {
                if(current->isSelected()) {
                    current->drawSelectionBox();
                }

                if(current->isSelectedByOtherPlayer()) {
                    current->drawOtherPlayerSelectionBox();
                }
            }
        }
    }

    // draw non infantry ground object selection rectangles
    if(hasANonInfantryGroundObject() && !isFogged(pLocalHouse->getHouseID())) {
        std::list<Uint32>::const_iterator iter;
        for(iter = assignedNonInfantryGroundObjectList.begin(); iter != assignedNonInfantryGroundObjectList.end() ; ++iter) {
            ObjectBase* current = currentGame->getObjectManager().getObject(*iter);

            if(current == NULL) {
                continue;
            }

            if(current->isVisible(pLocalHouse->getTeam()) && (location == current->getLocation())) {
                if(current->isSelected()) {
                    current->drawSelectionBox();
                }

                if(current->isSelectedByOtherPlayer()) {
                    current->drawOtherPlayerSelectionBox();
                }
            }
        }
    }

    // draw air unit selection rectangles
    if(hasAnAirUnit() && !isFogged(pLocalHouse->getHouseID())) {
        std::list<Uint32>::const_iterator iter;
        for(iter = assignedAirUnitList.begin(); iter != assignedAirUnitList.end() ; ++iter) {
            AirUnit* airUnit = dynamic_cast<AirUnit*>(currentGame->getObjectManager().getObject(*iter));

            if(airUnit == NULL) {
                continue;
            }

            if(airUnit->isVisible(pLocalHouse->getTeam()) && (location == airUnit->getLocation())) {
                if(airUnit->isSelected()) {
                    airUnit->drawSelectionBox();
                }

                if(airUnit->isSelectedByOtherPlayer()) {
                    airUnit->drawOtherPlayerSelectionBox();
                }
            }
        }
    }
}