Make tiletypes more useful

* Paint, filter, and brush state is now saved between calls.
 * Added 'all' paint option to set material, shape, special, and variant at
      the same time.
 * Added tiletypes-here (like liquids here, except is uses the saved brush
      settings)
 * Added tiletypes-here-point (like liquids here, always only the tile under
      the cursor)
 * Added tiletypes-command: runs tiletypes commands seperated by ';' tokens
      (affects saved state)
 * Make the internal workings match liquids a bit more
 * Give brush objects a descriptor string
 * Make Core::cheap_tokenise available
develop
Jared Adams 2012-04-15 08:40:19 -06:00
parent c69af6ab9e
commit f3c7a685f5
4 changed files with 582 additions and 386 deletions

@ -118,7 +118,7 @@ struct Core::Private
} }
}; };
void cheap_tokenise(string const& input, vector<string> &output) void Core::cheap_tokenise(string const& input, vector<string> &output)
{ {
string *cur = NULL; string *cur = NULL;
@ -177,7 +177,7 @@ void fHKthread(void * iodata)
color_ostream_proxy out(core->getConsole()); color_ostream_proxy out(core->getConsole());
vector <string> args; vector <string> args;
cheap_tokenise(stuff, args); Core::cheap_tokenise(stuff, args);
if (args.empty()) { if (args.empty()) {
out.printerr("Empty hotkey command.\n"); out.printerr("Empty hotkey command.\n");
continue; continue;
@ -218,7 +218,7 @@ static void runInteractiveCommand(Core *core, PluginManager *plug_mgr, int &clue
{ {
// cut the input into parts // cut the input into parts
vector <string> parts; vector <string> parts;
cheap_tokenise(command,parts); Core::cheap_tokenise(command,parts);
if(parts.size() == 0) if(parts.size() == 0)
{ {
clueless_counter ++; clueless_counter ++;

@ -135,6 +135,8 @@ namespace DFHack
PluginManager *getPluginManager() { return plug_mgr; } PluginManager *getPluginManager() { return plug_mgr; }
static void cheap_tokenise(std::string const& input, std::vector<std::string> &output);
private: private:
DFHack::Console con; DFHack::Console con;

@ -6,6 +6,9 @@ class Brush
public: public:
virtual ~Brush(){}; virtual ~Brush(){};
virtual coord_vec points(MapExtras::MapCache & mc,DFHack::DFCoord start) = 0; virtual coord_vec points(MapExtras::MapCache & mc,DFHack::DFCoord start) = 0;
virtual std::string str() const {
return "unknown";
}
}; };
/** /**
* generic 3D rectangle brush. you can specify the dimensions of * generic 3D rectangle brush. you can specify the dimensions of
@ -56,6 +59,13 @@ public:
return v; return v;
}; };
~RectangleBrush(){}; ~RectangleBrush(){};
std::string str() const {
if (x_ == 1 && y_ == 1 && z_ == 1) {
return "point";
} else {
return "rectangle";
}
}
private: private:
int x_, y_, z_; int x_, y_, z_;
int cx_, cy_, cz_; int cx_, cy_, cz_;
@ -89,6 +99,9 @@ public:
} }
return v; return v;
}; };
std::string str() const {
return "block";
}
}; };
/** /**
@ -117,6 +130,9 @@ public:
} }
return v; return v;
}; };
std::string str() const {
return "column";
}
}; };
/** /**
@ -168,6 +184,9 @@ public:
return v; return v;
} }
std::string str() const {
return "flood";
}
private: private:
void maybeFlood(DFCoord c, std::stack<DFCoord> &to_flood, MapExtras::MapCache &mc) { void maybeFlood(DFCoord c, std::stack<DFCoord> &to_flood, MapExtras::MapCache &mc) {
if (mc.testCoord(c)) { if (mc.testCoord(c)) {
@ -176,3 +195,7 @@ private:
} }
Core *c_; Core *c_;
}; };
std::ostream &operator<<(std::ostream &stream, const Brush& brush) {
stream << brush.str();
}

File diff suppressed because it is too large Load Diff