sources/interface.cpp

changeset 194
0c7e44e1078a
parent 193
fb1709f27108
child 195
be953e1621d9
--- a/sources/interface.cpp	Wed Jan 27 19:42:49 2021 +0200
+++ b/sources/interface.cpp	Wed Jan 27 19:44:36 2021 +0200
@@ -53,7 +53,7 @@
 //
 const std::string& Interface::getCurrentInput()
 {
-	return m_inputHistory[m_inputCursor];
+	return this->m_inputHistory[this->m_inputCursor];
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -62,10 +62,10 @@
 //
 void Interface::detachInput()
 {
-	if (m_inputCursor > 0)
+	if (this->m_inputCursor > 0)
 	{
-		m_inputHistory[0] = getCurrentInput();
-		m_inputCursor = 0;
+		this->m_inputHistory[0] = getCurrentInput();
+		this->m_inputCursor = 0;
 	}
 }
 
@@ -75,7 +75,7 @@
 std::string& Interface::getEditableInput()
 {
 	detachInput();
-	return m_inputHistory[m_inputCursor];
+	return this->m_inputHistory[this->m_inputCursor];
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -83,19 +83,19 @@
 void Interface::moveInputCursor(int delta)
 {
 	// No input history when inputting addresses or passwords
-	if (m_inputState != INPUTSTATE_NORMAL)
+	if (this->m_inputState != INPUTSTATE_NORMAL)
 	{
-		m_inputCursor = 0;
+		this->m_inputCursor = 0;
 		return;
 	}
 
-	int oldcursor = m_inputCursor;
-	m_inputCursor = clamp(m_inputCursor + delta, 0, static_cast<int>(m_inputHistory.size() - 1));
+	int oldcursor = this->m_inputCursor;
+	this->m_inputCursor = clamp(this->m_inputCursor + delta, 0, static_cast<int>(this->m_inputHistory.size() - 1));
 
-	if (m_inputCursor != oldcursor)
+	if (this->m_inputCursor != oldcursor)
 	{
-		m_cursorPosition = getCurrentInput().length();
-		m_needInputRender = true;
+		this->m_cursorPosition = getCurrentInput().length();
+		this->m_needInputRender = true;
 	}
 }
 
@@ -105,7 +105,7 @@
 {
 	std::string prompt;
 
-	switch (m_inputState)
+	switch (this->m_inputState)
 	{
 	case INPUTSTATE_NORMAL: prompt = ">"; break;
 	case INPUTSTATE_ADDRESS: prompt = "address:"; break;
@@ -122,25 +122,25 @@
 {
 	// Clear the input row(unless going to or from confirm state)
 	if (newstate != INPUTSTATE_CONFIRM_DISCONNECTION
-		and m_inputState != INPUTSTATE_CONFIRM_DISCONNECTION)
+		and this->m_inputState != INPUTSTATE_CONFIRM_DISCONNECTION)
 	{
-		m_inputCursor = 0;
+		this->m_inputCursor = 0;
 		getEditableInput().clear();
 	}
 
 	switch (newstate)
 	{
 	case INPUTSTATE_ADDRESS:
-		if (m_remoteAddress.host != 0)
-			getEditableInput() = net::ip_address_to_string(m_remoteAddress);
+		if (this->m_remoteAddress.host != 0)
+			getEditableInput() = net::ip_address_to_string(this->m_remoteAddress);
 		break;
 
 	default:
 		break;
 	}
 
-	m_inputState = newstate;
-	m_needInputRender = true;
+	this->m_inputState = newstate;
+	this->m_needInputRender = true;
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -164,11 +164,11 @@
 	::noecho();
 	::refresh();
 	::timeout(0);
-	m_inputHistory.clear();
-	m_inputHistory.push_back("");
-	m_outputLines.clear();
-	m_outputLines.push_back(ColoredLine());
-	m_session.setInterface(this);
+	this->m_inputHistory.clear();
+	this->m_inputHistory.push_back("");
+	this->m_outputLines.clear();
+	this->m_outputLines.push_back(ColoredLine());
+	this->m_session.setInterface(this);
 	resetTitle();
 
 	if (::has_colors())
@@ -196,7 +196,7 @@
 
 	renderFull();
 	refresh();
-	m_needRefresh = false;
+	this->m_needRefresh = false;
 }
 
 Interface::~Interface()
@@ -208,26 +208,26 @@
 //
 void Interface::renderTitlebar()
 {
-	if (static_cast<signed>(m_title.length()) <= COLS)
+	if (static_cast<signed>(this->m_title.length()) <= COLS)
 	{
 		chtype pair = getColorPair(WHITE, BLUE);
-		int startx =(COLS - m_title.length()) / 2;
-		int endx = startx + m_title.length();
+		int startx =(COLS - this->m_title.length()) / 2;
+		int endx = startx + this->m_title.length();
 		attron(pair);
-		mvprintw(0, startx, "%s", m_title.data());
+		mvprintw(0, startx, "%s", this->m_title.data());
 		mvhline(0, 0, ' ', startx);
 		mvhline(0, endx, ' ', COLS - endx);
 		attroff(pair);
 	}
 
-	m_needRefresh = true;
+	this->m_needRefresh = true;
 }
 
 // -------------------------------------------------------------------------------------------------
 //
 void Interface::setTitle(const std::string& title)
 {
-	m_title = title;
+	this->m_title = title;
 	renderTitlebar();
 }
 
@@ -235,9 +235,9 @@
 //
 void Interface::safeDisconnect(std::function<void(bool)> afterwards)
 {
-	if (m_session.isActive())
+	if (this->m_session.isActive())
 	{
-		m_disconnectCallback = afterwards;
+		this->m_disconnectCallback = afterwards;
 		setInputState(INPUTSTATE_CONFIRM_DISCONNECTION);
 	}
 	else
@@ -306,15 +306,15 @@
 //
 void Interface::renderOutput()
 {
-	if (m_outputLines.size() == 1)
+	if (this->m_outputLines.size() == 1)
 		return;
 
-	m_outputScroll = clamp(m_outputScroll, 0, static_cast<signed>(m_outputLines.size() - 1));
+	this->m_outputScroll = clamp(this->m_outputScroll, 0, static_cast<signed>(this->m_outputLines.size() - 1));
 
 	int height = LINES - 3;
 	int width = COLS - nicklistWidth();
 	int printOffset = 0;
-	int end = m_outputLines.size() - 1 - m_outputScroll;
+	int end = this->m_outputLines.size() - 1 - this->m_outputScroll;
 	int start = end;
 	int usedHeight = 0;
 	int y = 1;
@@ -323,7 +323,7 @@
 	// Where to start?
 	while (start > 0)
 	{
-		int rows = m_outputLines[start - 1].rows(width);
+		int rows = this->m_outputLines[start - 1].rows(width);
 
 		if (usedHeight + rows > height)
 		{
@@ -339,9 +339,9 @@
 	// See if there's any more rows to use(end may be too small)
 	if (not tightFit)
 	{
-		while (end < static_cast<int>(m_outputLines.size()))
+		while (end < static_cast<int>(this->m_outputLines.size()))
 		{
-			int rows = m_outputLines[end].rows(width);
+			int rows = this->m_outputLines[end].rows(width);
 
 			if (usedHeight + rows > height)
 			{
@@ -357,7 +357,7 @@
 	if (start > 0)
 		printOffset = height - usedHeight;
 
-	m_outputScroll = m_outputLines.size() - 1 - end;
+	this->m_outputScroll = this->m_outputLines.size() - 1 - end;
 
 	if (start < 0 or start == end or printOffset >= height)
 		return;
@@ -372,10 +372,10 @@
 	y += printOffset;
 
 	for (int i = start; i < end; i += 1)
-		y = renderColorline(y, 0, width, m_outputLines[i], true);
+		y = renderColorline(y, 0, width, this->m_outputLines[i], true);
 
-	m_needOutputRender = false;
-	m_needRefresh = true;
+	this->m_needOutputRender = false;
+	this->m_needRefresh = true;
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -394,14 +394,14 @@
 	{
 		mvhline(y, x, ' ', width);
 
-		if (i < static_cast<signed>(m_playerNames.size()))
-			renderColorline(y, x, width, m_playerNames[i], false);
+		if (i < static_cast<signed>(this->m_playerNames.size()))
+			renderColorline(y, x, width, this->m_playerNames[i], false);
 
 		y++;
 	}
 
-	m_needNicklistRender = false;
-	m_needRefresh = true;
+	this->m_needNicklistRender = false;
+	this->m_needRefresh = true;
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -412,13 +412,13 @@
 
 	// If we're asking the user if they want to disconnect, we don't render any input strings,
 	// just the confirmation message.
-	if (m_inputState == INPUTSTATE_CONFIRM_DISCONNECTION)
+	if (this->m_inputState == INPUTSTATE_CONFIRM_DISCONNECTION)
 	{
 		attron(promptColor);
 		mvhline(LINES - 2, 0, ' ', COLS);
 		mvprintw(LINES - 2, 0, "Are you sure you want to disconnect? y/n");
 		attroff(promptColor);
-		m_needRefresh = true;
+		this->m_needRefresh = true;
 		return;
 	}
 
@@ -428,25 +428,25 @@
 	int y = LINES - 2;
 
 	// If we're inputting a password, replace it with asterisks
-	if (m_inputState == INPUTSTATE_PASSWORD)
+	if (this->m_inputState == INPUTSTATE_PASSWORD)
 	{
 		for (char &ch : displayString)
 			ch = '*';
 	}
 
 	// Ensure the cursor is within bounds
-	m_cursorPosition = clamp(m_cursorPosition, 0, static_cast<signed>(displayString.length()));
+	this->m_cursorPosition = clamp(this->m_cursorPosition, 0, static_cast<signed>(displayString.length()));
 
 	// Ensure that the cursor is always in view, adjust panning if this is not the case
-	if (m_cursorPosition > m_inputPanning + displayLength)
-		m_inputPanning = m_cursorPosition - displayLength; // cursor went too far right
-	else if (m_cursorPosition < m_inputPanning)
-		m_inputPanning = m_cursorPosition; // cursor went past the pan value to the left
+	if (this->m_cursorPosition > this->m_inputPanning + displayLength)
+		this->m_inputPanning = this->m_cursorPosition - displayLength; // cursor went too far right
+	else if (this->m_cursorPosition < this->m_inputPanning)
+		this->m_inputPanning = this->m_cursorPosition; // cursor went past the pan value to the left
 
 	// What part of the string to draw?
-	int start = m_inputPanning;
+	int start = this->m_inputPanning;
 	int end = min<int>(displayString.length(), start + displayLength);
-	assert(m_cursorPosition >= start and m_cursorPosition <= end);
+	assert(this->m_cursorPosition >= start and this->m_cursorPosition <= end);
 
 	// Render the input string
 	mvhline(LINES - 2, 0, ' ', COLS);
@@ -459,10 +459,10 @@
 
 	// Store in memory where the cursor is now(so that we can re-draw it to position the terminal
 	// cursor).
-	m_cursorCharacter.ch = m_cursorPosition != 0 ? displayString[m_cursorPosition - 1] : '\0';
-	m_cursorCharacter.x = prompt.length() + (m_cursorPosition - m_inputPanning);
-	m_needRefresh = true;
-	m_needInputRender = false;
+	this->m_cursorCharacter.ch = this->m_cursorPosition != 0 ? displayString[this->m_cursorPosition - 1] : '\0';
+	this->m_cursorCharacter.x = prompt.length() + (this->m_cursorPosition - this->m_inputPanning);
+	this->m_needRefresh = true;
+	this->m_needInputRender = false;
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -473,10 +473,10 @@
 	int y = LINES - 1;
 	attron(color);
 	mvhline(y, 0, ' ', COLS);
-	mvprintw(y, 0, "%s", m_statusBarText.data());
+	mvprintw(y, 0, "%s", this->m_statusBarText.data());
 	attroff(color);
-	m_needRefresh = true;
-	m_needStatusBarRender = false;
+	this->m_needRefresh = true;
+	this->m_needStatusBarRender = false;
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -485,7 +485,7 @@
 {
 	std::string text;
 
-	switch (m_session.getState())
+	switch (this->m_session.getState())
 	{
 	case RCON_DISCONNECTED:
 		text = "Disconnected.";
@@ -493,26 +493,26 @@
 
 	case RCON_CONNECTING:
 	case RCON_AUTHENTICATING:
-		text = "Connecting to " + net::ip_address_to_string(m_session.address()) + "...";
+		text = "Connecting to " + net::ip_address_to_string(this->m_session.address()) + "...";
 		break;
 
 	case RCON_CONNECTED:
 		{
 			std::string adminText;
 
-			if (m_session.getAdminCount() == 0)
+			if (this->m_session.getAdminCount() == 0)
 			{
 				adminText = "No other admins";
 			}
 			else
 			{
-				adminText = zfc::sprintf("%d other admin%s", m_session.getAdminCount(),
-					m_session.getAdminCount() != 1 ? "s" : "");
+				adminText = zfc::sprintf("%d other admin%s", this->m_session.getAdminCount(),
+					this->m_session.getAdminCount() != 1 ? "s" : "");
 			}
 
 			text = zfc::sprintf("%s | %s | %s",
-				net::ip_address_to_string(m_session.address()).data(),
-				m_session.getLevel().data(),
+				net::ip_address_to_string(this->m_session.address()).data(),
+				this->m_session.getLevel().data(),
 				adminText.data());
 		}
 		break;
@@ -522,12 +522,12 @@
 		text += " | ";
 
 	text += "Ctrl+N to connect, Ctrl+Q to ";
-	text +=(m_session.getState() == RCON_DISCONNECTED) ? "quit" : "disconnect";
+	text +=(this->m_session.getState() == RCON_DISCONNECTED) ? "quit" : "disconnect";
 
-	if (text != m_statusBarText)
+	if (text != this->m_statusBarText)
 	{
-		m_statusBarText = text;
-		m_needStatusBarRender = true;
+		this->m_statusBarText = text;
+		this->m_needStatusBarRender = true;
 	}
 }
 
@@ -548,13 +548,13 @@
 void Interface::positionCursor()
 {
 	// This is only relevant if the input string is being drawn
-	if (m_inputState == INPUTSTATE_CONFIRM_DISCONNECTION)
+	if (this->m_inputState == INPUTSTATE_CONFIRM_DISCONNECTION)
 		return;
 
 	int y = LINES - 2;
 
-	if (m_cursorCharacter.ch != '\0')
-		mvprintw(y, m_cursorCharacter.x, "%c", m_cursorCharacter.ch);
+	if (this->m_cursorCharacter.ch != '\0')
+		mvprintw(y, this->m_cursorCharacter.x, "%c", this->m_cursorCharacter.ch);
 	else
 		mvprintw(y, getPromptString().length(), " ");
 }
@@ -564,7 +564,7 @@
 int Interface::findPreviousWord()
 {
 	const std::string& input = getCurrentInput();
-	int pos = m_cursorPosition;
+	int pos = this->m_cursorPosition;
 
 	// Move past whitespace
 	while (pos > 0 and isspace(input[pos - 1]))
@@ -582,7 +582,7 @@
 int Interface::findNextWord()
 {
 	const std::string& input = getCurrentInput();
-	int pos = m_cursorPosition;
+	int pos = this->m_cursorPosition;
 
 	// Move past current whitespace
 	while (pos < static_cast<signed>(input.length()) and isspace(input[pos]))
@@ -602,13 +602,13 @@
 	if (a >= b)
 		return;
 
-	if (m_cursorPosition > a and m_cursorPosition <= b)
-		m_cursorPosition = a;
+	if (this->m_cursorPosition > a and this->m_cursorPosition <= b)
+		this->m_cursorPosition = a;
 
 	std::string& input = getEditableInput();
-	m_pasteBuffer = mid(input, a, b);
+	this->m_pasteBuffer = mid(input, a, b);
 	input = remove_range(input, a, b - a);
-	m_needInputRender = true;
+	this->m_needInputRender = true;
 }
 
 bool Interface::tryResolveAddress(const std::string &address_string, net::ip_address* target)
@@ -647,12 +647,12 @@
 		return;
 	}
 
-	if (m_inputState == INPUTSTATE_CONFIRM_DISCONNECTION)
+	if (this->m_inputState == INPUTSTATE_CONFIRM_DISCONNECTION)
 	{
 		if (ch == 'y' or ch == 'Y')
 		{
-			m_session.disconnect();
-			m_disconnectCallback(true);
+			this->m_session.disconnect();
+			this->m_disconnectCallback(true);
 			this->updateStatusBar();
 		}
 		else if (ch == 'n' or ch == 'N')
@@ -664,14 +664,14 @@
 	if (ch >= 0x20 and ch <= 0x7E)
 	{
 		std::string& input = getEditableInput();
-		input.insert(input.begin() + m_cursorPosition, char(ch));
-		m_cursorPosition += 1;
-		m_needInputRender = true;
+		input.insert(input.begin() + this->m_cursorPosition, char(ch));
+		this->m_cursorPosition += 1;
+		this->m_needInputRender = true;
 	}
 	else switch (ch)
 	{
 	case 'Q' - 'A' + 1: // ^Q
-		switch (m_inputState)
+		switch (this->m_inputState)
 		{
 		case INPUTSTATE_CONFIRM_DISCONNECTION:
 			break;
@@ -701,19 +701,19 @@
 
 	case KEY_LEFT:
 	case 'B' - 'A' + 1: // readline ^B
-		if (m_cursorPosition > 0)
+		if (this->m_cursorPosition > 0)
 		{
-			m_cursorPosition--;
-			m_needInputRender = true;
+			this->m_cursorPosition--;
+			this->m_needInputRender = true;
 		}
 		break;
 
 	case KEY_RIGHT:
 	case 'F' - 'A' + 1: // readline ^F
-		if (m_cursorPosition < static_cast<int>(getCurrentInput().length()))
+		if (this->m_cursorPosition < static_cast<int>(getCurrentInput().length()))
 		{
-			m_cursorPosition++;
-			m_needInputRender = true;
+			this->m_cursorPosition++;
+			this->m_needInputRender = true;
 		}
 		break;
 
@@ -724,75 +724,75 @@
 
 	case KEY_HOME:
 	case 'A' - 'A' + 1: // readline ^A
-		if (m_cursorPosition != 0)
+		if (this->m_cursorPosition != 0)
 		{
-			m_cursorPosition = 0;
-			m_needInputRender = true;
+			this->m_cursorPosition = 0;
+			this->m_needInputRender = true;
 		}
 		break;
 
 	case KEY_END:
 	case 'E' - 'A' + 1: // readline ^E
-		if (m_cursorPosition != static_cast<signed>(getCurrentInput().length()))
+		if (this->m_cursorPosition != static_cast<signed>(getCurrentInput().length()))
 		{
-			m_cursorPosition = getCurrentInput().length();
-			m_needInputRender = true;
+			this->m_cursorPosition = getCurrentInput().length();
+			this->m_needInputRender = true;
 		}
 		break;
 
 	case KEY_BACKSPACE:
 	case '\b':
-		if (m_cursorPosition > 0)
+		if (this->m_cursorPosition > 0)
 		{
 			std::string& input = getEditableInput();
-			input.erase(input.begin() + m_cursorPosition - 1);
-			m_cursorPosition -= 1;
-			m_needInputRender = true;
+			input.erase(input.begin() + this->m_cursorPosition - 1);
+			this->m_cursorPosition -= 1;
+			this->m_needInputRender = true;
 		}
 		break;
 
 	case KEY_DC:
 	case 'D' - 'A' + 1: // readline ^D
-		if (m_cursorPosition < static_cast<signed>(getCurrentInput().length()))
+		if (this->m_cursorPosition < static_cast<signed>(getCurrentInput().length()))
 		{
 			std::string& input = getEditableInput();
-			input.erase(input.begin() + m_cursorPosition);
-			m_needInputRender = true;
+			input.erase(input.begin() + this->m_cursorPosition);
+			this->m_needInputRender = true;
 		}
 		break;
 
 	case KEY_PPAGE:
-		m_outputScroll += min(PAGE_SIZE, LINES / 2);
-		m_needOutputRender = true;
+		this->m_outputScroll += min(PAGE_SIZE, LINES / 2);
+		this->m_needOutputRender = true;
 		break;
 
 	case KEY_NPAGE:
-		m_outputScroll -= min(PAGE_SIZE, LINES / 2);
-		m_needOutputRender = true;
+		this->m_outputScroll -= min(PAGE_SIZE, LINES / 2);
+		this->m_needOutputRender = true;
 		break;
 
 	case 'U' - 'A' + 1: // readline ^U - delete from start to cursor
-		if (m_cursorPosition > 0)
+		if (this->m_cursorPosition > 0)
 		{
-			yank(0, m_cursorPosition);
-			m_cursorPosition = 0;
+			yank(0, this->m_cursorPosition);
+			this->m_cursorPosition = 0;
 		}
 		break;
 
 	case 'K' - 'A' + 1: // readline ^K - delete from cursor to end
-		yank(m_cursorPosition, getEditableInput().length());
+		yank(this->m_cursorPosition, getEditableInput().length());
 		break;
 
 	case 'W' - 'A' + 1: // readline ^W - delete from previous word bounary to current
-		yank(findPreviousWord(), m_cursorPosition);
+		yank(findPreviousWord(), this->m_cursorPosition);
 		break;
 
 	case 'Y' - 'A' + 1: // readline ^Y - paste previously deleted text
-		if (not m_pasteBuffer.empty())
+		if (not this->m_pasteBuffer.empty())
 		{
-			getEditableInput().insert(m_cursorPosition, m_pasteBuffer);
-			m_cursorPosition += m_pasteBuffer.length();
-			m_needInputRender = true;
+			getEditableInput().insert(this->m_cursorPosition, this->m_pasteBuffer);
+			this->m_cursorPosition += this->m_pasteBuffer.length();
+			this->m_needInputRender = true;
 		}
 		break;
 
@@ -800,12 +800,12 @@
 		{
 			int space = getCurrentInput().find(" ");
 
-			if (m_inputState == INPUTSTATE_NORMAL
-				and m_cursorPosition > 0
-				and(space == -1 or space >= m_cursorPosition))
+			if (this->m_inputState == INPUTSTATE_NORMAL
+				and this->m_cursorPosition > 0
+				and(space == -1 or space >= this->m_cursorPosition))
 			{
-				std::string start = mid(getCurrentInput(), 0, m_cursorPosition);
-				m_session.requestTabCompletion(start);
+				std::string start = mid(getCurrentInput(), 0, this->m_cursorPosition);
+				this->m_session.requestTabCompletion(start);
 			}
 		}
 		break;
@@ -813,7 +813,7 @@
 	case '\n':
 	case '\r':
 	case KEY_ENTER:
-		switch (m_inputState)
+		switch (this->m_inputState)
 		{
 		case INPUTSTATE_CONFIRM_DISCONNECTION:
 			break; // handled above
@@ -826,11 +826,11 @@
 			break;
 
 		case INPUTSTATE_PASSWORD:
-			if (m_inputState == INPUTSTATE_PASSWORD and not getCurrentInput().empty())
+			if (this->m_inputState == INPUTSTATE_PASSWORD and not getCurrentInput().empty())
 			{
-				m_session.disconnect();
-				m_session.setPassword(getCurrentInput());
-				m_session.connect(m_remoteAddress);
+				this->m_session.disconnect();
+				this->m_session.setPassword(getCurrentInput());
+				this->m_session.connect(this->m_remoteAddress);
 				setInputState(INPUTSTATE_NORMAL);
 			}
 			break;
@@ -841,7 +841,7 @@
 				handleCommand(getCurrentInput(), shouldquit);
 				flushInput();
 			}
-			else if (m_session.sendCommand(getCurrentInput()))
+			else if (this->m_session.sendCommand(getCurrentInput()))
 			{
 				flushInput();
 			}
@@ -850,7 +850,7 @@
 		break;
 
 	case 'N' - 'A' + 1: // ^N
-		if (m_inputState == INPUTSTATE_NORMAL)
+		if (this->m_inputState == INPUTSTATE_NORMAL)
 			safeDisconnect([&](bool){setInputState(INPUTSTATE_ADDRESS);});
 		break;
 
@@ -865,35 +865,35 @@
 			case 'b':
 			case 'B':
 				// readline alt-b - move one word to the left
-				m_cursorPosition = findPreviousWord();
-				m_needInputRender = true;
+				this->m_cursorPosition = findPreviousWord();
+				this->m_needInputRender = true;
 				break;
 
 			case 'f':
 			case 'F':
 				// readline alt-f - move one word to the right
-				m_cursorPosition = findNextWord();
-				m_needInputRender = true;
+				this->m_cursorPosition = findNextWord();
+				this->m_needInputRender = true;
 				break;
 
 			case 'd':
 			case 'D':
 				// readline alt-d - delete from here till next word boundary
-				yank(m_cursorPosition, findNextWord());
+				yank(this->m_cursorPosition, findNextWord());
 				break;
 
 			case KEY_BACKSPACE: // alt+backspace, remove previous word
 			case '\b':
-				yank(findPreviousWord(), m_cursorPosition);
+				yank(findPreviousWord(), this->m_cursorPosition);
 				break;
 			}
 		}
 		else
 		{
 			// No alt-key, handle pure escape
-			if (m_inputState == INPUTSTATE_PASSWORD)
+			if (this->m_inputState == INPUTSTATE_PASSWORD)
 				setInputState(INPUTSTATE_ADDRESS);
-			else if (m_inputState == INPUTSTATE_ADDRESS)
+			else if (this->m_inputState == INPUTSTATE_ADDRESS)
 				setInputState(INPUTSTATE_NORMAL);
 		}
 		break;
@@ -906,16 +906,16 @@
 //
 void Interface::render()
 {
-	if (m_needStatusBarRender) renderStatusBar();
-	if (m_needInputRender) renderInput();
-	if (m_needOutputRender) renderOutput();
-	if (m_needNicklistRender) renderNicklist();
+	if (this->m_needStatusBarRender) renderStatusBar();
+	if (this->m_needInputRender) renderInput();
+	if (this->m_needOutputRender) renderOutput();
+	if (this->m_needNicklistRender) renderNicklist();
 
-	if (m_needRefresh)
+	if (this->m_needRefresh)
 	{
 		positionCursor();
 		refresh();
-		m_needRefresh = false;
+		this->m_needRefresh = false;
 	}
 }
 
@@ -983,12 +983,12 @@
 	{
 		if (ch == '\n')
 		{
-			zfc::last(m_outputLines).finalize();
-			m_outputLines.push_back({});
+			zfc::last(this->m_outputLines).finalize();
+			this->m_outputLines.push_back({});
 			continue;
 		}
 
-		if (zfc::last(m_outputLines).length() == 0)
+		if (zfc::last(this->m_outputLines).length() == 0)
 		{
 			time_t now;
 			time(&now);
@@ -996,17 +996,17 @@
 			strftime(timestamp, sizeof timestamp, "[%H:%M:%S] ", localtime(&now));
 
 			for (char ch : std::string(timestamp))
-				zfc::last(m_outputLines).addChar(ch);
+				zfc::last(this->m_outputLines).addChar(ch);
 		}
 
 		// Remove some lines if there's too many of them. 20,000 should be enough, I hope.
-		while (m_outputLines.size() > 20000)
-			m_outputLines.erase(m_outputLines.begin());
+		while (this->m_outputLines.size() > 20000)
+			this->m_outputLines.erase(this->m_outputLines.begin());
 
-		zfc::last(m_outputLines).addChar(ch);
+		zfc::last(this->m_outputLines).addChar(ch);
 	}
 
-	m_needOutputRender = true;
+	this->m_needOutputRender = true;
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -1015,9 +1015,9 @@
 {
 	if (this->tryResolveAddress(address_string, &this->m_remoteAddress))
 	{
-		m_session.disconnect();
-		m_session.setPassword(password);
-		m_session.connect(m_remoteAddress);
+		this->m_session.disconnect();
+		this->m_session.setPassword(password);
+		this->m_session.connect(this->m_remoteAddress);
 	}
 }
 
@@ -1025,17 +1025,17 @@
 //
 void Interface::setPlayerNames(const std::vector<std::string>& names)
 {
-	m_playerNames.clear();
+	this->m_playerNames.clear();
 
 	for (const std::string& name : names)
 	{
 		ColoredLine coloredname;
 		coloredname.addString(name);
 		coloredname.finalize();
-		m_playerNames.push_back(coloredname);
+		this->m_playerNames.push_back(coloredname);
 	}
 
-	m_needNicklistRender = true;
+	this->m_needNicklistRender = true;
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -1050,8 +1050,8 @@
 			complete += ' ';
 
 		input.replace(0, part.length(), complete);
-		m_cursorPosition = complete.length();
-		m_needInputRender = true;
+		this->m_cursorPosition = complete.length();
+		this->m_needInputRender = true;
 	}
 }
 
@@ -1079,11 +1079,11 @@
 	}
 	else if (command == "disconnect")
 	{
-		m_session.disconnect();
+		this->m_session.disconnect();
 	}
 	else if (command == "quit")
 	{
-		m_session.disconnect();
+		this->m_session.disconnect();
 		*shouldquit = true;
 	}
 	else
@@ -1094,7 +1094,7 @@
 //
 void Interface::disconnected()
 {
-	print("Disconnected from %s\n", net::ip_address_to_string(m_session.address()).data());
+	print("Disconnected from %s\n", net::ip_address_to_string(this->m_session.address()).data());
 	resetTitle();
 	renderFull();
 }
@@ -1103,16 +1103,16 @@
 //
 void Interface::resetTitle()
 {
-	m_title = sprintf("%s %s (%s)", application_name(), full_version_string(), changeset_date_string());
+	this->m_title = sprintf("%s %s (%s)", application_name(), full_version_string(), changeset_date_string());
 }
 
 // -------------------------------------------------------------------------------------------------
 //
 void Interface::flushInput()
 {
-	m_inputHistory.insert(m_inputHistory.begin(), "");
-	m_inputCursor = 0;
-	m_needInputRender = true;
+	this->m_inputHistory.insert(this->m_inputHistory.begin(), "");
+	this->m_inputCursor = 0;
+	this->m_needInputRender = true;
 }
 
 END_ZFC_NAMESPACE

mercurial