2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2025-01-27 14:08:23 +03:00

Fix parse

This commit is contained in:
s1lent 2017-11-19 03:24:56 +07:00
parent e1e1b8aaaa
commit 98fd23afed
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C

View File

@ -193,7 +193,6 @@ MPlugin* MPluginList::plugin_addload(plid_t plid, const char* fname, PLUG_LOADTI
MPlugin* MPluginList::add(MPlugin* padd)
{
auto plug = new MPlugin();
memset(plug, 0, sizeof(MPlugin));
plug->m_index = ++m_last_index;
@ -323,12 +322,25 @@ bool MPluginList::ini_refresh()
if ((cp = Q_strrchr(line, '\n')))
*cp = '\0';
trimbuf(line);
// skip empty lines
if (line[0] == '\0') {
continue;
}
// skip comments
if (line[0] == '#' || line[0] == ';' || !Q_strncmp(line, "//", 2)) {
continue;
}
// Parse into a temp plugin
MPlugin pl_temp = {};
MPlugin pl_temp{};
if (!pl_temp.ini_parseline(line)) {
META_ERROR("ini: Skipping malformed line %d of %s", ln, m_inifile);
continue;
}
// Try to find plugin with this pathname in the current list of
// plugins.
auto pl_found = find(pl_temp.m_pathname);