added extensive menu action logging
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40976
This commit is contained in:
parent
5b7d82570f
commit
68d2f741cf
@ -18,6 +18,9 @@
|
||||
#include "PlayerManager.h"
|
||||
#include "MenuManager.h"
|
||||
#include "HandleSys.h"
|
||||
#if defined MENU_DEBUG
|
||||
#include "Logger.h"
|
||||
#endif
|
||||
|
||||
BaseMenuStyle::BaseMenuStyle() : m_WatchList(256), m_hHandle(BAD_HANDLE)
|
||||
{
|
||||
@ -36,16 +39,25 @@ Handle_t BaseMenuStyle::GetHandle()
|
||||
|
||||
void BaseMenuStyle::AddClientToWatch(int client)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] AddClientToWatch(%d)", client);
|
||||
#endif
|
||||
m_WatchList.push_back(client);
|
||||
}
|
||||
|
||||
void BaseMenuStyle::RemoveClientFromWatch(int client)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] RemoveClientFromWatch(%d)", client);
|
||||
#endif
|
||||
m_WatchList.remove(client);
|
||||
}
|
||||
|
||||
void BaseMenuStyle::_CancelClientMenu(int client, bool bAutoIgnore/* =false */, MenuCancelReason reason/* =MenuCancel_Interrupt */)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] _CancelClientMenu() (client %d) (bAutoIgnore %d) (reason %d)", client, bAutoIgnore, reason);
|
||||
#endif
|
||||
CBaseMenuPlayer *player = GetMenuPlayer(client);
|
||||
menu_states_t &states = player->states;
|
||||
|
||||
@ -83,6 +95,9 @@ void BaseMenuStyle::_CancelClientMenu(int client, bool bAutoIgnore/* =false */,
|
||||
|
||||
void BaseMenuStyle::CancelMenu(CBaseMenu *menu)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] CancelMenu() (menu %p)", menu);
|
||||
#endif
|
||||
int maxClients = g_Players.GetMaxClients();
|
||||
for (int i=1; i<=maxClients; i++)
|
||||
{
|
||||
@ -100,6 +115,9 @@ void BaseMenuStyle::CancelMenu(CBaseMenu *menu)
|
||||
|
||||
bool BaseMenuStyle::CancelClientMenu(int client, bool autoIgnore)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] CancelClientMenu() (client %d) (bAutoIgnore %d)", client, autoIgnore);
|
||||
#endif
|
||||
if (client < 1 || client > g_Players.MaxClients())
|
||||
{
|
||||
return false;
|
||||
@ -153,6 +171,9 @@ MenuSource BaseMenuStyle::GetClientMenu(int client, void **object)
|
||||
|
||||
void BaseMenuStyle::OnClientDisconnected(int client)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] OnClientDisconnected(%d)", client);
|
||||
#endif
|
||||
CBaseMenuPlayer *player = GetMenuPlayer(client);
|
||||
if (!player->bInMenu)
|
||||
{
|
||||
@ -179,6 +200,13 @@ void BaseMenuStyle::ProcessWatchList()
|
||||
do_lookup[total++] = (*iter);
|
||||
}
|
||||
|
||||
#if defined MENU_DEBUG
|
||||
if (total)
|
||||
{
|
||||
g_Logger.LogMessage("[SM_MENU] ProcessWatchList() found %d clients", total);
|
||||
}
|
||||
#endif
|
||||
|
||||
int client;
|
||||
CBaseMenuPlayer *player;
|
||||
float curTime = gpGlobals->curtime;
|
||||
@ -186,8 +214,19 @@ void BaseMenuStyle::ProcessWatchList()
|
||||
{
|
||||
client = do_lookup[i];
|
||||
player = GetMenuPlayer(client);
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] ProcessWatchList() (client %d) (bInMenu %d) (menuHoldTime %d) (curTime %f) (menuStartTime %f)",
|
||||
client,
|
||||
player->bInMenu,
|
||||
player->menuHoldTime,
|
||||
curTime,
|
||||
player->menuStartTime);
|
||||
#endif
|
||||
if (!player->bInMenu || !player->menuHoldTime)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] ProcessWatchList() removing client %d", client);
|
||||
#endif
|
||||
m_WatchList.remove(client);
|
||||
continue;
|
||||
}
|
||||
@ -200,6 +239,9 @@ void BaseMenuStyle::ProcessWatchList()
|
||||
|
||||
void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] ClientPressedKey() (client %d) (key_press %d)", client, key_press);
|
||||
#endif
|
||||
CBaseMenuPlayer *player = GetMenuPlayer(client);
|
||||
|
||||
/* First question: Are we in a menu? */
|
||||
@ -275,6 +317,13 @@ void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
|
||||
|
||||
bool BaseMenuStyle::DoClientMenu(int client, IMenuPanel *menu, IMenuHandler *mh, unsigned int time)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] DoClientMenu() (client %d) (panel %p) (mh %p) (time %d)",
|
||||
client,
|
||||
menu,
|
||||
mh,
|
||||
time);
|
||||
#endif
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||
if (!pPlayer || pPlayer->IsFakeClient() || !pPlayer->IsInGame())
|
||||
{
|
||||
@ -327,18 +376,21 @@ bool BaseMenuStyle::DoClientMenu(int client, IMenuPanel *menu, IMenuHandler *mh,
|
||||
|
||||
bool BaseMenuStyle::DoClientMenu(int client, CBaseMenu *menu, IMenuHandler *mh, unsigned int time)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] DoClientMenu() (client %d) (menu %p) (mh %p) (time %d)",
|
||||
client,
|
||||
menu,
|
||||
mh,
|
||||
time);
|
||||
#endif
|
||||
mh->OnMenuStart(menu);
|
||||
|
||||
if (!mh)
|
||||
{
|
||||
mh->OnMenuCancel(menu, client, MenuCancel_NoDisplay);
|
||||
mh->OnMenuEnd(menu);
|
||||
return false;
|
||||
}
|
||||
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||
if (!pPlayer || pPlayer->IsFakeClient() || !pPlayer->IsInGame())
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] DoClientMenu(): Failed to display to client %d", client);
|
||||
#endif
|
||||
mh->OnMenuCancel(menu, client, MenuCancel_NoDisplay);
|
||||
mh->OnMenuEnd(menu);
|
||||
return false;
|
||||
@ -347,6 +399,9 @@ bool BaseMenuStyle::DoClientMenu(int client, CBaseMenu *menu, IMenuHandler *mh,
|
||||
CBaseMenuPlayer *player = GetMenuPlayer(client);
|
||||
if (player->bAutoIgnore)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] DoClientMenu(): Client %d is autoIgnoring", client);
|
||||
#endif
|
||||
mh->OnMenuCancel(menu, client, MenuCancel_NoDisplay);
|
||||
mh->OnMenuEnd(menu);
|
||||
return false;
|
||||
@ -363,6 +418,9 @@ bool BaseMenuStyle::DoClientMenu(int client, CBaseMenu *menu, IMenuHandler *mh,
|
||||
menu_states_t &states = player->states;
|
||||
if (player->bInMenu)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] DoClientMenu(): Cancelling old menu to client %d", client);
|
||||
#endif
|
||||
_CancelClientMenu(client, true);
|
||||
}
|
||||
|
||||
@ -375,6 +433,9 @@ bool BaseMenuStyle::DoClientMenu(int client, CBaseMenu *menu, IMenuHandler *mh,
|
||||
IMenuPanel *display = g_Menus.RenderMenu(client, states, ItemOrder_Ascending);
|
||||
if (!display)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] DoClientMenu(): Failed to render to client %d", client);
|
||||
#endif
|
||||
player->bAutoIgnore = false;
|
||||
player->bInMenu = false;
|
||||
mh->OnMenuCancel(menu, client, MenuCancel_NoDisplay);
|
||||
@ -402,11 +463,18 @@ bool BaseMenuStyle::DoClientMenu(int client, CBaseMenu *menu, IMenuHandler *mh,
|
||||
/* We can be interrupted again! */
|
||||
player->bAutoIgnore = false;
|
||||
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] DoClientMenu() finished successfully (client %d)", client);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BaseMenuStyle::RedoClientMenu(int client, ItemOrder order)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] RedoClientMenu() (client %d) (order %d)", client, order);
|
||||
#endif
|
||||
CBaseMenuPlayer *player = GetMenuPlayer(client);
|
||||
menu_states_t &states = player->states;
|
||||
|
||||
@ -414,6 +482,9 @@ bool BaseMenuStyle::RedoClientMenu(int client, ItemOrder order)
|
||||
IMenuPanel *display = g_Menus.RenderMenu(client, states, order);
|
||||
if (!display)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] RedoClientMenu(): Failed to render menu");
|
||||
#endif
|
||||
if (player->menuHoldTime)
|
||||
{
|
||||
RemoveClientFromWatch(client);
|
||||
@ -428,6 +499,10 @@ bool BaseMenuStyle::RedoClientMenu(int client, ItemOrder order)
|
||||
|
||||
player->bAutoIgnore = false;
|
||||
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] RedoClientMenu(): Succeeded to client %d", client);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -598,6 +673,14 @@ void CBaseMenu::Cancel()
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] CBaseMenu::Cancel(%p) (m_pVote %p) (inVote %d) (m_bShouldDelete %d)",
|
||||
this,
|
||||
m_pVoteHandler,
|
||||
m_pVoteHandler ? m_pVoteHandler->IsVoteInProgress() : false,
|
||||
m_bShouldDelete);
|
||||
#endif
|
||||
|
||||
if (m_pVoteHandler && m_pVoteHandler->IsVoteInProgress())
|
||||
{
|
||||
m_pVoteHandler->CancelVoting();
|
||||
@ -621,6 +704,14 @@ void CBaseMenu::Destroy(bool releaseHandle)
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] CBaseMenu::Destroy(%p) (release %d) (m_bCancelling %d) (m_bShouldDelete %d)",
|
||||
this,
|
||||
releaseHandle,
|
||||
m_bCancelling,
|
||||
m_bShouldDelete);
|
||||
#endif
|
||||
|
||||
/* Save the destruction hint about our handle */
|
||||
m_bWillFreeHandle = releaseHandle;
|
||||
|
||||
@ -659,6 +750,14 @@ bool CBaseMenu::BroadcastVote(int clients[],
|
||||
unsigned int maxTime,
|
||||
unsigned int flags)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] CBaseMenu::BroadcastVote(%p) (maxTime %d) (numClients %d) (m_pVote %p) (inVote %d)",
|
||||
this,
|
||||
maxTime,
|
||||
numClients,
|
||||
m_pVoteHandler,
|
||||
m_pVoteHandler ? m_pVoteHandler->IsVoteInProgress() : false);
|
||||
#endif
|
||||
if (!m_pVoteHandler)
|
||||
{
|
||||
m_pVoteHandler = g_Menus.CreateVoteWrapper(m_pHandler);
|
||||
|
@ -17,6 +17,9 @@
|
||||
#include "UserMessages.h"
|
||||
#include "GameConfigs.h"
|
||||
#include "PlayerManager.h"
|
||||
#if defined MENU_DEBUG
|
||||
#include "Logger.h"
|
||||
#endif
|
||||
|
||||
extern const char *g_RadioNumTable[];
|
||||
CRadioStyle g_RadioMenuStyle;
|
||||
@ -120,6 +123,11 @@ void CRadioStyle::OnUserMessageSent(int msg_id)
|
||||
for (unsigned int i=0; i<g_last_client_count; i++)
|
||||
{
|
||||
int client = g_last_clients[i];
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] CRadioStyle got ShowMenu (client %d) (bInMenu %d)",
|
||||
client,
|
||||
m_players[client].bInExternMenu);
|
||||
#endif
|
||||
if (m_players[client].bInMenu)
|
||||
{
|
||||
_CancelClientMenu(client, true);
|
||||
@ -366,6 +374,12 @@ IMenuPanel *CRadioMenu::CreatePanel()
|
||||
|
||||
bool CRadioMenu::Display(int client, unsigned int time)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] CRadioMenu::Display(%p) (client %d) (time %d)",
|
||||
this,
|
||||
client,
|
||||
time);
|
||||
#endif
|
||||
if (m_bCancelling)
|
||||
{
|
||||
return false;
|
||||
@ -376,6 +390,12 @@ bool CRadioMenu::Display(int client, unsigned int time)
|
||||
|
||||
void CRadioMenu::VoteDisplay(int client, unsigned int maxTime)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] CRadioMenu::VoteDisplay(%p) (client %d) (time %d)",
|
||||
this,
|
||||
client,
|
||||
maxTime);
|
||||
#endif
|
||||
if (m_bCancelling)
|
||||
{
|
||||
return;
|
||||
|
@ -19,6 +19,9 @@
|
||||
#include "MenuStyle_Radio.h"
|
||||
#include "HandleSys.h"
|
||||
#include "PluginSys.h"
|
||||
#if defined MENU_DEBUG
|
||||
#include "Logger.h"
|
||||
#endif
|
||||
|
||||
#if defined CreateMenu
|
||||
#undef CreateMenu
|
||||
@ -306,6 +309,14 @@ void CMenuHandler::OnMenuVoteCancel(IBaseMenu *menu)
|
||||
|
||||
void CMenuHandler::DoAction(IBaseMenu *menu, MenuAction action, cell_t param1, cell_t param2)
|
||||
{
|
||||
#if defined MENU_DEBUG
|
||||
g_Logger.LogMessage("[SM_MENU] CMenuHandler::DoAction() (menu %p/%08x) (action %d) (param1 %d) (param2 %d)",
|
||||
menu,
|
||||
menu->GetHandle(),
|
||||
action,
|
||||
param1,
|
||||
param2);
|
||||
#endif
|
||||
m_pBasic->PushCell(menu->GetHandle());
|
||||
m_pBasic->PushCell((cell_t)action);
|
||||
m_pBasic->PushCell(param1);
|
||||
|
Loading…
Reference in New Issue
Block a user