@@ -167,36 +167,13 @@ void CCommandFuncs::Clear(const char* szParameters)
167167
168168void CCommandFuncs::Load (const char * szParameters)
169169{
170- if (!szParameters)
171- {
172- CCore::GetSingleton ().GetConsole ()->Printf (" * Syntax: load <mod-name> [<arguments>]" );
173- return ;
174- }
175-
176- // Copy the buffer
177- char * szTemp = new char [strlen (szParameters) + 1 ];
178- strcpy (szTemp, szParameters);
179-
180- // Split it up into mod name and the arguments
181- char * szModName = strtok (szTemp, " " );
182- char * szArguments = strtok (NULL , " \0 " );
183-
184- if (szModName)
185- {
186- // Load the mod with the given arguments
187- CModManager::GetSingleton ().RequestLoad (szModName, szArguments);
188- }
189- else
190- CCore::GetSingleton ().GetConsole ()->Printf (" * Syntax: load <mod-name> [<arguments>]" );
191-
192- // Free the temp buffer
193- delete[] szTemp;
170+ CModManager::GetSingleton ().RequestLoad (szParameters);
194171}
195172
196173void CCommandFuncs::Unload (const char * szParameters)
197174{
198175 // Any mod loaded?
199- if (CModManager::GetSingleton ().GetCurrentMod ())
176+ if (CModManager::GetSingleton ().IsLoaded ())
200177 {
201178 // Unload it
202179 CModManager::GetSingleton ().RequestUnload ();
@@ -209,6 +186,12 @@ void CCommandFuncs::Unload(const char* szParameters)
209186
210187void CCommandFuncs::Connect (const char * szParameters)
211188{
189+ if (!CCore::GetSingleton ().IsNetworkReady ())
190+ {
191+ CCore::GetSingleton ().GetConsole ()->Print (_ (" connect: Network is not ready, please wait a moment" ));
192+ return ;
193+ }
194+
212195 // Parse the arguments (host port nick pass)
213196 char szBuffer[256 ] = " " ;
214197 if (szParameters)
@@ -264,7 +247,7 @@ void CCommandFuncs::Connect(const char* szParameters)
264247 CModManager::GetSingleton ().Unload ();
265248
266249 // Only connect if there is no mod loaded
267- if (!CModManager::GetSingleton ().GetCurrentMod ())
250+ if (!CModManager::GetSingleton ().IsLoaded ())
268251 {
269252 // Start the connect
270253 if (CCore::GetSingleton ().GetConnectManager ()->Connect (szHost, usPort, strNick.c_str (), szPass))
@@ -284,7 +267,7 @@ void CCommandFuncs::Connect(const char* szParameters)
284267
285268void CCommandFuncs::ReloadNews (const char * szParameters)
286269{
287- if (CModManager::GetSingleton ().GetCurrentMod ())
270+ if (CModManager::GetSingleton ().IsLoaded ())
288271 {
289272 CCore::GetSingleton ().GetConsole ()->Print (" reloadnews: can't do this whilst connected to server" );
290273 return ;
@@ -296,6 +279,12 @@ void CCommandFuncs::ReloadNews(const char* szParameters)
296279
297280void CCommandFuncs::Reconnect (const char * szParameters)
298281{
282+ if (!CCore::GetSingleton ().IsNetworkReady ())
283+ {
284+ CCore::GetSingleton ().GetConsole ()->Print (_ (" reconnect: Network is not ready, please wait a moment" ));
285+ return ;
286+ }
287+
299288 CModManager::GetSingleton ().Unload ();
300289
301290 std::string strHost, strNick, strPassword;
@@ -309,7 +298,7 @@ void CCommandFuncs::Reconnect(const char* szParameters)
309298 CModManager::GetSingleton ().Unload ();
310299
311300 // Any mod loaded?
312- if (!CModManager::GetSingleton ().GetCurrentMod ())
301+ if (!CModManager::GetSingleton ().IsLoaded ())
313302 {
314303 // Verify and convert the port number
315304 if (uiPort <= 0 || uiPort > 0xFFFF )
0 commit comments