Skip to content

Commit 543bd1a

Browse files
author
hogantp
committed
read the config file on the command line
fixed a typo in the admin game welcome message added responses for !disable and !enable updated version to 10.3
1 parent 6120e5a commit 543bd1a

File tree

9 files changed

+67
-5
lines changed

9 files changed

+67
-5
lines changed

BNCSutil.dll

204 KB
Binary file not shown.

ghost.exe

936 KB
Binary file not shown.

ghost/bnet.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,10 @@ void CBNET :: ProcessChatEvent( CIncomingChatEvent *chatEvent )
782782
if( Command == "disable" )
783783
{
784784
if( IsRootAdmin( User ) )
785+
{
786+
QueueChatCommand( m_GHost->m_Language->BotDisabled( ), User, Whisper );
785787
m_GHost->m_Enabled = false;
788+
}
786789
else
787790
QueueChatCommand( m_GHost->m_Language->YouDontHaveAccessToThatCommand( ), User, Whisper );
788791
}
@@ -794,7 +797,10 @@ void CBNET :: ProcessChatEvent( CIncomingChatEvent *chatEvent )
794797
if( Command == "enable" )
795798
{
796799
if( IsRootAdmin( User ) )
800+
{
801+
QueueChatCommand( m_GHost->m_Language->BotEnabled( ), User, Whisper );
797802
m_GHost->m_Enabled = true;
803+
}
798804
else
799805
QueueChatCommand( m_GHost->m_Language->YouDontHaveAccessToThatCommand( ), User, Whisper );
800806
}

ghost/game.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -3291,7 +3291,7 @@ void CAdminGame :: SendWelcomeMessage( CGamePlayer *player )
32913291
SendChat( player, "Commands: addadmin, checkadmin, countadmins, deladmin" );
32923292
SendChat( player, "Commands: disable, enable, end, exit, getgame, getgames" );
32933293
SendChat( player, "Commands: load, map, password, priv, privby, pub, pubby" );
3294-
SendChat( player, "Commands: saygames, quit, unhost" );
3294+
SendChat( player, "Commands: quit, saygames, unhost" );
32953295
}
32963296

32973297
void CAdminGame :: EventPlayerJoined( CPotentialPlayer *player, CIncomingJoinPlayer *joinPlayer )
@@ -3482,14 +3482,20 @@ void CAdminGame :: EventPlayerBotCommand( CGamePlayer *player, string command, s
34823482
//
34833483

34843484
if( Command == "disable" )
3485+
{
3486+
SendChat( player, m_GHost->m_Language->BotDisabled( ) );
34853487
m_GHost->m_Enabled = false;
3488+
}
34863489

34873490
//
34883491
// !ENABLE
34893492
//
34903493

34913494
if( Command == "enable" )
3495+
{
3496+
SendChat( player, m_GHost->m_Language->BotEnabled( ) );
34923497
m_GHost->m_Enabled = true;
3498+
}
34933499

34943500
//
34953501
// !END

ghost/ghost.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,21 @@ void SignalCatcher( int signal )
120120
// main
121121
//
122122

123-
int main( void )
123+
int main( int argc, char **argv )
124124
{
125+
string CFGFile = "ghost.cfg";
126+
127+
if( argc > 1 && argv[1] )
128+
CFGFile = argv[1];
129+
125130
// read config file
126131

127132
CConfig CFG;
128-
CFG.Read( "ghost.cfg" );
133+
CFG.Read( CFGFile );
129134
gLogFile = CFG.GetString( "bot_log", "ghost.log" );
130135

136+
// print something for logging purposes
137+
131138
CONSOLE_Print( "[GHOST] starting up" );
132139

133140
// catch SIGABRT and SIGINT
@@ -241,7 +248,7 @@ CGHost :: CGHost( CConfig *CFG )
241248
m_Language = new CLanguage( );
242249
m_Exiting = false;
243250
m_Enabled = true;
244-
m_Version = "10.2";
251+
m_Version = "10.3";
245252
m_HostCounter = 1;
246253
m_Warcraft3Path = CFG->GetString( "bot_war3path", "C:\\Program Files\\Warcraft III\\" );
247254
m_HostPort = CFG->GetInt( "bot_hostport", 6112 );

ghost/language.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -931,3 +931,13 @@ string CLanguage :: UnableToCreateGameDisabled( string gamename )
931931
Replace( Out, "$GAMENAME$", gamename );
932932
return Out;
933933
}
934+
935+
string CLanguage :: BotDisabled( )
936+
{
937+
return m_CFG->GetString( "lang_0126", "lang_0126" );
938+
}
939+
940+
string CLanguage :: BotEnabled( )
941+
{
942+
return m_CFG->GetString( "lang_0127", "lang_0127" );
943+
}

ghost/language.h

+2
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ class CLanguage
161161
string UnableToCheckPlayerFoundMoreThanOneMatch( string victim );
162162
string TheGameIsLockedBNET( );
163163
string UnableToCreateGameDisabled( string gamename );
164+
string BotDisabled( );
165+
string BotEnabled( );
164166
};
165167

166168
#endif

