Skip to content

Commit 7990fdc

Browse files
committed
Improvements to Debug 'summary'
1 parent 0a28c28 commit 7990fdc

File tree

5 files changed

+96
-18
lines changed

5 files changed

+96
-18
lines changed

OtherTypes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,8 @@ class CMiniWindow
12391239
const long GetFlags () const { return m_iFlags; }
12401240
const CPoint GetLocation () const { return m_Location; }
12411241
const COLORREF GetBackgroundColour () const { return m_iBackgroundColour; }
1242+
const FontMap & GetFonts () const { return m_Fonts; }
1243+
const ImageMap & GetImages () const { return m_Images; }
12421244

12431245
void Create (long Left, long Top, long Width, long Height,
12441246
short Position, long Flags,

doc.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,12 @@ class CMUSHclientDoc : public CDocument
12781278

12791279
list<CPaneStyle> m_OutstandingLines;
12801280

1281+
long m_nCount_IAC_DO; // count of IAC DO we got
1282+
long m_nCount_IAC_DONT; // count of IAC DONT we got
1283+
long m_nCount_IAC_WILL; // count of IAC WILL we got
1284+
long m_nCount_IAC_WONT; // count of IAC WONT we got
1285+
long m_nCount_IAC_SB; // count of IAC SB x IAC SE we got
1286+
12811287
#ifdef PANE
12821288
// for pane windows
12831289

doc_construct.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,14 @@ int i;
404404
ZeroMemory (&m_bClient_IAC_WILL, sizeof m_bClient_IAC_WILL);
405405
ZeroMemory (&m_bClient_IAC_WONT, sizeof m_bClient_IAC_WONT);
406406

407+
m_nCount_IAC_DO = 0;
408+
m_nCount_IAC_DONT = 0;
409+
m_nCount_IAC_WILL = 0;
410+
m_nCount_IAC_WONT = 0;
411+
m_nCount_IAC_SB = 0;
412+
413+
414+
407415
// set up some default triggers for MUSHes
408416

409417
/*

telnet_phases.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ void CMUSHclientDoc::Phase_WILL (const unsigned char c)
278278

279279
TRACE1 ("<%d>", c);
280280
m_phase = NONE; // back to normal text after this character
281+
282+
m_nCount_IAC_WILL++;
283+
281284
switch (c)
282285
{
283286
case TELOPT_COMPRESS2:
@@ -381,6 +384,8 @@ void CMUSHclientDoc::Phase_WONT (const unsigned char c)
381384
TRACE1 ("<%d>", c);
382385
m_phase = NONE;
383386

387+
m_nCount_IAC_WONT++;
388+
384389
switch (c)
385390
{
386391
case TELOPT_ECHO:
@@ -412,6 +417,8 @@ void CMUSHclientDoc::Phase_DO (const unsigned char c)
412417
TRACE1 ("<%d>", c);
413418
m_phase = NONE;
414419

420+
m_nCount_IAC_DO++;
421+
415422
switch (c)
416423
{
417424
case SGA:
@@ -465,6 +472,8 @@ void CMUSHclientDoc::Phase_DONT (const unsigned char c)
465472
unsigned char p [3] = { IAC, WONT, c };
466473
SendPacket (p, sizeof p);
467474

475+
m_nCount_IAC_DONT++;
476+
468477
switch (c)
469478
{
470479

@@ -541,6 +550,8 @@ void CMUSHclientDoc::Phase_SUBNEGOTIATION_IAC (const unsigned char c)
541550

542551
m_phase = NONE; // negotiation is over, next byte is plain text
543552

553+
m_nCount_IAC_SB++;
554+
544555
// subnegotiation is complete ...
545556
// we have IAC SB <m_subnegotiation_type> <m_IAC_subnegotiation_data> IAC SE
546557

world_debug.cpp

Lines changed: 69 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include "mxp\mxp.h"
55
#include "sendvw.h"
66
#include "Color.h"
7+
#include "childfrm.h"
8+
#include "MUSHview.h"
79

810
#include "png/png.h" // for version
911

@@ -21,6 +23,8 @@ extern CString strMacroDescriptions [MACRO_COUNT];
2123
extern CString strKeypadNames [eKeypad_Max_Items];
2224
extern tInfoTypeMapping InfoTypes [];
2325

26+
#define SHOW_TRUE(x) ((x) ? "yes" : "no")
27+
2428
// compare-less for colours
2529
struct colour_less : binary_function<COLORREF, COLORREF, bool>
2630
{
@@ -730,7 +734,7 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
730734
Note (TFormat ("Author: %s", (LPCTSTR) p->m_strAuthor));
731735
Note (TFormat ("Disk file: %s", (LPCTSTR) p->m_strSource));
732736
Note (TFormat ("Language: %s", (LPCTSTR) p->m_strLanguage));
733-
Note (TFormat ("Enabled: %s", (LPCTSTR) (p->m_bEnabled ? "yes" : "no")));
737+
Note (TFormat ("Enabled: %s", SHOW_TRUE (p->m_bEnabled)));
734738

735739
if (!p->m_strScript.IsEmpty ())
736740
{
@@ -906,20 +910,23 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
906910
Note (TFormat ("Operating system: %s", (LPCTSTR) sVersion));
907911

908912
// show included library versions
909-
Note (TFormat ("Using: %s, PCRE %s, PNG %s, SQLite3 %s, Zlib %s",
913+
Note (TFormat ("Libraries: %s, PCRE %s, PNG %s, SQLite3 %s, Zlib %s",
910914
LUA_RELEASE,
911915
XSTRING(PCRE_MAJOR.PCRE_MINOR),
912916
PNG_LIBPNG_VER_STRING,
913917
SQLITE_VERSION,
914918
ZLIB_VERSION));
915919

920+
Note (TFormat ("World name: '%s', ID: %s",
921+
(LPCTSTR) m_mush_name, (LPCTSTR) m_strWorldID));
922+
916923
// scripting info
917924

918925
Note (TFormat ("Script language: %s, enabled: %s",
919926
(LPCTSTR) m_strLanguage,
920-
(m_bEnableScripts ? "yes" : "no")));
921-
Note (TFormat ("Scripting active: %s",
922-
(GetScriptEngine () ? "yes" : "no")));
927+
SHOW_TRUE (m_bEnableScripts)
928+
));
929+
Note (TFormat ("Scripting active: %s", SHOW_TRUE (GetScriptEngine ()) ));
923930
if (!m_strScriptFilename.IsEmpty ())
924931
Note (TFormat ("Script file: %s",
925932
(LPCTSTR) m_strScriptFilename
@@ -975,7 +982,7 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
975982

976983
Note (TFormat ("** Triggers: %ld in world file, triggers enabled: %s.",
977984
nTotal,
978-
(m_enable_triggers ? "yes" : "no")));
985+
SHOW_TRUE (m_enable_triggers)));
979986
Note (TFormat (" %ld enabled, %ld regexp, %I64d attempts, %I64d matched, %1.6f seconds.",
980987
nEnabled, nRegexp, nTotalMatchAttempts, nTotalMatches, elapsed_time));
981988

@@ -1019,7 +1026,7 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
10191026

10201027
Note (TFormat ("** Aliases: %ld in world file, aliases enabled: %s.",
10211028
nTotal,
1022-
(m_enable_aliases ? "yes" : "no")));
1029+
SHOW_TRUE (m_enable_aliases)));
10231030
Note (TFormat (" %ld enabled, %ld regexp, %I64d attempts, %I64d matched, %1.6f seconds.",
10241031
nEnabled, nRegexp, nTotalMatchAttempts, nTotalMatches, elapsed_time));
10251032

@@ -1042,7 +1049,7 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
10421049

10431050
Note (TFormat ("** Timers: %ld in world file, timers enabled: %s.",
10441051
nTotal,
1045-
(m_bEnableTimers ? "yes" : "no")));
1052+
SHOW_TRUE (m_bEnableTimers)));
10461053
Note (TFormat (" %ld enabled, %I64d fired.",
10471054
nEnabled, nTotalMatches));
10481055

@@ -1090,7 +1097,7 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
10901097
Note (TFormat ("Plugin: %s, '%s', enabled: %s",
10911098
(LPCTSTR) pPlugin->m_strID,
10921099
(LPCTSTR) pPlugin->m_strName,
1093-
(pPlugin->m_bEnabled ? "yes" : "no")));
1100+
SHOW_TRUE (pPlugin->m_bEnabled)));
10941101

10951102

10961103
}
@@ -1113,8 +1120,8 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
11131120
//MXP
11141121

11151122
Note (TFormat ("MXP active: %s, Pueblo mode: %s",
1116-
(m_bMXP ? "yes" : "no"),
1117-
(m_bPuebloActive ? "yes" : "no") ));
1123+
SHOW_TRUE (m_bMXP ),
1124+
SHOW_TRUE (m_bPuebloActive) ));
11181125

11191126
Note (TFormat ("MXP tags received: %I64d", m_iMXPtags));
11201127
Note (TFormat ("MXP entities received: %I64d", m_iMXPentities));
@@ -1152,6 +1159,8 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
11521159
CMiniWindow * pWindow = it->second;
11531160
nTotal++;
11541161
int nHotspots = 0;
1162+
int nFonts = 0;
1163+
int nImages = 0;
11551164

11561165
if (pWindow->GetShow ())
11571166
nEnabled++;
@@ -1160,28 +1169,70 @@ VARIANT CMUSHclientDoc::Debug(LPCTSTR Command)
11601169
for (HotspotMapIterator hit = pWindow->m_Hotspots.begin ();
11611170
hit != pWindow->m_Hotspots.end ();
11621171
hit++)
1163-
{
11641172
nHotspots++;
1165-
}
11661173

1167-
Note (TFormat ("Window: '%s', at (%ld,%ld,%ld,%ld), enabled: %s",
1174+
for (FontMap::const_iterator fit = pWindow->GetFonts ().begin ();
1175+
fit != pWindow->GetFonts ().end ();
1176+
fit++)
1177+
nFonts++;
1178+
1179+
for (ImageMap::const_iterator imit = pWindow->GetImages ().begin ();
1180+
imit != pWindow->GetImages ().end ();
1181+
imit++)
1182+
nImages++;
1183+
1184+
Note (TFormat ("Window: '%s', at (%ld,%ld,%ld,%ld), shown: %s",
11681185
it->first.c_str (),
11691186
pWindow->m_rect.left,
11701187
pWindow->m_rect.top,
11711188
pWindow->m_rect.right,
11721189
pWindow->m_rect.bottom,
1173-
(pWindow->GetShow () ? "yes" : "no")));
1190+
SHOW_TRUE (pWindow->GetShow ())));
11741191

1175-
Note (TFormat (" width: %ld, height: %ld, position: %d, hotspots: %ld",
1192+
Note (TFormat (" width: %ld, height: %ld, position: %d, hotspots: %ld, fonts: %ld, images: %ld",
11761193
pWindow->GetWidth (),
11771194
pWindow->GetHeight (),
11781195
pWindow->GetPosition (),
1179-
nHotspots
1196+
nHotspots,
1197+
nFonts,
1198+
nImages
11801199
));
11811200

11821201
}
11831202

1184-
Note (TFormat ("** Miniwindows: %ld loaded, %ld enabled.", nTotal, nEnabled));
1203+
Note (TFormat ("** Miniwindows: %ld loaded, %ld shown.", nTotal, nEnabled));
1204+
1205+
// output window info
1206+
1207+
CRect r (0, 0, 0, 0);
1208+
CMUSHView* pmyView = GetFirstOutputWindow ();
1209+
1210+
if (pmyView)
1211+
pmyView->GetClientRect(&r);
1212+
1213+
Note (TFormat ("** Output pixels: width %ld, height: %ld, font width: %ld, font height: %ld",
1214+
r.right, r.bottom, m_FontWidth, m_FontHeight));
1215+
1216+
if (m_FontWidth > 0 && m_FontHeight > 0)
1217+
Note (TFormat (" width %ld characters, wrap at column %ld, height %ld lines.",
1218+
r.right / m_FontWidth, m_nWrapColumn, r.bottom / m_FontHeight));
1219+
1220+
1221+
// accelerators
1222+
1223+
Note (TFormat ("Accelerators defined: %ld", m_AcceleratorToCommandMap.size ()));
1224+
1225+
// telnet negotiation
1226+
1227+
Note (TFormat ("** Telnet (IAC) received: DO: %ld, DONT: %ld, WILL: %ld, WONT: %ld, SB: %ld",
1228+
m_nCount_IAC_DO,
1229+
m_nCount_IAC_DONT,
1230+
m_nCount_IAC_WILL,
1231+
m_nCount_IAC_WONT,
1232+
m_nCount_IAC_SB));
1233+
1234+
1235+
// end summary
11851236

11861237
Note ("");
11871238
Note ("-------------- End summary --------------");

0 commit comments

Comments
 (0)