mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +02:00
Remove #ifdefs for USE_VFS
This commit is contained in:
@@ -206,26 +206,6 @@ BOOLEAN ReadInAltSectors(STR fileName)
|
||||
|
||||
BOOLEAN WriteInAltSectors(STR fileName)
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
// Lets output the current Strategic map format using the XML structure I've devised.
|
||||
FILE *outfile = fopen(fileName, "wt");
|
||||
|
||||
UINT32 x, y;
|
||||
|
||||
fprintf (outfile, "<ALT_SECTORS_LIST>\n");
|
||||
for(y = 1;y <= 16;y++)
|
||||
{
|
||||
fprintf (outfile, "\t<ROW y=\"%c\">",(y+0x40));
|
||||
for(x = 1;x <= 16; x++)
|
||||
{
|
||||
fprintf (outfile, " %d",RandomSector[ ((y - 1) * 16) + (x - 1) ] );
|
||||
}
|
||||
fprintf (outfile, " </ROW>\n");
|
||||
}
|
||||
fprintf (outfile, "</ALT_SECTORS_LIST>\n");
|
||||
|
||||
fclose(outfile);
|
||||
#else
|
||||
XMLWriter xmlw;
|
||||
xmlw.openNode(L"ALT_SECTORS_LIST");
|
||||
UINT32 x, y;
|
||||
@@ -241,7 +221,6 @@ BOOLEAN WriteInAltSectors(STR fileName)
|
||||
}
|
||||
xmlw.closeNode();
|
||||
xmlw.writeToFile(fileName);
|
||||
#endif
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
|
||||
@@ -5430,22 +5430,11 @@ void LogStrategicMsg( STR8 str, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
CHAR8 string[512];
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen( "Strategic Decisions.txt", "a" );
|
||||
if( !fp )
|
||||
return;
|
||||
#endif
|
||||
va_start(argptr, str );
|
||||
vsprintf( string, str, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
#ifndef USE_VFS
|
||||
fprintf( fp, "%s\n", string );
|
||||
#else
|
||||
SGP_LOG(s_stratD.id, string);
|
||||
#endif
|
||||
|
||||
if( gfDisplayStrategicAILogs )
|
||||
{
|
||||
@@ -5455,33 +5444,17 @@ void LogStrategicMsg( STR8 str, ... )
|
||||
{
|
||||
OutputDebugString( (LPCSTR)String( "%s\n", string ) );
|
||||
}
|
||||
|
||||
#ifndef USE_VFS
|
||||
fclose( fp );
|
||||
#endif
|
||||
}
|
||||
|
||||
void LogStrategicEvent( STR8 str, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
CHAR8 string[512];
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen( "Strategic Decisions.txt", "a" );
|
||||
if( !fp )
|
||||
return;
|
||||
#endif
|
||||
va_start(argptr, str );
|
||||
vsprintf( string, str, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
#ifndef USE_VFS
|
||||
fprintf( fp, "\n%S:\n", WORLDTIMESTR );
|
||||
fprintf( fp, "%s\n", string );
|
||||
#else
|
||||
SGP_LOG(s_stratD.id) << sgp::endl << WORLDTIMESTR << ":" << sgp::endl << string << sgp::endl;
|
||||
#endif
|
||||
if( gfDisplayStrategicAILogs )
|
||||
{
|
||||
ScreenMsg( FONT_LTKHAKI, MSG_DIALOG, L"%S", string );
|
||||
@@ -5490,25 +5463,11 @@ void LogStrategicEvent( STR8 str, ... )
|
||||
{
|
||||
OutputDebugString( (LPCSTR)String( "%s\n", string ) );
|
||||
}
|
||||
#ifndef USE_VFS
|
||||
fclose( fp );
|
||||
#endif
|
||||
}
|
||||
|
||||
void ClearStrategicLog()
|
||||
{
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
fp = fopen( "Strategic Decisions.txt", "w" );
|
||||
if( !fp )
|
||||
return;
|
||||
|
||||
fprintf( fp, "STRATEGIC LOG\n" );
|
||||
|
||||
fclose( fp );
|
||||
#else
|
||||
SGP_LOG(s_stratD.id) << sgp::flush;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1659,80 +1659,6 @@ void EndLoadScreen( )
|
||||
'A' + gWorldSectorY - 1, gWorldSectorX, gbWorldSectorZ, uiSeconds, uiHundreths );
|
||||
}
|
||||
ScreenMsg( FONT_YELLOW, MSG_TESTVERSION, str );
|
||||
#ifndef USE_VFS
|
||||
FILE *fp;
|
||||
|
||||
if ( fStartNewFile )
|
||||
{ //start new file
|
||||
fp = fopen( "TimeResults.txt", "w" );
|
||||
ScreenMsg( FONT_YELLOW, MSG_TESTVERSION, L"See JA2\\Data\\TimeResults.txt for more detailed timings." );
|
||||
fStartNewFile = FALSE;
|
||||
}
|
||||
else
|
||||
{ //append to end of file
|
||||
fp = fopen( "TimeResults.txt", "a" );
|
||||
|
||||
if ( fp )
|
||||
{
|
||||
fprintf( fp, "\n\n--------------------------------------------------------------------\n\n" );
|
||||
}
|
||||
}
|
||||
if ( fp )
|
||||
{
|
||||
//Record all of the timings.
|
||||
fprintf( fp, "%S\n", str );
|
||||
fprintf( fp, "EnterSector() supersets LoadWorld(). This includes other external sections.\n" );
|
||||
//FileRead()
|
||||
fprintf( fp, "\n\nVARIOUS FUNCTION TIMINGS (exclusive of actual function timings in second heading)\n" );
|
||||
uiSeconds = uiTotalFileReadTime / 1000;
|
||||
uiHundreths = (uiTotalFileReadTime / 10) % 100;
|
||||
fprintf( fp, "FileRead: %d.%02d (called %d times)\n", uiSeconds, uiHundreths, uiTotalFileReadCalls );
|
||||
|
||||
fprintf( fp, "\n\nSECTIONS OF LOADWORLD (all parts should add up to 100%)\n" );
|
||||
//TrashWorld()
|
||||
uiSeconds = uiTrashWorldTime / 1000;
|
||||
uiHundreths = (uiTrashWorldTime / 10) % 100;
|
||||
fprintf( fp, "TrashWorld: %d.%02d\n", uiSeconds, uiHundreths );
|
||||
//LoadMapTilesets()
|
||||
uiSeconds = uiLoadMapTilesetTime / 1000;
|
||||
uiHundreths = (uiLoadMapTilesetTime / 10) % 100;
|
||||
fprintf( fp, "LoadMapTileset: %d.%02d\n", uiSeconds, uiHundreths );
|
||||
//LoadMapLights()
|
||||
uiSeconds = uiLoadMapLightsTime / 1000;
|
||||
uiHundreths = (uiLoadMapLightsTime / 10) % 100;
|
||||
fprintf( fp, "LoadMapLights: %d.%02d\n", uiSeconds, uiHundreths );
|
||||
uiSeconds = uiBuildShadeTableTime / 1000;
|
||||
uiHundreths = (uiBuildShadeTableTime / 10) % 100;
|
||||
fprintf( fp, " 1) BuildShadeTables: %d.%02d\n", uiSeconds, uiHundreths );
|
||||
|
||||
uiPercentage = uiNumImagesReloaded * 100 / giNumberOfTileTypes;
|
||||
fprintf( fp, " 2) %d%% of the tileset images were actually reloaded.\n", uiPercentage );
|
||||
if ( (uiNumTablesSaved + uiNumTablesLoaded) != 0 )
|
||||
{
|
||||
uiPercentage = uiNumTablesSaved * 100 / (uiNumTablesSaved + uiNumTablesLoaded);
|
||||
}
|
||||
else
|
||||
{
|
||||
uiPercentage = 0;
|
||||
}
|
||||
fprintf( fp, " 3) Of that, %d%% of the shade tables were generated (not loaded).\n", uiPercentage );
|
||||
if ( gfForceBuildShadeTables )
|
||||
fprintf( fp, " NOTE: Force building of shadetables enabled on this local computer.\n" );
|
||||
|
||||
|
||||
//Unaccounted
|
||||
uiUnaccounted = uiLoadWorldTime - uiTrashWorldTime - uiLoadMapTilesetTime - uiLoadMapLightsTime;
|
||||
uiSeconds = uiUnaccounted / 1000;
|
||||
uiHundreths = (uiUnaccounted / 10) % 100;
|
||||
fprintf( fp, "Unaccounted: %d.%02d\n", uiSeconds, uiHundreths );
|
||||
//LoadWorld()
|
||||
uiSeconds = uiLoadWorldTime / 1000;
|
||||
uiHundreths = (uiLoadWorldTime / 10) % 100;
|
||||
fprintf( fp, "\nTotal: %d.%02d\n", uiSeconds, uiHundreths );
|
||||
|
||||
fclose( fp );
|
||||
}
|
||||
#else
|
||||
sgp::Logger_ID time_log_id = sgp::Logger::instance( ).createLogger( );
|
||||
sgp::Logger::instance( ).connectFile( time_log_id, L"TimeResults.txt", true, sgp::Logger::FLUSH_ON_ENDL );
|
||||
sgp::Logger::LogInstance timeResults = SGP_LOG( time_log_id );
|
||||
@@ -1793,7 +1719,6 @@ void EndLoadScreen( )
|
||||
uiSeconds = uiLoadWorldTime / 1000;
|
||||
uiHundreths = (uiLoadWorldTime / 10) % 100;
|
||||
timeResults << vfs::Log::endl << "Total: " << uiSeconds << "." << uiHundreths << sgp::endl;
|
||||
#endif // USE_VFS
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user