37 extern void MakeNewgameSettingsLive();
96 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),
269 MakeNewgameSettingsLive();
277 default: NOT_REACHED();
281 static void LandscapeGenerationCallback(
Window *w,
bool confirmed)
292 item->SetParam(0, 1 << i);
299 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};
300 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};
301 static const StringID _rivers[] = {STR_RIVERS_NONE, STR_RIVERS_FEW, STR_RIVERS_MODERATE, STR_RIVERS_LOT,
INVALID_STRING_ID};
302 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};
303 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};
304 static const StringID _rotation[] = {STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_COUNTER_CLOCKWISE, STR_CONFIG_SETTING_HEIGHTMAP_ROTATION_CLOCKWISE,
INVALID_STRING_ID};
305 static const StringID _landscape[] = {STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL, STR_CONFIG_SETTING_LAND_GENERATOR_TERRA_GENESIS,
INVALID_STRING_ID};
306 static const StringID _num_towns[] = {STR_NUM_VERY_LOW, STR_NUM_LOW, STR_NUM_NORMAL, STR_NUM_HIGH, STR_NUM_CUSTOM,
INVALID_STRING_ID};
307 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};
308 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};
346 if (_game_mode == GM_EDITOR) {
363 SetDParam(0, STR_SEA_LEVEL_CUSTOM_PERCENTAGE);
399 if (!gui_scope)
return;
518 size->width += padding.width;
526 DrawString(r.left, r.right, r.top, this->name, TC_ORANGE);
575 STR_WARNING_HEIGHTMAP_SCALE_CAPTION,
576 STR_WARNING_HEIGHTMAP_SCALE_MESSAGE,
578 LandscapeGenerationCallback);
580 StartGeneratingLandscape(mode);
658 uint32 hidden_mask = 0;
710 for (
const int *widget = raise_widgets; *widget !=
WIDGET_LIST_END; widget++) {
739 this->widget_id = widget;
751 this->widget_id = widget;
765 if (str == NULL)
return;
772 switch (this->widget_id) {
778 default: NOT_REACHED();
782 switch (this->widget_id) {
815 _nested_generate_landscape_widgets,
lengthof(_nested_generate_landscape_widgets)
822 _nested_heightmap_load_widgets,
lengthof(_nested_heightmap_load_widgets)
934 str = STR_BLACK_DATE_LONG;
950 size->width += padding.width;
951 size->height += padding.height;
1022 for (
const int *widget = raise_widgets; *widget !=
WIDGET_LIST_END; widget++) {
1042 int32 value = atoi(str);
1044 switch (this->widget_id) {
1061 static const NWidgetPart _nested_create_scenario_widgets[] = {
1117 _nested_create_scenario_widgets,
lengthof(_nested_create_scenario_widgets)
1127 static const NWidgetPart _nested_generate_progress_widgets[] = {
1145 _nested_generate_progress_widgets,
lengthof(_nested_generate_progress_widgets)
1158 static const StringID _generation_class_table[] = {
1159 STR_GENERATION_WORLD_GENERATION,
1160 STR_SCENEDIT_TOOLBAR_LANDSCAPE_GENERATION,
1161 STR_GENERATION_RIVER_GENERATION,
1162 STR_GENERATION_CLEARING_TILES,
1163 STR_SCENEDIT_TOOLBAR_TOWN_GENERATION,
1164 STR_SCENEDIT_TOOLBAR_INDUSTRY_GENERATION,
1165 STR_GENERATION_OBJECT_GENERATION,
1166 STR_GENERATION_TREE_GENERATION,
1167 STR_GENERATION_SETTINGUP_GAME,
1168 STR_GENERATION_PREPARING_TILELOOP,
1169 STR_GENERATION_PREPARING_SCRIPT,
1170 STR_GENERATION_PREPARING_GAME
1172 assert_compile(
lengthof(_generation_class_table) == GWP_CLASS_COUNT);
1175 static void AbortGeneratingWorldCallback(
Window *w,
bool confirmed)
1197 STR_GENERATION_ABORT_CAPTION,
1198 STR_GENERATION_ABORT_MESSAGE,
1200 AbortGeneratingWorldCallback
1219 for (uint i = 0; i < GWP_CLASS_COUNT; i++) {
1233 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);
1255 _gws.cls = STR_GENERATION_WORLD_GENERATION;
1271 static void _SetGeneratingWorldProgress(
GenWorldProgress cls, uint progress, uint total)
1273 static const int percent_table[] = {0, 5, 14, 17, 20, 40, 60, 65, 80, 85, 95, 99, 100 };
1274 assert_compile(
lengthof(percent_table) == GWP_CLASS_COUNT + 1);
1275 assert(cls < GWP_CLASS_COUNT);
1283 assert(_gws.cls == _generation_class_table[cls]);
1284 _gws.current += progress;
1285 assert(_gws.current <= _gws.total);
1287 _gws.cls = _generation_class_table[cls];
1288 _gws.current = progress;
1290 _gws.percent = percent_table[cls];
1297 _gws.percent = percent_table[cls] + (percent_table[cls + 1] - percent_table[cls]) * (_gws.current == 0 ? 0 : _gws.current - 1) / _gws.total;
1300 static uint last_percent = 0;
1303 if (_gws.percent == 0)
return;
1305 if (_gws.percent < last_percent) last_percent = 0;
1307 if (_gws.percent % 5 != 0 && _gws.percent <= last_percent + 5)
return;
1309 if (_gws.percent <= last_percent + 2)
return;
1311 DEBUG(net, 1,
"Map generation percentage complete: %d", _gws.percent);
1312 last_percent = _gws.percent;
1343 if (total == 0)
return;
1345 _SetGeneratingWorldProgress(cls, 0, total);
1358 _SetGeneratingWorldProgress(cls, 1, 0);