Fix representation and parsing of built-in materials.

The trick is to support both FOO and FOO:NONE for all of them,
including INORGANIC[:NONE]. Otherwise the workflow gui scripts
have problems.
develop
Alexander Gavrilov 2012-11-07 13:31:36 +04:00
parent 20e98d4926
commit ff982dcf73
3 changed files with 7 additions and 3 deletions

@ -10,6 +10,8 @@ DFHack future
- fastdwarf: new mode using debug flags, and some internal consistency fixes. - fastdwarf: new mode using debug flags, and some internal consistency fixes.
- added a small stand-alone utility for applying and removing binary patches. - added a small stand-alone utility for applying and removing binary patches.
- removebadthoughts: add --dry-run option - removebadthoughts: add --dry-run option
New scripts:
- region-pops: displays animal populations of the region and allows tweaking them.
New GUI scripts: New GUI scripts:
- gui/guide-path: displays the cached path for minecart Guide orders. - gui/guide-path: displays the cached path for minecart Guide orders.
- gui/workshop-job: displays inputs of a workshop job and allows tweaking them. - gui/workshop-job: displays inputs of a workshop job and allows tweaking them.

@ -18,7 +18,7 @@ keybinding add Ctrl-Alt-S@dwarfmode/Default quicksave
# gui/rename script # gui/rename script
keybinding add Ctrl-Shift-N gui/rename keybinding add Ctrl-Shift-N gui/rename
keybinding add Alt-Shift-P "gui/rename unit-profession" keybinding add Ctrl-Shift-T "gui/rename unit-profession"
############################## ##############################
# Generic adv mode bindings # # Generic adv mode bindings #

@ -190,6 +190,8 @@ bool MaterialInfo::find(const std::vector<std::string> &items)
} }
else if (items.size() == 2) else if (items.size() == 2)
{ {
if (items[1] == "NONE" && findBuiltin(items[0]))
return true;
if (findPlant(items[0], items[1])) if (findPlant(items[0], items[1]))
return true; return true;
if (findCreature(items[0], items[1])) if (findCreature(items[0], items[1]))
@ -210,7 +212,7 @@ bool MaterialInfo::findBuiltin(const std::string &token)
} }
df::world_raws &raws = world->raws; df::world_raws &raws = world->raws;
for (int i = 1; i < NUM_BUILTIN; i++) for (int i = 0; i < NUM_BUILTIN; i++)
{ {
auto obj = raws.mat_table.builtin[i]; auto obj = raws.mat_table.builtin[i];
if (obj && obj->id == token) if (obj && obj->id == token)
@ -312,7 +314,7 @@ std::string MaterialInfo::getToken()
else if (index == 1) else if (index == 1)
return "COAL:CHARCOAL"; return "COAL:CHARCOAL";
} }
return material->id + ":NONE"; return material->id;
case Inorganic: case Inorganic:
return "INORGANIC:" + inorganic->id; return "INORGANIC:" + inorganic->id;
case Creature: case Creature: