Changeset - r15973:f4c5b31a17d3
[Not reviewed]
master
0 6 0
rubidium - 14 years ago 2010-08-28 19:45:56
rubidium@openttd.org
(svn r20671) -Add: feature F (not action F as written mistakenly in the previous message) support for the scenario editor
6 files changed with 37 insertions and 33 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -2082,9 +2082,7 @@ STR_TREES_RANDOM_TREES_TOOLTIP          
 
# Land generation window (SE)
 
STR_TERRAFORM_TOOLBAR_LAND_GENERATION_CAPTION                   :{WHITE}Land Generation
 
STR_TERRAFORM_TOOLTIP_PLACE_ROCKY_AREAS_ON_LANDSCAPE            :{BLACK}Place rocky areas on landscape
 
STR_TERRAFORM_TOOLTIP_PLACE_LIGHTHOUSE                          :{BLACK}Place lighthouse
 
STR_TERRAFORM_TOOLTIP_DEFINE_DESERT_AREA                        :{BLACK}Define desert area.{}Hold Ctrl to remove it
 
STR_TERRAFORM_TOOLTIP_PLACE_TRANSMITTER                         :{BLACK}Place transmitter
 
STR_TERRAFORM_TOOLTIP_INCREASE_SIZE_OF_LAND_AREA                :{BLACK}Increase area of land to lower/raise
 
STR_TERRAFORM_TOOLTIP_DECREASE_SIZE_OF_LAND_AREA                :{BLACK}Decrease area of land to lower/raise
 
STR_TERRAFORM_TOOLTIP_GENERATE_RANDOM_LAND                      :{BLACK}Generate random land
src/newgrf_object.cpp
Show inline comments
 
@@ -69,6 +69,10 @@ void ResetObjects()
 

	
 
	/* And add our originals. */
 
	MemCpyT(_object_specs, _original_objects, lengthof(_original_objects));
 

	
 
	for (uint16 i = 0; i < lengthof(_original_objects); i++) {
 
		_object_specs[i].grf_prop.local_id = i;
 
	}
 
}
 

	
 
template <typename Tspec, typename Tid, Tid Tmax>
src/object_gui.cpp
Show inline comments
 
@@ -165,7 +165,13 @@ public:
 
				if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
 
					DrawPixelInfo *old_dpi = _cur_dpi;
 
					_cur_dpi = &tmp_dpi;
 
					DrawNewObjectTileInGUI((r.right - r.left) / 2 - 1, this->object_height + OBJECT_MARGIN, spec);
 
					if (spec->grf_prop.grffile == NULL) {
 
						extern const DrawTileSprites _objects[];
 
						const DrawTileSprites *dts = &_objects[spec->grf_prop.local_id];
 
						DrawOrigTileSeqInGUI((r.right - r.left) / 2 - 1, this->object_height + OBJECT_MARGIN, dts, PAL_NONE);
 
					} else {
 
						DrawNewObjectTileInGUI((r.right - r.left) / 2 - 1, this->object_height + OBJECT_MARGIN, spec);
 
					}
 
					_cur_dpi = old_dpi;
 
				}
 
				break;
src/table/object_land.h
Show inline comments
 
@@ -36,7 +36,7 @@ static const DrawTileSeqStruct _object_o
 
	TILE_SEQ_END()
 
};
 

	
 
static const DrawTileSprites _objects[] = {
 
extern const DrawTileSprites _objects[] = {
 
	{ { SPR_FLAT_2_THIRD_GRASS_TILE, PAL_NONE }, _object_transmitter_seq },
 
	{ { SPR_FLAT_2_THIRD_GRASS_TILE, PAL_NONE }, _object_lighthouse_seq  },
 
	{ { SPR_CONCRETE_GROUND,         PAL_NONE }, _object_statue_seq      },
src/table/sprites.h
Show inline comments
 
@@ -1036,7 +1036,7 @@ static const SpriteID SPR_IMG_TERRAFORM_
 
static const SpriteID SPR_IMG_TERRAFORM_DOWN  = 695;
 
static const SpriteID SPR_IMG_DYNAMITE        = 703;
 
static const SpriteID SPR_IMG_ROCKS           = 4084;
 
static const SpriteID SPR_IMG_LIGHTHOUSE_DESERT = 4085; // XXX - is Desert image on the desert-climate
 
static const SpriteID SPR_IMG_DESERT          = 4085;
 
static const SpriteID SPR_IMG_TRANSMITTER     = 4086;
 
static const SpriteID SPR_IMG_LEVEL_LAND      = SPR_OPENTTD_BASE + 91;
 
static const SpriteID SPR_IMG_BUILD_CANAL     = SPR_OPENTTD_BASE + 88;
 
@@ -1337,7 +1337,7 @@ static const CursorID SPR_CURSOR_LEVEL_L
 
static const CursorID SPR_CURSOR_TOWN           = 4080;
 
static const CursorID SPR_CURSOR_INDUSTRY       = 4081;
 
static const CursorID SPR_CURSOR_ROCKY_AREA     = 4087;
 
static const CursorID SPR_CURSOR_LIGHTHOUSE     = 4088;
 
static const CursorID SPR_CURSOR_DESERT         = 4088;
 
static const CursorID SPR_CURSOR_TRANSMITTER    = 4089;
 

	
 
/* airport cursors */
src/terraform_gui.cpp
Show inline comments
 
@@ -457,16 +457,6 @@ static void PlaceProc_RockyArea(TileInde
 
	VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_ROCKS);
 
}
 

	
 
static void PlaceProc_LightHouse(TileIndex tile)
 
{
 
	DoCommandP(tile, OBJECT_LIGHTHOUSE, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_BUILD_OBJECT), CcTerraform);
 
}
 

	
 
