cleaned up code based on feedback from cppcheck
This commit is contained in:
parent
24cfc243eb
commit
ad0fb1d6f7
|
@ -3,6 +3,22 @@ MEGAGLEST CHANGELOG
|
||||||
To see a timeline of detail changes please visit:
|
To see a timeline of detail changes please visit:
|
||||||
http://sourceforge.net/apps/trac/megaglest/timeline
|
http://sourceforge.net/apps/trac/megaglest/timeline
|
||||||
|
|
||||||
|
v3.8.0-beta1
|
||||||
|
- Greater ability to translate game content into your native language. (including techtrees)
|
||||||
|
- Added Hebrew, Arabic, Vietnamese.
|
||||||
|
- better network game performance / management to handle slower clients.
|
||||||
|
- performance improvements.
|
||||||
|
- Enhanced AI behaviour.
|
||||||
|
- new game content including maps and tilesets.
|
||||||
|
- many bugfixes discovered in 3.7.1
|
||||||
|
- added ability for stand alone mod's to customize more of the engine like about screen.
|
||||||
|
- animated tileset object support.
|
||||||
|
- easier ability to download game content from host.
|
||||||
|
- many new lua functions for scenario modders.
|
||||||
|
- addition of google-breakpad to better track down bugs.
|
||||||
|
- color picking is now the default selection mode
|
||||||
|
-
|
||||||
|
|
||||||
v3.7.1
|
v3.7.1
|
||||||
- bugfixes reported in the bugs forum since 3.7.0
|
- bugfixes reported in the bugs forum since 3.7.0
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ void AiInterfaceThread::execute() {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ****************** STARTING worker thread this = %p\n",__FILE__,__FUNCTION__,__LINE__,this);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ****************** STARTING worker thread this = %p\n",__FILE__,__FUNCTION__,__LINE__,this);
|
||||||
|
|
||||||
bool minorDebugPerformance = false;
|
//bool minorDebugPerformance = false;
|
||||||
Chrono chrono;
|
Chrono chrono;
|
||||||
|
|
||||||
//unsigned int idx = 0;
|
//unsigned int idx = 0;
|
||||||
|
|
|
@ -1327,7 +1327,6 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
||||||
int lowestCommandCount=1000000;
|
int lowestCommandCount=1000000;
|
||||||
int currentProducerIndex=backupProducers[randomstart];
|
int currentProducerIndex=backupProducers[randomstart];
|
||||||
int bestIndex=-1;
|
int bestIndex=-1;
|
||||||
int currentCommandCount=0;
|
|
||||||
for(unsigned int i=randomstart; i<backupProducers.size()+randomstart; i++) {
|
for(unsigned int i=randomstart; i<backupProducers.size()+randomstart; i++) {
|
||||||
int prIndex = i;
|
int prIndex = i;
|
||||||
if(i >= backupProducers.size()) {
|
if(i >= backupProducers.size()) {
|
||||||
|
@ -1349,7 +1348,7 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
|
||||||
throw megaglest_runtime_error(szBuf);
|
throw megaglest_runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentCommandCount=aiInterface->getMyUnit(currentProducerIndex)->getCommandSize();
|
int currentCommandCount=aiInterface->getMyUnit(currentProducerIndex)->getCommandSize();
|
||||||
if( currentCommandCount==1 &&
|
if( currentCommandCount==1 &&
|
||||||
aiInterface->getMyUnit(currentProducerIndex)->getCurrCommand()->getCommandType()->getClass()==ccStop)
|
aiInterface->getMyUnit(currentProducerIndex)->getCurrCommand()->getCommandType()->getClass()==ccStop)
|
||||||
{// special for non buildings
|
{// special for non buildings
|
||||||
|
|
|
@ -1599,7 +1599,6 @@ bool PathFinder::unitCannotMove(Unit *unit) {
|
||||||
bool unitImmediatelyBlocked = false;
|
bool unitImmediatelyBlocked = false;
|
||||||
|
|
||||||
// First check if unit currently blocked all around them, if so don't try to pathfind
|
// First check if unit currently blocked all around them, if so don't try to pathfind
|
||||||
const bool showConsoleDebugInfo = Config::getInstance().getBool("EnablePathfinderDistanceOutput","false");
|
|
||||||
const Vec2i unitPos = unit->getPos();
|
const Vec2i unitPos = unit->getPos();
|
||||||
int failureCount = 0;
|
int failureCount = 0;
|
||||||
int cellCount = 0;
|
int cellCount = 0;
|
||||||
|
|
|
@ -2045,13 +2045,12 @@ void Game::update() {
|
||||||
if(hasAIPlayer == true) {
|
if(hasAIPlayer == true) {
|
||||||
//sleep(0);
|
//sleep(0);
|
||||||
|
|
||||||
bool workThreadsFinished = false;
|
|
||||||
Chrono chronoAI;
|
Chrono chronoAI;
|
||||||
chronoAI.start();
|
chronoAI.start();
|
||||||
|
|
||||||
const int MAX_FACTION_THREAD_WAIT_MILLISECONDS = 20000;
|
const int MAX_FACTION_THREAD_WAIT_MILLISECONDS = 20000;
|
||||||
for(;chronoAI.getMillis() < MAX_FACTION_THREAD_WAIT_MILLISECONDS;) {
|
for(;chronoAI.getMillis() < MAX_FACTION_THREAD_WAIT_MILLISECONDS;) {
|
||||||
workThreadsFinished = true;
|
bool workThreadsFinished = true;
|
||||||
for(int j = 0; j < world.getFactionCount(); ++j) {
|
for(int j = 0; j < world.getFactionCount(); ++j) {
|
||||||
Faction *faction = world.getFaction(j);
|
Faction *faction = world.getFaction(j);
|
||||||
if(faction == NULL) {
|
if(faction == NULL) {
|
||||||
|
|
|
@ -30,10 +30,8 @@ ScriptManagerMessage::ScriptManagerMessage() : text(""), header("") {
|
||||||
this->teamIndex=-1;
|
this->teamIndex=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptManagerMessage::ScriptManagerMessage(string text, string header,
|
ScriptManagerMessage::ScriptManagerMessage(string textIn, string headerIn,
|
||||||
int factionIndex,int teamIndex) {
|
int factionIndex,int teamIndex) : text(textIn), header(headerIn) {
|
||||||
this->text = text;
|
|
||||||
this->header = header;
|
|
||||||
this->factionIndex = factionIndex;
|
this->factionIndex = factionIndex;
|
||||||
this->teamIndex = teamIndex;
|
this->teamIndex = teamIndex;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2090,8 +2090,9 @@ void Renderer::renderConsole(const Console *console,const bool showFullConsole,
|
||||||
int x= console->getXPos()-5;
|
int x= console->getXPos()-5;
|
||||||
int y= console->getYPos()-5;
|
int y= console->getYPos()-5;
|
||||||
int h= console->getLineHeight()*console->getStoredLineCount();
|
int h= console->getLineHeight()*console->getStoredLineCount();
|
||||||
int w= 1000;
|
|
||||||
if(h>0){
|
if(h > 0) {
|
||||||
|
int w= 1000;
|
||||||
//background
|
//background
|
||||||
glPushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT);
|
glPushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
@ -4312,8 +4313,6 @@ void Renderer::renderSurface(const int renderFps) {
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int lastSurfaceDataIndex = -1;
|
|
||||||
|
|
||||||
const bool useVBOs = false;
|
const bool useVBOs = false;
|
||||||
const bool useSurfaceCache = false;
|
const bool useSurfaceCache = false;
|
||||||
|
|
||||||
|
@ -4349,6 +4348,7 @@ void Renderer::renderSurface(const int renderFps) {
|
||||||
}
|
}
|
||||||
surface->reserve(qCache.visibleScaledCellList.size());
|
surface->reserve(qCache.visibleScaledCellList.size());
|
||||||
|
|
||||||
|
int lastSurfaceDataIndex = -1;
|
||||||
for(int visibleIndex = 0;
|
for(int visibleIndex = 0;
|
||||||
visibleIndex < qCache.visibleScaledCellList.size(); ++visibleIndex) {
|
visibleIndex < qCache.visibleScaledCellList.size(); ++visibleIndex) {
|
||||||
Vec2i &pos = qCache.visibleScaledCellList[visibleIndex];
|
Vec2i &pos = qCache.visibleScaledCellList[visibleIndex];
|
||||||
|
@ -4429,22 +4429,12 @@ void Renderer::renderSurface(const int renderFps) {
|
||||||
cellData->normals.push_back(tc10->getNormal());
|
cellData->normals.push_back(tc10->getNormal());
|
||||||
cellData->bufferCount++;
|
cellData->bufferCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if(useSurfaceCache == true) {
|
|
||||||
std::pair<Chrono, std::vector<SurfaceData> > &surfaceCacheEntity = mapSurfaceData[snapshotOfvisibleQuad.getString()];
|
|
||||||
surfaceCacheEntity.first.start();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
//printf("\nsurface.size() = %d vs qCache.visibleScaledCellList.size() = %d snapshotOfvisibleQuad [%s]\n",surface.size(),qCache.visibleScaledCellList.size(),snapshotOfvisibleQuad.getString().c_str());
|
|
||||||
|
|
||||||
std::vector<SurfaceData> *surface = &surfaceData;
|
std::vector<SurfaceData> *surface = &surfaceData;
|
||||||
if(useSurfaceCache == true) {
|
if(useSurfaceCache == true) {
|
||||||
std::pair<Chrono, std::vector<SurfaceData> > &surfaceCacheEntity = mapSurfaceData[snapshotOfvisibleQuad.getString()];
|
std::pair<Chrono, std::vector<SurfaceData> > &surfaceCacheEntity = mapSurfaceData[snapshotOfvisibleQuad.getString()];
|
||||||
surface = &surfaceCacheEntity.second;
|
surface = &surfaceCacheEntity.second;
|
||||||
|
|
||||||
//printf("Surface Cache Size for Rendering using VA's = " MG_SIZE_T_SPECIFIER "\n",mapSurfaceData.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnableClientState(GL_VERTEX_ARRAY);
|
glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
|
|
@ -667,8 +667,6 @@ void Intro::render() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int difTime=0;
|
|
||||||
|
|
||||||
canRender();
|
canRender();
|
||||||
incrementFps();
|
incrementFps();
|
||||||
|
|
||||||
|
@ -686,7 +684,7 @@ void Intro::render() {
|
||||||
for(int i = 0; i < texts.size(); ++i) {
|
for(int i = 0; i < texts.size(); ++i) {
|
||||||
Text *text= texts[i];
|
Text *text= texts[i];
|
||||||
|
|
||||||
difTime= 1000 * timer / GameConstants::updateFps - text->getTime();
|
int difTime= 1000 * timer / GameConstants::updateFps - text->getTime();
|
||||||
|
|
||||||
if(difTime > 0 && difTime < appearTime + showTime + disapearTime) {
|
if(difTime > 0 && difTime < appearTime + showTime + disapearTime) {
|
||||||
float alpha= 1.f;
|
float alpha= 1.f;
|
||||||
|
|
|
@ -466,7 +466,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu,
|
||||||
labelTeam.setFont(CoreData::getInstance().getMenuFontBig());
|
labelTeam.setFont(CoreData::getInstance().getMenuFontBig());
|
||||||
labelTeam.setFont3D(CoreData::getInstance().getMenuFontBig3D());
|
labelTeam.setFont3D(CoreData::getInstance().getMenuFontBig3D());
|
||||||
|
|
||||||
xoffset=100;
|
//xoffset=100;
|
||||||
|
|
||||||
//texts
|
//texts
|
||||||
buttonClearBlockedPlayers.setText(lang.get("BlockPlayerClear"));
|
buttonClearBlockedPlayers.setText(lang.get("BlockPlayerClear"));
|
||||||
|
|
|
@ -353,14 +353,11 @@ void MenuStateLoadGame::mouseUp(int x, int y, const MouseButton mouseButton){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuStateLoadGame::deleteSlot(int i){
|
//void MenuStateLoadGame::deleteSlot(int i){
|
||||||
if(selectedButton==slots[i]){
|
// if(selectedButton==slots[i]){
|
||||||
selectedButton=NULL;
|
// selectedButton=NULL;
|
||||||
}
|
// }
|
||||||
// buttonToDelete=slots[i];
|
//}
|
||||||
// slots.erase(i);
|
|
||||||
// slotsGB.erase(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuStateLoadGame::mouseMove(int x, int y, const MouseState *ms){
|
void MenuStateLoadGame::mouseMove(int x, int y, const MouseState *ms){
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void clearSlots();
|
void clearSlots();
|
||||||
void deleteSlot(int i);
|
//void deleteSlot(int i);
|
||||||
void listFiles();
|
void listFiles();
|
||||||
|
|
||||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||||
|
|
|
@ -301,20 +301,20 @@ void MenuStateOptionsNetwork::reloadUI() {
|
||||||
GraphicComponent::reloadFontsForRegisterGraphicComponents(containerName);
|
GraphicComponent::reloadFontsForRegisterGraphicComponents(containerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuStateOptionsNetwork::showMessageBox(const string &text, const string &header, bool toggle){
|
//void MenuStateOptionsNetwork::showMessageBox(const string &text, const string &header, bool toggle){
|
||||||
if(!toggle){
|
// if(!toggle){
|
||||||
mainMessageBox.setEnabled(false);
|
// mainMessageBox.setEnabled(false);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(!mainMessageBox.getEnabled()){
|
// if(!mainMessageBox.getEnabled()){
|
||||||
mainMessageBox.setText(text);
|
// mainMessageBox.setText(text);
|
||||||
mainMessageBox.setHeader(header);
|
// mainMessageBox.setHeader(header);
|
||||||
mainMessageBox.setEnabled(true);
|
// mainMessageBox.setEnabled(true);
|
||||||
}
|
// }
|
||||||
else{
|
// else{
|
||||||
mainMessageBox.setEnabled(false);
|
// mainMessageBox.setEnabled(false);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
void MenuStateOptionsNetwork::mouseClick(int x, int y, MouseButton mouseButton){
|
void MenuStateOptionsNetwork::mouseClick(int x, int y, MouseButton mouseButton){
|
||||||
|
|
|
@ -82,7 +82,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void saveConfig();
|
void saveConfig();
|
||||||
void setActiveInputLable(GraphicLabel* newLable);
|
void setActiveInputLable(GraphicLabel* newLable);
|
||||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
//void showMessageBox(const string &text, const string &header, bool toggle);
|
||||||
};
|
};
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
|
|
@ -230,20 +230,20 @@ void MenuStateOptionsSound::reloadUI() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MenuStateOptionsSound::showMessageBox(const string &text, const string &header, bool toggle){
|
//void MenuStateOptionsSound::showMessageBox(const string &text, const string &header, bool toggle){
|
||||||
if(!toggle){
|
// if(!toggle){
|
||||||
mainMessageBox.setEnabled(false);
|
// mainMessageBox.setEnabled(false);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(!mainMessageBox.getEnabled()){
|
// if(!mainMessageBox.getEnabled()){
|
||||||
mainMessageBox.setText(text);
|
// mainMessageBox.setText(text);
|
||||||
mainMessageBox.setHeader(header);
|
// mainMessageBox.setHeader(header);
|
||||||
mainMessageBox.setEnabled(true);
|
// mainMessageBox.setEnabled(true);
|
||||||
}
|
// }
|
||||||
else{
|
// else{
|
||||||
mainMessageBox.setEnabled(false);
|
// mainMessageBox.setEnabled(false);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
void MenuStateOptionsSound::mouseClick(int x, int y, MouseButton mouseButton){
|
void MenuStateOptionsSound::mouseClick(int x, int y, MouseButton mouseButton){
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void saveConfig();
|
void saveConfig();
|
||||||
void setActiveInputLable(GraphicLabel* newLable);
|
void setActiveInputLable(GraphicLabel* newLable);
|
||||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
//void showMessageBox(const string &text, const string &header, bool toggle);
|
||||||
};
|
};
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
|
|
@ -77,7 +77,7 @@ void ClientInterfaceThread::execute() {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ****************** STARTING worker thread this = %p\n",__FILE__,__FUNCTION__,__LINE__,this);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ****************** STARTING worker thread this = %p\n",__FILE__,__FUNCTION__,__LINE__,this);
|
||||||
|
|
||||||
bool minorDebugPerformance = false;
|
//bool minorDebugPerformance = false;
|
||||||
Chrono chrono;
|
Chrono chrono;
|
||||||
|
|
||||||
// Set socket to blocking
|
// Set socket to blocking
|
||||||
|
@ -1044,7 +1044,6 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
||||||
case nmtCommandList:
|
case nmtCommandList:
|
||||||
{
|
{
|
||||||
|
|
||||||
int waitCount = 0;
|
|
||||||
//make sure we read the message
|
//make sure we read the message
|
||||||
time_t receiveTimeElapsed = time(NULL);
|
time_t receiveTimeElapsed = time(NULL);
|
||||||
NetworkMessageCommandList networkMessageCommandList;
|
NetworkMessageCommandList networkMessageCommandList;
|
||||||
|
@ -1060,13 +1059,7 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
||||||
throw megaglest_runtime_error("error retrieving nmtCommandList returned false!");
|
throw megaglest_runtime_error("error retrieving nmtCommandList returned false!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// while(receiveMessage(&networkMessageCommandList) == false &&
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] receiveMessage took %lld msecs\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
// isConnected() == true &&
|
|
||||||
// difftime(time(NULL),receiveTimeElapsed) <= (messageWaitTimeout / 2000)) {
|
|
||||||
// waitCount++;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] receiveMessage took %lld msecs, waitCount = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis(),waitCount);
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) chrono.start();
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) chrono.start();
|
||||||
|
|
||||||
MutexSafeWrapper safeMutex(networkCommandListThreadAccessor,CODE_AT_LINE);
|
MutexSafeWrapper safeMutex(networkCommandListThreadAccessor,CODE_AT_LINE);
|
||||||
|
|
|
@ -23,6 +23,7 @@ TilesetModelType::TilesetModelType() {
|
||||||
height = 0;
|
height = 0;
|
||||||
rotationAllowed = false;
|
rotationAllowed = false;
|
||||||
smoothTwoFrameAnim = false;
|
smoothTwoFrameAnim = false;
|
||||||
|
randomPositionEnabled = false;
|
||||||
|
|
||||||
animSpeed = 0;
|
animSpeed = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -499,9 +499,7 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
if(f) fclose(f);
|
|
||||||
|
|
||||||
throw megaglest_runtime_error("Can't open file");
|
throw megaglest_runtime_error("Can't open file");
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
|
@ -633,13 +633,12 @@ void World::updateAllFactionUnits() {
|
||||||
perfList.push_back(perfBuf);
|
perfList.push_back(perfBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool workThreadsFinished = false;
|
|
||||||
Chrono chrono;
|
Chrono chrono;
|
||||||
chrono.start();
|
chrono.start();
|
||||||
|
|
||||||
const int MAX_FACTION_THREAD_WAIT_MILLISECONDS = 20000;
|
const int MAX_FACTION_THREAD_WAIT_MILLISECONDS = 20000;
|
||||||
for(;chrono.getMillis() < MAX_FACTION_THREAD_WAIT_MILLISECONDS;) {
|
for(;chrono.getMillis() < MAX_FACTION_THREAD_WAIT_MILLISECONDS;) {
|
||||||
workThreadsFinished = true;
|
bool workThreadsFinished = true;
|
||||||
for(int i = 0; i < factionCount; ++i) {
|
for(int i = 0; i < factionCount; ++i) {
|
||||||
Faction *faction = getFaction(i);
|
Faction *faction = getFaction(i);
|
||||||
if(faction->isWorkerThreadSignalCompleted(frameCount) == false) {
|
if(faction->isWorkerThreadSignalCompleted(frameCount) == false) {
|
||||||
|
|
|
@ -153,13 +153,13 @@ Pixmap2D* JPGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const
|
||||||
//std::cout << "output width and height: " << cinfo.output_width <<" pixels and " << cinfo.output_height <<" pixels." << std::endl;
|
//std::cout << "output width and height: " << cinfo.output_width <<" pixels and " << cinfo.output_height <<" pixels." << std::endl;
|
||||||
/* now actually read the jpeg into the raw buffer */
|
/* now actually read the jpeg into the raw buffer */
|
||||||
row_pointer[0] = new unsigned char[cinfo.output_width*cinfo.num_components];
|
row_pointer[0] = new unsigned char[cinfo.output_width*cinfo.num_components];
|
||||||
size_t location = 0; //Current pixel
|
|
||||||
/* read one scan line at a time */
|
/* read one scan line at a time */
|
||||||
/* Again you need to invert the lines unfortunately*/
|
/* Again you need to invert the lines unfortunately*/
|
||||||
while( cinfo.output_scanline < cinfo.output_height )
|
while( cinfo.output_scanline < cinfo.output_height )
|
||||||
{
|
{
|
||||||
jpeg_read_scanlines( &cinfo, row_pointer, 1 );
|
jpeg_read_scanlines( &cinfo, row_pointer, 1 );
|
||||||
location = (cinfo.output_height - cinfo.output_scanline)*cinfo.output_width*picComponents;
|
//Current pixel
|
||||||
|
size_t location = (cinfo.output_height - cinfo.output_scanline) * cinfo.output_width * picComponents;
|
||||||
if (picComponents == cinfo.num_components) {
|
if (picComponents == cinfo.num_components) {
|
||||||
memcpy(pixels+location,row_pointer[0],cinfo.output_width*cinfo.num_components);
|
memcpy(pixels+location,row_pointer[0],cinfo.output_width*cinfo.num_components);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -438,14 +438,14 @@ bool fileExists(const string &path) {
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
// else {
|
||||||
//int fileErrno = errno;
|
//int fileErrno = errno;
|
||||||
#ifdef WIN32
|
//#ifdef WIN32
|
||||||
int fileErrno = errno;
|
//int fileErrno = errno;
|
||||||
DWORD error = GetLastError();
|
//DWORD error = GetLastError();
|
||||||
string strError = "[#6] Could not open file, result: " + intToStr(error) + " - " + intToStr(fileErrno) + " " + strerror(fileErrno) + " [" + path + "]";
|
//string strError = "[#6] Could not open file, result: " + intToStr(error) + " - " + intToStr(fileErrno) + " " + strerror(fileErrno) + " [" + path + "]";
|
||||||
#endif
|
//#endif
|
||||||
}
|
// }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -699,7 +699,7 @@ pair<bool,time_t> hasCachedFileCRCValue(string crcCacheFile, uint32 &value) {
|
||||||
char gameVer[500]="";
|
char gameVer[500]="";
|
||||||
char svnVer[500]="";
|
char svnVer[500]="";
|
||||||
char actualFilePath[8096]="";
|
char actualFilePath[8096]="";
|
||||||
int readbytes = fscanf(fp,"%20ld,%20u,%20ld\n%s\n%s\n%s",
|
int readbytes = fscanf(fp,"%20ld,%20u,%20ld\n%499s\n%499s\n%8095s",
|
||||||
&refreshDate,
|
&refreshDate,
|
||||||
&crcValue,
|
&crcValue,
|
||||||
&lastUpdateDate,
|
&lastUpdateDate,
|
||||||
|
|
|
@ -96,9 +96,8 @@ void FileCRCPreCacheThread::execute() {
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] techsPerWorker = %u, MAX_FileCRCPreCacheThread_WORKER_THREADS = %d, techPaths.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,techsPerWorker,MAX_FileCRCPreCacheThread_WORKER_THREADS,(int)techPaths.size());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] techsPerWorker = %u, MAX_FileCRCPreCacheThread_WORKER_THREADS = %d, techPaths.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,techsPerWorker,MAX_FileCRCPreCacheThread_WORKER_THREADS,(int)techPaths.size());
|
||||||
|
|
||||||
unsigned int consumedWorkers = 0;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
unsigned int consumedWorkers = 0;
|
||||||
for(unsigned int workerIdx = 0; workerIdx < MAX_FileCRCPreCacheThread_WORKER_THREADS; ++workerIdx) {
|
for(unsigned int workerIdx = 0; workerIdx < MAX_FileCRCPreCacheThread_WORKER_THREADS; ++workerIdx) {
|
||||||
if(getQuitStatus() == true) {
|
if(getQuitStatus() == true) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
@ -162,9 +161,9 @@ void FileCRCPreCacheThread::execute() {
|
||||||
|
|
||||||
sleep(0);
|
sleep(0);
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] Waiting for Spawned CRC threads to complete, preCacheWorkerThreadList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,(int)preCacheWorkerThreadList.size());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] Waiting for Spawned CRC threads to complete, preCacheWorkerThreadList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,(int)preCacheWorkerThreadList.size());
|
||||||
bool hasRunningWorkerThread = true;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
bool hasRunningWorkerThread = true;
|
||||||
for(;hasRunningWorkerThread == true;) {
|
for(;hasRunningWorkerThread == true;) {
|
||||||
hasRunningWorkerThread = false;
|
hasRunningWorkerThread = false;
|
||||||
for(unsigned int idx = 0; idx < preCacheWorkerThreadList.size(); idx++) {
|
for(unsigned int idx = 0; idx < preCacheWorkerThreadList.size(); idx++) {
|
||||||
|
|
|
@ -236,8 +236,6 @@ void event_privmsg (irc_session_t * session, const char * event, const char * or
|
||||||
}
|
}
|
||||||
|
|
||||||
void dcc_recv_callback (irc_session_t * session, irc_dcc_t id, int status, void * ctx, const char * data, unsigned int length) {
|
void dcc_recv_callback (irc_session_t * session, irc_dcc_t id, int status, void * ctx, const char * data, unsigned int length) {
|
||||||
static int count = 1;
|
|
||||||
char buf[12]="";
|
|
||||||
|
|
||||||
switch (status)
|
switch (status)
|
||||||
{
|
{
|
||||||
|
@ -252,6 +250,9 @@ void dcc_recv_callback (irc_session_t * session, irc_dcc_t id, int status, void
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED || IRCThread::debugEnabled) printf ("DCC %d: %s\n", id, data);
|
if(SystemFlags::VERBOSE_MODE_ENABLED || IRCThread::debugEnabled) printf ("DCC %d: %s\n", id, data);
|
||||||
|
|
||||||
|
static int count = 1;
|
||||||
|
char buf[12]="";
|
||||||
sprintf (buf, "DCC [%d]: %d", id, count++);
|
sprintf (buf, "DCC [%d]: %d", id, count++);
|
||||||
irc_dcc_msg (session, id, buf);
|
irc_dcc_msg (session, id, buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,7 +272,7 @@ void Thread::queueAutoCleanThread() {
|
||||||
if(Thread::getEnableVerboseMode()) printf("In Thread::shutdownThreads Line: %d\n",__LINE__);
|
if(Thread::getEnableVerboseMode()) printf("In Thread::shutdownThreads Line: %d\n",__LINE__);
|
||||||
|
|
||||||
BaseThread *base_thread = dynamic_cast<BaseThread *>(this);
|
BaseThread *base_thread = dynamic_cast<BaseThread *>(this);
|
||||||
ThreadGarbageCollector *garbage_collector = dynamic_cast<ThreadGarbageCollector *>(this);
|
//ThreadGarbageCollector *garbage_collector = dynamic_cast<ThreadGarbageCollector *>(this);
|
||||||
if(Thread::getEnableVerboseMode()) printf("In Thread::shutdownThreads Line: %d thread = %p base_thread = %p [%s]\n",__LINE__,this,base_thread,(base_thread != NULL ? base_thread->getUniqueID().c_str() : "n/a"));
|
if(Thread::getEnableVerboseMode()) printf("In Thread::shutdownThreads Line: %d thread = %p base_thread = %p [%s]\n",__LINE__,this,base_thread,(base_thread != NULL ? base_thread->getUniqueID().c_str() : "n/a"));
|
||||||
|
|
||||||
MutexSafeWrapper safeMutex(cleanupThreadMutex.get());
|
MutexSafeWrapper safeMutex(cleanupThreadMutex.get());
|
||||||
|
|
|
@ -179,7 +179,6 @@ void Properties::load(const string &path, bool clearCurrentProperties) {
|
||||||
|
|
||||||
string getUserHomeFromGLIBC() {
|
string getUserHomeFromGLIBC() {
|
||||||
string home_folder = "";
|
string home_folder = "";
|
||||||
char dateiname[512];
|
|
||||||
const char *homedir = getenv("HOME");
|
const char *homedir = getenv("HOME");
|
||||||
if (!homedir) {
|
if (!homedir) {
|
||||||
#if _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
|
#if _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
|
||||||
|
|
|
@ -833,31 +833,17 @@ bool checkVersionComptability(string clientVersionString, string serverVersionSt
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) {
|
if(SystemFlags::VERBOSE_MODE_ENABLED) {
|
||||||
// debug version strings
|
// debug version strings
|
||||||
for(unsigned int i = 0; i < tokensServer.size(); ++i) {
|
for(unsigned int i = 0; i < tokensServer.size(); ++i) {
|
||||||
printf("Server version index = %d str [%s] IsNumeric = %d\n",i,tokensServer[i].c_str(),IsNumeric(tokensServer[i].c_str(),false));
|
printf("Server version index = %u str [%s] IsNumeric = %d\n",i,tokensServer[i].c_str(),IsNumeric(tokensServer[i].c_str(),false));
|
||||||
}
|
}
|
||||||
for(unsigned int i = 0; i < tokens.size(); ++i) {
|
for(unsigned int i = 0; i < tokens.size(); ++i) {
|
||||||
printf("Client version index = %d str [%s] IsNumeric = %d\n",i,tokens[i].c_str(),IsNumeric(tokens[i].c_str(),false));
|
printf("Client version index = %u str [%s] IsNumeric = %d\n",i,tokens[i].c_str(),IsNumeric(tokens[i].c_str(),false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// **NOTE:
|
// **NOTE:
|
||||||
// after of 3.7.0 we go to 2 digi version compatibility, check if both
|
// after of 3.7.0 we go to 2 digi version compatibility, check if both
|
||||||
// client and server are at least 3.7
|
// client and server are at least 3.7
|
||||||
bool compatiblePost3_7_0_Check = false;
|
|
||||||
bool compatiblePre3_7_0_1_Check = true;
|
bool compatiblePre3_7_0_1_Check = true;
|
||||||
|
|
||||||
// if(tokens.size() >= 3 && tokensServer.size() >= 3 &&
|
|
||||||
// tokensServer[0] != "" && IsNumeric(tokensServer[0].c_str(),false) && strToInt(tokensServer[0]) == 3 &&
|
|
||||||
// tokensServer[1] != "" && IsNumeric(tokensServer[1].c_str(),false) && strToInt(tokensServer[1]) == 7 &&
|
|
||||||
// (tokensServer[2][0] == '0' || tokensServer[2][0] == '1') &&
|
|
||||||
// tokens[0] != "" && IsNumeric(tokens[0].c_str(),false) && strToInt(tokens[0]) == 3 &&
|
|
||||||
// tokens[1] != "" && IsNumeric(tokens[1].c_str(),false) && strToInt(tokens[1]) == 7 &&
|
|
||||||
// (tokens[2][0] == '0' || tokens[2][0] == '1')) {
|
|
||||||
//
|
|
||||||
// compatiblePost3_7_0_Check = false;
|
|
||||||
// compatiblePre3_7_0_1_Check = false;
|
|
||||||
// compatible = true;
|
|
||||||
// }
|
|
||||||
// else if(tokens.size() >= 2 && tokensServer.size() >= 2) {
|
|
||||||
if(tokens.size() >= 2 && tokensServer.size() >= 2) {
|
if(tokens.size() >= 2 && tokensServer.size() >= 2) {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
@ -869,6 +855,7 @@ bool checkVersionComptability(string clientVersionString, string serverVersionSt
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
bool compatiblePost3_7_0_Check = false;
|
||||||
// Both are at least 3.7.0, now check if both are > 3.7.0
|
// Both are at least 3.7.0, now check if both are > 3.7.0
|
||||||
if(tokens.size() >= 3 && tokensServer.size() >= 3) {
|
if(tokens.size() >= 3 && tokensServer.size() >= 3) {
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||||
|
|
Loading…
Reference in New Issue