Skip to content

Commit

Permalink
Count newlines received. Available as GetInfo (310).
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed Dec 6, 2010
1 parent e1a8672 commit c8ff618
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions ProcessPreviousLine.cpp
Expand Up @@ -536,6 +536,7 @@ assemble the full text of the original line.


m_sRecentLines.push_back ((const char *) strCurrentLine);
m_newlines_received++;

// too many? remove oldest one
if (m_sRecentLines.size () > MAX_RECENT_LINES)
Expand Down
2 changes: 2 additions & 0 deletions doc.cpp
Expand Up @@ -6635,6 +6635,8 @@ void CMUSHclientDoc::ConnectionEstablished (void)
m_iTimersFiredThisSessionCount = 0;
m_bSuppressNewline = false;
m_iLastCommandCount = 0;
m_sRecentLines.clear ();
m_newlines_received = 0;
m_strLastCommandSent.Empty (); // no command sent yet
m_iNoteStyle = NORMAL; // back to default style

Expand Down
1 change: 1 addition & 0 deletions doc.h
Expand Up @@ -988,6 +988,7 @@ class CMUSHclientDoc : public CDocument

long m_total_lines;
long m_new_lines; // lines they haven't read yet (if not active view)
long m_newlines_received; // lines pushed into m_sRecentLines
long m_nTotalLinesSent; // lines sent this connection
long m_nTotalLinesReceived; // lines they received this connection
long m_last_line_with_IAC_GA;
Expand Down
1 change: 1 addition & 0 deletions doc_construct.cpp
Expand Up @@ -196,6 +196,7 @@ int i;
m_InputFontHeight = 0;
m_InputFontWidth = 0;
m_total_lines = 0;
m_newlines_received = 0;
m_last_line_with_IAC_GA = 0;
m_nTotalLinesSent = 0;
m_nTotalLinesReceived = 0;
Expand Down
13 changes: 13 additions & 0 deletions scripting/methods/methods_info.cpp
Expand Up @@ -328,6 +328,11 @@ tInfoTypeMapping InfoTypes [] =
{ 306, "When this world was created/opened" },


// more numbers

{ 310, "Newlines received" },


{ 0, "" }, // end of table marker

};
Expand Down Expand Up @@ -1044,6 +1049,8 @@ VARIANT CMUSHclientDoc::GetInfo(long InfoType)
break;


// dates

case 301:
if (m_tConnectTime.GetTime ()) // only if non-zero, otherwise return empty
SetUpVariantDate (vaResult, COleDateTime (m_tConnectTime.GetTime ()));
Expand All @@ -1069,6 +1076,12 @@ VARIANT CMUSHclientDoc::GetInfo(long InfoType)
SetUpVariantDate (vaResult, COleDateTime (m_whenWorldStarted.GetTime ()));
break;

// more numbers

case 310:
SetUpVariantLong (vaResult, m_newlines_received); // newlines received
break;

default:
vaResult.vt = VT_NULL;
break;
Expand Down

0 comments on commit c8ff618

Please sign in to comment.