sourcemm/concommands.cpp
changeset 13 4a48c5b9f93c
parent 12 9fd53562f68c
child 16 862e254723a4
     1.1 --- a/sourcemm/concommands.cpp	Sun Apr 17 03:37:50 2005 +0000
     1.2 +++ b/sourcemm/concommands.cpp	Sun Apr 17 04:21:02 2005 +0000
     1.3 @@ -227,7 +227,7 @@
     1.4  				pl = g_PluginMngr.FindById(id);
     1.5  				if (!pl || id < Pl_MinId || (pl->m_Status < Pl_Paused))
     1.6  				{
     1.7 -					Msg("Failed to load plugin %s.  %s\n", file, error);
     1.8 +					Msg("Failed to load plugin %s (%s).\n", file, error);
     1.9  					return;
    1.10  				}
    1.11  
    1.12 @@ -294,6 +294,45 @@
    1.13  			Msg("All plugins unloaded.\n");
    1.14  
    1.15  			return;
    1.16 +		} else if (strcmp(command, "retry") == 0) {
    1.17 +			if (args >= 3)
    1.18 +			{
    1.19 +				int id = atoi(e->Cmd_Argv(2));
    1.20 +				SourceMM::CPluginManager::CPlugin *pl;
    1.21 +
    1.22 +				pl = g_PluginMngr.FindById(id);
    1.23 +
    1.24 +				if (!pl)
    1.25 +				{
    1.26 +					Msg("Plugin %d not found.\n", id);
    1.27 +					return;
    1.28 +				}
    1.29 +
    1.30 +				if (pl->m_Status >= Pl_Paused)
    1.31 +				{
    1.32 +					Msg("Plugin %d is already loaded.\n");
    1.33 +					return;
    1.34 +				}
    1.35 +				
    1.36 +				PluginId plid;
    1.37 +				char error[255];
    1.38 +				bool already;
    1.39 +
    1.40 +				plid = g_PluginMngr.Load(pl->m_File.c_str(), Pl_Console, already, error, sizeof(error)-1);
    1.41 +				if (plid < Pl_MinId)
    1.42 +				{
    1.43 +					Msg("Failed to reload plugin %d: (%s).\n", id, error);
    1.44 +					return;
    1.45 +				}
    1.46 +
    1.47 +				Msg("Plugin %d successfully reloaded as plugin %d.\n", id, plid);
    1.48 +
    1.49 +				return;
    1.50 +			} else {
    1.51 +				Msg("Usage: meta force_unload <id>\n");
    1.52 +
    1.53 +				return;
    1.54 +			}
    1.55  		}
    1.56  	}
    1.57  
    1.58 @@ -308,6 +347,7 @@
    1.59  	Msg("  load         - Load a plugin\n");
    1.60  	Msg("  pause        - Pause a running plugin\n");
    1.61  	Msg("  refresh      - Reparse plugins file\n");
    1.62 +	Msg("  retry		- Attempt to reload a plugin\n");
    1.63  	Msg("  unload       - Unload a loaded plugin\n");
    1.64  	Msg("  unpause      - Unpause a paused plugin\n");
    1.65  	Msg("  version      - Version information\n");