Bugfix for trace bug#: 2984991

falling back to english text for scenarios text. 
- Also added more error checking and commented out some excessive debug output statements.
This commit is contained in:
Mark Vejvoda 2010-04-11 01:25:06 +00:00
parent ac6deedd93
commit af87e53bbe
17 changed files with 522 additions and 239 deletions

View File

@ -1,7 +1,7 @@
// ==============================================================
// This file is part of Glest (www.glest.org)
//
// Copyright (C) 2001-2008 Martiño Figueroa
// Copyright (C) 2001-2008 Martio Figueroa
//
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
@ -17,8 +17,10 @@
#include "network_manager.h"
#include "lang.h"
#include "util.h"
#include <stdexcept>
#include "leak_dumper.h"
using namespace std;
using namespace Shared::Platform;
using namespace Shared::Util;
@ -43,42 +45,52 @@ void ChatManager::init(Console* console, int thisTeamIndex){
}
void ChatManager::keyDown(char key){
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
Lang &lang= Lang::getInstance();
try {
Lang &lang= Lang::getInstance();
//toggle team mode
if(!editEnabled && key=='H'){
if(teamMode){
teamMode= false;
console->addLine(lang.get("ChatMode") + ": " + lang.get("All"));
}
else{
teamMode= true;
console->addLine(lang.get("ChatMode") + ": " + lang.get("Team"));
}
}
if(key==vkReturn){
if(editEnabled){
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
editEnabled= false;
if(!text.empty()) {
console->addLine(Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()) + ": " + text);
gameNetworkInterface->sendTextMessage(Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()) + ": "+
text, teamMode? thisTeamIndex: -1);
//toggle team mode
if(!editEnabled && key=='H'){
if(teamMode){
teamMode= false;
console->addLine(lang.get("ChatMode") + ": " + lang.get("All"));
}
else{
teamMode= true;
console->addLine(lang.get("ChatMode") + ": " + lang.get("Team"));
}
}
else{
editEnabled= true;
text.clear();
if(key==vkReturn){
if(editEnabled){
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
editEnabled= false;
if(!text.empty()) {
console->addLine(Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()) + ": " + text);
gameNetworkInterface->sendTextMessage(Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()) + ": "+
text, teamMode? thisTeamIndex: -1);
}
}
else{
editEnabled= true;
text.clear();
}
}
else if(key==vkBack){
if(!text.empty()){
text.erase(text.end() -1);
}
}
}
else if(key==vkBack){
if(!text.empty()){
text.erase(text.end() -1);
}
catch(const exception &ex) {
char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
throw runtime_error(szBuf);
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
void ChatManager::keyPress(char c){
@ -92,23 +104,32 @@ void ChatManager::keyPress(char c){
void ChatManager::updateNetwork()
{
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
string text;
string sender;
Config &config= Config::getInstance();
try {
GameNetworkInterface *gameNetworkInterface= NetworkManager::getInstance().getGameNetworkInterface();
string text;
string sender;
Config &config= Config::getInstance();
if(!gameNetworkInterface->getChatText().empty())
{
int teamIndex= gameNetworkInterface->getChatTeamIndex();
if(!gameNetworkInterface->getChatText().empty())
{
int teamIndex= gameNetworkInterface->getChatTeamIndex();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] got nmtText [%s] for team = %d\n",__FILE__,__FUNCTION__,gameNetworkInterface->getChatText().c_str(),teamIndex);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] got nmtText [%s] for team = %d\n",__FILE__,__FUNCTION__,gameNetworkInterface->getChatText().c_str(),teamIndex);
if(teamIndex==-1 || teamIndex==thisTeamIndex){
console->addLine(gameNetworkInterface->getChatText(), true);
if(teamIndex==-1 || teamIndex==thisTeamIndex){
console->addLine(gameNetworkInterface->getChatText(), true);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Added text to console\n",__FILE__,__FUNCTION__);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Added text to console\n",__FILE__,__FUNCTION__);
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
}
catch(const std::exception &ex) {
char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
throw runtime_error(szBuf);
}
}
}}//end namespace

View File

@ -0,0 +1,76 @@
// ==============================================================
// This file is part of Glest (www.glest.org)
//
// Copyright (C) 2001-2008 Martio Figueroa
//
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
// by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version
// ==============================================================
#include "console.h"
#include "lang.h"
#include "config.h"
#include "program.h"
#include "game_constants.h"
#include "sound_renderer.h"
#include "core_data.h"
#include <stdexcept>
#include "leak_dumper.h"
using namespace std;
namespace Glest{ namespace Game{
// =====================================================
// class Console
// =====================================================
Console::Console(){
//config
maxLines= Config::getInstance().getInt("ConsoleMaxLines");
timeout= Config::getInstance().getInt("ConsoleTimeout");
timeElapsed= 0.0f;
}
void Console::addStdMessage(const string &s){
addLine(Lang::getInstance().get(s));
}
void Console::addLine(string line, bool playSound){
try
{
if(playSound){
SoundRenderer::getInstance().playFx(CoreData::getInstance().getClickSoundA());
}
lines.insert(lines.begin(), StringTimePair(line, timeElapsed));
if(lines.size()>maxLines){
lines.pop_back();
}
}
catch(const exception &ex) {
char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
throw runtime_error(szBuf);
}
}
void Console::update(){
timeElapsed+= 1.f/GameConstants::updateFps;
if(!lines.empty()){
if(lines.back().second<timeElapsed-timeout){
lines.pop_back();
}
}
}
bool Console::isEmpty(){
return lines.empty();
}
}}//end namespace

View File

@ -0,0 +1,68 @@
// ==============================================================
// This file is part of Glest (www.glest.org)
//
// Copyright (C) 2001-2008 Martio Figueroa
//
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
// by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version
// ==============================================================
#ifndef _GLEST_GAME_CONSOLE_H_
#define _GLEST_GAME_CONSOLE_H_
#include <utility>
#include <string>
#include <vector>
#include <stdexcept>
using std::string;
using std::vector;
using std::pair;
using namespace std;
namespace Glest{ namespace Game{
// =====================================================
// class Console
//
// In-game console that shows various types of messages
// =====================================================
class Console{
private:
static const int consoleLines= 5;
public:
typedef pair<string, float> StringTimePair;
typedef vector<StringTimePair> Lines;
typedef Lines::const_iterator LineIterator;
private:
float timeElapsed;
Lines lines;
//this should be deleted from here someday
bool won, lost;
//config
int maxLines;
float timeout;
public:
Console();
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;}
void addStdMessage(const string &s);
void addLine(string line, bool playSound= false);
void update();
bool isEmpty();
};
}}//end namespace
#endif

View File

@ -89,6 +89,8 @@ void CoreData::load(){
displayFont->setType(displayFontName);
displayFont->setSize(displayFontSize);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] displayFontName = [%s] displayFontSize = %d\n",__FILE__,__FUNCTION__,__LINE__,displayFontName.c_str(),displayFontSize);
//menu fonts
string displayFontNameSmallPrefix= config.getString("FontDisplayPrefix");
string displayFontNameSmallPostfix= config.getString("FontDisplayPostfix");
@ -98,6 +100,7 @@ void CoreData::load(){
displayFontSmall->setType(displayFontNameSmall);
displayFontSmall->setSize(displayFontNameSmallSize);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] displayFontSmallName = [%s] displayFontSmallNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,displayFontNameSmall.c_str(),displayFontNameSmallSize);
string menuFontNameNormalPrefix= config.getString("FontMenuNormalPrefix");
string menuFontNameNormalPostfix= config.getString("FontMenuNormalPostfix");
@ -108,6 +111,7 @@ void CoreData::load(){
menuFontNormal->setSize(menuFontNameNormalSize);
menuFontNormal->setWidth(Font::wBold);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNormalName = [%s] menuFontNormalNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameNormal.c_str(),menuFontNameNormalSize);
string menuFontNameBigPrefix= config.getString("FontMenuBigPrefix");
string menuFontNameBigPostfix= config.getString("FontMenuBigPostfix");
@ -117,6 +121,8 @@ void CoreData::load(){
menuFontBig->setType(menuFontNameBig);
menuFontBig->setSize(menuFontNameBigSize);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNameBig = [%s] menuFontNameBigSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameBig.c_str(),menuFontNameBigSize);
string menuFontNameVeryBigPrefix= config.getString("FontMenuBigPrefix");
string menuFontNameVeryBigPostfix= config.getString("FontMenuBigPostfix");
int menuFontNameVeryBigSize=computeFontSize(config.getInt("FontMenuVeryBigBaseSize"));
@ -125,6 +131,8 @@ void CoreData::load(){
menuFontVeryBig->setType(menuFontNameVeryBig);
menuFontVeryBig->setSize(menuFontNameVeryBigSize);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNameVeryBig = [%s] menuFontNameVeryBigSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameVeryBig.c_str(),menuFontNameVeryBigSize);
//console font
string consoleFontNamePrefix= config.getString("FontConsolePrefix");
string consoleFontNamePostfix= config.getString("FontConsolePostfix");
@ -134,6 +142,8 @@ void CoreData::load(){
consoleFont->setType(consoleFontName);
consoleFont->setSize(consoleFontNameSize);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] consoleFontName = [%s] consoleFontNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,consoleFontName.c_str(),consoleFontNameSize);
//sounds
clickSoundA.load(dir+"/menu/sound/click_a.wav");
clickSoundB.load(dir+"/menu/sound/click_b.wav");

View File

@ -1,7 +1,7 @@
// ==============================================================
// This file is part of Glest (www.glest.org)
//
// Copyright (C) 2001-2008 Martiño Figueroa
// Copyright (C) 2001-2008 Martio Figueroa
//
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
@ -40,11 +40,15 @@ void Lang::loadStrings(const string &language){
}
void Lang::loadScenarioStrings(const string &scenarioDir, const string &scenarioName){
string path= scenarioDir + "/" + scenarioName + "/" + scenarioName + "_" + language + ".lng";
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] scenarioDir = [%s] scenarioName = [%s]\n",__FILE__,__FUNCTION__,__LINE__,scenarioDir.c_str(),scenarioName.c_str());
string scenarioFolder = scenarioDir + "/" + scenarioName + "/";
string path = scenarioFolder + scenarioName + "_" + language + ".lng";
if(EndsWith(scenarioDir, ".xml") == true) {
path= scenarioDir;
path = path.erase(path.size()-4,4);
path += "_" + language + ".lng";
scenarioFolder = extractDirectoryPathFromFile(scenarioDir);
path = scenarioFolder + scenarioName + "_" + language + ".lng";
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
}
scenarioStrings.clear();
@ -57,7 +61,9 @@ void Lang::loadScenarioStrings(const string &scenarioDir, const string &scenario
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path not found [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
//try english otherwise
string path= scenarioDir + "/" +scenarioName + "/" + scenarioName + "_english.lng";
path = scenarioFolder + scenarioName + "_english.lng";
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
if(fileExists(path)){
scenarioStrings.load(path);
}

View File

@ -13,9 +13,11 @@
#include "metrics.h"
#include "command_type.h"
#include "util.h"
#include "leak_dumper.h"
using namespace Shared::Graphics;
using namespace Shared::Util;
namespace Glest{ namespace Game{
@ -24,6 +26,8 @@ namespace Glest{ namespace Game{
// =====================================================
Display::Display(){
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
colors[0]= Vec4f(1.f, 1.f, 1.f, 0.0f);
colors[1]= Vec4f(1.f, 0.5f, 0.5f, 0.0f);
colors[2]= Vec4f(0.5f, 0.5f, 1.0f, 0.0f);
@ -37,6 +41,17 @@ Display::Display(){
currentColor= 0;
clear();
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
Vec4f Display::getColor() const {
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] currentColor = %d\n",__FILE__,__FUNCTION__,__LINE__,currentColor);
if(currentColor < 0 || currentColor >= colorCount) {
throw runtime_error("currentColor >= colorCount");
}
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] currentColor = %d\n",__FILE__,__FUNCTION__,__LINE__,currentColor);
return colors[currentColor];
}
//misc

View File

@ -71,7 +71,7 @@ public:
bool getDownLighted(int index) const {return downLighted[index];}
const CommandType *getCommandType(int i) {return commandTypes[i];}
CommandClass getCommandClass(int i) {return commandClasses[i];}
Vec4f getColor() const {return colors[currentColor];}
Vec4f getColor() const;
int getProgressBar() const {return progressBar;}
int getDownSelectedPos() const {return downSelectedPos;}

View File

@ -309,7 +309,7 @@ void Gui::mouseDoubleClickLeftGraphics(int x, int y){
}
void Gui::groupKey(int groupIndex){
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] groupIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,groupIndex);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] groupIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,groupIndex);
if(isKeyDown(vkControl)){
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] groupIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,groupIndex);

View File

@ -221,6 +221,8 @@ void MainWindow::eventKeyDown(char key){
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
void MainWindow::eventKeyUp(char key){

View File

@ -1,7 +1,7 @@
// ==============================================================
// This file is part of Glest (www.glest.org)
//
// Copyright (C) 2001-2008 Martiño Figueroa
// Copyright (C) 2001-2008 Martio Figueroa
//
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
@ -191,10 +191,20 @@ void Program::loop(){
//update world
while(updateTimer.isTime()){
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
GraphicComponent::update();
programState->update();
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
SoundRenderer::getInstance().update();
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
NetworkManager::getInstance().update();
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);

View File

@ -349,169 +349,187 @@ void MenuStateCustomGame::mouseMove(int x, int y, const MouseState *ms){
void MenuStateCustomGame::render(){
Renderer &renderer= Renderer::getInstance();
try {
Renderer &renderer= Renderer::getInstance();
int i;
int i;
renderer.renderButton(&buttonReturn);
renderer.renderButton(&buttonPlayNow);
renderer.renderButton(&buttonReturn);
renderer.renderButton(&buttonPlayNow);
for(i=0; i<GameConstants::maxPlayers; ++i){
renderer.renderLabel(&labelPlayers[i]);
renderer.renderListBox(&listBoxControls[i]);
if(listBoxControls[i].getSelectedItemIndex()!=ctClosed){
renderer.renderListBox(&listBoxFactions[i]);
renderer.renderListBox(&listBoxTeams[i]);
renderer.renderLabel(&labelNetStatus[i]);
for(i=0; i<GameConstants::maxPlayers; ++i){
renderer.renderLabel(&labelPlayers[i]);
renderer.renderListBox(&listBoxControls[i]);
if(listBoxControls[i].getSelectedItemIndex()!=ctClosed){
renderer.renderListBox(&listBoxFactions[i]);
renderer.renderListBox(&listBoxTeams[i]);
renderer.renderLabel(&labelNetStatus[i]);
}
}
}
renderer.renderLabel(&labelMap);
renderer.renderLabel(&labelFogOfWar);
renderer.renderLabel(&labelTileset);
renderer.renderLabel(&labelTechTree);
renderer.renderLabel(&labelControl);
renderer.renderLabel(&labelFaction);
renderer.renderLabel(&labelTeam);
renderer.renderLabel(&labelMapInfo);
renderer.renderLabel(&labelMap);
renderer.renderLabel(&labelFogOfWar);
renderer.renderLabel(&labelTileset);
renderer.renderLabel(&labelTechTree);
renderer.renderLabel(&labelControl);
renderer.renderLabel(&labelFaction);
renderer.renderLabel(&labelTeam);
renderer.renderLabel(&labelMapInfo);
renderer.renderListBox(&listBoxMap);
renderer.renderListBox(&listBoxFogOfWar);
renderer.renderListBox(&listBoxTileset);
renderer.renderListBox(&listBoxTechTree);
renderer.renderListBox(&listBoxMap);
renderer.renderListBox(&listBoxFogOfWar);
renderer.renderListBox(&listBoxTileset);
renderer.renderListBox(&listBoxTechTree);
renderer.renderChatManager(&chatManager);
renderer.renderConsole(&console);
renderer.renderChatManager(&chatManager);
renderer.renderConsole(&console);
}
catch(const std::exception &ex) {
char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
throw runtime_error(szBuf);
}
}
void MenuStateCustomGame::update()
{
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
Lang& lang= Lang::getInstance();
try {
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
bool haveAtLeastOneNetworkClientConnected = false;
Config &config = Config::getInstance();
for(int i= 0; i<mapInfo.players; ++i)
{
if(listBoxControls[i].getSelectedItemIndex() == ctNetwork)
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
Lang& lang= Lang::getInstance();
bool haveAtLeastOneNetworkClientConnected = false;
Config &config = Config::getInstance();
for(int i= 0; i<mapInfo.players; ++i)
{
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] START - ctNetwork\n",__FILE__,__FUNCTION__);
ConnectionSlot* connectionSlot= serverInterface->getSlot(i);
assert(connectionSlot!=NULL);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] A - ctNetwork\n",__FILE__,__FUNCTION__);
if(connectionSlot->isConnected())
if(listBoxControls[i].getSelectedItemIndex() == ctNetwork)
{
haveAtLeastOneNetworkClientConnected = true;
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] B - ctNetwork\n",__FILE__,__FUNCTION__);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] START - ctNetwork\n",__FILE__,__FUNCTION__);
string label = connectionSlot->getName();
if(connectionSlot->getAllowDownloadDataSynch() == true &&
connectionSlot->getAllowGameDataSynchCheck() == true)
{
if(connectionSlot->getNetworkGameDataSynchCheckOk() == false)
{
label = connectionSlot->getName() + " - waiting to synch:";
if(connectionSlot->getNetworkGameDataSynchCheckOkMap() == false)
{
label = label + " map";
}
if(connectionSlot->getNetworkGameDataSynchCheckOkTile() == false)
{
label = label + " tile";
}
if(connectionSlot->getNetworkGameDataSynchCheckOkTech() == false)
{
label = label + " techtree";
}
//if(connectionSlot->getNetworkGameDataSynchCheckOkFogOfWar() == false)
//{
// label = label + " FogOfWar == false";
//}
ConnectionSlot* connectionSlot= serverInterface->getSlot(i);
}
else
{
label = connectionSlot->getName() + " - data synch is ok";
}
}
else
{
label = connectionSlot->getName();
assert(connectionSlot!=NULL);
if(connectionSlot->getAllowGameDataSynchCheck() == true &&
connectionSlot->getNetworkGameDataSynchCheckOk() == false)
{
label += " - warning synch mismatch for:";
if(connectionSlot->getNetworkGameDataSynchCheckOkMap() == false)
{
label = label + " map";
}
if(connectionSlot->getNetworkGameDataSynchCheckOkTile() == false)
{
label = label + " tile";
}
if(connectionSlot->getNetworkGameDataSynchCheckOkTech() == false)
{
label = label + " techtree";
}
//if(connectionSlot->getNetworkGameDataSynchCheckOkFogOfWar() == false)
//{
// label = label + " FogOfWar == false";
//}
}
}
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] A - ctNetwork\n",__FILE__,__FUNCTION__);
labelNetStatus[i].setText(label);
}
else
{
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] C - ctNetwork\n",__FILE__,__FUNCTION__);
string port=intToStr(config.getInt("ServerPort"));
if(port!="61357"){
port=port +lang.get(" NonStandardPort")+"!";
if(connectionSlot->isConnected())
{
haveAtLeastOneNetworkClientConnected = true;
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] B - ctNetwork\n",__FILE__,__FUNCTION__);
string label = connectionSlot->getName();
if(connectionSlot->getAllowDownloadDataSynch() == true &&
connectionSlot->getAllowGameDataSynchCheck() == true)
{
if(connectionSlot->getNetworkGameDataSynchCheckOk() == false)
{
label = connectionSlot->getName() + " - waiting to synch:";
if(connectionSlot->getNetworkGameDataSynchCheckOkMap() == false)
{
label = label + " map";
}
if(connectionSlot->getNetworkGameDataSynchCheckOkTile() == false)
{
label = label + " tile";
}
if(connectionSlot->getNetworkGameDataSynchCheckOkTech() == false)
{
label = label + " techtree";
}
//if(connectionSlot->getNetworkGameDataSynchCheckOkFogOfWar() == false)
//{
// label = label + " FogOfWar == false";
//}
}
else
{
label = connectionSlot->getName() + " - data synch is ok";
}
}
else
{
label = connectionSlot->getName();
if(connectionSlot->getAllowGameDataSynchCheck() == true &&
connectionSlot->getNetworkGameDataSynchCheckOk() == false)
{
label += " - warning synch mismatch for:";
if(connectionSlot->getNetworkGameDataSynchCheckOkMap() == false)
{
label = label + " map";
}
if(connectionSlot->getNetworkGameDataSynchCheckOkTile() == false)
{
label = label + " tile";
}
if(connectionSlot->getNetworkGameDataSynchCheckOkTech() == false)
{
label = label + " techtree";
}
//if(connectionSlot->getNetworkGameDataSynchCheckOkFogOfWar() == false)
//{
// label = label + " FogOfWar == false";
//}
}
}
labelNetStatus[i].setText(label);
}
else
{
port=port+")";
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] C - ctNetwork\n",__FILE__,__FUNCTION__);
string port=intToStr(config.getInt("ServerPort"));
if(port!="61357"){
port=port +lang.get(" NonStandardPort")+"!";
}
else
{
port=port+")";
}
port="("+port;
labelNetStatus[i].setText("--- "+port);
}
port="("+port;
labelNetStatus[i].setText("--- "+port);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] END - ctNetwork\n",__FILE__,__FUNCTION__);
}
else{
labelNetStatus[i].setText("");
}
}
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] END - ctNetwork\n",__FILE__,__FUNCTION__);
}
else{
labelNetStatus[i].setText("");
// Send the game settings to each client if we have at least one networked client
if( serverInterface->getAllowGameDataSynchCheck() == true &&
haveAtLeastOneNetworkClientConnected == true &&
needToSetChangedGameSettings == true &&
difftime(time(NULL),lastSetChangedGameSettings) >= 2)
{
GameSettings gameSettings;
loadGameSettings(&gameSettings);
serverInterface->setGameSettings(&gameSettings);
needToSetChangedGameSettings = false;
lastSetChangedGameSettings = time(NULL);
}
//call the chat manager
chatManager.updateNetwork();
//console
console.update();
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
catch(const std::exception &ex) {
char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
throw runtime_error(szBuf);
}
// Send the game settings to each client if we have at least one networked client
if( serverInterface->getAllowGameDataSynchCheck() == true &&
haveAtLeastOneNetworkClientConnected == true &&
needToSetChangedGameSettings == true &&
difftime(time(NULL),lastSetChangedGameSettings) >= 2)
{
GameSettings gameSettings;
loadGameSettings(&gameSettings);
serverInterface->setGameSettings(&gameSettings);
needToSetChangedGameSettings = false;
lastSetChangedGameSettings = time(NULL);
}
//call the chat manager
chatManager.updateNetwork();
//console
console.update();
}
void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings)
{
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] START\n",__FILE__,__FUNCTION__);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
int factionCount= 0;
@ -546,7 +564,7 @@ void MenuStateCustomGame::loadGameSettings(GameSettings *gameSettings)
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] gameSettings->getTech() = [%s]\n",__FILE__,__FUNCTION__,gameSettings->getTech().c_str());
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] gameSettings->getMap() = [%s]\n",__FILE__,__FUNCTION__,gameSettings->getMap().c_str());
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] END\n",__FILE__,__FUNCTION__);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
}
// ============ PRIVATE ===========================
@ -555,18 +573,25 @@ bool MenuStateCustomGame::hasNetworkGameSettings()
{
bool hasNetworkSlot = false;
for(int i=0; i<mapInfo.players; ++i)
{
ControlType ct= static_cast<ControlType>(listBoxControls[i].getSelectedItemIndex());
if(ct != ctClosed)
try {
for(int i=0; i<mapInfo.players; ++i)
{
if(ct == ctNetwork)
ControlType ct= static_cast<ControlType>(listBoxControls[i].getSelectedItemIndex());
if(ct != ctClosed)
{
hasNetworkSlot = true;
break;
if(ct == ctNetwork)
{
hasNetworkSlot = true;
break;
}
}
}
}
catch(const std::exception &ex) {
char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
throw runtime_error(szBuf);
}
return hasNetworkSlot;
}
@ -641,50 +666,71 @@ void MenuStateCustomGame::reloadFactions(){
}
void MenuStateCustomGame::updateControlers(){
bool humanPlayer= false;
try {
bool humanPlayer= false;
for(int i= 0; i<mapInfo.players; ++i){
if(listBoxControls[i].getSelectedItemIndex() == ctHuman){
humanPlayer= true;
for(int i= 0; i<mapInfo.players; ++i){
if(listBoxControls[i].getSelectedItemIndex() == ctHuman){
humanPlayer= true;
}
}
if(!humanPlayer){
listBoxControls[0].setSelectedItemIndex(ctHuman);
}
for(int i= mapInfo.players; i<GameConstants::maxPlayers; ++i){
listBoxControls[i].setSelectedItemIndex(ctClosed);
}
}
if(!humanPlayer){
listBoxControls[0].setSelectedItemIndex(ctHuman);
}
for(int i= mapInfo.players; i<GameConstants::maxPlayers; ++i){
listBoxControls[i].setSelectedItemIndex(ctClosed);
catch(const std::exception &ex) {
char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
throw runtime_error(szBuf);
}
}
void MenuStateCustomGame::closeUnusedSlots(){
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
for(int i= 0; i<mapInfo.players; ++i){
if(listBoxControls[i].getSelectedItemIndex()==ctNetwork){
if(!serverInterface->getSlot(i)->isConnected()){
listBoxControls[i].setSelectedItemIndex(ctClosed);
try {
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
for(int i= 0; i<mapInfo.players; ++i){
if(listBoxControls[i].getSelectedItemIndex()==ctNetwork){
if(!serverInterface->getSlot(i)->isConnected()){
listBoxControls[i].setSelectedItemIndex(ctClosed);
}
}
}
updateNetworkSlots();
}
catch(const std::exception &ex) {
char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
throw runtime_error(szBuf);
}
updateNetworkSlots();
}
void MenuStateCustomGame::updateNetworkSlots()
{
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
try {
ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface();
for(int i= 0; i<GameConstants::maxPlayers; ++i)
{
if(serverInterface->getSlot(i) == NULL && listBoxControls[i].getSelectedItemIndex() == ctNetwork)
for(int i= 0; i<GameConstants::maxPlayers; ++i)
{
serverInterface->addSlot(i);
}
if(serverInterface->getSlot(i) != NULL && listBoxControls[i].getSelectedItemIndex() != ctNetwork)
{
serverInterface->removeSlot(i);
if(serverInterface->getSlot(i) == NULL && listBoxControls[i].getSelectedItemIndex() == ctNetwork)
{
serverInterface->addSlot(i);
}
if(serverInterface->getSlot(i) != NULL && listBoxControls[i].getSelectedItemIndex() != ctNetwork)
{
serverInterface->removeSlot(i);
}
}
}
catch(const std::exception &ex) {
char szBuf[1024]="";
sprintf(szBuf,"In [%s::%s %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
throw runtime_error(szBuf);
}
}
void MenuStateCustomGame::keyDown(char key)

View File

@ -362,6 +362,8 @@ void MenuStateJoinGame::update()
//process network messages
if(clientInterface->isConnected())
{
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
//update lobby
clientInterface->updateLobby();
@ -391,6 +393,8 @@ void MenuStateJoinGame::update()
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] clientInterface->getLaunchGame() - C\n",__FILE__,__FUNCTION__);
}
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
if(clientInterface->getLaunchGame()) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] clientInterface->getLaunchGame() - D\n",__FILE__,__FUNCTION__);

View File

@ -173,10 +173,12 @@ void ServerInterface::update()
//teamMessageData.sourceTeamIndex = i;
//vctTeamMessages.push_back(teamMessageData);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] #1 about to broadcast nmtText chatText [%s] chatSender [%s] chatTeamIndex = %d for SlotIndex# %d\n",__FILE__,__FUNCTION__,chatText.c_str(),chatSender.c_str(),chatTeamIndex,i);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 about to broadcast nmtText chatText [%s] chatSender [%s] chatTeamIndex = %d for SlotIndex# %d\n",__FILE__,__FUNCTION__,__LINE__,chatText.c_str(),chatSender.c_str(),chatTeamIndex,i);
NetworkMessageText networkMessageText(chatText,chatSender,chatTeamIndex);
broadcastMessage(&networkMessageText, i);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
break;
}
}
@ -349,12 +351,18 @@ void ServerInterface::waitUntilReady(Checksum* checksum){
}
void ServerInterface::sendTextMessage(const string &text, int teamIndex){
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
NetworkMessageText networkMessageText(text, Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()), teamIndex);
broadcastMessage(&networkMessageText);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
}
void ServerInterface::quitGame(bool userManuallyQuit)
{
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
if(userManuallyQuit == true)
{
string sQuitText = Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()) + " has chosen to leave the game!";
@ -364,12 +372,16 @@ void ServerInterface::quitGame(bool userManuallyQuit)
NetworkMessageQuit networkMessageQuit;
broadcastMessage(&networkMessageQuit);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
}
string ServerInterface::getNetworkStatus() const{
Lang &lang= Lang::getInstance();
string str;
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
for(int i= 0; i<GameConstants::maxPlayers; ++i){
ConnectionSlot* connectionSlot= slots[i];
@ -388,6 +400,9 @@ string ServerInterface::getNetworkStatus() const{
str+= '\n';
}
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
return str;
}
@ -395,6 +410,8 @@ bool ServerInterface::launchGame(const GameSettings* gameSettings){
bool bOkToStart = true;
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
for(int i= 0; i<GameConstants::maxPlayers; ++i)
{
ConnectionSlot *connectionSlot= slots[i];
@ -418,12 +435,14 @@ bool ServerInterface::launchGame(const GameSettings* gameSettings){
broadcastMessage(&networkMessageLaunch);
}
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
return bOkToStart;
}
void ServerInterface::broadcastMessage(const NetworkMessage* networkMessage, int excludeSlot){
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START\n",__FILE__,__FUNCTION__);
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
for(int i= 0; i<GameConstants::maxPlayers; ++i)
{
@ -434,7 +453,7 @@ void ServerInterface::broadcastMessage(const NetworkMessage* networkMessage, int
if(connectionSlot->isConnected())
{
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] before sendMessage\n",__FILE__,__FUNCTION__);
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] before sendMessage\n",__FILE__,__FUNCTION__);
connectionSlot->sendMessage(networkMessage);
}
else if(gameHasBeenInitiated == true)
@ -452,12 +471,12 @@ void ServerInterface::broadcastMessage(const NetworkMessage* networkMessage, int
}
}
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",__FILE__,__FUNCTION__);
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
}
void ServerInterface::broadcastMessageToConnectedClients(const NetworkMessage* networkMessage, int excludeSlot){
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START\n",__FILE__,__FUNCTION__);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
for(int i= 0; i<GameConstants::maxPlayers; ++i){
ConnectionSlot* connectionSlot= slots[i];
@ -465,14 +484,14 @@ void ServerInterface::broadcastMessageToConnectedClients(const NetworkMessage* n
if(i!= excludeSlot && connectionSlot!= NULL){
if(connectionSlot->isConnected()){
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] before sendMessage\n",__FILE__,__FUNCTION__);
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] before sendMessage\n",__FILE__,__FUNCTION__);
connectionSlot->sendMessage(networkMessage);
}
}
}
//SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",__FILE__,__FUNCTION__);
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
}
void ServerInterface::updateListen()

View File

@ -975,8 +975,7 @@ void ServerSocket::listen(int connectionQueueSize)
throwException(szBuf);
}
broadCastThread = new BroadCastSocketThread();
broadCastThread->start();
startBroadCastThread();
}

View File

@ -125,22 +125,22 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
for(unsigned int i = 0; i < static_cast<unsigned int> (charCount); ++i) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(i < fontInfo->min_char_or_byte2 || i > fontInfo->max_char_or_byte2) {
float width = static_cast<float>(6);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] setting size = %f\n",__FILE__,__FUNCTION__,__LINE__,width);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] setting size = %f\n",__FILE__,__FUNCTION__,__LINE__,width);
metrics.setWidth(i, width);
} else {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
int p = i - fontInfo->min_char_or_byte2;
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] p = %d fontInfo->per_char = %p\n",__FILE__,__FUNCTION__,__LINE__,p,fontInfo->per_char);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] p = %d fontInfo->per_char = %p\n",__FILE__,__FUNCTION__,__LINE__,p,fontInfo->per_char);
if(fontInfo->per_char == NULL) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] type = [%s] p = %d fontInfo->per_char = %p\n",__FILE__,__FUNCTION__,__LINE__,type.c_str(),p,fontInfo->per_char);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] type = [%s] p = %d fontInfo->per_char = %p\n",__FILE__,__FUNCTION__,__LINE__,type.c_str(),p,fontInfo->per_char);
XCharStruct *charinfo = &(fontInfo->min_bounds);
//int charWidth = charinfo->rbearing - charinfo->lbearing;
@ -148,11 +148,11 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
//int spanLength = (charWidth + 7) / 8;
if(charinfo != NULL) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] type = [%s] charinfo->width = %d\n",__FILE__,__FUNCTION__,__LINE__,type.c_str(),charinfo->width);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] type = [%s] charinfo->width = %d\n",__FILE__,__FUNCTION__,__LINE__,type.c_str(),charinfo->width);
metrics.setWidth(i, static_cast<float> (charinfo->width));
}
else {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] type = [%s] using size 6\n",__FILE__,__FUNCTION__,__LINE__,type.c_str());
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] type = [%s] using size 6\n",__FILE__,__FUNCTION__,__LINE__,type.c_str());
metrics.setWidth(i, static_cast<float>(6));
}
@ -162,7 +162,7 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
if(width <= 0) {
width = static_cast<float>(6);
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] type = [%s] using size = %f\n",__FILE__,__FUNCTION__,__LINE__,type.c_str(),width);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] type = [%s] using size = %f\n",__FILE__,__FUNCTION__,__LINE__,type.c_str(),width);
metrics.setWidth(i, width);
}
}
@ -179,7 +179,6 @@ void createGlFontBitmaps(uint32 &base, const string &type, int size, int width,
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] glerror = %d\n",__FILE__,__FUNCTION__,__LINE__,glerror);
XFreeFont(display, fontInfo);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);

View File

@ -128,8 +128,11 @@ bool Window::handleEvent() {
}
if(global_window) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
global_window->eventKeyDown(getKey(event.key.keysym));
global_window->eventKeyPress(static_cast<char>(event.key.keysym.unicode));
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
break;
case SDL_KEYUP:
@ -153,6 +156,11 @@ bool Window::handleEvent() {
std::cerr << "(b) Couldn't process event: " << e.what() << "\n";
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] (b) Couldn't process event: [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
}
catch(...) {
std::cerr << "(b) Couldn't process event: [UNKNOWN ERROR]\n";
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] (b) Couldn't process event: [UNKNOWN ERROR]\n",__FILE__,__FUNCTION__,__LINE__);
}
}
//printf("END [%d]\n",event.type);

View File

@ -32,12 +32,12 @@ SoundSource::SoundSource()
SoundSource::~SoundSource()
{
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
stop();
alDeleteSources(1, &source);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
}
bool SoundSource::playing()
@ -195,7 +195,7 @@ void StreamSoundSource::update()
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(sound == 0) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
return;
}