topmenu config files are now read properly
authorDavid Anderson <dvander@alliedmods.net>
Tue Oct 16 17:28:19 2007 +0000 (2007-10-16)
changeset 15891ac5df1857fd
parent 1588 5ce5ddb0f3f6
child 1590 47557c457768
topmenu config files are now read properly
extensions/topmenus/TopMenu.cpp
     1.1 --- a/extensions/topmenus/TopMenu.cpp	Tue Oct 16 17:24:52 2007 +0000
     1.2 +++ b/extensions/topmenus/TopMenu.cpp	Tue Oct 16 17:28:19 2007 +0000
     1.3 @@ -923,7 +923,8 @@
     1.4  }
     1.5  
     1.6  #define PARSE_STATE_NONE		0
     1.7 -#define PARSE_STATE_CATEGORY	1
     1.8 +#define PARSE_STATE_MAIN		1
     1.9 +#define PARSE_STATE_CATEGORY	2
    1.10  unsigned int ignore_parse_level = 0;
    1.11  unsigned int current_parse_state = 0;
    1.12  config_category_t *cur_cat = NULL;
    1.13 @@ -953,6 +954,17 @@
    1.14  	{
    1.15  		if (current_parse_state == PARSE_STATE_NONE)
    1.16  		{
    1.17 +			if (strcmp(name, "Menu") == 0)
    1.18 +			{
    1.19 +				current_parse_state = PARSE_STATE_MAIN;
    1.20 +			}
    1.21 +			else
    1.22 +			{
    1.23 +				ignore_parse_level = 1;
    1.24 +			}
    1.25 +		}
    1.26 +		else if (current_parse_state = PARSE_STATE_MAIN)
    1.27 +		{
    1.28  			cur_cat = new config_category_t;
    1.29  			cur_cat->name = m_Config.strings.AddString(name);
    1.30  			m_Config.cats.push_back(cur_cat);
    1.31 @@ -995,6 +1007,10 @@
    1.32  		if (current_parse_state == PARSE_STATE_CATEGORY)
    1.33  		{
    1.34  			cur_cat = NULL;
    1.35 +			current_parse_state = PARSE_STATE_MAIN;
    1.36 +		}
    1.37 +		else if (current_parse_state == PARSE_STATE_MAIN)
    1.38 +		{
    1.39  			current_parse_state = PARSE_STATE_NONE;
    1.40  		}
    1.41  	}