Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 261699 Details for
Bug 340343
games-strategy/megaglest: new package
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for megaglest-3.4.0
megaglest-3.4.0-gentoo.patch (text/plain), 5.61 KB, created by
yury fedorchenko
on 2011-02-07 08:19:31 UTC
(
hide
)
Description:
patch for megaglest-3.4.0
Filename:
MIME Type:
Creator:
yury fedorchenko
Created:
2011-02-07 08:19:31 UTC
Size:
5.61 KB
patch
obsolete
>diff -urN megaglest-source-3.4.0.old/source/glest_game/ai/ai_interface.h megaglest-source-3.4.0/source/glest_game/ai/ai_interface.h >--- megaglest-source-3.4.0.old/source/glest_game/ai/ai_interface.h 2011-02-04 18:30:23.000000000 +0300 >+++ megaglest-source-3.4.0/source/glest_game/ai/ai_interface.h 2011-02-04 18:33:08.000000000 +0300 >@@ -95,7 +95,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+="/.megaglest/ai"+intToStr(factionIndex)+".log"; >+ return logfn; >+ } > bool executeCommandOverNetwork(); > }; > >diff -urN megaglest-source-3.4.0.old/source/glest_game/main/main.cpp megaglest-source-3.4.0/source/glest_game/main/main.cpp >--- megaglest-source-3.4.0.old/source/glest_game/main/main.cpp 2011-02-04 18:30:23.000000000 +0300 >+++ megaglest-source-3.4.0/source/glest_game/main/main.cpp 2011-02-04 18:33:08.000000000 +0300 >@@ -1408,6 +1408,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/.megaglest", getenv("HOME")); >+ mkdir(path, 0750); >+ >+ snprintf(path, PATH_MAX, "%s/.megaglest/screens", getenv("HOME")); >+ mkdir(path, 0750); >+ >+ chdir("@GENTOO_DATADIR@"); > #ifdef SL_LEAK_DUMP > AllocRegistry memoryLeaks = AllocRegistry::getInstance(); > #endif >diff -urN megaglest-source-3.4.0.old/source/glest_game/main/program.cpp megaglest-source-3.4.0/source/glest_game/main/program.cpp >--- megaglest-source-3.4.0.old/source/glest_game/main/program.cpp 2011-02-04 18:30:23.000000000 +0300 >+++ megaglest-source-3.4.0/source/glest_game/main/program.cpp 2011-02-04 18:33:08.000000000 +0300 >@@ -488,7 +488,9 @@ > > //log start > Logger &logger= Logger::getInstance(); >- string logFile = "glest.log"; >+ string a=getenv("HOME"); >+ string b= "/.megaglest/glest.log"; >+ string logFile = a+b; > if(getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) != "") { > logFile = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) + logFile; > } >diff -urN megaglest-source-3.4.0.old/source/shared_lib/sources/util/leak_dumper.cpp megaglest-source-3.4.0/source/shared_lib/sources/util/leak_dumper.cpp >--- megaglest-source-3.4.0.old/source/shared_lib/sources/util/leak_dumper.cpp 2011-02-04 18:30:23.000000000 +0300 >+++ megaglest-source-3.4.0/source/shared_lib/sources/util/leak_dumper.cpp 2011-02-04 18:33:08.000000000 +0300 >@@ -43,7 +43,9 @@ > > AllocRegistry::~AllocRegistry(){ > >- dump("leak_dump.log"); >+ char path[PATH_MAX]; >+ snprintf(path, PATH_MAX, "%s/.megaglest/leak_dump.log", getenv("HOME")); >+ dump(path); > } > > void AllocRegistry::allocate(AllocInfo info){ >diff -urN megaglest-source-3.4.0.old/source/shared_lib/sources/util/profiler.cpp megaglest-source-3.4.0/source/shared_lib/sources/util/profiler.cpp >--- megaglest-source-3.4.0.old/source/shared_lib/sources/util/profiler.cpp 2011-02-04 18:30:23.000000000 +0300 >+++ megaglest-source-3.4.0/source/shared_lib/sources/util/profiler.cpp 2011-02-04 18:33:08.000000000 +0300 >@@ -76,9 +76,11 @@ > if(getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) != "") { > profileLog = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) + profileLog; > } >- FILE *f= fopen(profileLog.c_str(), "w"); >+ char path[PATH_MAX]; >+ snprintf(path, PATH_MAX, "%s/.magaglest/profiler.log", getenv("HOME")); >+ FILE *f= fopen(path, "w"); > if(f==NULL) >- throw runtime_error("Can not open file: " + profileLog); >+ throw runtime_error("Can not open file: %s",path); > > fprintf(f, "Profiler Results\n\n"); > >diff -urN megaglest-source-3.4.0.old/source/shared_lib/sources/util/properties.cpp megaglest-source-3.4.0/source/shared_lib/sources/util/properties.cpp >--- megaglest-source-3.4.0.old/source/shared_lib/sources/util/properties.cpp 2011-02-04 18:30:23.000000000 +0300 >+++ megaglest-source-3.4.0/source/shared_lib/sources/util/properties.cpp 2011-02-04 18:33:08.000000000 +0300 >@@ -14,7 +14,8 @@ > #include <fstream> > #include <stdexcept> > #include <cstring> >- >+#include <limits.h> >+#include <stdlib.h> > #include "conversion.h" > #include "util.h" > #include "leak_dumper.h" >@@ -38,10 +39,15 @@ > > //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str()); > >- fileStream.open(path.c_str(), ios_base::in); >+ char str[PATH_MAX]; >+ snprintf(str, PATH_MAX, "%s/.megaglest/%s", getenv("HOME"), path.c_str()); >+ fileStream.open(str, ios_base::in); > if(fileStream.fail()){ >- SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str()); >- throw runtime_error("Can't open propertyMap file: " + path); >+ fileStream.open(path.c_str(), ios_base::in); // use defaults >+ if(fileStream.fail()){ >+ SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str()); >+ throw runtime_error("Can't open propertyMap file: " + path + " cwd: "+ getenv("PWD")); >+ } > } > > //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str()); >@@ -78,7 +84,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/.megaglest/%s", getenv("HOME"), path.c_str()); >+ fileStream.open(str, ios_base::out | ios_base::trunc); > > fileStream << "; === propertyMap File === \n"; > fileStream << '\n';
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 340343
:
255751
|
255753
|
261697
| 261699 |
271041
|
271043
|
286595
|
286597
|
286599
|
286727
|
286729
|
286731
|
295125
|
295127
|
295825
|
295827
|
297221
|
301947
|
301949
|
301951
|
301953
|
301955