- fixed admin menu regression bugs

- if a category fails to draw, the root menu now gets re-displayed

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401533
This commit is contained in:
David Anderson 2007-10-02 16:11:02 +00:00
parent 5fa3cbf134
commit 97d2c4b5a9
4 changed files with 12 additions and 4 deletions

View File

@ -354,6 +354,10 @@ bool TopMenu::DisplayMenu(int client, unsigned int hold_time, TopMenuPosition po
pClient->last_category < m_Categories.size())
{
return_value = DisplayCategory(client, pClient->last_category, hold_time, true);
if (!return_value)
{
return_value = pClient->root->DisplayAtItem(client, hold_time, pClient->last_root_pos);
}
}
else if (position == TopMenuPosition_LastRoot)
{
@ -424,7 +428,11 @@ void TopMenu::OnMenuSelect2(IBaseMenu *menu, int client, unsigned int item, unsi
if (m_Categories[i]->obj == obj)
{
pClient->last_root_pos = item_on_page;
DisplayCategory(client, (unsigned int)i, MENU_TIME_FOREVER, false);
if (!DisplayCategory(client, (unsigned int)i, MENU_TIME_FOREVER, false))
{
/* If we can't display the category, re-display the root menu */
DisplayMenu(client, MENU_TIME_FOREVER, TopMenuPosition_LastRoot);
}
break;
}
}

View File

@ -61,3 +61,4 @@ void TopMenuExtension::SDK_OnUnload()
playerhelpers->RemoveClientListener(&g_TopMenus);
plsys->RemovePluginsListener(&g_TopMenus);
}

View File

@ -85,7 +85,7 @@ public:
m_pFunction->PushCell(TopMenuAction_DrawOption);
m_pFunction->PushCell(object_id);
m_pFunction->PushCell(client);
m_pFunction->PushStringEx(buffer, sizeof(buffer), 0, SM_PARAM_COPYBACK);
m_pFunction->PushStringEx(buffer, sizeof(buffer), SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK);
m_pFunction->PushCell(sizeof(buffer));
m_pFunction->Execute(NULL);
return (unsigned int)buffer[0];

View File

@ -113,6 +113,7 @@ public CategoryHandler(Handle:topmenu,
String:buffer[],
maxlength)
{
PrintToServer("CategoryHandler(%x, %d, %x)", topmenu, action, object_id);
if (action == TopMenuAction_DisplayTitle)
{
if (object_id == INVALID_TOPMENUOBJECT)
@ -147,8 +148,6 @@ public CategoryHandler(Handle:topmenu,
Format(buffer, maxlength, "%T", "Voting Commands", param);
}
}
return 0;
}
public __GetAdminTopMenu(Handle:plugin, numParams)