question: private boolean isValidEngine ( ) { if ( hasFlag ( ~ ( CLAN_ENGINE | TANK_ENGINE | LARGE_ENGINE | SUPERHEAVY_ENGINE | SUPPORT_VEE_ENGINE ) ) ) { problem . append ( "Flags:" + engineFlags ) ; return false ; } if ( hasFlag ( SUPPORT_VEE_ENGINE ) && ( engineType != STEAM ) && ( engineType != COMBUSTION_ENGINE ) && ( engineType != BATTERY ) && ( engineType != FUEL_CELL ) && ( engineType != SOLAR ) && ( engineType != FISSION ) && ( engineType != NORMAL_ENGINE ) && ( engineType != NONE ) ) { problem . append ( "Invalid Engine type for support vehicle engines!" ) ; return false ; } if ( ( ( ( int ) Math . ceil ( engineRating / 5 ) > ENGINE_RATINGS . length ) || ( engineRating < 0 ) ) && ! hasFlag ( SUPPORT_VEE_ENGINE ) ) { problem . append ( "Rating:" + engineRating ) ; return false ; } if ( ( engineRating > 400 ) && ! hasFlag ( SUPPORT_VEE_ENGINE ) ) { engineFlags |= LARGE_ENGINE ; } switch ( engineType ) { case COMBUSTION_ENGINE : case NORMAL_ENGINE : case XL_ENGINE : case XXL_ENGINE : case FUEL_CELL : case NONE : case MAGLEV : case BATTERY : case SOLAR : break ; case COMPACT_ENGINE : if ( hasFlag ( LARGE_ENGINE ) ) { problem . append ( Messages . getString ( "Engine.invalidCompactLarge" ) ) ; return false ; } break ; case LIGHT_ENGINE : case FISSION : if ( hasFlag ( CLAN_ENGINE ) ) { problem . append ( Messages . getString ( "Engine.invalidSphereOnly" ) ) ; return false ; } break ; default : problem . append ( "Type:" + engineType ) ; return false ; } return true ; }
target:  Sanity checks the engine, no negative ratings, and similar checks.