- fixed masterserver invalid connection issue and blank error message in custom game menu

- added optional bmp icon load for linux
This commit is contained in:
Mark Vejvoda
2010-06-26 08:04:11 +00:00
parent 0d5cfdda03
commit 7b3ba31fe7
5 changed files with 114 additions and 41 deletions

View File

@@ -23,6 +23,7 @@
#include "util.h"
#include "window.h"
#include <vector>
//#include <SDL_image.h>
#include "leak_dumper.h"
using namespace Shared::Graphics::Gl;
@@ -54,6 +55,31 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits) {
int resW = PlatformCommon::Private::ScreenWidth;
int resH = PlatformCommon::Private::ScreenHeight;
#ifndef WIN32
if(fileExists("megaglest.bmp")) {
SDL_Surface *icon = SDL_LoadBMP("megaglest.bmp");
//SDL_Surface *icon = IMG_Load("megaglest.ico");
//#if !defined(MACOSX)
// Set Icon (must be done before any sdl_setvideomode call)
// But don't set it on OS X, as we use a nicer external icon there.
//#if WORDS_BIGENDIAN
// SDL_Surface* icon= SDL_CreateRGBSurfaceFrom((void*)logo,32,32,8,128,0xff000000,0x00ff0000,0x0000ff00,0);
//#else
// SDL_Surface* icon= SDL_CreateRGBSurfaceFrom((void*)logo,32,32,32,128,0x000000ff,0x0000ff00,0x00ff0000,0xff000000);
//#endif
printf("In [%s::%s Line: %d] icon = %p\n",__FILE__,__FUNCTION__,__LINE__,icon);
if(icon == NULL) {
printf("Error: %s\n", SDL_GetError());
}
if(icon != NULL) {
SDL_WM_SetIcon(icon, NULL);
}
}
#endif
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] about to set resolution: %d x %d, colorBits = %d.\n",__FILE__,__FUNCTION__,__LINE__,resW,resH,colorBits);
SDL_Surface* screen = SDL_SetVideoMode(resW, resH, colorBits, flags);

View File

@@ -108,19 +108,26 @@ std::string SystemFlags::getHTTP(std::string URL,CURL *handle) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] handle = %p\n",__FILE__,__FUNCTION__,__LINE__,handle);
//curl_easy_setopt(handle, CURLOPT_VERBOSE, 1);
if(getSystemSettingType(SystemFlags::debugNetwork).enabled == true) {
curl_easy_setopt(handle, CURLOPT_VERBOSE, 1);
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
char errbuf[CURL_ERROR_SIZE]="";
curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, errbuf);
/* get contents from the URL */
curl_easy_perform(handle);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
CURLcode result = curl_easy_perform(handle);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] return code [%d] [%s]\n",__FILE__,__FUNCTION__,__LINE__,result,errbuf);
std::string serverResponse = (chunk.memory != NULL ? chunk.memory : "");
if(chunk.memory) {
free(chunk.memory);
}
if(result != CURLE_OK) {
serverResponse = errbuf;
}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d] serverResponse [%s]\n",__FILE__,__FUNCTION__,__LINE__,serverResponse.c_str());