BOOLEAN IsTheRoofVisible( const INT32& sGridNo ) { if( FlatRoofAboveGridNo( sGridNo ) ) { if( gpWorldLevelData[ sGridNo ].uiFlags & MAPELEMENT_REVEALED ) { if( gTacticalStatus.uiFlags & SHOW_ALL_ROOFS ) return( TRUE ); else return( FALSE ); } else { return( TRUE ); } } return( FALSE ); }
void UpdateCursorAreas() { INT32 x, y, iMapIndex; RemoveCursors(); EnsureSelectionType(); //Determine if the mouse is currently in the world. if( gViewportRegion.uiFlags & MSYS_MOUSE_IN_AREA && GetMouseXY( &sGridX, &sGridY ) ) { iMapIndex = MAPROWCOLTOPOS( sGridY, sGridX ); if( gpBuildingLayoutList ) { gSelectRegion.iLeft = gSelectRegion.iRight = sGridX; gSelectRegion.iTop = gSelectRegion.iBottom = sGridY; fValidCursor = TRUE; DrawBuildingLayout( iMapIndex ); } else switch( gusSelectionType ) { case SMALLSELECTION: gSelectRegion.iLeft = gSelectRegion.iRight = sGridX; gSelectRegion.iTop = gSelectRegion.iBottom = sGridY; fValidCursor = TRUE; break; case MEDIUMSELECTION: case LARGESELECTION: case XLARGESELECTION: //The mouse mode value reflects the size of the cursor. gSelectRegion.iTop = sGridY - gusSelectionType; gSelectRegion.iBottom = sGridY + gusSelectionType; gSelectRegion.iLeft = sGridX - gusSelectionType; gSelectRegion.iRight = sGridX + gusSelectionType; ValidateSelectionRegionBoundaries(); fValidCursor = TRUE; break; case LINESELECTION: fValidCursor = HandleAreaSelection(); ForceAreaSelectionWidth(); ValidateSelectionRegionBoundaries(); break; case AREASELECTION: fValidCursor = HandleAreaSelection(); break; } } //Draw all of the area cursors here. if( fValidCursor ) { if( iDrawMode == DRAW_MODE_ENEMY || iDrawMode == DRAW_MODE_CREATURE || iDrawMode == DRAW_MODE_REBEL || iDrawMode == DRAW_MODE_CIVILIAN || iDrawMode == DRAW_MODE_SCHEDULEACTION ) { iMapIndex = gSelectRegion.iTop * WORLD_COLS + gSelectRegion.iLeft; if( !IsLocationSittable( iMapIndex, gfRoofPlacement ) && iDrawMode != DRAW_MODE_SCHEDULEACTION || !IsLocationSittableExcludingPeople( iMapIndex, gfRoofPlacement ) && iDrawMode == DRAW_MODE_SCHEDULEACTION ) { if( sBadMarker != iMapIndex ) { RemoveBadMarker(); if( gfRoofPlacement && FlatRoofAboveGridNo( iMapIndex ) ) { AddTopmostToTail( iMapIndex + ROOF_OFFSET, BADMARKER1 ); sBadMarker = (INT16)(iMapIndex + ROOF_OFFSET ); } else { AddTopmostToTail( (iMapIndex), BADMARKER1 ); sBadMarker = (INT16)(iMapIndex); } } } else { RemoveBadMarker(); if( gfRoofPlacement && FlatRoofAboveGridNo( iMapIndex ) ) { AddTopmostToTail( iMapIndex + ROOF_OFFSET, FIRSTPOINTERS5 ); gfUsingOffset = TRUE; } else AddTopmostToTail( iMapIndex, FIRSTPOINTERS1 ); } } else for( y = gSelectRegion.iTop; y <= gSelectRegion.iBottom; y++ ) { for( x = gSelectRegion.iLeft; x <= gSelectRegion.iRight; x++ ) { iMapIndex = y * WORLD_COLS + x; AddTopmostToTail( iMapIndex, FIRSTPOINTERS1 ); } } } }