static void PlaceProc_Transmitter(TileIndex tile)
 
{
 
	DoCommandP(tile, OBJECT_TRANSMITTER, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_BUILD_OBJECT), CcTerraform);
 
}
 

	
 
static void PlaceProc_DesertArea(TileIndex tile)
 
{
 
	VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_CREATE_DESERT);
 
@@ -485,7 +475,8 @@ static const int8 _multi_terraform_coord
 

	
 
/** Enum referring to the widgets of the editor terraform toolbar */
 
enum EditorTerraformToolbarWidgets {
 
	ETTW_START = 0,                        ///< Used for iterations
 
	ETTW_SHOW_PLACE_DESERT,                ///< Should the place desert button be shown?
 
	ETTW_START,                            ///< Used for iterations
 
	ETTW_DOTS = ETTW_START,                ///< Invisible widget for rendering the terraform size on.
 
	ETTW_BUTTONS_START,                    ///< Start of pushable buttons
 
	ETTW_DEMOLISH = ETTW_BUTTONS_START,    ///< Demolish aka dynamite button
 
@@ -493,8 +484,8 @@ enum EditorTerraformToolbarWidgets {
 
	ETTW_RAISE_LAND,                       ///< Raise land button
 
	ETTW_LEVEL_LAND,                       ///< Level land button
 
	ETTW_PLACE_ROCKS,                      ///< Place rocks button
 
	ETTW_PLACE_DESERT_LIGHTHOUSE,          ///< Place desert button (in tropical climate) / place lighthouse button (else)
 
	ETTW_PLACE_TRANSMITTER,                ///< Place transmitter button
 
	ETTW_PLACE_DESERT,                     ///< Place desert button (in tropical climate)
 
	ETTW_PLACE_OBJECT,                     ///< Place transmitter button
 
	ETTW_BUTTONS_END,                      ///< End of pushable buttons
 
	ETTW_INCREASE_SIZE = ETTW_BUTTONS_END, ///< Upwards arrow button to increase terraforming size
 
	ETTW_DECREASE_SIZE,                    ///< Downwards arrow button to decrease terraforming size
 
@@ -522,10 +513,12 @@ static const NWidgetPart _nested_scen_ed
 
										SetFill(0, 1), SetDataTip(SPR_IMG_LEVEL_LAND, STR_LANDSCAPING_LEVEL_LAND_TOOLTIP),
 
			NWidget(WWT_IMGBTN, COLOUR_GREY, ETTW_PLACE_ROCKS), SetMinimalSize(22, 22),
 
										SetFill(0, 1), SetDataTip(SPR_IMG_ROCKS, STR_TERRAFORM_TOOLTIP_PLACE_ROCKY_AREAS_ON_LANDSCAPE),
 
			NWidget(WWT_IMGBTN, COLOUR_GREY, ETTW_PLACE_DESERT_LIGHTHOUSE), SetMinimalSize(22, 22),
 
										SetFill(0, 1), SetDataTip(SPR_IMG_LIGHTHOUSE_DESERT, STR_NULL),
 
			NWidget(WWT_IMGBTN, COLOUR_GREY, ETTW_PLACE_TRANSMITTER), SetMinimalSize(23, 22),
 
										SetFill(0, 1), SetDataTip(SPR_IMG_TRANSMITTER, STR_TERRAFORM_TOOLTIP_PLACE_TRANSMITTER),
 
			NWidget(NWID_SELECTION, INVALID_COLOUR, ETTW_SHOW_PLACE_DESERT),
 
				NWidget(WWT_IMGBTN, COLOUR_GREY, ETTW_PLACE_DESERT), SetMinimalSize(22, 22),
 
											SetFill(0, 1), SetDataTip(SPR_IMG_DESERT, STR_TERRAFORM_TOOLTIP_DEFINE_DESERT_AREA),
 
			EndContainer(),
 
			NWidget(WWT_IMGBTN, COLOUR_GREY, ETTW_PLACE_OBJECT), SetMinimalSize(23, 22),
 
										SetFill(0, 1), SetDataTip(SPR_IMG_TRANSMITTER, STR_SCENEDIT_TOOLBAR_PLACE_OBJECT),
 
			NWidget(NWID_SPACER), SetFill(1, 0),
 
		EndContainer(),
 
		NWidget(NWID_HORIZONTAL),
 
@@ -578,14 +571,14 @@ static void EditorTerraformClick_RockyAr
 
	HandlePlacePushButton(w, ETTW_PLACE_ROCKS, SPR_CURSOR_ROCKY_AREA, HT_RECT, PlaceProc_RockyArea);
 
}
 

	
 
static void EditorTerraformClick_DesertLightHouse(Window *w)
 
static void EditorTerraformClick_Desert(Window *w)
 
{
 
	HandlePlacePushButton(w, ETTW_PLACE_DESERT_LIGHTHOUSE, SPR_CURSOR_LIGHTHOUSE, HT_RECT, (_settings_game.game_creation.landscape == LT_TROPIC) ? PlaceProc_DesertArea : PlaceProc_LightHouse);
 
	HandlePlacePushButton(w, ETTW_PLACE_DESERT, SPR_CURSOR_DESERT, HT_RECT, PlaceProc_DesertArea);
 
}
 

	
 
static void EditorTerraformClick_Transmitter(Window *w)
 
static void EditorTerraformClick_PlaceObject(Window *w)
 
{
 
	HandlePlacePushButton(w, ETTW_PLACE_TRANSMITTER, SPR_CURSOR_TRANSMITTER, HT_RECT, PlaceProc_Transmitter);
 
	if (HandlePlacePushButton(w, ETTW_PLACE_OBJECT, SPR_CURSOR_TRANSMITTER, HT_RECT, PlaceProc_Object)) ShowBuildObjectPicker(w);
 
}
 

	
 
static OnButtonClick * const _editor_terraform_button_proc[] = {
 
@@ -594,8 +587,8 @@ static OnButtonClick * const _editor_ter
 
	EditorTerraformClick_RaiseBigLand,
 
	EditorTerraformClick_LevelLand,
 
	EditorTerraformClick_RockyArea,
 
	EditorTerraformClick_DesertLightHouse,
 
	EditorTerraformClick_Transmitter
 
	EditorTerraformClick_Desert,
 
	EditorTerraformClick_PlaceObject
 
};
 

	
 

	
 
@@ -635,8 +628,10 @@ static void ResetLandscapeConfirmationCa
 
struct ScenarioEditorLandscapeGenerationWindow : Window {
 
