diff options
author | Darkvater <darkvater@openttd.org> | 2005-11-07 16:19:45 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2005-11-07 16:19:45 +0000 |
commit | 947fc8a8ec7eec13b0c405b4019c068706b5f3cf (patch) | |
tree | 80216301a0d5e498b85adbe0aff99c640659e676 | |
parent | 7304bbe5001d1508f4598ead2fad121c1e4a988c (diff) | |
download | openttd-947fc8a8ec7eec13b0c405b4019c068706b5f3cf.tar.xz |
(svn r3153) - Feature: [ 1276827 ] Drag and drop rocky areas in scenario editor (MeusH-ish)
-rw-r--r-- | gui.h | 3 | ||||
-rw-r--r-- | main_gui.c | 6 | ||||
-rw-r--r-- | terraform_gui.c | 30 |
3 files changed, 33 insertions, 6 deletions
@@ -74,7 +74,8 @@ enum { // max 32 - 4 = 28 types GUI_PlaceProc_LevelArea = 1 << 4, GUI_PlaceProc_DesertArea = 2 << 4, GUI_PlaceProc_WaterArea = 3 << 4, - GUI_PlaceProc_ConvertRailArea = 4 << 4 + GUI_PlaceProc_ConvertRailArea = 4 << 4, + GUI_PlaceProc_RockyArea = 5 << 4, }; /* misc_gui.c */ diff --git a/main_gui.c b/main_gui.c index 212d5f48b..80e4f1105 100644 --- a/main_gui.c +++ b/main_gui.c @@ -1211,11 +1211,7 @@ static void PlaceProc_LowerBigLand(TileIndex tile) static void PlaceProc_RockyArea(TileIndex tile) { - if (!IsTileType(tile, MP_CLEAR) && !IsTileType(tile, MP_TREES)) - return; - - ModifyTile(tile, MP_SETTYPE(MP_CLEAR) | MP_MAP5, (_m[tile].m5 & ~0x1C) | 0xB); - SndPlayTileFx(SND_1F_SPLAT, tile); + VpStartPlaceSizing(tile, VPM_X_AND_Y | GUI_PlaceProc_RockyArea); } static void PlaceProc_LightHouse(TileIndex tile) diff --git a/terraform_gui.c b/terraform_gui.c index 78bb87cd0..4bb27a611 100644 --- a/terraform_gui.c +++ b/terraform_gui.c @@ -62,6 +62,33 @@ static void GenerateDesertArea(TileIndex end, TileIndex start) _generating_world = false; } +/** Scenario editor command that generates desert areas */ +static void GenerateRockyArea(TileIndex end, TileIndex start) +{ + int size_x, size_y; + bool success = false; + int sx = TileX(start); + int sy = TileY(start); + int ex = TileX(end); + int ey = TileY(end); + + if (_game_mode != GM_EDITOR) return; + + if (ex < sx) intswap(ex, sx); + if (ey < sy) intswap(ey, sy); + size_x = (ex - sx) + 1; + size_y = (ey - sy) + 1; + + BEGIN_TILE_LOOP(tile, size_x, size_y, TileXY(sx, sy)) { + if (IsTileType(tile, MP_CLEAR) || IsTileType(tile, MP_TREES)) { + ModifyTile(tile, MP_SETTYPE(MP_CLEAR) | MP_MAP5, (_m[tile].m5 & ~0x1C) | 0xB); + success = true; + } + } END_TILE_LOOP(tile, size_x, size_y, 0); + + if (success) SndPlayTileFx(SND_1F_SPLAT, end); +} + /** * A central place to handle all X_AND_Y dragged GUI functions. * @param we @WindowEvent variable holding in its higher bits (excluding the lower @@ -82,6 +109,9 @@ bool GUIPlaceProcDragXY(const WindowEvent *we) case GUI_PlaceProc_LevelArea >> 4: DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_LEVEL_LAND | CMD_AUTO); break; + case GUI_PlaceProc_RockyArea >> 4: + GenerateRockyArea(end_tile, start_tile); + break; case GUI_PlaceProc_DesertArea >> 4: GenerateDesertArea(end_tile, start_tile); break; |