default techtree and map ( if available ) , jpg default for screenshots

This commit is contained in:
Titus Tscharntke 2011-04-04 23:11:59 +00:00
parent 064addf888
commit 5cd4824c94
4 changed files with 20 additions and 8 deletions

View File

@ -816,7 +816,7 @@ void MainWindow::saveScreenshot() {
string path = screenShotsPath; string path = screenShotsPath;
if(isdir(path.c_str()) == true) { if(isdir(path.c_str()) == true) {
Config &config= Config::getInstance(); Config &config= Config::getInstance();
string fileFormat = config.getString("ScreenShotFileType","png"); string fileFormat = config.getString("ScreenShotFileType","jpg");
//string fileFormat = "png"; //string fileFormat = "png";
for(int i=0; i < 5000; ++i) { for(int i=0; i < 5000; ++i) {

View File

@ -789,7 +789,7 @@ void MainWindow::eventKeyDown(char key){
string path = userData + GameConstants::folder_path_screenshots; string path = userData + GameConstants::folder_path_screenshots;
if(isdir(path.c_str()) == true) { if(isdir(path.c_str()) == true) {
Config &config= Config::getInstance(); Config &config= Config::getInstance();
string fileFormat = config.getString("ScreenShotFileType","png"); string fileFormat = config.getString("ScreenShotFileType","jpg");
unsigned int queueSize = Renderer::getInstance().getSaveScreenQueueSize(); unsigned int queueSize = Renderer::getInstance().getSaveScreenQueueSize();

View File

@ -144,6 +144,9 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
int networkPos=networkHeadPos-labelOffset; int networkPos=networkHeadPos-labelOffset;
int xoffset=10; int xoffset=10;
int initialMapSelection=0;
int initialTechSelection=0;
//map listBox //map listBox
// put them all in a set, to weed out duplicates (gbm & mgm with same name) // put them all in a set, to weed out duplicates (gbm & mgm with same name)
// will also ensure they are alphabetically listed (rather than how the OS provides them) // will also ensure they are alphabetically listed (rather than how the OS provides them)
@ -165,11 +168,13 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
copy(playerSortedMaps[0].begin(), playerSortedMaps[0].end(), std::back_inserter(formattedPlayerSortedMaps[0])); copy(playerSortedMaps[0].begin(), playerSortedMaps[0].end(), std::back_inserter(formattedPlayerSortedMaps[0]));
std::for_each(formattedPlayerSortedMaps[0].begin(), formattedPlayerSortedMaps[0].end(), FormatString()); std::for_each(formattedPlayerSortedMaps[0].begin(), formattedPlayerSortedMaps[0].end(), FormatString());
for ( int i = 0 ; i<mapFiles.size(); i++ ) for(int i= 0; i < mapFiles.size(); i++){// fetch info and put map in right list
{// fetch info and put map in right list loadMapInfo(Map::getMapPath(mapFiles.at(i), "", false), &mapInfo, false);
loadMapInfo(Map::getMapPath(mapFiles.at(i),"",false), &mapInfo, false);
playerSortedMaps[mapInfo.players].push_back(mapFiles.at(i)); playerSortedMaps[mapInfo.players].push_back(mapFiles.at(i));
formattedPlayerSortedMaps[mapInfo.players].push_back(formatString(mapFiles.at(i))); formattedPlayerSortedMaps[mapInfo.players].push_back(formatString(mapFiles.at(i)));
if(config.getString("InitialMap", "Conflict") == formattedPlayerSortedMaps[mapInfo.players].back()){
initialMapSelection= i;
}
} }
labelLocalIP.registerGraphicComponent(containerName,"labelLocalIP"); labelLocalIP.registerGraphicComponent(containerName,"labelLocalIP");
@ -201,6 +206,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
listBoxMap.registerGraphicComponent(containerName,"listBoxMap"); listBoxMap.registerGraphicComponent(containerName,"listBoxMap");
listBoxMap.init(xoffset+100, mapPos, 200); listBoxMap.init(xoffset+100, mapPos, 200);
listBoxMap.setItems(formattedPlayerSortedMaps[0]); listBoxMap.setItems(formattedPlayerSortedMaps[0]);
listBoxMap.setSelectedItemIndex(initialMapSelection);
labelMapInfo.registerGraphicComponent(containerName,"labelMapInfo"); labelMapInfo.registerGraphicComponent(containerName,"labelMapInfo");
labelMapInfo.init(xoffset+100, mapPos-labelOffset, 200, 40); labelMapInfo.init(xoffset+100, mapPos-labelOffset, 200, 40);
@ -243,11 +249,17 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
throw runtime_error("No tech-trees were found!"); throw runtime_error("No tech-trees were found!");
} }
techTreeFiles= results; techTreeFiles= results;
std::for_each(results.begin(), results.end(), FormatString()); //std::for_each(results.begin(), results.end(), FormatString());
for(int i= 0; i < results.size(); i++){
results.at(i)= formatString(results.at(i));
if(config.getString("InitialTechTree", "Megapack") == results.at(i)){
initialTechSelection= i;
}
}
listBoxTechTree.registerGraphicComponent(containerName,"listBoxTechTree"); listBoxTechTree.registerGraphicComponent(containerName,"listBoxTechTree");
listBoxTechTree.init(xoffset+650, mapPos, 150); listBoxTechTree.init(xoffset+650, mapPos, 150);
listBoxTechTree.setItems(results); listBoxTechTree.setItems(results);
listBoxTechTree.setSelectedItemIndex(initialTechSelection);
labelTechTree.registerGraphicComponent(containerName,"labelTechTree"); labelTechTree.registerGraphicComponent(containerName,"labelTechTree");
labelTechTree.init(xoffset+650, mapHeadPos); labelTechTree.init(xoffset+650, mapHeadPos);

View File

@ -254,7 +254,7 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu):
listBoxScreenShotType.pushBackItem("jpg"); listBoxScreenShotType.pushBackItem("jpg");
listBoxScreenShotType.pushBackItem("png"); listBoxScreenShotType.pushBackItem("png");
listBoxScreenShotType.pushBackItem("tga"); listBoxScreenShotType.pushBackItem("tga");
listBoxScreenShotType.setSelectedItem(config.getString("ScreenShotFileType","png")); listBoxScreenShotType.setSelectedItem(config.getString("ScreenShotFileType","jpg"));
currentLine-=30; currentLine-=30;
// end // end