38 extern void MakeNewgameSettingsLive();
97 NWidget(
WWT_TEXT, COLOUR_ORANGE),
SetDataTip(STR_MAPGEN_BY, STR_NULL),
SetPadding(1, 0, 0, 0),
SetFill(1, 1),
151 NWidget(
WWT_TEXT, COLOUR_ORANGE),
SetDataTip(STR_MAPGEN_NORTHWEST, STR_NULL),
SetPadding(1, 0, 0, 0),
SetFill(0, 1),
156 NWidget(
WWT_TEXT, COLOUR_ORANGE),
SetDataTip(STR_MAPGEN_NORTHEAST, STR_NULL),
SetPadding(1, 0, 0, 0),
SetFill(0, 1),
163 NWidget(
WWT_TEXT, COLOUR_ORANGE),
SetDataTip(STR_MAPGEN_SOUTHWEST, STR_NULL),
SetPadding(1, 0, 0, 0),
SetFill(0, 1),
168 NWidget(
WWT_TEXT, COLOUR_ORANGE),
SetDataTip(STR_MAPGEN_SOUTHEAST, STR_NULL),
SetPadding(1, 0, 0, 0),
SetFill(0, 1),
217 NWidget(
WWT_TEXT, COLOUR_ORANGE),
SetDataTip(STR_MAPGEN_BY, STR_NULL),
SetPadding(1, 0, 0, 0),
SetFill(1, 1),
268 MakeNewgameSettingsLive();
276 default: NOT_REACHED();
280 static void LandscapeGenerationCallback(
Window *w,
bool confirmed)
291 item->SetParam(0, 1 << i);
298 static const StringID _elevations[] = {STR_TERRAIN_TYPE_VERY_FLAT, STR_TERRAIN_TYPE_FLAT, STR_TERRAIN_TYPE_HILLY, STR_TERRAIN_TYPE_MOUNTAINOUS, STR_TERRAIN_TYPE_ALPINIST,
INVALID_STRING_ID};
299 static const StringID _sea_lakes[] = {STR_SEA_LEVEL_VERY_LOW, STR_SEA_LEVEL_LOW, STR_SEA_LEVEL_MEDIUM, STR_SEA_LEVEL_HIGH, STR_SEA_LEVEL_CUSTOM,
INVALID_STRING_ID};
300 static const StringID _rivers[] = {STR_RIVERS_NONE, STR_RIVERS_FEW, STR_RIVERS_MODERATE, STR_RIVERS_LOT,
INVALID_STRING_ID};
301 static const StringID _smoothness[] = {STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_SMOOTH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_SMOOTH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_ROUGH, STR_CONFIG_SETTING_ROUGHNESS_OF_TERRAIN_VERY_ROUGH,
INVALID_STRING_ID};
302 static const StringID _tree_placer[] = {STR_CONFIG_SETTING_TREE_PLACER_NONE, STR_CONFIG_SETTING_TREE_PLACER_ORIGINAL, STR_CONFIG_SETTING_TREE_PLACER_IMPROVED,
INVALID_STRING_ID};
303 static const StringID _rotation[] = {STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_COUNTER_CLOCKWISE, STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_CLOCKWISE,
INVALID_STRING_ID};
304 static const StringID _landscape[] = {STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL, STR_CONFIG_SETTING_LAND_GENERATOR_TERRA_GENESIS,
INVALID_STRING_ID};
305 static const StringID _num_towns[] = {STR_NUM_VERY_LOW, STR_NUM_LOW, STR_NUM_NORMAL, STR_NUM_HIGH, STR_NUM_CUSTOM,
INVALID_STRING_ID};
306 static const StringID _num_inds[] = {STR_FUNDING_ONLY, STR_MINIMAL, STR_NUM_VERY_LOW, STR_NUM_LOW, STR_NUM_NORMAL, STR_NUM_HIGH,
INVALID_STRING_ID};
307 static const StringID _variety[] = {STR_VARIETY_NONE, STR_VARIETY_VERY_LOW, STR_VARIETY_LOW, STR_VARIETY_MEDIUM, STR_VARIETY_HIGH, STR_VARIETY_VERY_HIGH,
INVALID_STRING_ID};
345 if (_game_mode == GM_EDITOR) {
362 SetDParam(0, STR_SEA_LEVEL_CUSTOM_PERCENTAGE);
398 if (!gui_scope)
return;
517 size->width += padding.width;
525 DrawString(r.left, r.right, r.top, this->name, TC_ORANGE);
574 STR_WARNING_HEIGHTMAP_SCALE_CAPTION,
575 STR_WARNING_HEIGHTMAP_SCALE_MESSAGE,
577 LandscapeGenerationCallback);
579 StartGeneratingLandscape(mode);
657 uint32 hidden_mask = 0;
709 for (
const int *widget = raise_widgets; *widget !=
WIDGET_LIST_END; widget++) {
738 this->widget_id = widget;
750 this->widget_id = widget;
764 if (str == NULL)
return;
771 switch (this->widget_id) {
777 default: NOT_REACHED();
781 switch (this->widget_id) {
814 _nested_generate_landscape_widgets,
lengthof(_nested_generate_landscape_widgets)
821 _nested_heightmap_load_widgets,
lengthof(_nested_heightmap_load_widgets)
933 str = STR_BLACK_DATE_LONG;
949 size->width += padding.width;
950 size->height += padding.height;
1021 for (
const int *widget = raise_widgets; *widget !=
WIDGET_LIST_END; widget++) {
1041 int32 value = atoi(str);
1043 switch (this->widget_id) {
1060 static const NWidgetPart _nested_create_scenario_widgets[] = {
1116 _nested_create_scenario_widgets,
lengthof(_nested_create_scenario_widgets)
1126 static const NWidgetPart _nested_generate_progress_widgets[] = {
1144 _nested_generate_progress_widgets,
lengthof(_nested_generate_progress_widgets)
1157 static const StringID _generation_class_table[] = {
1158 STR_GENERATION_WORLD_GENERATION,
1159 STR_SCENEDIT_TOOLBAR_LANDSCAPE_GENERATION,
1160 STR_GENERATION_RIVER_GENERATION,
1161 STR_GENERATION_CLEARING_TILES,
1162 STR_SCENEDIT_TOOLBAR_TOWN_GENERATION,
1163 STR_SCENEDIT_TOOLBAR_INDUSTRY_GENERATION,
1164 STR_GENERATION_OBJECT_GENERATION,
1165 STR_GENERATION_TREE_GENERATION,
1166 STR_GENERATION_SETTINGUP_GAME,
1167 STR_GENERATION_PREPARING_TILELOOP,
1168 STR_GENERATION_PREPARING_SCRIPT,
1169 STR_GENERATION_PREPARING_GAME
1171 assert_compile(
lengthof(_generation_class_table) == GWP_CLASS_COUNT);
1174 static void AbortGeneratingWorldCallback(
Window *w,
bool confirmed)
1196 STR_GENERATION_ABORT_CAPTION,
1197 STR_GENERATION_ABORT_MESSAGE,
1199 AbortGeneratingWorldCallback
1218 for (uint i = 0; i < GWP_CLASS_COUNT; i++) {
1232 DrawFrameRect(r.left + 1, r.top + 1, (
int)((r.right - r.left - 2) * _gws.percent / 100) + r.left + 1, r.bottom - 1, COLOUR_MAUVE, FR_NONE);
1254 _gws.cls = STR_GENERATION_WORLD_GENERATION;
1270 static void _SetGeneratingWorldProgress(
GenWorldProgress cls, uint progress, uint total)
1272 static const int percent_table[] = {0, 5, 14, 17, 20, 40, 60, 65, 80, 85, 95, 99, 100 };
1273 assert_compile(
lengthof(percent_table) == GWP_CLASS_COUNT + 1);
1274 assert(cls < GWP_CLASS_COUNT);
1282 assert(_gws.cls == _generation_class_table[cls]);
1283 _gws.current += progress;
1284 assert(_gws.current <= _gws.total);
1286 _gws.cls = _generation_class_table[cls];
1287 _gws.current = progress;
1289 _gws.percent = percent_table[cls];
1296 _gws.percent = percent_table[cls] + (percent_table[cls + 1] - percent_table[cls]) * (_gws.current == 0 ? 0 : _gws.current - 1) / _gws.total;
1299 static uint last_percent = 0;
1302 if (_gws.percent == 0)
return;
1304 if (_gws.percent < last_percent) last_percent = 0;
1306 if (_gws.percent % 5 != 0 && _gws.percent <= last_percent + 5)
return;
1308 if (_gws.percent <= last_percent + 2)
return;
1310 DEBUG(net, 1,
"Map generation percentage complete: %d", _gws.percent);
1311 last_percent = _gws.percent;
1342 if (total == 0)
return;
1344 _SetGeneratingWorldProgress(cls, 0, total);
1357 _SetGeneratingWorldProgress(cls, 1, 0);