buildingplan: Support floodgates, grates, bars

See #808
develop
lethosor 2016-01-31 14:50:07 -05:00
parent 80fd2270db
commit 248331a196
3 changed files with 76 additions and 46 deletions

@ -53,6 +53,7 @@ New Scripts
New Features
------------
- `buildingplan`: Support for floodgates, grates, and bars
- `confirm`: Added a confirmation for retiring locations
- `exportlegends`: Exports more information (poetic/musical/dance forms, written/artifact content, landmasses, extra histfig information, and more)
- `search-plugin`: Support for new screens:

@ -49,31 +49,35 @@ using namespace std;
using namespace DFHack;
#include "DataDefs.h"
#include "df/world.h"
#include "df/ui.h"
#include "df/ui_look_list.h"
#include "df/d_init.h"
#include "df/item.h"
#include "df/unit.h"
#include "df/job.h"
#include "df/job_item.h"
#include "df/general_ref_building_holderst.h"
#include "df/buildings_other_id.h"
#include "df/building_design.h"
#include "df/building_def.h"
#include "df/building_axle_horizontalst.h"
#include "df/building_trapst.h"
#include "df/building_bars_floorst.h"
#include "df/building_bars_verticalst.h"
#include "df/building_bridgest.h"
#include "df/building_coffinst.h"
#include "df/building_civzonest.h"
#include "df/building_stockpilest.h"
#include "df/building_coffinst.h"
#include "df/building_def.h"
#include "df/building_design.h"
#include "df/building_floodgatest.h"
#include "df/building_furnacest.h"
#include "df/building_workshopst.h"
#include "df/building_grate_floorst.h"
#include "df/building_grate_wallst.h"
#include "df/building_rollersst.h"
#include "df/building_screw_pumpst.h"
#include "df/building_stockpilest.h"
#include "df/building_trapst.h"
#include "df/building_water_wheelst.h"
#include "df/building_wellst.h"
#include "df/building_rollersst.h"
#include "df/building_floodgatest.h"
#include "df/building_workshopst.h"
#include "df/buildings_other_id.h"
#include "df/d_init.h"
#include "df/general_ref_building_holderst.h"
#include "df/item.h"
#include "df/job.h"
#include "df/job_item.h"
#include "df/ui.h"
#include "df/ui_look_list.h"
#include "df/unit.h"
#include "df/world.h"
using namespace df::enums;
using df::global::ui;
@ -347,32 +351,58 @@ df::building *Buildings::allocInstance(df::coord pos, df::building_type type, in
{
case building_type::Well:
{
auto obj = (df::building_wellst*)bld;
if (VIRTUAL_CAST_VAR(obj, df::building_wellst, bld))
obj->bucket_z = bld->z;
break;
}
case building_type::Furnace:
{
auto obj = (df::building_furnacest*)bld;
if (VIRTUAL_CAST_VAR(obj, df::building_furnacest, bld))
obj->melt_remainder.resize(df::inorganic_raw::get_vector().size(), 0);
break;
}
case building_type::Coffin:
{
auto obj = (df::building_coffinst*)bld;
if (VIRTUAL_CAST_VAR(obj, df::building_coffinst, bld))
obj->initBurialFlags(); // DF has this copy&pasted
break;
}
case building_type::Trap:
{
auto obj = (df::building_trapst*)bld;
if (VIRTUAL_CAST_VAR(obj, df::building_trapst, bld))
{
if (obj->trap_type == trap_type::PressurePlate)
obj->ready_timeout = 500;
}
break;
}
case building_type::Floodgate:
{
auto obj = (df::building_floodgatest*)bld;
if (VIRTUAL_CAST_VAR(obj, df::building_floodgatest, bld))
obj->gate_flags.bits.closed = true;
break;
}
case building_type::GrateWall:
{
if (VIRTUAL_CAST_VAR(obj, df::building_grate_wallst, bld))
obj->gate_flags.bits.closed = true;
break;
}
case building_type::GrateFloor:
{
if (VIRTUAL_CAST_VAR(obj, df::building_grate_floorst, bld))
obj->gate_flags.bits.closed = true;
break;
}
case building_type::BarsVertical:
{
if (VIRTUAL_CAST_VAR(obj, df::building_bars_verticalst, bld))
obj->gate_flags.bits.closed = true;
break;
}
case building_type::BarsFloor:
{
if (VIRTUAL_CAST_VAR(obj, df::building_bars_floorst, bld))
obj->gate_flags.bits.closed = true;
break;
}

@ -241,13 +241,13 @@ void ViewscreenChooseMaterial::render()
int32_t y = gps->dimy - 3;
int32_t x = 2;
OutputHotkeyString(x, y, "Toggle", "Enter");
OutputHotkeyString(x, y, "Toggle", interface_key::SELECT);
x += 3;
OutputHotkeyString(x, y, "Save", "Shift-Enter");
OutputHotkeyString(x, y, "Save", interface_key::SEC_SELECT);
x += 3;
OutputHotkeyString(x, y, "Clear", "C");
OutputHotkeyString(x, y, "Clear", interface_key::CUSTOM_SHIFT_C);
x += 3;
OutputHotkeyString(x, y, "Cancel", "Esc");
OutputHotkeyString(x, y, "Cancel", interface_key::LEAVESCREEN);
}
// START Room Reservation
@ -538,13 +538,12 @@ void Planner::initialize()
add_building_type(Chair, CHAIR);
add_building_type(Coffin, COFFIN);
add_building_type(Door, DOOR);
// add_building_type(Floodgate, FLOODGATE); not displayed before or after being built
add_building_type(Floodgate, FLOODGATE);
add_building_type(Hatch, HATCH_COVER);
// not displayed before or after being built:
// add_building_type(GrateWall, GRATE);
// add_building_type(GrateFloor, GRATE);
// add_building_type(BarsVertical, BAR);
// add_building_type(BarsFloor, BAR);
add_building_type(GrateWall, GRATE);
add_building_type(GrateFloor, GRATE);
add_building_type(BarsVertical, BAR);
add_building_type(BarsFloor, BAR);
add_building_type(Cabinet, CABINET);
add_building_type(Box, BOX);
// skip kennels, farm plot