AutoExecConfig: Adjust few things

This commit is contained in:
Arkshine 2015-07-20 11:19:28 +02:00
parent 78b1154b8d
commit 5b8bbddbc1
4 changed files with 20 additions and 7 deletions

View File

@ -449,15 +449,19 @@ void CPluginMngr::CPlugin::AddConfig(bool create, const char *name, const char *
// Do a check for duplicates to prevent double-execution // Do a check for duplicates to prevent double-execution
for (size_t i = 0; i < m_configs.length(); ++i) for (size_t i = 0; i < m_configs.length(); ++i)
{ {
auto config = m_configs[i]; AutoConfig *config = m_configs[i];
if (config->autocfg.compare(name) == 0 && config->folder.compare(folder) == 0 && config->create == create) if (config->autocfg.compare(name) == 0 && config->folder.compare(folder) == 0)
{ {
if (!config->create)
{
config->create = create;
}
return; return;
} }
} }
AutoConfig *c = new AutoConfig; auto c = new AutoConfig;
c->autocfg = name; c->autocfg = name;
c->folder = folder; c->folder = folder;

View File

@ -71,7 +71,7 @@ public:
bool m_Debug; bool m_Debug;
cell* m_pNullStringOfs; cell* m_pNullStringOfs;
cell* m_pNullVectorOfs; cell* m_pNullVectorOfs;
ke::Vector<AutoConfig*> m_configs; ke::Vector<ke::AutoPtr<AutoConfig>> m_configs;
public: public:
inline const char* getName() { return name.chars();} inline const char* getName() { return name.chars();}
inline const char* getVersion() { return version.chars();} inline const char* getVersion() { return version.chars();}

View File

@ -15,7 +15,7 @@
CoreConfig CoreCfg; CoreConfig CoreCfg;
const char *MainConfigFile = "amxx.cfg"; const char *MainConfigFile = "amxx.cfg";
const char *AutoConfigDir = "/plugin"; const char *AutoConfigDir = "/plugins";
const char *MapConfigDir = "/maps"; const char *MapConfigDir = "/maps";
const char *CommandFormat = "exec %s\n"; const char *CommandFormat = "exec %s\n";
@ -163,7 +163,16 @@ bool CoreConfig::ExecuteAutoConfig(CPluginMngr::CPlugin *plugin, AutoConfig *con
if (fp) if (fp)
{ {
fprintf(fp, "// This file was auto-generated by AMX Mod X (v%s)\n", AMXX_VERSION); fprintf(fp, "// This file was auto-generated by AMX Mod X (v%s)\n", AMXX_VERSION);
if (*plugin->getTitle() && *plugin->getAuthor() && *plugin->getVersion())
{
fprintf(fp, "// Cvars for plugin \"%s\" by \"%s\" (%s, v%s)\n", plugin->getTitle(), plugin->getAuthor(), plugin->getName(), plugin->getVersion());
}
else
{
fprintf(fp, "// Cvars for plugin \"%s\"\n", plugin->getName()); fprintf(fp, "// Cvars for plugin \"%s\"\n", plugin->getName());
}
fprintf(fp, "\n\n"); fprintf(fp, "\n\n");
for (auto iter = list->begin(); iter != list->end(); iter++) for (auto iter = list->begin(); iter != list->end(); iter++)

View File

@ -3226,7 +3226,7 @@ forward OnAutoConfigsBuffered();
* information from the plugin's registered cvars. * information from the plugin's registered cvars.
* @param name Name of the config file, excluding the .cfg extension. * @param name Name of the config file, excluding the .cfg extension.
* If empty, <plugin.filename.cfg> is assumed. * If empty, <plugin.filename.cfg> is assumed.
* @param folder Folder under plugin/ to use. * @param folder Folder under plugins/ to use.
* *
* @noreturn * @noreturn
*/ */