mirror of
https://github.com/glest/glest-source.git
synced 2025-08-15 12:54:01 +02:00
Bugfixes so that win32 code will compile with latest user data changes
This commit is contained in:
@@ -15,6 +15,9 @@
|
|||||||
|
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
#include "game_constants.h"
|
#include "game_constants.h"
|
||||||
|
#include "platform_util.h"
|
||||||
|
|
||||||
|
using namespace Shared::Platform;
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
|
@@ -146,7 +146,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(results.size() == 0) {
|
if(results.size() == 0) {
|
||||||
throw runtime_error("There is no factions for this tech tree");
|
throw runtime_error("(1)There are no factions for the tech tree [" + techTreeFiles[listBoxTechTree.getSelectedItemIndex()] + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i<GameConstants::maxPlayers; ++i){
|
for(int i=0; i<GameConstants::maxPlayers; ++i){
|
||||||
@@ -593,7 +593,7 @@ void MenuStateCustomGame::reloadFactions(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(results.size() == 0) {
|
if(results.size() == 0) {
|
||||||
throw runtime_error("There is no factions for this tech tree");
|
throw runtime_error("(2)There are no factions for the tech tree [" + techTreeFiles[listBoxTechTree.getSelectedItemIndex()] + "]");
|
||||||
}
|
}
|
||||||
factionFiles= results;
|
factionFiles= results;
|
||||||
for(int i= 0; i<results.size(); ++i){
|
for(int i= 0; i<results.size(); ++i){
|
||||||
|
@@ -218,19 +218,35 @@ void findAll(const string &path, vector<string> &results, bool cutExtension, boo
|
|||||||
cstr= new char[path.length()+1];
|
cstr= new char[path.length()+1];
|
||||||
strcpy(cstr, path.c_str());
|
strcpy(cstr, path.c_str());
|
||||||
|
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
|
||||||
|
|
||||||
if((handle=_findfirst(cstr,&fi))!=-1){
|
if((handle=_findfirst(cstr,&fi))!=-1){
|
||||||
do{
|
do{
|
||||||
if(!(strcmp(".", fi.name)==0 || strcmp("..", fi.name)==0)){
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] fi.name [%s]\n",__FILE__,__FUNCTION__,__LINE__,fi.name);
|
||||||
i++;
|
|
||||||
results.push_back(fi.name);
|
DWORD fileAttributes = GetFileAttributes(fi.name);
|
||||||
|
if( (fileAttributes != INVALID_FILE_ATTRIBUTES && ((fileAttributes & FILE_ATTRIBUTE_HIDDEN) == FILE_ATTRIBUTE_HIDDEN)) || (fi.attrib & _A_HIDDEN) == _A_HIDDEN) {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] file IS HIDDEN fi.name [%s]\n",__FILE__,__FUNCTION__,__LINE__,fi.name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!(strcmp(".", fi.name)==0 || strcmp("..", fi.name)==0 || strcmp(".svn", fi.name)==0)){
|
||||||
|
i++;
|
||||||
|
results.push_back(fi.name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SKIPPED SPECIAL FILENAME [%s]\n",__FILE__,__FUNCTION__,__LINE__,fi.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while(_findnext(handle, &fi)==0);
|
while(_findnext(handle, &fi)==0);
|
||||||
}
|
}
|
||||||
else if(errorOnNotFound == true){
|
else if(errorOnNotFound == true){
|
||||||
|
_findclose(handle);
|
||||||
throw runtime_error("Error opening files: "+ path);
|
throw runtime_error("Error opening files: "+ path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_findclose(handle);
|
||||||
if(i==0 && errorOnNotFound == true){
|
if(i==0 && errorOnNotFound == true){
|
||||||
throw runtime_error("No files found: "+ path);
|
throw runtime_error("No files found: "+ path);
|
||||||
}
|
}
|
||||||
@@ -247,7 +263,17 @@ void findAll(const string &path, vector<string> &results, bool cutExtension, boo
|
|||||||
bool isdir(const char *path)
|
bool isdir(const char *path)
|
||||||
{
|
{
|
||||||
struct stat stats;
|
struct stat stats;
|
||||||
bool ret = stat (path, &stats) == 0 && S_ISDIR (stats.st_mode);
|
bool ret = stat (path, &stats) == 0 && S_ISDIR(stats.st_mode);
|
||||||
|
|
||||||
|
if(ret == true) {
|
||||||
|
DWORD fileAttributes = GetFileAttributes(path);
|
||||||
|
if( fileAttributes != INVALID_FILE_ATTRIBUTES && (fileAttributes & FILE_ATTRIBUTE_HIDDEN) == FILE_ATTRIBUTE_HIDDEN)
|
||||||
|
{
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ret == false) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] NOT a path [%s]\n",__FILE__,__FUNCTION__,__LINE__,path);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,7 +505,7 @@ void getFullscreenVideoInfo(int &colorBits,int &screenWidth,int &screenHeight) {
|
|||||||
DEVMODE devMode;
|
DEVMODE devMode;
|
||||||
for (int i=0; EnumDisplaySettings(NULL, i, &devMode) ;i++){
|
for (int i=0; EnumDisplaySettings(NULL, i, &devMode) ;i++){
|
||||||
|
|
||||||
printf("devMode.dmPelsWidth = %d, devMode.dmPelsHeight = %d, devMode.dmBitsPerPel = %d\n",devMode.dmPelsWidth,devMode.dmPelsHeight,devMode.dmBitsPerPel);
|
//printf("devMode.dmPelsWidth = %d, devMode.dmPelsHeight = %d, devMode.dmBitsPerPel = %d\n",devMode.dmPelsWidth,devMode.dmPelsHeight,devMode.dmBitsPerPel);
|
||||||
|
|
||||||
if(devMode.dmPelsWidth > iMaxWidth) {
|
if(devMode.dmPelsWidth > iMaxWidth) {
|
||||||
iMaxWidth = devMode.dmPelsWidth;
|
iMaxWidth = devMode.dmPelsWidth;
|
||||||
|
Reference in New Issue
Block a user