MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / Load

Method Load

neo/tools/compilers/aas/AASFile.cpp:1103–1201  ·  view source on GitHub ↗

================ idAASFileLocal::Load ================ */

Source from the content-addressed store, hash-verified

1101================
1102*/
1103bool idAASFileLocal::Load( const idStr &fileName, unsigned int mapFileCRC ) {
1104 idLexer src( LEXFL_NOFATALERRORS | LEXFL_NOSTRINGESCAPECHARS | LEXFL_NOSTRINGCONCAT | LEXFL_ALLOWPATHNAMES );
1105 idToken token;
1106 int depth;
1107 unsigned int c;
1108
1109 name = fileName;
1110 crc = mapFileCRC;
1111
1112 common->Printf( "[Load AAS]\n" );
1113 common->Printf( "loading %s\n", name.c_str() );
1114
1115 if ( !src.LoadFile( name ) ) {
1116 return false;
1117 }
1118
1119 if ( !src.ExpectTokenString( AAS_FILEID ) ) {
1120 common->Warning( "Not an AAS file: '%s'", name.c_str() );
1121 return false;
1122 }
1123
1124 if ( !src.ReadToken( &token ) || token != AAS_FILEVERSION ) {
1125 common->Warning( "AAS file '%s' has version %s instead of %s", name.c_str(), token.c_str(), AAS_FILEVERSION );
1126 return false;
1127 }
1128
1129 if ( !src.ExpectTokenType( TT_NUMBER, TT_INTEGER, &token ) ) {
1130 common->Warning( "AAS file '%s' has no map file CRC", name.c_str() );
1131 return false;
1132 }
1133
1134 c = token.GetUnsignedIntValue();
1135 if ( mapFileCRC && c != mapFileCRC ) {
1136 common->Warning( "AAS file '%s' is out of date", name.c_str() );
1137 return false;
1138 }
1139
1140 // clear the file in memory
1141 Clear();
1142
1143 // parse the file
1144 while ( 1 ) {
1145 if ( !src.ReadToken( &token ) ) {
1146 break;
1147 }
1148
1149 if ( token == "settings" ) {
1150 if ( !settings.FromParser( src ) ) { return false; }
1151 }
1152 else if ( token == "planes" ) {
1153 if ( !ParsePlanes( src ) ) { return false; }
1154 }
1155 else if ( token == "vertices" ) {
1156 if ( !ParseVertices( src ) ) { return false; }
1157 }
1158 else if ( token == "edges" ) {
1159 if ( !ParseEdges( src ) ) { return false; }
1160 }

Callers 2

LoadAASMethod · 0.45
BuildReachabilityMethod · 0.45

Calls 11

ClearFunction · 0.85
GetUnsignedIntValueMethod · 0.80
FromParserMethod · 0.80
PrintfMethod · 0.45
c_strMethod · 0.45
LoadFileMethod · 0.45
ExpectTokenStringMethod · 0.45
WarningMethod · 0.45
ReadTokenMethod · 0.45
ExpectTokenTypeMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected