summaryrefslogtreecommitdiff
path: root/plugins/Brushes.h
diff options
context:
space:
mode:
authorJared Adams2012-04-19 21:13:07 -0600
committerJared Adams2012-04-19 21:13:07 -0600
commit52138d8998e38b6af550749ac7fd226a7bd86edd (patch)
tree61f77061caa8a0f8843d5a0c776a494850643844 /plugins/Brushes.h
parentf97e2bf4103cc09478220decd35c9732c10863aa (diff)
downloaddfhack-52138d8998e38b6af550749ac7fd226a7bd86edd.tar.gz
dfhack-52138d8998e38b6af550749ac7fd226a7bd86edd.tar.bz2
dfhack-52138d8998e38b6af550749ac7fd226a7bd86edd.tar.xz
Improve the range function of tiletypes a bit and add the functionality to liquids.
Diffstat (limited to 'plugins/Brushes.h')
-rw-r--r--plugins/Brushes.h52
1 files changed, 50 insertions, 2 deletions
diff --git a/plugins/Brushes.h b/plugins/Brushes.h
index a525d279..39f1614b 100644
--- a/plugins/Brushes.h
+++ b/plugins/Brushes.h
@@ -196,12 +196,60 @@ private:
Core *c_;
};
-inline std::ostream &operator<<(std::ostream &stream, const Brush& brush) {
+command_result parseRectangle(color_ostream & out,
+ int & width, int & height, int & zLevels,
+ int oldWidth, int oldHeight, int oldZLevels,
+ bool hasConsole = true)
+{
+ out << "Parse:" << endl
+ << "\tW:" << width << " - " << oldWidth << endl
+ << "\tW:" << height << " - " << oldHeight << endl
+ << "\tW:" << zLevels << " - " << oldZLevels << endl
+ << "Console: " << hasConsole << endl;
+ if (width < 1 || height < 1) {
+ if (hasConsole) {
+ string command = "";
+ std::stringstream str;
+ Console &con = static_cast<Console&>(out);
+ CommandHistory hist;
+
+ str.str("");
+ str << "Set range width <" << oldWidth << "> ";
+ con.lineedit(str.str(), command, hist);
+ hist.add(command);
+ width = command == "" ? oldWidth : atoi(command.c_str());
+
+ str.str("");
+ str << "Set range height <" << oldHeight << "> ";
+ con.lineedit(str.str(), command, hist);
+ hist.add(command);
+ height = command == "" ? oldHeight : atoi(command.c_str());
+
+ str.str("");
+ str << "Set range z-levels <" << oldZLevels << "> ";
+ con.lineedit(str.str(), command, hist);
+ hist.add(command);
+ zLevels = command == "" ? oldZLevels : atoi(command.c_str());
+ } else {
+ return CR_WRONG_USAGE;
+ }
+ }
+
+ width = width < 1? 1 : width;
+ height = height < 1? 1 : height;
+ zLevels = zLevels < 1? 1 : zLevels;
+
+ return CR_OK;
+}
+
+inline std::ostream &operator<<(std::ostream &stream, const Brush& brush)
+{
stream << brush.str();
return stream;
}
-inline std::ostream &operator<<(std::ostream &stream, const Brush* brush) {
+inline std::ostream &operator<<(std::ostream &stream, const Brush* brush)
+{
stream << brush->str();
return stream;
}