aboutsummaryrefslogtreecommitdiff
path: root/games/glest/patches
diff options
context:
space:
mode:
authorLarry Hajali <larryhaja[at]gmail[dot]com>2010-05-13 00:26:25 +0200
committerRobby Workman <rworkman@slackbuilds.org>2010-05-13 00:26:25 +0200
commit971596f5c35c82f9698c2866c16c7684cd6184eb (patch)
treeeffb137a45c936565d94553fe2e6fc10288d9cce /games/glest/patches
parenta2b88d12b1bf7a747702a52f0500cbbdccf9e521 (diff)
games/glest: Updated for version 3.2.2
Diffstat (limited to 'games/glest/patches')
-rw-r--r--games/glest/patches/g3d_viewer.patch277
-rw-r--r--games/glest/patches/glest-3.2.2-glibc210.patch10
-rw-r--r--games/glest/patches/glest-home-directory.patch143
-rw-r--r--games/glest/patches/glest-xerces-c.patch41
4 files changed, 471 insertions, 0 deletions
diff --git a/games/glest/patches/g3d_viewer.patch b/games/glest/patches/g3d_viewer.patch
new file mode 100644
index 0000000000000..279f602be90e7
--- /dev/null
+++ b/games/glest/patches/g3d_viewer.patch
@@ -0,0 +1,277 @@
+Index: source/g3d_viewer/main.cpp
+===================================================================
+--- source/g3d_viewer/main.cpp (Revision 191)
++++ source/g3d_viewer/main.cpp (Arbeitskopie)
+@@ -2,7 +2,6 @@
+
+ #include <stdexcept>
+
+-#include "graphics_factory_basic_gl.h"
+ #include "graphics_interface.h"
+ #include "util.h"
+
+@@ -11,8 +10,15 @@
+ using namespace Shared::Graphics::Gl;
+ using namespace Shared::Util;
+
+-using namespace std;
++using std::exception;
+
++#if (wxUSE_UNICODE == 1)
++#define STRCONV(x) wxConvUTF8.cMB2WC(x)
++#else
++#define STRCONV(x) x
++#endif
++
++
+ namespace Shared{ namespace G3dViewer{
+
+ // ===============================================
+@@ -24,7 +30,7 @@
+
+ MainWindow::MainWindow(const string &modelPath):
+ wxFrame(
+- NULL, -1, winHeader.c_str(),
++ NULL, -1, STRCONV(winHeader.c_str()),
+ wxPoint(Renderer::windowX, Renderer::windowY),
+ wxSize(Renderer::windowW, Renderer::windowH))
+ {
+@@ -37,38 +43,33 @@
+
+ glCanvas = new GlCanvas(this);
+
+- glCanvas->SetCurrent();
+-
+- renderer->init();
+-
+-
+ menu= new wxMenuBar();
+
+ //menu
+ menuFile= new wxMenu();
+- menuFile->Append(miFileLoad, "Load");
+- menu->Append(menuFile, "File");
++ menuFile->Append(miFileLoad, wxT("Load"));
++ menu->Append(menuFile, wxT("File"));
+
+ //mode
+ menuMode= new wxMenu();
+- menuMode->AppendCheckItem(miModeNormals, "Normals");
+- menuMode->AppendCheckItem(miModeWireframe, "Wireframe");
+- menuMode->AppendCheckItem(miModeGrid, "Grid");
+- menu->Append(menuMode, "Mode");
++ menuMode->AppendCheckItem(miModeNormals, wxT("Normals"));
++ menuMode->AppendCheckItem(miModeWireframe, wxT("Wireframe"));
++ menuMode->AppendCheckItem(miModeGrid, wxT("Grid"));
++ menu->Append(menuMode, wxT("Mode"));
+
+ //mode
+ menuSpeed= new wxMenu();
+- menuSpeed->Append(miSpeedSlower, "Slower");
+- menuSpeed->Append(miSpeedFaster, "Faster");
+- menu->Append(menuSpeed, "Speed");
++ menuSpeed->Append(miSpeedSlower, wxT("Slower"));
++ menuSpeed->Append(miSpeedFaster, wxT("Faster"));
++ menu->Append(menuSpeed, wxT("Speed"));
+
+ //custom color
+ menuCustomColor= new wxMenu();
+- menuCustomColor->AppendCheckItem(miColorRed, "Red");
+- menuCustomColor->AppendCheckItem(miColorBlue, "Blue");
+- menuCustomColor->AppendCheckItem(miColorYellow, "Yellow");
+- menuCustomColor->AppendCheckItem(miColorGreen, "Green");
+- menu->Append(menuCustomColor, "Custom Color");
++ menuCustomColor->AppendCheckItem(miColorRed, wxT("Red"));
++ menuCustomColor->AppendCheckItem(miColorBlue, wxT("Blue"));
++ menuCustomColor->AppendCheckItem(miColorYellow, wxT("Yellow"));
++ menuCustomColor->AppendCheckItem(miColorGreen, wxT("Green"));
++ menu->Append(menuCustomColor, wxT("Custom Color"));
+
+ menuMode->Check(miModeGrid, true);
+ menuCustomColor->Check(miColorRed, true);
+@@ -88,13 +89,6 @@
+
+ timer = new wxTimer(this);
+ timer->Start(40);
+-
+- if(!modelPath.empty()){
+- Model *tmpModel= new ModelGl();
+- renderer->loadTheModel(tmpModel, modelPath);
+- model= tmpModel;
+- GetStatusBar()->SetStatusText(getModelInfo().c_str());
+- }
+ }
+
+ MainWindow::~MainWindow(){
+@@ -104,6 +98,17 @@
+ delete glCanvas;
+ }
+
++void MainWindow::init(){
++ glCanvas->SetCurrent();
++ renderer->init();
++ if(!modelPath.empty()){
++ Model *tmpModel= new ModelGl();
++ renderer->loadTheModel(tmpModel, modelPath);
++ model= tmpModel;
++ GetStatusBar()->SetStatusText(STRCONV(getModelInfo().c_str()));
++ }
++}
++
+ void MainWindow::onPaint(wxPaintEvent &event){
+ renderer->reset(GetClientSize().x, GetClientSize().y, playerColor);
+ renderer->transform(rotX, rotY, zoom);
+@@ -141,13 +146,14 @@
+ void MainWindow::onMenuFileLoad(wxCommandEvent &event){
+ string fileName;
+ wxFileDialog fileDialog(this);
+- fileDialog.SetWildcard("G3D files (*.g3d)|*.g3d");
++ fileDialog.SetWildcard(wxT("G3D files (*.g3d)|*.g3d"));
+ if(fileDialog.ShowModal()==wxID_OK){
+ delete model;
+ Model *tmpModel= new ModelGl();
+- renderer->loadTheModel(tmpModel, fileDialog.GetPath().c_str());
++ fileName = wxFNCONV(fileDialog.GetPath());
++ renderer->loadTheModel(tmpModel, fileName);
+ model= tmpModel;
+- GetStatusBar()->SetStatusText(getModelInfo().c_str());
++ GetStatusBar()->SetStatusText(wxString(getModelInfo().c_str(), wxConvUTF8));
+ }
+ }
+
+@@ -252,7 +258,7 @@
+ // =====================================================
+
+ GlCanvas::GlCanvas(MainWindow * mainWindow):
+- wxGLCanvas(mainWindow, -1)
++ wxGLCanvas(mainWindow, -1, wxDefaultPosition)
+ {
+ this->mainWindow = mainWindow;
+ }
+@@ -261,13 +267,8 @@
+ mainWindow->onMouseMove(event);
+ }
+
+-void GlCanvas::onPaint(wxPaintEvent &event){
+- mainWindow->onPaint(event);
+-}
+-
+ BEGIN_EVENT_TABLE(GlCanvas, wxGLCanvas)
+ EVT_MOTION(GlCanvas::onMouseMove)
+- EVT_PAINT(GlCanvas::onPaint)
+ END_EVENT_TABLE()
+
+ // ===============================================
+@@ -277,11 +278,12 @@
+ bool App::OnInit(){
+ string modelPath;
+ if(argc==2){
+- modelPath= argv[1];
++ modelPath = wxFNCONV(argv[1]);
+ }
+
+ mainWindow= new MainWindow(modelPath);
+ mainWindow->Show();
++ mainWindow->init();
+ return true;
+ }
+
+@@ -290,9 +292,9 @@
+ return wxApp::MainLoop();
+ }
+ catch(const exception &e){
+- wxMessageDialog(NULL, e.what(), "Exception", wxOK | wxICON_ERROR).ShowModal();
+- return 0;
++ wxMessageDialog(NULL, STRCONV(e.what()), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal();
+ }
++ return 0;
+ }
+
+ int App::OnExit(){
+Index: source/g3d_viewer/main.h
+===================================================================
+--- source/g3d_viewer/main.h (Revision 191)
++++ source/g3d_viewer/main.h (Arbeitskopie)
+@@ -7,12 +7,13 @@
+ #include <wx/timer.h>
+ #include <wx/glcanvas.h>
+
++#include "graphics_factory_basic_gl.h"
+ #include "renderer.h"
+ #include "util.h"
+ #include "window.h"
+
+-using Shared::Platform::Window;
+-using Shared::Platform::MouseState;
++//using Shared::Platform::Window;
++//using Shared::Platform::MouseState;
+
+ using std::string;
+
+@@ -70,6 +71,8 @@
+ MainWindow(const string &modelPath);
+ ~MainWindow();
+
++ void init();
++
+ void Notify();
+
+ void onPaint(wxPaintEvent &event);
+Index: mk/linux/Jamfile
+===================================================================
+--- mk/linux/Jamfile (Revision 191)
++++ mk/linux/Jamfile (Arbeitskopie)
+@@ -26,7 +26,7 @@
+ }
+
+ Library glestlib : $(LIB_SOURCES) ;
+-ExternalLibs glestlib : SDL GL GLU XERCES VORBIS VORBISFILE OGG OPENAL LUA ;
++ExternalLibs glestlib : SDL GL GLU XERCES VORBISFILE OPENAL LUA ;
+ IncludeDir glestlib : $(LIB_INCLUDE_DIRS) ;
+
+ #### Game ####
+@@ -55,7 +55,7 @@
+
+ Application glest : $(GLEST_SOURCES) ;
+ LinkWith glest : glestlib ;
+-ExternalLibs glest : SDL GL GLU XERCES VORBIS VORBISFILE OGG OPENAL LUA ;
++ExternalLibs glest : SDL GL GLU XERCES VORBISFILE OPENAL LUA ;
+ IncludeDir glest : ../shared_lib/include/$(LIB_INCLUDE_DIRS) $(GLEST_DIRS) ;
+
+ #### Editor ####
+@@ -69,7 +69,22 @@
+
+ Application glest_editor : $(GLEST_MAP_SOURCES) ;
+ LinkWith glest_editor : glestlib ;
+- ExternalLibs glest_editor : SDL GL GLU XERCES VORBIS VORBISFILE OGG OPENAL WX ;
++ ExternalLibs glest_editor : SDL GL GLU XERCES VORBISFILE OPENAL WX ;
+ IncludeDir glest_editor : ../shared_lib/include/$(LIB_INCLUDE_DIRS) $(GLEST_MAP_DIRS) ;
+ }
+
++### Viewer ###
++if $(WX_AVAILABLE) = "yes" {
++ SubDir TOP g3d_viewer ;
++
++ GLEST_VIEWER_DIRS = . ;
++ for i in $(GLEST_DIRS) {
++ GLEST_VIEWER_SOURCES += [ Wildcard $(i) : *.cpp *.h ] ;
++ }
++
++ Application glest_g3dviewer : $(GLEST_VIEWER_SOURCES) ;
++ LinkWith glest_g3dviewer : glestlib ;
++ ExternalLibs glest_g3dviewer : SDL GL GLU XERCES VORBISFILE OPENAL WX ;
++ IncludeDir glest_g3dviewer : ../shared_lib/include/$(LIB_INCLUDE_DIRS) $(GLEST_VIEWER_DIRS) ;
++}
++
+Index: mk/linux/autogen.sh
+===================================================================
+--- mk/linux/autogen.sh (Revision 191)
++++ mk/linux/autogen.sh (Arbeitskopie)
+@@ -34,4 +34,6 @@
+ if [ ! -d glest_map_editor ]; then
+ ln -sf ../../source/glest_map_editor .
+ fi
+-
++if [ ! -d g3d_viewer ]; then
++ ln -sf ../../source/g3d_viewer .
++fi
diff --git a/games/glest/patches/glest-3.2.2-glibc210.patch b/games/glest/patches/glest-3.2.2-glibc210.patch
new file mode 100644
index 0000000000000..31e3ff183b15c
--- /dev/null
+++ b/games/glest/patches/glest-3.2.2-glibc210.patch
@@ -0,0 +1,10 @@
+--- source/shared_lib/sources/platform/posix/socket.cpp
++++ source/shared_lib/sources/platform/posix/socket.cpp
+@@ -10,6 +10,7 @@
+
+ #include <cstring>
+ #include <cstdlib>
++#include <cstdio>
+ #include <stdexcept>
+ #include <sstream>
+ #if defined(HAVE_SYS_IOCTL_H)
diff --git a/games/glest/patches/glest-home-directory.patch b/games/glest/patches/glest-home-directory.patch
new file mode 100644
index 0000000000000..a92002ab6080d
--- /dev/null
+++ b/games/glest/patches/glest-home-directory.patch
@@ -0,0 +1,143 @@
+--- source/glest_game/ai/ai_interface.h 2009-04-15 11:17:19.000000000 +0400
++++ source/glest_game/ai/ai_interface.h 2009-04-15 12:25:04.000000000 +0400
+@@ -84,7 +84,11 @@
+ bool isFreeCells(const Vec2i &pos, int size, Field field);
+
+ private:
+- string getLogFilename() const {return "ai"+intToStr(factionIndex)+".log";}
++ string getLogFilename() const {
++ string logfn=getenv("HOME");
++ logfn+="/.glest/ai"+intToStr(factionIndex)+".log";
++ return logfn;
++ }
+ };
+
+ }}//end namespace
+--- source/glest_game/ai/ai_rule.cpp 2009-04-15 11:17:19.000000000 +0400
++++ source/glest_game/ai/ai_rule.cpp 2009-04-15 11:19:02.000000000 +0400
+@@ -17,6 +17,8 @@
+ #include "unit.h"
+ #include "leak_dumper.h"
+
++#include <limits.h>
++
+ using Shared::Graphics::Vec2i;
+
+ namespace Glest{ namespace Game{
+--- source/glest_game/game/game.cpp 2009-04-15 11:17:19.000000000 +0400
++++ source/glest_game/game/game.cpp 2009-04-15 12:21:29.000000000 +0400
+@@ -443,7 +443,8 @@
+ }
+ else if(key=='E'){
+ for(int i=0; i<100; ++i){
+- string path= "screens/screen" + intToStr(i) + ".tga";
++ string path=getenv("HOME");
++ path+="/.glest/screens/screen" + intToStr(i) + ".tga";
+
+ FILE *f= fopen(path.c_str(), "rb");
+ if(f==NULL){
+--- source/glest_game/main/main.cpp 2009-04-15 11:17:19.000000000 +0400
++++ source/glest_game/main/main.cpp 2009-04-15 12:32:04.000000000 +0400
+@@ -114,6 +114,17 @@
+ // =====================================================
+
+ int glestMain(int argc, char** argv){
++ if (!getenv("HOME"))
++ throw runtime_error("HOME external variable is not set");
++
++ char path[PATH_MAX];
++ snprintf(path, PATH_MAX, "%s/.glest", getenv("HOME"));
++ mkdir(path, 0750);
++
++ snprintf(path, PATH_MAX, "%s/.glest/screens", getenv("HOME"));
++ mkdir(path, 0750);
++
++ chdir("/usr/share/glest");
+
+ MainWindow *mainWindow= NULL;
+ Program *program= NULL;
+--- source/glest_game/main/program.cpp 2009-04-15 11:17:19.000000000 +0400
++++ source/glest_game/main/program.cpp 2009-04-15 12:11:51.000000000 +0400
+@@ -196,9 +196,11 @@
+ updateTimer.init(GameConstants::updateFps, maxTimes);
+ updateCameraTimer.init(GameConstants::cameraFps, maxTimes);
+
+- //log start
+- Logger &logger= Logger::getInstance();
+- logger.setFile("glest.log");
++ //log start
++ char path[PATH_MAX];
++ snprintf(path, PATH_MAX, "%s/.glest/glest.log", getenv("HOME"));
++ Logger &logger= Logger::getInstance();
++ logger.setFile(path);
+ logger.clear();
+
+ //lang
+--- source/shared_lib/sources/util/leak_dumper.cpp 2009-04-15 11:17:19.000000000 +0400
++++ source/shared_lib/sources/util/leak_dumper.cpp 2009-04-15 12:04:49.000000000 +0400
+@@ -52,7 +52,9 @@
+ }
+
+ AllocRegistry::~AllocRegistry(){
+- dump("leak_dump.log");
++ char path[PATH_MAX];
++ snprintf(path, PATH_MAX, "%s/.glest/leak_dump.log", getenv("HOME"));
++ dump(path);
+ }
+
+ void AllocRegistry::allocate(AllocInfo info){
+--- source/shared_lib/sources/util/profiler.cpp 2009-04-15 11:17:19.000000000 +0400
++++ source/shared_lib/sources/util/profiler.cpp 2009-04-15 12:01:52.000000000 +0400
+@@ -71,9 +71,11 @@
+ Profiler::~Profiler(){
+ rootSection->stop();
+
+- FILE *f= fopen("profiler.log", "w");
++ char path[PATH_MAX];
++ snprintf(path, PATH_MAX, "%s/.glest/profiler.log", getenv("HOME"));
++ FILE *f= fopen(path, "w");
+ if(f==NULL)
+- throw runtime_error("Can not open file: profiler.log");
++ throw runtime_error("Can not open file: %s",path);
+
+ fprintf(f, "Profiler Results\n\n");
+
+--- source/shared_lib/sources/util/properties.cpp 2009-04-15 11:17:19.000000000 +0400
++++ source/shared_lib/sources/util/properties.cpp 2009-04-15 13:09:33.000000000 +0400
+@@ -15,6 +15,9 @@
+ #include <stdexcept>
+ #include <cstring>
+
++#include <limits.h>
++#include <stdlib.h>
++
+ #include "conversion.h"
+ #include "leak_dumper.h"
+
+@@ -34,9 +37,13 @@
+
+ this->path= path;
+
+- fileStream.open(path.c_str(), ios_base::in);
++ char str[PATH_MAX];
++ snprintf(str, PATH_MAX, "%s/.glest/%s", getenv("HOME"), path.c_str());
++ fileStream.open(str, ios_base::in);
+ if(fileStream.fail()){
+- throw runtime_error("Can't open propertyMap file: " + path);
++ fileStream.open(path.c_str(), ios_base::in); // use defaults
++ if(fileStream.fail())
++ throw runtime_error("Can't open propertyMap file: " + path + " cwd: "+ getenv("PWD"));
+ }
+
+ propertyMap.clear();
+@@ -71,7 +78,9 @@
+ void Properties::save(const string &path){
+ ofstream fileStream;
+
+- fileStream.open(path.c_str(), ios_base::out | ios_base::trunc);
++ char str[PATH_MAX];
++ snprintf(str, PATH_MAX, "%s/.glest/%s", getenv("HOME"), path.c_str());
++ fileStream.open(str, ios_base::out | ios_base::trunc);
+
+ fileStream << "; === propertyMap File === \n";
+ fileStream << '\n';
diff --git a/games/glest/patches/glest-xerces-c.patch b/games/glest/patches/glest-xerces-c.patch
new file mode 100644
index 0000000000000..f7582060b3ee2
--- /dev/null
+++ b/games/glest/patches/glest-xerces-c.patch
@@ -0,0 +1,41 @@
+--- source/shared_lib/sources/xml/xml_parser.cpp.old 2008-02-16 16:01:28.000000000 +0300
++++ source/shared_lib/sources/xml/xml_parser.cpp 2009-03-19 18:28:08.000000000 +0300
+@@ -87,10 +87,17 @@
+
+ try{
+ ErrorHandler errorHandler;
++#if XERCES_VERSION_MAJOR < 3
+ DOMBuilder *parser= (static_cast<DOMImplementationLS*>(implementation))->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
+ parser->setErrorHandler(&errorHandler);
+ parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
+ parser->setFeature(XMLUni::fgDOMValidation, true);
++#else
++ DOMLSParser *parser = (static_cast<DOMImplementationLS*>(implementation))->createLSParser(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
++ DOMConfiguration *config = parser->getDomConfig();
++ config->setParameter(XMLUni::fgXercesSchemaFullChecking, true);
++ config->setParameter(XMLUni::fgDOMValidate, true);
++#endif
+ DOMDocument *document= parser->parseURI(path.c_str());
+
+ if(document==NULL){
+@@ -119,9 +126,20 @@
+ }
+
+ LocalFileFormatTarget file(path.c_str());
++#if XERCES_VERSION_MAJOR < 3
+ DOMWriter* writer = implementation->createDOMWriter();
+ writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
+ writer->writeNode(&file, *document);
++#else
++ DOMLSSerializer *serializer = implementation->createLSSerializer();
++ DOMLSOutput* output=implementation->createLSOutput();
++ DOMConfiguration* config=serializer->getDomConfig();
++ config->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,true);
++ output->setByteStream(&file);
++ serializer->write(document,output);
++ output->release();
++ serializer->release();
++#endif
+ document->release();
+ }
+ catch(const DOMException &e){