- 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:
		
							parent
							
								
									5fa3cbf134
								
							
						
					
					
						commit
						97d2c4b5a9
					
				@ -354,6 +354,10 @@ bool TopMenu::DisplayMenu(int client, unsigned int hold_time, TopMenuPosition po
 | 
				
			|||||||
		pClient->last_category < m_Categories.size())
 | 
							pClient->last_category < m_Categories.size())
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		return_value = DisplayCategory(client, pClient->last_category, hold_time, true);
 | 
							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)
 | 
						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)
 | 
								if (m_Categories[i]->obj == obj)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				pClient->last_root_pos = item_on_page;
 | 
									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;
 | 
									break;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -61,3 +61,4 @@ void TopMenuExtension::SDK_OnUnload()
 | 
				
			|||||||
	playerhelpers->RemoveClientListener(&g_TopMenus);
 | 
						playerhelpers->RemoveClientListener(&g_TopMenus);
 | 
				
			||||||
	plsys->RemovePluginsListener(&g_TopMenus);
 | 
						plsys->RemovePluginsListener(&g_TopMenus);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -85,7 +85,7 @@ public:
 | 
				
			|||||||
		m_pFunction->PushCell(TopMenuAction_DrawOption);
 | 
							m_pFunction->PushCell(TopMenuAction_DrawOption);
 | 
				
			||||||
		m_pFunction->PushCell(object_id);
 | 
							m_pFunction->PushCell(object_id);
 | 
				
			||||||
		m_pFunction->PushCell(client);
 | 
							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->PushCell(sizeof(buffer));
 | 
				
			||||||
		m_pFunction->Execute(NULL);
 | 
							m_pFunction->Execute(NULL);
 | 
				
			||||||
		return (unsigned int)buffer[0];
 | 
							return (unsigned int)buffer[0];
 | 
				
			||||||
 | 
				
			|||||||
@ -113,6 +113,7 @@ public CategoryHandler(Handle:topmenu,
 | 
				
			|||||||
						String:buffer[],
 | 
											String:buffer[],
 | 
				
			||||||
						maxlength)
 | 
											maxlength)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						PrintToServer("CategoryHandler(%x, %d, %x)", topmenu, action, object_id);
 | 
				
			||||||
	if (action == TopMenuAction_DisplayTitle)
 | 
						if (action == TopMenuAction_DisplayTitle)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (object_id == INVALID_TOPMENUOBJECT)
 | 
							if (object_id == INVALID_TOPMENUOBJECT)
 | 
				
			||||||
@ -147,8 +148,6 @@ public CategoryHandler(Handle:topmenu,
 | 
				
			|||||||
			Format(buffer, maxlength, "%T", "Voting Commands", param);
 | 
								Format(buffer, maxlength, "%T", "Voting Commands", param);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	return 0;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public __GetAdminTopMenu(Handle:plugin, numParams)
 | 
					public __GetAdminTopMenu(Handle:plugin, numParams)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user