- fixed chatting logic to now retain more info about the user that sent the text in the console manager. Colors now apply to the playername and changing playernames is ok in the lobby andf rendering accounts for this (as well as switching slots)

This commit is contained in:
Mark Vejvoda 2010-10-23 04:00:39 +00:00
parent e53e6b49a9
commit e2610df502
13 changed files with 132 additions and 77 deletions

View File

@ -119,7 +119,7 @@ void ChatManager::keyDown(char key) {
if(text.empty() == false) {
string playerName = gameNetworkInterface->getHumanPlayerName();
int playerIndex = gameNetworkInterface->getHumanPlayerIndex();
console->addLine(playerName + ": " + text,false,playerIndex);
console->addLine(text,false,playerIndex);
gameNetworkInterface->sendTextMessage(text, teamMode? thisTeamIndex: -1);
if(inMenu == false) {
@ -187,7 +187,8 @@ void ChatManager::updateNetwork() {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] got nmtText [%s] for team = %d\n",__FILE__,__FUNCTION__,msg.chatText.c_str(),teamIndex);
if(teamIndex == -1 || teamIndex == thisTeamIndex) {
console->addLine(msg.chatSender + ": " + msg.chatText, true, msg.chatPlayerIndex);
//console->addLine(msg.chatSender + ": " + msg.chatText, true, msg.chatPlayerIndex);
console->addLine(msg.chatText, true, msg.chatPlayerIndex);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Added text to console\n",__FILE__,__FUNCTION__);
}

View File

@ -18,6 +18,7 @@
#include "sound_renderer.h"
#include "core_data.h"
#include <stdexcept>
#include "network_manager.h"
#include "leak_dumper.h"
using namespace std;
@ -45,11 +46,27 @@ void Console::addLine(string line, bool playSound, int playerIndex) {
if(playSound == true) {
SoundRenderer::getInstance().playFx(CoreData::getInstance().getClickSoundA());
}
lines.insert(lines.begin(), StringTimePair(line, StringTimePairData(timeElapsed,playerIndex)));
ConsoleLineInfo info;
info.text = line;
info.timeStamp = timeElapsed;
info.PlayerIndex = playerIndex;
info.originalPlayerName = "";
if(playerIndex >= 0) {
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
if(gameNetworkInterface != NULL) {
info.originalPlayerName = gameNetworkInterface->getGameSettings()->getNetworkPlayerNameByPlayerIndex(playerIndex);
//for(int i = 0; i < GameConstants::maxPlayers; ++i) {
// printf("i = %d, playerName = [%s]\n",i,gameNetworkInterface->getGameSettings()->getNetworkPlayerName(i).c_str());
//}
}
}
//printf("info.PlayerIndex = %d, line [%s]\n",info.PlayerIndex,info.originalPlayerName.c_str());
lines.insert(lines.begin(), info);
if(lines.size() > maxLines) {
lines.pop_back();
}
storedLines.insert(storedLines.begin(), StringTimePair(line, StringTimePairData(timeElapsed,playerIndex)));
storedLines.insert(storedLines.begin(), info);
if(storedLines.size() > maxStoredLines) {
storedLines.pop_back();
}
@ -72,7 +89,7 @@ void Console::update() {
timeElapsed += 1.f / GameConstants::updateFps;
if(lines.empty() == false) {
if(lines.back().second.first < (timeElapsed - timeout)) {
if(lines.back().timeStamp < (timeElapsed - timeout)) {
lines.pop_back();
}
}
@ -81,6 +98,30 @@ void Console::update() {
bool Console::isEmpty() {
return lines.empty();
}
string Console::getLine(int i) const {
if(i < 0 || i >= lines.size())
throw runtime_error("i >= Lines.size()");
return lines[i].text;
}
string Console::getStoredLine(int i) const {
if(i < 0 || i >= storedLines.size())
throw runtime_error("i >= storedLines.size()");
return storedLines[i].text;
}
ConsoleLineInfo Console::getLineItem(int i) const {
if(i < 0 || i >= lines.size())
throw runtime_error("i >= Lines.size()");
return lines[i];
}
ConsoleLineInfo Console::getStoredLineItem(int i) const {
if(i < 0 || i >= storedLines.size())
throw runtime_error("i >= storedLines.size()");
return storedLines[i];
}
}}//end namespace

View File

@ -23,7 +23,7 @@ using std::vector;
using std::pair;
using namespace std;
namespace Glest{ namespace Game{
namespace Glest { namespace Game {
// =====================================================
// class Console
@ -31,15 +31,21 @@ namespace Glest{ namespace Game{
// In-game console that shows various types of messages
// =====================================================
class Console{
class ConsoleLineInfo {
public:
string text;
float timeStamp;
int PlayerIndex;
string originalPlayerName;
};
class Console {
private:
static const int consoleLines= 5;
public:
// The float is elapsed time, the int is playerindex (-1 is no player)
typedef pair<float, int> StringTimePairData;
typedef pair<string, StringTimePairData > StringTimePair;
typedef vector<StringTimePair> Lines;
typedef vector<ConsoleLineInfo> Lines;
typedef Lines::const_iterator LineIterator;
private:
@ -57,11 +63,10 @@ public:
int getStoredLineCount() const {return storedLines.size();}
int getLineCount() const {return lines.size();}
string getLine(int i) const { if(i < 0 || i >= lines.size()) throw runtime_error("i >= Lines.size()"); return lines[i].first;}
string getStoredLine(int i) const { if(i < 0 || i >= storedLines.size()) throw runtime_error("i >= storedLines.size()"); return storedLines[i].first;}
int getLinePlayerIndex(int i) const { if(i < 0 || i >= lines.size()) throw runtime_error("i >= Lines.size()"); return lines[i].second.second;}
int getStoredLinePlayerIndex(int i) const { if(i < 0 || i >= storedLines.size()) throw runtime_error("i >= storedLines.size()"); return storedLines[i].second.second;}
string getLine(int i) const;
string getStoredLine(int i) const;
ConsoleLineInfo getLineItem(int i) const;
ConsoleLineInfo getStoredLineItem(int i) const;
void clearStoredLines();
void addStdMessage(const string &s);

View File

@ -89,6 +89,16 @@ public:
const string &getScenarioDir() const {return scenarioDir;}
const string &getFactionTypeName(int factionIndex) const {return factionTypeNames[factionIndex];}
const string &getNetworkPlayerName(int factionIndex) const {return networkPlayerNames[factionIndex];}
const string getNetworkPlayerNameByPlayerIndex(int playerIndex) const {
string result = "";
for(int i = 0; i < GameConstants::maxPlayers; ++i) {
if(startLocationIndex[i] == playerIndex) {
result = networkPlayerNames[i];
break;
}
}
return result;
}
ControlType getFactionControl(int factionIndex) const {return factionControls[factionIndex];}
bool isNetworkGame() const {

View File

@ -787,7 +787,7 @@ void Renderer::renderTextureQuad(int x, int y, int w, int h, const Texture2D *te
assertGl();
}
void Renderer::RenderConsoleLine(int lineIndex, string line,int playerIndex,int xPosition) {
void Renderer::RenderConsoleLine(int lineIndex, int xPosition, const ConsoleLineInfo *lineInfo) {
Vec4f fontColor;
if(game != NULL) {
fontColor = game->getGui()->getDisplay()->getColor();
@ -799,9 +799,9 @@ void Renderer::RenderConsoleLine(int lineIndex, string line,int playerIndex,int
Vec4f defaultFontColor = fontColor;
if(playerIndex >= 0) {
if(lineInfo->PlayerIndex >= 0) {
std::map<int,Texture2D *> &crcPlayerTextureCache = CacheManager::getCachedItem< std::map<int,Texture2D *> >(GameConstants::playerTextureCacheLookupKey);
Vec3f playerColor = crcPlayerTextureCache[playerIndex]->getPixmap()->getPixel3f(0, 0);
Vec3f playerColor = crcPlayerTextureCache[lineInfo->PlayerIndex]->getPixmap()->getPixel3f(0, 0);
fontColor.x = playerColor.x;
fontColor.y = playerColor.y;
fontColor.z = playerColor.z;
@ -809,20 +809,22 @@ void Renderer::RenderConsoleLine(int lineIndex, string line,int playerIndex,int
GameNetworkInterface *gameNetInterface = NetworkManager::getInstance().getGameNetworkInterface();
if(gameNetInterface != NULL && gameNetInterface->getGameSettings() != NULL) {
const GameSettings *gameSettings = gameNetInterface->getGameSettings();
string playerName = gameSettings->getNetworkPlayerName(playerIndex);
if(StartsWith(line, playerName + ":") == true) {
line = line.erase(0,playerName.length()+1);
string headerLine = "*" + playerName + ":";
string playerName = gameSettings->getNetworkPlayerNameByPlayerIndex(lineInfo->PlayerIndex);
if(playerName != lineInfo->originalPlayerName && lineInfo->originalPlayerName != "") {
playerName = lineInfo->originalPlayerName;
}
//printf("playerName [%s], line [%s]\n",playerName.c_str(),line.c_str());
renderTextShadow(
string headerLine = "*" + playerName + ":";
renderTextShadow(
headerLine,
CoreData::getInstance().getConsoleFont(),
fontColor,
xPosition, lineIndex * 20 + 20);
fontColor = defaultFontColor;
xPosition += (7 * (playerName.length() + 2));
}
fontColor = defaultFontColor;
xPosition += (7 * (playerName.length() + 2));
}
}
else {
@ -830,7 +832,7 @@ void Renderer::RenderConsoleLine(int lineIndex, string line,int playerIndex,int
}
renderTextShadow(
line,
lineInfo->text,
CoreData::getInstance().getConsoleFont(),
fontColor,
xPosition, lineIndex * 20 + 20);
@ -847,29 +849,23 @@ void Renderer::renderConsole(const Console *console,const bool showFullConsole,c
if(showFullConsole) {
for(int i = 0; i < console->getStoredLineCount(); ++i) {
string line = console->getStoredLine(i);
int playerIndex = console->getStoredLinePlayerIndex(i);
int xPosition = 20;
RenderConsoleLine(i, line,playerIndex,xPosition);
const ConsoleLineInfo &lineInfo = console->getStoredLineItem(i);
RenderConsoleLine(i, xPosition, &lineInfo);
}
}
else if(showMenuConsole) {
for(int i = 0; i < console->getStoredLineCount() && i < maxConsoleLines; ++i) {
string line = console->getStoredLine(i);
int playerIndex = console->getStoredLinePlayerIndex(i);
int xPosition = 20;
RenderConsoleLine(i, line,playerIndex,xPosition);
const ConsoleLineInfo &lineInfo = console->getStoredLineItem(i);
RenderConsoleLine(i, xPosition, &lineInfo);
}
}
else {
for(int i = 0; i < console->getLineCount(); ++i) {
string line = console->getLine(i);
int playerIndex = console->getLinePlayerIndex(i);
int xPosition = 20;
RenderConsoleLine(i, line,playerIndex,xPosition);
const ConsoleLineInfo &lineInfo = console->getLineItem(i);
RenderConsoleLine(i, xPosition, &lineInfo);
}
}
glPopAttrib();

View File

@ -68,7 +68,7 @@ class Console;
class MenuBackground;
class ChatManager;
class Object;
class ConsoleLineInfo;
// ===========================================================
// class Renderer
//
@ -306,7 +306,7 @@ public:
void renderBackground(const Texture2D *texture);
void renderTextureQuad(int x, int y, int w, int h, const Texture2D *texture, float alpha=1.f,const Vec3f *color=NULL);
void renderConsole(const Console *console, const bool showAll=false, const bool showMenuConsole=false);
void RenderConsoleLine(int lineIndex, string line,int playerIndex,int xPosition);
void RenderConsoleLine(int lineIndex, int xPosition, const ConsoleLineInfo *lineInfo);
void renderChatManager(const ChatManager *chatManager);
void renderResourceStatus();
void renderSelectionQuad();

View File

@ -1772,6 +1772,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] i = %d, slotIndex = %d, getHumanPlayerName(i) [%s]\n",__FILE__,__FUNCTION__,__LINE__,i,slotIndex,getHumanPlayerName(i).c_str());
gameSettings->setThisFactionIndex(slotIndex);
//gameSettings->setNetworkPlayerName(slotIndex, getHumanPlayerName(i));
gameSettings->setNetworkPlayerName(slotIndex, getHumanPlayerName(i));
//labelPlayerNames[i].setText(getHumanPlayerName(i));
//SetActivePlayerNameEditor();
@ -2269,7 +2270,7 @@ void MenuStateCustomGame::updateNetworkSlots() {
try {
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
for(int i= 0; i<GameConstants::maxPlayers; ++i) {
for(int i= 0; i < GameConstants::maxPlayers; ++i) {
if(serverInterface->getSlot(i) == NULL &&
listBoxControls[i].getSelectedItemIndex() == ctNetwork) {
try {

View File

@ -435,7 +435,7 @@ void ClientInterface::updateLobby() {
{
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] got nmtText\n",__FILE__,__FUNCTION__);
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getSender().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex());
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex());
this->addChatInfo(msg);
}
}
@ -622,7 +622,7 @@ void ClientInterface::updateKeyframe(int frameCount)
sleep(0);
}
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getSender().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex());
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex());
this->addChatInfo(msg);
}
break;
@ -798,11 +798,13 @@ void ClientInterface::sendTextMessage(const string &text, int teamIndex, bool ec
string humanPlayerName = getHumanPlayerName();
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] humanPlayerName = [%s] playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,humanPlayerName.c_str(),playerIndex);
NetworkMessageText networkMessageText(text, humanPlayerName, teamIndex,playerIndex);
//NetworkMessageText networkMessageText(text, humanPlayerName, teamIndex,playerIndex);
NetworkMessageText networkMessageText(text, teamIndex,playerIndex);
sendMessage(&networkMessageText);
if(echoLocal == true) {
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getSender().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex());
//ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getSender().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex());
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex());
this->addChatInfo(msg);
}
@ -960,7 +962,7 @@ bool ClientInterface::shouldDiscardNetworkMessage(NetworkMessageType networkMess
NetworkMessageText netMsg = NetworkMessageText();
this->receiveMessage(&netMsg);
ChatMsgInfo msg(netMsg.getText().c_str(),netMsg.getSender().c_str(),netMsg.getTeamIndex(),netMsg.getPlayerIndex());
ChatMsgInfo msg(netMsg.getText().c_str(),netMsg.getTeamIndex(),netMsg.getPlayerIndex());
this->addChatInfo(msg);
}
break;

View File

@ -311,7 +311,7 @@ void ConnectionSlot::update(bool checkForNewClients) {
if(gotIntro == true) {
NetworkMessageText networkMessageText;
if(receiveMessage(&networkMessageText)) {
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getSender().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex());
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex());
this->addChatInfo(msg);
gotTextMsg = true;

View File

@ -46,7 +46,6 @@ protected:
void copyAll(const ChatMsgInfo &obj) {
this->chatText = obj.chatText.c_str();
this->chatSender = obj.chatSender.c_str();
this->chatTeamIndex = obj.chatTeamIndex;
this->chatPlayerIndex = obj.chatPlayerIndex;
}
@ -54,13 +53,11 @@ public:
ChatMsgInfo() {
this->chatText = "";
this->chatSender = "";
this->chatTeamIndex = -1;
this->chatPlayerIndex = -1;
}
ChatMsgInfo(string chatText, string chatSender,int chatTeamIndex, int chatPlayerIndex) {
ChatMsgInfo(string chatText, int chatTeamIndex, int chatPlayerIndex) {
this->chatText = chatText;
this->chatSender = chatSender;
this->chatTeamIndex = chatTeamIndex;
this->chatPlayerIndex = chatPlayerIndex;
}
@ -73,7 +70,6 @@ public:
}
string chatText;
string chatSender;
int chatTeamIndex;
int chatPlayerIndex;

View File

@ -393,20 +393,20 @@ void NetworkMessageCommandList::send(Socket* socket) const{
// class NetworkMessageText
// =====================================================
NetworkMessageText::NetworkMessageText(const string &text, const string &sender, int teamIndex, int playerIndex) {
//NetworkMessageText::NetworkMessageText(const string &text, const string &sender, int teamIndex, int playerIndex) {
NetworkMessageText::NetworkMessageText(const string &text, int teamIndex, int playerIndex) {
if(text.length() >= maxTextStringSize) {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING / ERROR - text [%s] length = %d, max = %d\n",__FILE__,__FUNCTION__,__LINE__,text.c_str(),text.length(),maxTextStringSize);
//throw runtime_error("NetworkMessageText - text.length() >= maxStringSize");
}
if(sender.length() >= maxSenderStringSize) {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING / ERROR - sender [%s] length = %d, max = %d\n",__FILE__,__FUNCTION__,__LINE__,sender.c_str(),sender.length(),maxSenderStringSize);
//if(sender.length() >= maxSenderStringSize) {
// SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] WARNING / ERROR - sender [%s] length = %d, max = %d\n",__FILE__,__FUNCTION__,__LINE__,sender.c_str(),sender.length(),maxSenderStringSize);
//throw runtime_error("NetworkMessageText - sender.length() >= maxSenderStringSize");
}
//}
data.messageType = nmtText;
data.text = text;
data.sender = sender;
//data.sender = sender;
data.teamIndex = teamIndex;
data.playerIndex = playerIndex;
}
@ -415,7 +415,7 @@ bool NetworkMessageText::receive(Socket* socket){
bool result = NetworkMessage::receive(socket, &data, sizeof(data));
data.text.nullTerminate();
data.sender.nullTerminate();
//data.sender.nullTerminate();
return result;
}

View File

@ -285,13 +285,13 @@ public:
class NetworkMessageText: public NetworkMessage {
private:
static const int maxTextStringSize= 340;
static const int maxSenderStringSize= 60;
//static const int maxSenderStringSize= 60;
private:
struct Data{
int8 messageType;
NetworkString<maxTextStringSize> text;
NetworkString<maxSenderStringSize> sender;
//NetworkString<maxSenderStringSize> sender;
int8 teamIndex;
int8 playerIndex;
};
@ -301,10 +301,11 @@ private:
public:
NetworkMessageText(){}
NetworkMessageText(const string &text, const string &sender, int teamIndex, int playerIndex);
//NetworkMessageText(const string &text, const string &sender, int teamIndex, int playerIndex);
NetworkMessageText(const string &text, int teamIndex, int playerIndex);
string getText() const {return data.text.getString();}
string getSender() const {return data.sender.getString();}
//string getSender() const {return data.sender.getString();}
int getTeamIndex() const {return data.teamIndex;}
int getPlayerIndex() const {return data.playerIndex;}

View File

@ -677,16 +677,16 @@ void ServerInterface::update() {
this->addChatInfo(msg);
string newChatText = msg.chatText.c_str();
string newChatSender = msg.chatSender.c_str();
//string newChatSender = msg.chatSender.c_str();
int newChatTeamIndex = msg.chatTeamIndex;
int newChatPlayerIndex = msg.chatPlayerIndex;
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 about to broadcast nmtText chatText [%s] chatSender [%s] chatTeamIndex = %d, newChatPlayerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,newChatText.c_str(),newChatSender.c_str(),newChatTeamIndex,newChatPlayerIndex);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 about to broadcast nmtText chatText [%s] chatTeamIndex = %d, newChatPlayerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,newChatText.c_str(),newChatTeamIndex,newChatPlayerIndex);
NetworkMessageText networkMessageText(newChatText.c_str(),newChatSender.c_str(),newChatTeamIndex,newChatPlayerIndex);
NetworkMessageText networkMessageText(newChatText.c_str(),newChatTeamIndex,newChatPlayerIndex);
broadcastMessage(&networkMessageText, connectionSlot->getPlayerIndex());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] after broadcast nmtText chatText [%s] chatSender [%s] chatTeamIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,newChatText.c_str(),newChatSender.c_str(),newChatTeamIndex);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] after broadcast nmtText chatText [%s] chatTeamIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,newChatText.c_str(),newChatTeamIndex);
}
}
@ -806,20 +806,20 @@ bool ServerInterface::shouldDiscardNetworkMessage(NetworkMessageType networkMess
NetworkMessageText netMsg = NetworkMessageText();
connectionSlot->receiveMessage(&netMsg);
ChatMsgInfo msg(netMsg.getText().c_str(),netMsg.getSender().c_str(),netMsg.getTeamIndex(),netMsg.getPlayerIndex());
ChatMsgInfo msg(netMsg.getText().c_str(),netMsg.getTeamIndex(),netMsg.getPlayerIndex());
this->addChatInfo(msg);
string newChatText = msg.chatText.c_str();
string newChatSender = msg.chatSender.c_str();
//string newChatSender = msg.chatSender.c_str();
int newChatTeamIndex = msg.chatTeamIndex;
int newChatPlayerIndex = msg.chatPlayerIndex;
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 about to broadcast nmtText chatText [%s] chatSender [%s] chatTeamIndex = %d, newChatPlayerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,newChatText.c_str(),newChatSender.c_str(),newChatTeamIndex,newChatPlayerIndex);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 about to broadcast nmtText chatText [%s] chatTeamIndex = %d, newChatPlayerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,newChatText.c_str(),newChatTeamIndex,newChatPlayerIndex);
NetworkMessageText networkMessageText(newChatText.c_str(),newChatSender.c_str(),newChatTeamIndex,newChatPlayerIndex);
NetworkMessageText networkMessageText(newChatText.c_str(),newChatTeamIndex,newChatPlayerIndex);
broadcastMessage(&networkMessageText, connectionSlot->getPlayerIndex());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] after broadcast nmtText chatText [%s] chatSender [%s] chatTeamIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,newChatText.c_str(),newChatSender.c_str(),newChatTeamIndex);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] after broadcast nmtText chatText [%s] chatTeamIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,newChatText.c_str(),newChatTeamIndex);
}
break;
@ -974,13 +974,15 @@ void ServerInterface::waitUntilReady(Checksum* checksum){
void ServerInterface::sendTextMessage(const string &text, int teamIndex, bool echoLocal) {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] text [%s] teamIndex = %d, echoLocal = %d\n",__FILE__,__FUNCTION__,__LINE__,text.c_str(),teamIndex,echoLocal);
NetworkMessageText networkMessageText(text, getHumanPlayerName().c_str(), teamIndex, getHumanPlayerIndex());
//NetworkMessageText networkMessageText(text, getHumanPlayerName().c_str(), teamIndex, getHumanPlayerIndex());
NetworkMessageText networkMessageText(text, teamIndex, getHumanPlayerIndex());
broadcastMessage(&networkMessageText);
if(echoLocal == true) {
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
ChatMsgInfo msg(text.c_str(),networkMessageText.getSender().c_str(),teamIndex,networkMessageText.getPlayerIndex());
//ChatMsgInfo msg(text.c_str(),networkMessageText.getSender().c_str(),teamIndex,networkMessageText.getPlayerIndex());
ChatMsgInfo msg(text.c_str(),teamIndex,networkMessageText.getPlayerIndex());
this->addChatInfo(msg);
}