language.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,5 @@ lang_0122 = Checked player [$VICTIM$]. Admin: $ADMIN$, Owner: $OWNER$, Spoof Che
127127
lang_0123 = Unable to check player [$VICTIM$]. Found more than one match.
128128
lang_0124 = This command is disabled while the game is locked.
129129
lang_0125 = Unable to create game [$GAMENAME$]. The bot is disabled.
130+
lang_0126 = Creation of new games has been disabled (if there is a game in the lobby it will not be automatically unhosted).
131+
lang_0127 = Creation of new games has been enabled.

readme.txt

+30-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
====================
2-
GHost++ Version 10.2
2+
GHost++ Version 10.3
33
====================
44

55
GHost++ is a port of the original GHost project to C++ (ported by Trevor Hogan).
@@ -225,8 +225,12 @@ In battle.net (via local chat or whisper at any time):
225225
!countbans display the total number of bans for this realm
226226
!deladmin <name> remove an admin from the database for this realm
227227
!delban <name> remove a ban from the database for this realm
228+
!disable disable creation of new games
229+
!enable enable creation of new games
228230
!end <number> end a game in progress (disconnect everyone)
229231
!exit [force] shutdown ghost++, optionally add [force] to skip checks
232+
!getclan refresh the internal copy of the clan members list
233+
!getfriends refresh the internal copy of the friends list
230234
!getgame <number> display information on a game in progress
231235
!getgames display information on all games
232236
!hold <name> ... hold a slot for someone
@@ -240,6 +244,7 @@ In battle.net (via local chat or whisper at any time):
240244
!pubby <owner> <name> host public game by another player (gives <owner> access to admin commands in the game lobby and in the game)
241245
!quit [force] alias to !exit
242246
!say <text> send <text> to battle.net as a chat command
247+
!saygames <text> send <text> to all games
243248
!sp shuffle players
244249
!start [force] start game, optionally add [force] to skip checks
245250
!stats [name] display basic player statistics, optionally add [name] to display statistics for another player (can be used by non admins)
@@ -292,6 +297,7 @@ In game:
292297

293298
!addban <name> <reason> add a new ban to the database (it tries to do a partial match)
294299
!ban alias to !addban
300+
!banlast <reason> ban the last leaver
295301
!check <name> check a user's status (leave blank to check your own status)
296302
!checkban <name> check if a user is banned on any realm
297303
!drop drop all lagging players
@@ -314,6 +320,8 @@ In admin game lobby:
314320
!checkadmin <name> <realm> check if a user is an admin for the specified realm (if only one realm is defined in ghost.cfg it uses that realm instead)
315321
!countadmins <realm> display the total number of admins for the specified realm (if only one realm is defined in ghost.cfg it uses that realm instead)
316322
!deladmin <name> <realm> remove an admin from the database for the specified realm (if only one realm is defined in ghost.cfg it uses that realm instead)
323+
!disable disable creation of new games
324+
!enable enable creation of new games
317325
!end <number> end a game in progress (disconnect everyone)
318326
!exit [force] shutdown ghost++, optionally add [force] to skip checks
319327
!getgame <number> display information on a game in progress
@@ -326,6 +334,7 @@ In admin game lobby:
326334
!pub <name> host public game
327335
!pubby <owner> <name> host public game by another player (gives <owner> access to admin commands in the game lobby and in the game)
328336
!quit [force] alias to !exit
337+
!saygames <text> send <text> to all games
329338
!unhost unhost game
330339

331340
============================
@@ -392,6 +401,26 @@ GHost++ searches for "storm.dll" in all lowercase not "Storm.dll" so you may nee
392401
CHANGELOG
393402
=========
394403

404+
Version 10.3
405+
- added support for specifying the config file on the command line (e.g. "ghost.exe mycfg.cfg" or "ghost++ mycfg.cfg")
406+
* it will default to ghost.cfg if no config file is specified
407+
- added support for logging console output
408+
- added new config value bot_log to specify the log file
409+
- added new config value bot_autolock to automatically lock the game when the owner joins
410+
- added new config value bnet*_holdfriends to automatically add the bot's friends to the reserved list when creating a game
411+
- added new config value bnet*_holdclan to automatically add the bot's clan members to the reserved list when creating a game
412+
- added new command !banlast to ban the last leaver
413+
- added new command !getclan to refresh the clan members list
414+
- added new command !getfriends to refresh the friends list
415+
- added new command !disable to prevent new games from being created
416+
- added new command !enable to allow new games to be created
417+
- added new command !saygames to send a chat message to all games
418+
- fixed a bug where Warcraft 3 would crash when sharing control of units when the map has 12 slots and when connecting via LAN
419+
- fixed some bugs where long chat messages would be incorrectly truncated
420+
- fixed a crash bug when there was an error opening the sqlite3 database
421+
- fixed a potential crash bug when checking game player summaries with a corrupt database
422+
- added 3 new entries to language.cfg
423+
395424
Version 10.2
396425
- added new command !closeall to close all open slots
397426
- added new command !openall to open all closed slots

0 commit comments

Comments
 (0)