File diff r4718:854675088e66 → r4719:e1d2222eb9fb
genworld_gui.c
Show inline comments
 
@@ -205,12 +205,14 @@ void GenerateLandscapeWndProc(Window *w,
 
	static const StringID num_inds[]    = {STR_26816_NONE, STR_6816_LOW, STR_6817_NORMAL, STR_6818_HIGH, INVALID_STRING_ID};
 

	
 
	uint mode = w->window_number;
 
	uint y;
 

	
 
	switch (e->event) {
 
	case WE_CREATE: LowerWindowWidget(w, _opt_newgame.landscape + 3); break;
 

	
 
	case WE_PAINT:
 
		/* TODO -- Above and below you see some lines commented out with '//' in
 
		 *  front of it. This is because currently the widget system can't handle
 
		 *  more than 32 widgets per window, and we need 34. Therefor we draw
 
		 *  parts of the widgets manually below, reducing the number to 32.
 
		 *  Of course someone is already hard working to replace the system with
 
@@ -236,12 +238,13 @@ void GenerateLandscapeWndProc(Window *w,
 

	
 
		SetWindowWidgetDisabledState(w, 18, _patches_newgame.starting_year <= MIN_YEAR);
 
		SetWindowWidgetDisabledState(w, 20, _patches_newgame.starting_year >= MAX_YEAR);
 
		SetWindowWidgetDisabledState(w, 21, _patches_newgame.snow_line_height <= 2 || _opt_newgame.landscape != LT_HILLY);
 
		SetWindowWidgetDisabledState(w, 23, _patches_newgame.snow_line_height >= 13 || _opt_newgame.landscape != LT_HILLY);
 

	
 
		LowerWindowWidget(w, _opt_newgame.landscape + 3); // All buttons get automagically unclicked
 
		DrawWindowWidgets(w);
 

	
 
		y = (mode == GLWP_HEIGHTMAP) ? 22 : 0;
 

	
 
		DrawString( 12,  91 + y, STR_MAPSIZE, 0);
 
		DrawString(119,  91 + y, mapsizes[_patches_newgame.map_x - 6], 0x10);
 
@@ -322,13 +325,15 @@ void GenerateLandscapeWndProc(Window *w,
 

	
 
		break;
 
	case WE_CLICK:
 
		switch (e->we.click.widget) {
 
		case 0: DeleteWindow(w); break;
 
		case 3: case 4: case 5: case 6:
 
			RaiseWindowWidget(w, _opt_newgame.landscape + 3);
 
			SetNewLandscapeType(e->we.click.widget - 3);
 
			LowerWindowWidget(w, _opt_newgame.landscape + 3);
 
			break;
 
		case 7: case 8: // Mapsize X
 
			ShowDropDownMenu(w, mapsizes, _patches_newgame.map_x - 6, 8, 0, 0);
 
			break;
 
		case 9: case 10: // Mapsize Y
 
			ShowDropDownMenu(w, mapsizes, _patches_newgame.map_y - 6, 10, 0, 0);
 
@@ -576,19 +581,21 @@ void StartNewGameWithoutGUI(uint seed)
 

	
 
void CreateScenarioWndProc(Window *w, WindowEvent *e)
 
{
 
	static const StringID mapsizes[] = {STR_64, STR_128, STR_256, STR_512, STR_1024, STR_2048, INVALID_STRING_ID};
 

	
 
	switch (e->event) {
 
	case WE_CREATE: LowerWindowWidget(w, _opt_newgame.landscape + 3); break;
 

	
 
	case WE_PAINT:
 
		SetWindowWidgetDisabledState(w, 14, _patches_newgame.starting_year <= MIN_YEAR);
 
		SetWindowWidgetDisabledState(w, 16, _patches_newgame.starting_year >= MAX_YEAR);
 
		SetWindowWidgetDisabledState(w, 17, _patches_newgame.se_flat_world_height <= 0);
 
		SetWindowWidgetDisabledState(w, 19, _patches_newgame.se_flat_world_height >= 15);
 

	
 
		w->click_state = (w->click_state & ~(0xF << 3)) | (1 << (_opt_newgame.landscape + 3));
 
		LowerWindowWidget(w, _opt_newgame.landscape + 3); // All buttons get automagically unclicked
 
		DrawWindowWidgets(w);
 

	
 
		DrawString( 12,  96, STR_MAPSIZE, 0);
 
		DrawString(167,  96, mapsizes[_patches_newgame.map_x - 6], 0x10);
 
		DrawString(216,  96, STR_BY, 0);
 
		DrawString(230,  96, mapsizes[_patches_newgame.map_y - 6], 0x10);
 
@@ -603,13 +610,15 @@ void CreateScenarioWndProc(Window *w, Wi
 

	
 
		break;
 
	case WE_CLICK:
 
		switch (e->we.click.widget) {
 
		case 0: DeleteWindow(w); break;
 
		case 3: case 4: case 5: case 6:
 
			RaiseWindowWidget(w, _opt_newgame.landscape + 3);
 
			SetNewLandscapeType(e->we.click.widget - 3);
 
			LowerWindowWidget(w, _opt_newgame.landscape + 3);
 
			break;
 
		case 7: case 8: // Mapsize X
 
			ShowDropDownMenu(w, mapsizes, _patches_newgame.map_x - 6, 8, 0, 0);
 
			break;
 
		case 9: case 10: // Mapsize Y
 
			ShowDropDownMenu(w, mapsizes, _patches_newgame.map_y - 6, 10, 0, 0);