	ScenarioEditorLandscapeGenerationWindow(const WindowDesc *desc, WindowNumber window_number) : Window()
 
	{
 
		this->InitNested(desc, window_number);
 
		this->GetWidget<NWidgetCore>(ETTW_PLACE_DESERT_LIGHTHOUSE)->tool_tip = (_settings_game.game_creation.landscape == LT_TROPIC) ? STR_TERRAFORM_TOOLTIP_DEFINE_DESERT_AREA : STR_TERRAFORM_TOOLTIP_PLACE_LIGHTHOUSE;
 
		this->CreateNestedTree(desc);
 
		NWidgetStacked *show_desert = this->GetWidget<NWidgetStacked>(ETTW_SHOW_PLACE_DESERT);
 
		show_desert->SetDisplayedPlane(_settings_game.game_creation.landscape == LT_TROPIC ? 0 : SZSP_NONE);
 
		this->FinishInitNested(desc, window_number);
 
	}
 

	
 
	virtual void OnPaint()
 
@@ -749,6 +744,7 @@ struct ScenarioEditorLandscapeGeneration
 
	{
 
		this->RaiseButtons();
 
		this->SetDirty();
 
		DeleteWindowById(WC_BUILD_OBJECT, 0);
 
	}
 

	
 
	static Hotkey<ScenarioEditorLandscapeGenerationWindow> terraform_editor_hotkeys[];
 
@@ -760,8 +756,8 @@ Hotkey<ScenarioEditorLandscapeGeneration
 
	Hotkey<ScenarioEditorLandscapeGenerationWindow>('W' | WKC_GLOBAL_HOTKEY, "raise", ETTW_RAISE_LAND),
 
	Hotkey<ScenarioEditorLandscapeGenerationWindow>('E' | WKC_GLOBAL_HOTKEY, "level", ETTW_LEVEL_LAND),
 
	Hotkey<ScenarioEditorLandscapeGenerationWindow>('R', "rocky", ETTW_PLACE_ROCKS),
 
	Hotkey<ScenarioEditorLandscapeGenerationWindow>('T', "desertlighthouse", ETTW_PLACE_DESERT_LIGHTHOUSE),
 
	Hotkey<ScenarioEditorLandscapeGenerationWindow>('Y', "transmitter", ETTW_PLACE_TRANSMITTER),
 
	Hotkey<ScenarioEditorLandscapeGenerationWindow>('T', "desert", ETTW_PLACE_DESERT),
 
	Hotkey<ScenarioEditorLandscapeGenerationWindow>('O', "object", ETTW_PLACE_OBJECT),
 
	HOTKEY_LIST_END(ScenarioEditorLandscapeGenerationWindow)
 
};
 

	
0 comments (0 inline, 0 general)