Just click on the category of ship you are looking for and the info for each ship will be available. Left and right arrow keys are also supported on PC.
For anybody that is concerned or interested about the code, here it is. Feel free to do what you want with it.
<body>
<div class="container">
<?php
// Check if a ship type has been specified
if ( isset ( $_GET["type"] ) == TRUE AND $_GET["type"] <= CATEGORY_MAX )
{
$test_category = htmlspecialchars( $_GET["type"] );
//Which type
switch ( $test_category )
{
case FREIGHTER: // Freighter
case TANKER: // Tanker
case WARSHIP: // Warships
case ESCORT: // Escort
case TROOPTRANSPORT: // Troop Transport
case CARRIER: // Carrier
case OTHER: // Other
$category = $test_category;
break;
default:
$category = NULL;
}
// If a type has been specified
if ( is_null( $category ) == FALSE )
{
// Scan ships directory
$dir = "ships";
$tmpFile = scandir( $dir, 0 );
//$cfgCount = 0;
// Run through all ship files
for( $i = 2; $i < count( $tmpFile ); $i++ )
{
// Only look at config files
if ( strpos( $tmpFile[$i], '.cfg' ) == TRUE )
{
$fileHandler = fopen( $dir."/".$tmpFile[$i], "r" ) or exit( "unable to open file ($fileHandler)" );
// If the file opened successfully
if ( $fileHandler )
{
// Run through each line of the file
while ( !feof( $fileHandler ) )
{
$line = fgets( $fileHandler );
if ( strpos( $line, '=' ) ) // If the read line is option=value
{
list( $opt , $val ) = explode( "=" , $line ); // Split the options and values to seperate variables
// Cut off any ****
$opt = trim ( $opt );
$val = trim ( $val );
if ( strpos ( $val, ';' ) == TRUE ) // If the value has a comment after it, remove it
{
$val = substr( $val, 0, strpos ( $val, ';' ) );
}
switch ( $opt ) // Accept only options of interest
{
case "ShowInRecognitionManual":
switch ( $val )
{
case "YES":
$val = 1;
break;
default:
$val = 0;
}
case "UnitType":
case "RecManualCategory":
switch ( $val ) // Set ship category
{
case "Freighter": // Freighter
$val = FREIGHTER;
break;
case "Tanker": // Tanker
$val = TANKER;
break;
case "LargeWarship": // Warships
$val = WARSHIP;
break;
case "EscortShip": // Escort
$val = ESCORT;
break;
case "TroopTransport": // Troop Transport
$val = TROOPTRANSPORT;
break;
case "AircraftCarrier": // Carrier
$val = CARRIER;
break;
case "Other": // Other
$val = OTHER;
break;
}
case "ClassName":
case "MaxSpeed":
case "Length":
case "Width":
case "Mast":
case "Displacement":
case "Draft":
$ships[$tmpFile[$i]][$opt] = $val;
break;
}
}
unset( $opt );
unset( $val );
}
TODO
- Filtering for TWOS ships by bow, stacks, superstructures
- Disable view of clone ships that use same model
- Enabling view for hidden ships not shown in TWOS recognition manual
- Parsing of config files from data\roster
- Filtering for all ships by stats, dates, country (bow etc was not included in stock game)
- Enable swipe support for smartphones
CHANGES
2021 09 08
- Cleaned up all pictures to have white backgrounds where possible.
- Reduced size of text
- Fixed logical error causing wrongs shipset to show
- Added tonnage to statistics