- attmpt to auto-create the screens folder at startup to avoid crashes when folder is missing and users try to take a screenshot.
This commit is contained in:
parent
c9393024ce
commit
4e8fdc105c
|
@ -937,19 +937,22 @@ void Game::keyDown(char key){
|
||||||
showFullConsole= true;
|
showFullConsole= true;
|
||||||
}
|
}
|
||||||
else if(key == configKeys.getCharKey("Screenshot")) {
|
else if(key == configKeys.getCharKey("Screenshot")) {
|
||||||
|
string path = GameConstants::folder_path_screenshots;
|
||||||
|
if(isdir(path.c_str()) == true) {
|
||||||
for(int i=0; i<100; ++i){
|
for(int i=0; i<100; ++i){
|
||||||
string path= "screens/screen" + intToStr(i) + ".tga";
|
path = GameConstants::folder_path_screenshots;
|
||||||
|
path += "screen" + intToStr(i) + ".tga";
|
||||||
FILE *f= fopen(path.c_str(), "rb");
|
FILE *f= fopen(path.c_str(), "rb");
|
||||||
if(f==NULL){
|
if(f==NULL) {
|
||||||
Renderer::getInstance().saveScreen(path);
|
Renderer::getInstance().saveScreen(path);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//move camera left
|
//move camera left
|
||||||
else if(key == configKeys.getCharKey("CameraModeLeft")) {
|
else if(key == configKeys.getCharKey("CameraModeLeft")) {
|
||||||
gameCamera.setMoveX(-1);
|
gameCamera.setMoveX(-1);
|
||||||
|
|
|
@ -64,6 +64,8 @@ public:
|
||||||
static const char *folder_path_tutorials;
|
static const char *folder_path_tutorials;
|
||||||
|
|
||||||
static const char *NETWORK_SLOT_UNCONNECTED_SLOTNAME;
|
static const char *NETWORK_SLOT_UNCONNECTED_SLOTNAME;
|
||||||
|
|
||||||
|
static const char *folder_path_screenshots;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PathType {
|
enum PathType {
|
||||||
|
|
|
@ -38,6 +38,8 @@ const char *GameConstants::folder_path_tutorials = "tutorials";
|
||||||
|
|
||||||
const char *GameConstants::NETWORK_SLOT_UNCONNECTED_SLOTNAME = "???";
|
const char *GameConstants::NETWORK_SLOT_UNCONNECTED_SLOTNAME = "???";
|
||||||
|
|
||||||
|
const char *GameConstants::folder_path_screenshots = "screens/";
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
// class Config
|
// class Config
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
|
@ -663,6 +663,11 @@ int glestMain(int argc, char** argv){
|
||||||
|
|
||||||
gameInitialized = true;
|
gameInitialized = true;
|
||||||
|
|
||||||
|
string screenShotsPath = GameConstants::folder_path_screenshots;
|
||||||
|
if(isdir(screenShotsPath.c_str()) == false) {
|
||||||
|
createDirectoryPaths(screenShotsPath);
|
||||||
|
}
|
||||||
|
|
||||||
if(config.getBool("AllowGameDataSynchCheck","false") == true) {
|
if(config.getBool("AllowGameDataSynchCheck","false") == true) {
|
||||||
vector<string> techDataPaths = config.getPathListForType(ptTechs);
|
vector<string> techDataPaths = config.getPathListForType(ptTechs);
|
||||||
preCacheThread.reset(new FileCRCPreCacheThread());
|
preCacheThread.reset(new FileCRCPreCacheThread());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user