From ac1dd904f1e19d9c4d43f9bfb28a33f8315fe12a Mon Sep 17 00:00:00 2001 From: Garux Date: Mon, 8 Mar 2021 13:31:25 +0300 Subject: [PATCH] * print available games on wrong -game and -format args --- tools/quake3/q3map2/help.cpp | 10 +++++++--- tools/quake3/q3map2/path_init.cpp | 7 +++---- tools/quake3/q3map2/q3map2.h | 1 + 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/quake3/q3map2/help.cpp b/tools/quake3/q3map2/help.cpp index 255d5caf..1a266bb0 100644 --- a/tools/quake3/q3map2/help.cpp +++ b/tools/quake3/q3map2/help.cpp @@ -406,6 +406,12 @@ void HelpCommon() } +void HelpGames(){ + Sys_Printf( "Available games:\n" ); + for( game_t *game = games; game->arg != NULL; ++game ) + Sys_Printf( " %s\n", game->arg ); +} + void HelpMain(const char* arg) { printf("Usage: q3map2 [stage] [common options...] [stage options...] [stage source file]\n"); @@ -455,9 +461,7 @@ void HelpMain(const char* arg) return; } if( striEqual( arg, "game" ) ){ - printf( "Available games:\n" ); - for( game_t *game = games; game->arg != NULL; ++game ) - printf( " %s\n", game->arg ); + HelpGames(); return; } } diff --git a/tools/quake3/q3map2/path_init.cpp b/tools/quake3/q3map2/path_init.cpp index cfb48fac..0fd66a76 100644 --- a/tools/quake3/q3map2/path_init.cpp +++ b/tools/quake3/q3map2/path_init.cpp @@ -196,9 +196,6 @@ void LokiInitPaths( char *argv0 ){ */ game_t *GetGame( char *arg ){ - int i; - - /* dummy check */ if ( strEmptyOrNull( arg ) ) { return NULL; @@ -217,7 +214,7 @@ game_t *GetGame( char *arg ){ } /* test it */ - i = 0; + int i = 0; while ( games[ i ].arg != NULL ) { if ( striEqual( arg, games[ i ].arg ) ) { @@ -227,6 +224,8 @@ game_t *GetGame( char *arg ){ } /* no matching game */ + Sys_Warning( "Game \"%s\" is unknown.\n", arg ); + HelpGames(); return NULL; } diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 8e4b51ca..20300db1 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -1524,6 +1524,7 @@ inline float Random( void ){ /* returns a pseudorandom number between 0 and 1 */ /* help.c */ void HelpMain(const char* arg); +void HelpGames(); /* path_init.c */ game_t *GetGame( char *arg );