From 6d95ec7d03e52591949076d2b2f267b2226cd3c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Troch?= Date: Wed, 28 Aug 2024 11:04:35 +0200 Subject: [PATCH] [HL25] Backport changes to CS bot place loading code --- game_shared/bot/nav_file.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/game_shared/bot/nav_file.cpp b/game_shared/bot/nav_file.cpp index 5e47ee5..67971d4 100644 --- a/game_shared/bot/nav_file.cpp +++ b/game_shared/bot/nav_file.cpp @@ -139,7 +139,7 @@ public: } /// load the directory - void Load( SteamFile *file ) + bool Load( SteamFile *file ) { // read number of entries EntryType count; @@ -156,7 +156,7 @@ public: if ( len >= sizeof( placeName ) ) { assert( false && "PlaceDirectory::Load: Invalid placeName size" ); - return; + return false; } file->Read( placeName, len ); @@ -164,6 +164,8 @@ public: AddPlace( TheBotPhrases->NameToID( placeName ) ); } + + return true; } private: @@ -1020,7 +1022,11 @@ NavErrorType LoadNavigationMap( void ) // load Place directory if (version >= 5) { - placeDirectory.Load( &navFile ); + if ( !placeDirectory.Load( &navFile ) ) + { + CONSOLE_ECHO( "ERROR: Invalid navigation file '%s'.\n", filename ); + return NAV_INVALID_FILE; + } } // get number of areas