From 890824dd38c0cf7f86aabdd3d9b85b9c52a5835e Mon Sep 17 00:00:00 2001 From: Tim Walberg Date: Fri, 6 Jan 2012 02:27:27 +0100 Subject: [PATCH] =?UTF-8?q?Merge=20patch=20with=20new=20dig=20patterns=20f?= =?UTF-8?q?or=20vdig=20plugin=20Signed-off-by:=20Petr=20Mr=C3=A1zek=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/vdig.cpp | 194 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 192 insertions(+), 2 deletions(-) diff --git a/plugins/vdig.cpp b/plugins/vdig.cpp index 290b3b933..fbbd36e46 100644 --- a/plugins/vdig.cpp +++ b/plugins/vdig.cpp @@ -459,6 +459,100 @@ static digmask diag5[5] = }, }; +static digmask diag5r[5] = +{ + { + {0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0}, + {0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0}, + {0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0}, + {0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0}, + {1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1}, + {0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0}, + {0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0}, + {0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0}, + {0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0}, + {1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1}, + {0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0}, + {0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0}, + {0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0}, + {0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0}, + {1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1}, + {0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0}, + }, + { + {0,0,1,0,0,0,0,1,0,0,0,0,1,0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1}, + {0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0}, + {0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0}, + {0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0}, + {0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0}, + {1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1}, + }, +}; + static digmask ladder[3] = { { @@ -517,6 +611,64 @@ static digmask ladder[3] = }, }; +static digmask ladderr[3] = +{ + { + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + {0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1}, + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + {0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0}, + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + {0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1}, + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + {0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0}, + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + {0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1}, + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + }, + { + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + {0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0}, + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + {0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1}, + {0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, + {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R, EXPLO_LADDER, + EXPLO_LADDERR, EXPLO_CLEAR, EXPLO_CROSS, }; @@ -653,6 +807,10 @@ DFhackCExport command_result expdig (Core * c, vector & parameters) { how = EXPLO_DIAG5; } + else if(parameters[i] == "diag5r") + { + how = EXPLO_DIAG5R; + } else if(parameters[i] == "clear") { how = EXPLO_CLEAR; @@ -661,6 +819,10 @@ DFhackCExport command_result expdig (Core * c, vector & parameters) { how = EXPLO_LADDER; } + else if(parameters[i] == "ladderr") + { + how = EXPLO_LADDERR; + } else if(parameters[i] == "cross") { how = EXPLO_CROSS; @@ -674,7 +836,9 @@ DFhackCExport command_result expdig (Core * c, vector & parameters) "There are two variables that can be set: pattern and filter.\n" "Patterns:\n" " diag5 = diagonals separated by 5 tiles\n" - " ladder = A 'ladder' pattern\n" + " diag5r = diag5 rotated 90 degrees\n" + " ladder = A 'ladder' pattern\n" + "ladderr = ladder rotated 90 degrees\n" " clear = Just remove all dig designations\n" " cross = A cross, exactly in the middle of the map.\n" "Filters:\n" @@ -719,6 +883,19 @@ DFhackCExport command_result expdig (Core * c, vector & parameters) } } } + else if(how == EXPLO_DIAG5R) + { + int which; + for(uint32_t x = 0; x < x_max; x++) + { + for(int32_t y = 0 ; y < y_max; y++) + { + which = (4*x + 1000-y) % 5; + stamp_pattern(maps, x,y_max - 1 - y, z_level, diag5r[which], + how, what, x_max, y_max); + } + } + } else if(how == EXPLO_LADDER) { int which; @@ -732,6 +909,19 @@ DFhackCExport command_result expdig (Core * c, vector & parameters) } } } + else if(how == EXPLO_LADDERR) + { + int which; + for(int32_t y = 0 ; y < y_max; y++) + { + which = y % 3; + for(uint32_t x = 0; x < x_max; x++) + { + stamp_pattern(maps, x, y, z_level, ladderr[which], + how, what, x_max, y_max); + } + } + } else if(how == EXPLO_CROSS) { // middle + recentering for the image @@ -941,4 +1131,4 @@ DFhackCExport command_result vdig (Core * c, vector & parameters) DFhackCExport command_result autodig (Core * c, vector & parameters) { return CR_NOT_IMPLEMENTED; -} \ No newline at end of file +}