Last-minute curse: no menus for dedis, empty item names instead of '.'
This commit is contained in:
parent
0fda4cf017
commit
784fc8f46c
2 changed files with 24 additions and 22 deletions
|
|
@ -2361,7 +2361,6 @@ void readmenu(MYFILE *f, INT32 num)
|
||||||
char *word2;
|
char *word2;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
INT32 value;
|
INT32 value;
|
||||||
boolean space = false;
|
|
||||||
|
|
||||||
menu_t *menudef = allocmenu(num);
|
menu_t *menudef = allocmenu(num);
|
||||||
|
|
||||||
|
|
@ -2383,44 +2382,37 @@ void readmenu(MYFILE *f, INT32 num)
|
||||||
if (s == tmp)
|
if (s == tmp)
|
||||||
continue; // Skip comment lines, but don't break.
|
continue; // Skip comment lines, but don't break.
|
||||||
|
|
||||||
space = false;
|
|
||||||
|
|
||||||
// Get the part before the " = "
|
// Get the part before the " = "
|
||||||
tmp = strchr(s, '=');
|
tmp = strchr(s, '=');
|
||||||
if (tmp)
|
if (tmp)
|
||||||
*(tmp-1) = '\0';
|
*(tmp-1) = '\0';
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
space = true;
|
// ...or get the word after the space. yay special syntax!
|
||||||
tmp = strchr(s, ' ');
|
word2 = strchr(s, ' ');
|
||||||
if (tmp)
|
if (word2)
|
||||||
*tmp-- = '\0'; // decrement after, so word2 is correct
|
{
|
||||||
else
|
*word2++ = '\0';
|
||||||
break;
|
if (*word2 == '\0' || *word2 == ' ') // trailing space(s) after MenuItem doesn't count
|
||||||
}
|
word2 = NULL;
|
||||||
strupr(word);
|
else
|
||||||
|
strupr(word2);
|
||||||
|
}
|
||||||
|
strupr(word);
|
||||||
|
|
||||||
// Now get the part after
|
|
||||||
word2 = (tmp += 2);
|
|
||||||
strupr(word2);
|
|
||||||
|
|
||||||
value = atoi(word2); // used for numerical settings
|
|
||||||
|
|
||||||
if (space)
|
|
||||||
{
|
|
||||||
if (fastcmp(word, "MENUITEM"))
|
if (fastcmp(word, "MENUITEM"))
|
||||||
{
|
{
|
||||||
if (strlen(word2) > ITEMNAMELEN)
|
if (word2 && strlen(word2) > ITEMNAMELEN)
|
||||||
{
|
{
|
||||||
deh_warning("Menu %d: item name %s is too long (max %d characters)", num, word2, ITEMNAMELEN);
|
deh_warning("Menu %d: item name %s is too long (max %d characters)", num, word2, ITEMNAMELEN);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
menuitem_t *item = word2[0] == '.' ? NULL : M_CheckMenuItem(num, word2);
|
menuitem_t *item = word2 ? M_CheckMenuItem(num, word2) : NULL;
|
||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
{
|
{
|
||||||
menudef->menuitems = Z_Realloc(menudef->menuitems, sizeof(menuitem_t)*(menudef->numitems+1), PU_STATIC, NULL);
|
menudef->menuitems = Z_Realloc(menudef->menuitems, sizeof(menuitem_t)*(menudef->numitems+1), PU_STATIC, NULL);
|
||||||
item = menudef->menuitems + menudef->numitems++;
|
item = menudef->menuitems + menudef->numitems++;
|
||||||
strncpy(item->itemname, word2, ITEMNAMELEN);
|
strncpy(item->itemname, word2 ? word2 : "", ITEMNAMELEN);
|
||||||
item->text = "";
|
item->text = "";
|
||||||
}
|
}
|
||||||
readmenuitem(f, item);
|
readmenuitem(f, item);
|
||||||
|
|
@ -2429,6 +2421,13 @@ void readmenu(MYFILE *f, INT32 num)
|
||||||
deh_warning("Menu %d: unknown word '%s'", num, word);
|
deh_warning("Menu %d: unknown word '%s'", num, word);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
strupr(word);
|
||||||
|
|
||||||
|
// Now get the part after
|
||||||
|
word2 = (tmp += 2);
|
||||||
|
strupr(word2);
|
||||||
|
|
||||||
|
value = atoi(word2); // used for numerical settings
|
||||||
|
|
||||||
if (fastcmp(word, "BACKGROUNDNAME"))
|
if (fastcmp(word, "BACKGROUNDNAME"))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -471,6 +471,9 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "MENU"))
|
else if (fastcmp(word, "MENU"))
|
||||||
{
|
{
|
||||||
|
if (dedicated)
|
||||||
|
continue; // dedis don't need menus, silly!
|
||||||
|
|
||||||
if (i == 0 && word2[0] != '0') // If word2 isn't a number
|
if (i == 0 && word2[0] != '0') // If word2 isn't a number
|
||||||
i = get_menutype(word2); // find a huditem by name
|
i = get_menutype(word2); // find a huditem by name
|
||||||
if (i >= 1 && i < NUMMENUTYPES)
|
if (i >= 1 && i < NUMMENUTYPES)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue