changed bot directory structure.
added folder renaming on start (temporary).
This commit is contained in:
parent
77ed0bedd1
commit
0ff1caf5b9
3 changed files with 76 additions and 52 deletions
|
|
@ -812,7 +812,7 @@ void InitConfig (void)
|
|||
else
|
||||
{
|
||||
yb_communication_type.SetInt (1);
|
||||
AddLogEntry (true, LL_DEFAULT, "Voice Communication disabled.");
|
||||
AddLogEntry (true, LL_DEFAULT, "Chatter Communication disabled.");
|
||||
}
|
||||
|
||||
// LOCALIZER INITITALIZATION
|
||||
|
|
@ -909,7 +909,7 @@ void GameDLLInit (void)
|
|||
RegisterCommand ("yb", CommandHandler);
|
||||
|
||||
// execute main config
|
||||
ServerCommand ("exec addons/yapb/config/yapb.cfg");
|
||||
ServerCommand ("exec addons/yapb/conf/yapb.cfg");
|
||||
|
||||
// register fake metamod command handler if we not! under mm
|
||||
if (!g_isMetamod)
|
||||
|
|
@ -2053,7 +2053,7 @@ void ServerActivate (edict_t *pentEdictList, int edictCount, int clientMax)
|
|||
g_waypoint->Load ();
|
||||
|
||||
// execute main config
|
||||
ServerCommand ("exec addons/yapb/config/yapb.cfg");
|
||||
ServerCommand ("exec addons/yapb/conf/yapb.cfg");
|
||||
|
||||
if (TryFileOpen (FormatBuffer ("%s/maps/%s_yapb.cfg", GetModName (), GetMapName ())))
|
||||
{
|
||||
|
|
@ -2989,6 +2989,50 @@ export void Meta_Init (void)
|
|||
g_isMetamod = true;
|
||||
}
|
||||
|
||||
#include <io.h>
|
||||
|
||||
void FixDirectoryStructure (void)
|
||||
{
|
||||
// temporary function for 2.7 directory structure changes, will be delete after final releases of the bot
|
||||
|
||||
struct DirectoryTransition
|
||||
{
|
||||
String oldName;
|
||||
String newName;
|
||||
|
||||
DirectoryTransition (void)
|
||||
{
|
||||
}
|
||||
|
||||
DirectoryTransition (const String &oldName, const String &newName)
|
||||
{
|
||||
String rootPath;
|
||||
rootPath->AssignFormat ("%s/addons/yapb/", GetModName ());
|
||||
|
||||
this->oldName = rootPath + oldName;
|
||||
this->newName = rootPath + newName;
|
||||
}
|
||||
|
||||
void TryToRename (void)
|
||||
{
|
||||
if (access (oldName->GetBuffer (), 00) != -1)
|
||||
rename (oldName->GetBuffer (), newName->GetBuffer ());
|
||||
}
|
||||
};
|
||||
|
||||
Array <DirectoryTransition> directories;
|
||||
|
||||
directories.Push (DirectoryTransition ("wptdefault", "data"));
|
||||
directories.Push (DirectoryTransition ("data/data", "data/learned"));
|
||||
directories.Push (DirectoryTransition ("config", "conf"));
|
||||
directories.Push (DirectoryTransition ("conf/language", "conf/lang"));
|
||||
|
||||
IterateArray (directories, it)
|
||||
directories[it].TryToRename ();
|
||||
|
||||
directories.RemoveAll ();
|
||||
}
|
||||
|
||||
DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *functionTable, globalvars_t *pGlobals)
|
||||
{
|
||||
// this is the very first function that is called in the game DLL by the engine. Its purpose
|
||||
|
|
@ -3006,6 +3050,8 @@ DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *functionTable, globalvars_t
|
|||
memcpy (&g_engfuncs, functionTable, sizeof (enginefuncs_t));
|
||||
g_pGlobals = pGlobals;
|
||||
|
||||
FixDirectoryStructure ();
|
||||
|
||||
// register our cvars
|
||||
g_convarWrapper->PushRegisteredConVarsToEngine ();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue