Made DFHack buildable. Also added plant proto definitions

develop
JapaMala 2014-07-23 19:57:47 +05:30
parent b530e9bb02
commit bc5e0f6ad6
9 changed files with 139 additions and 124 deletions

@ -1158,7 +1158,7 @@ int Items::getItemBaseValue(int16_t item_type, int16_t item_subtype, int16_t mat
case item_type::MEAT:
case item_type::PLANT:
case item_type::LEAVES:
// case item_type::LEAVES:
case item_type::CHEESE:
value = 2;
break;

@ -728,9 +728,9 @@ void MapExtras::BlockInfo::prepare(Block *mblock)
block = mblock->getRaw();
parent = mblock->getParent();
column = Maps::getBlockColumn((block->map_pos.x/48)*3, (block->map_pos.y/48)*3);
column = Maps::getBlockColumn((block->map_pos.x / 48) * 3, (block->map_pos.y / 48) * 3);
SquashVeins(block,veinmats,veintype);
SquashVeins(block, veinmats, veintype);
SquashGrass(block, grass);
for (size_t i = 0; i < column->plants.size(); i++)
@ -738,40 +738,41 @@ void MapExtras::BlockInfo::prepare(Block *mblock)
auto pp = column->plants[i];
// A plant without tree_info is single tile
// TODO: verify that x any y lie inside the block.
if(!pp->tree_info)
if (!pp->tree_info)
{
if(pp->pos.z == block->map_pos.z)
if (pp->pos.z == block->map_pos.z)
plants[pp->pos] = pp;
continue;
}
// tree_info contains vertical slices of the tree. This ensures there's a slice for our Z-level.
df::plant_tree_info * info = pp->tree_info;
if(!((pp->pos.z-1 <= block->map_pos.z) && ((pp->pos.z+info->z_dim) > block->map_pos.z)))
if (!((pp->pos.z - info->roots_depth <= block->map_pos.z) && ((pp->pos.z + info->body_height) > block->map_pos.z)))
continue;
// Parse through a single horizontal slice of the tree.
for(int xx = 0; xx < info->x_dim;xx++)
for(int yy = 0; yy < info->y_dim;yy++)
for (int xx = 0; xx < info->dim_x; xx++)
for (int yy = 0; yy < info->dim_y; yy++)
{
// Any non-zero value here other than blocked means there's some sort of branch here.
// If the block is at or above the plant's base level, we use the body array
// otherwise we use the roots.
// TODO: verify that the tree bounds intersect the block.
df::plant_tree_tile tile;
int z_diff = block->map_pos.z - pp->pos.z;
if (z_diff >= 0)
tile = info->body[z_diff][xx + (yy*info->dim_x)];
else
tile = info->roots[info->roots_depth - 1 - z_diff][xx + (yy*info->dim_x)];
if (tile.whole && !(tile.bits.blocked))
{
// Any non-zero value here other than blocked means there's some sort of branch here.
// If the block is at or above the plant's base level, we use the body array
// otherwise we use the roots.
// TODO: verify that the tree bounds intersect the block.
df::plant_tree_tile tile;
int z_diff = block->map_pos.z-pp->pos.z;
if(z_diff >= 0)
tile = info->body[z_diff][xx+(yy*info->x_dim)];
else tile = info->roots[0][xx+(yy*info->x_dim)];
if(tile.whole && !(tile.bits.blocked))
{
df::coord pos=pp->pos;
pos.x = pos.x - (info->x_dim/2) + xx;
pos.y = pos.y - (info->y_dim/2) + yy;
pos.z = block->map_pos.z;
plants[pos] = pp;
}
df::coord pos = pp->pos;
pos.x = pos.x - (info->dim_x / 2) + xx;
pos.y = pos.y - (info->dim_y / 2) + yy;
pos.z = block->map_pos.z;
plants[pos] = pp;
}
}
}
global_feature = Maps::getGlobalInitFeature(block->global_feature);
@ -842,6 +843,7 @@ t_matpair MapExtras::BlockInfo::getBaseMaterial(df::tiletype tt, df::coord2d pos
rv.mat_index = mblock->biomeInfoAt(pos).lava_stone;
break;
case MUSHROOM:
case ROOT:
case TREE:
case PLANT:

@ -253,15 +253,15 @@ void Maps::enableBlockUpdates(df::map_block *blk, bool flow, bool temperature)
blk->flags.bits.update_liquid_twice = true;
}
auto z_flags = world->map.z_level_flags;
int z_level = blk->map_pos.z;
if (z_flags && z_level >= 0 && z_level < world->map.z_count_block)
{
z_flags += z_level;
z_flags->bits.update = true;
z_flags->bits.update_twice = true;
}
//auto z_flags = world->map.z_level_flags;
//int z_level = blk->map_pos.z;
//if (z_flags && z_level >= 0 && z_level < world->map.z_count_block)
//{
// z_flags += z_level;
// z_flags->bits.update = true;
// z_flags->bits.update_twice = true;
//}
}
df::flow_info *Maps::spawnFlow(df::coord pos, df::flow_type type, int mat_type, int mat_index, int density)

@ -479,7 +479,7 @@ void MaterialInfo::getMatchBits(df::job_item_flags1 &ok, df::job_item_flags1 &ma
TEST(extract_bearing_fish, false);
TEST(extract_bearing_vermin, false);
TEST(processable_to_vial, structural && FLAG(plant, plant_raw_flags::EXTRACT_VIAL));
TEST(processable_to_bag, structural && FLAG(plant, plant_raw_flags::LEAVES));
// TEST(processable_to_bag, structural && FLAG(plant, plant_raw_flags::LEAVES));
TEST(processable_to_barrel, structural && FLAG(plant, plant_raw_flags::EXTRACT_BARREL));
TEST(solid, !(MAT_FLAG(ALCOHOL_PLANT) ||
MAT_FLAG(ALCOHOL_CREATURE) ||

@ -153,17 +153,17 @@ string Translation::TranslateName(const df::language_name * name, bool inEnglish
if (!name->nickname.empty())
{
word = "`" + name->nickname + "'";
switch (d_init ? d_init->nickname_dwarf : d_init_nickname::CENTRALIZE)
{
case d_init_nickname::REPLACE_ALL:
out = word;
return out;
case d_init_nickname::REPLACE_FIRST:
out = "";
break;
case d_init_nickname::CENTRALIZE:
break;
}
//switch (d_init ? d_init->nickname_dwarf : d_init_nickname::CENTRALIZE)
//{
//case d_init_nickname::REPLACE_ALL:
// out = word;
// return out;
//case d_init_nickname::REPLACE_FIRST:
// out = "";
// break;
//case d_init_nickname::CENTRALIZE:
// break;
//}
addNameWord(out, word);
}
}

@ -1 +1 @@
Subproject commit c66ab33071842bcfb7d37c3993f6a024923ca358
Subproject commit 03ae01781aa1578a1d7a53dc09fe9bf33f59a356

@ -82,84 +82,84 @@ SET_SOURCE_FILES_PROPERTIES( Brushes.h PROPERTIES HEADER_FILE_ONLY TRUE )
# Plugins
OPTION(BUILD_SUPPORTED "Build the supported plugins (reveal, probe, etc.)." ON)
if (BUILD_SUPPORTED)
DFHACK_PLUGIN(3dveins 3dveins.cpp)
DFHACK_PLUGIN(add-spatter add-spatter.cpp)
DFHACK_PLUGIN(advtools advtools.cpp)
DFHACK_PLUGIN(autodump autodump.cpp)
DFHACK_PLUGIN(autolabor autolabor.cpp)
DFHACK_PLUGIN(automaterial automaterial.cpp)
DFHACK_PLUGIN(autotrade autotrade.cpp)
DFHACK_PLUGIN(burrows burrows.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(building-hacks building-hacks.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(buildingplan buildingplan.cpp)
DFHACK_PLUGIN(catsplosion catsplosion.cpp)
DFHACK_PLUGIN(changeitem changeitem.cpp)
DFHACK_PLUGIN(changelayer changelayer.cpp)
DFHACK_PLUGIN(changevein changevein.cpp)
DFHACK_PLUGIN(cleanconst cleanconst.cpp)
DFHACK_PLUGIN(cleaners cleaners.cpp)
DFHACK_PLUGIN(cleanowned cleanowned.cpp)
DFHACK_PLUGIN(colonies colonies.cpp)
DFHACK_PLUGIN(command-prompt command-prompt.cpp)
DFHACK_PLUGIN(createitem createitem.cpp)
DFHACK_PLUGIN(cursecheck cursecheck.cpp)
DFHACK_PLUGIN(deramp deramp.cpp)
DFHACK_PLUGIN(dig dig.cpp)
DFHACK_PLUGIN(digFlood digFlood.cpp)
add_subdirectory(diggingInvaders)
DFHACK_PLUGIN(drybuckets drybuckets.cpp)
DFHACK_PLUGIN(dwarfmonitor dwarfmonitor.cpp)
DFHACK_PLUGIN(embark-tools embark-tools.cpp)
DFHACK_PLUGIN(eventful eventful.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(fastdwarf fastdwarf.cpp)
DFHACK_PLUGIN(feature feature.cpp)
DFHACK_PLUGIN(filltraffic filltraffic.cpp)
DFHACK_PLUGIN(fix-armory fix-armory.cpp)
DFHACK_PLUGIN(fixpositions fixpositions.cpp)
DFHACK_PLUGIN(fixveins fixveins.cpp)
DFHACK_PLUGIN(flows flows.cpp)
DFHACK_PLUGIN(follow follow.cpp)
DFHACK_PLUGIN(forceequip forceequip.cpp)
DFHACK_PLUGIN(getplants getplants.cpp)
DFHACK_PLUGIN(infiniteSky infiniteSky.cpp)
DFHACK_PLUGIN(initflags initflags.cpp)
# DFHACK_PLUGIN(3dveins 3dveins.cpp)
# DFHACK_PLUGIN(add-spatter add-spatter.cpp)
# DFHACK_PLUGIN(advtools advtools.cpp)
# DFHACK_PLUGIN(autodump autodump.cpp)
# DFHACK_PLUGIN(autolabor autolabor.cpp)
# DFHACK_PLUGIN(automaterial automaterial.cpp)
# DFHACK_PLUGIN(autotrade autotrade.cpp)
# DFHACK_PLUGIN(burrows burrows.cpp LINK_LIBRARIES lua)
# DFHACK_PLUGIN(building-hacks building-hacks.cpp LINK_LIBRARIES lua)
# DFHACK_PLUGIN(buildingplan buildingplan.cpp)
# DFHACK_PLUGIN(catsplosion catsplosion.cpp)
# DFHACK_PLUGIN(changeitem changeitem.cpp)
# DFHACK_PLUGIN(changelayer changelayer.cpp)
# DFHACK_PLUGIN(changevein changevein.cpp)
# DFHACK_PLUGIN(cleanconst cleanconst.cpp)
# DFHACK_PLUGIN(cleaners cleaners.cpp)
# DFHACK_PLUGIN(cleanowned cleanowned.cpp)
# DFHACK_PLUGIN(colonies colonies.cpp)
# DFHACK_PLUGIN(command-prompt command-prompt.cpp)
# DFHACK_PLUGIN(createitem createitem.cpp)
# DFHACK_PLUGIN(cursecheck cursecheck.cpp)
# DFHACK_PLUGIN(deramp deramp.cpp)
# DFHACK_PLUGIN(dig dig.cpp)
# DFHACK_PLUGIN(digFlood digFlood.cpp)
# add_subdirectory(diggingInvaders)
# DFHACK_PLUGIN(drybuckets drybuckets.cpp)
# DFHACK_PLUGIN(dwarfmonitor dwarfmonitor.cpp)
# DFHACK_PLUGIN(embark-tools embark-tools.cpp)
# DFHACK_PLUGIN(eventful eventful.cpp LINK_LIBRARIES lua)
# DFHACK_PLUGIN(fastdwarf fastdwarf.cpp)
# DFHACK_PLUGIN(feature feature.cpp)
# DFHACK_PLUGIN(filltraffic filltraffic.cpp)
# DFHACK_PLUGIN(fix-armory fix-armory.cpp)
# DFHACK_PLUGIN(fixpositions fixpositions.cpp)
# DFHACK_PLUGIN(fixveins fixveins.cpp)
# DFHACK_PLUGIN(flows flows.cpp)
# DFHACK_PLUGIN(follow follow.cpp)
# DFHACK_PLUGIN(forceequip forceequip.cpp)
# DFHACK_PLUGIN(getplants getplants.cpp)
# DFHACK_PLUGIN(infiniteSky infiniteSky.cpp)
# DFHACK_PLUGIN(initflags initflags.cpp)
DFHACK_PLUGIN(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote)
DFHACK_PLUGIN(jobutils jobutils.cpp)
DFHACK_PLUGIN(lair lair.cpp)
DFHACK_PLUGIN(liquids liquids.cpp Brushes.h LINK_LIBRARIES lua)
DFHACK_PLUGIN(manipulator manipulator.cpp)
DFHACK_PLUGIN(mode mode.cpp)
DFHACK_PLUGIN(misery misery.cpp)
DFHACK_PLUGIN(mousequery mousequery.cpp)
DFHACK_PLUGIN(petcapRemover petcapRemover.cpp)
DFHACK_PLUGIN(plants plants.cpp)
DFHACK_PLUGIN(probe probe.cpp)
DFHACK_PLUGIN(prospector prospector.cpp)
DFHACK_PLUGIN(power-meter power-meter.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(regrass regrass.cpp)
# DFHACK_PLUGIN(jobutils jobutils.cpp)
# DFHACK_PLUGIN(lair lair.cpp)
# DFHACK_PLUGIN(liquids liquids.cpp Brushes.h LINK_LIBRARIES lua)
# DFHACK_PLUGIN(manipulator manipulator.cpp)
# DFHACK_PLUGIN(mode mode.cpp)
# DFHACK_PLUGIN(misery misery.cpp)
# DFHACK_PLUGIN(mousequery mousequery.cpp)
# DFHACK_PLUGIN(petcapRemover petcapRemover.cpp)
# DFHACK_PLUGIN(plants plants.cpp)
# DFHACK_PLUGIN(probe probe.cpp)
# DFHACK_PLUGIN(prospector prospector.cpp)
# DFHACK_PLUGIN(power-meter power-meter.cpp LINK_LIBRARIES lua)
# DFHACK_PLUGIN(regrass regrass.cpp)
DFHACK_PLUGIN(remotefortressreader remotefortressreader.cpp PROTOBUFS RemoteFortressReader)
DFHACK_PLUGIN(rename rename.cpp LINK_LIBRARIES lua PROTOBUFS rename)
add_subdirectory(rendermax)
DFHACK_PLUGIN(resume resume.cpp)
DFHACK_PLUGIN(reveal reveal.cpp)
DFHACK_PLUGIN(search search.cpp)
DFHACK_PLUGIN(seedwatch seedwatch.cpp)
DFHACK_PLUGIN(showmood showmood.cpp)
DFHACK_PLUGIN(siege-engine siege-engine.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(sort sort.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(steam-engine steam-engine.cpp)
DFHACK_PLUGIN(stockflow stockflow.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(stockpiles stockpiles.cpp)
DFHACK_PLUGIN(stocks stocks.cpp)
DFHACK_PLUGIN(strangemood strangemood.cpp)
DFHACK_PLUGIN(tiletypes tiletypes.cpp Brushes.h)
DFHACK_PLUGIN(treefarm treefarm.cpp)
DFHACK_PLUGIN(tubefill tubefill.cpp)
DFHACK_PLUGIN(tweak tweak.cpp)
DFHACK_PLUGIN(weather weather.cpp)
DFHACK_PLUGIN(workflow workflow.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(workNow workNow.cpp)
DFHACK_PLUGIN(zone zone.cpp LINK_LIBRARIES lua)
# DFHACK_PLUGIN(rename rename.cpp LINK_LIBRARIES lua PROTOBUFS rename)
# add_subdirectory(rendermax)
# DFHACK_PLUGIN(resume resume.cpp)
# DFHACK_PLUGIN(reveal reveal.cpp)
# DFHACK_PLUGIN(search search.cpp)
# DFHACK_PLUGIN(seedwatch seedwatch.cpp)
# DFHACK_PLUGIN(showmood showmood.cpp)
# DFHACK_PLUGIN(siege-engine siege-engine.cpp LINK_LIBRARIES lua)
# DFHACK_PLUGIN(sort sort.cpp LINK_LIBRARIES lua)
# DFHACK_PLUGIN(steam-engine steam-engine.cpp)
# DFHACK_PLUGIN(stockflow stockflow.cpp LINK_LIBRARIES lua)
# DFHACK_PLUGIN(stockpiles stockpiles.cpp)
# DFHACK_PLUGIN(stocks stocks.cpp)
# DFHACK_PLUGIN(strangemood strangemood.cpp)
# DFHACK_PLUGIN(tiletypes tiletypes.cpp Brushes.h)
# DFHACK_PLUGIN(treefarm treefarm.cpp)
# DFHACK_PLUGIN(tubefill tubefill.cpp)
# DFHACK_PLUGIN(tweak tweak.cpp)
# DFHACK_PLUGIN(weather weather.cpp)
# DFHACK_PLUGIN(workflow workflow.cpp LINK_LIBRARIES lua)
# DFHACK_PLUGIN(workNow workNow.cpp)
# DFHACK_PLUGIN(zone zone.cpp LINK_LIBRARIES lua)
endif()
# this is the skeleton plugin. If you want to make your own, make a copy and then change it

@ -147,4 +147,17 @@ message BlockList
repeated MapBlock map_blocks = 1;
optional int32 map_x = 2;
optional int32 map_y = 3;
}
message PlantDef
{
required int32 pos_x = 1;
required int32 pos_y = 2;
required int32 pos_z = 3;
required int32 index = 4;
}
message PlantList
{
repeated PlantDef plant_list = 1;
}

@ -1 +1 @@
Subproject commit 0d19548402932c970c8a0d45404808cbe8fe1bcd
Subproject commit 1b883efc2a736b69c41316cc7c6eff4498d6aa9a