|
|
@ -1,5 +1,6 @@
|
|
|
|
#include "df/building_design.h"
|
|
|
|
#include "df/building_design.h"
|
|
|
|
#include "df/building_doorst.h"
|
|
|
|
#include "df/building_doorst.h"
|
|
|
|
|
|
|
|
#include "df/building_type.h"
|
|
|
|
#include "df/general_ref_building_holderst.h"
|
|
|
|
#include "df/general_ref_building_holderst.h"
|
|
|
|
#include "df/job_item.h"
|
|
|
|
#include "df/job_item.h"
|
|
|
|
#include "df/ui_build_selector.h"
|
|
|
|
#include "df/ui_build_selector.h"
|
|
|
@ -236,15 +237,15 @@ static std::vector<ItemFilter> deserializeFilters(PersistentDataItem &config)
|
|
|
|
return ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int getNumFilters(BuildingTypeKey key)
|
|
|
|
static size_t getNumFilters(BuildingTypeKey key)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// TODO: get num filters in Lua when we handle all building types
|
|
|
|
// TODO: get num filters in Lua when we handle all building types
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PlannedBuilding::PlannedBuilding(df::building *building, const std::vector<ItemFilter> &filters)
|
|
|
|
PlannedBuilding::PlannedBuilding(df::building *building, const std::vector<ItemFilter> &filters)
|
|
|
|
: building(building),
|
|
|
|
: building_id(building->id),
|
|
|
|
building_id(building->id),
|
|
|
|
building(building),
|
|
|
|
filters(filters)
|
|
|
|
filters(filters)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
config = DFHack::World::AddPersistentData(planned_building_persistence_key_v1);
|
|
|
|
config = DFHack::World::AddPersistentData(planned_building_persistence_key_v1);
|
|
|
@ -546,7 +547,7 @@ Planner::ItemFiltersWrapper Planner::getItemFilters(BuildingTypeKey key)
|
|
|
|
static std::vector<ItemFilter> empty_vector;
|
|
|
|
static std::vector<ItemFilter> empty_vector;
|
|
|
|
static const ItemFiltersWrapper empty_ret(empty_vector);
|
|
|
|
static const ItemFiltersWrapper empty_ret(empty_vector);
|
|
|
|
|
|
|
|
|
|
|
|
int nfilters = getNumFilters(key);
|
|
|
|
size_t nfilters = getNumFilters(key);
|
|
|
|
if (nfilters < 1)
|
|
|
|
if (nfilters < 1)
|
|
|
|
return empty_ret;
|
|
|
|
return empty_ret;
|
|
|
|
while (default_item_filters[key].size() < nfilters)
|
|
|
|
while (default_item_filters[key].size() < nfilters)
|
|
|
|