Merge pull request #3214 from myk002/myk_tree_root

adjust to tree root changes
develop
Myk 2023-04-11 12:04:26 -07:00 committed by GitHub
commit 887e587e48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 14 deletions

@ -60,6 +60,7 @@ using namespace std;
#include "df/flow_info.h"
#include "df/job.h"
#include "df/plant.h"
#include "df/plant_root_tile.h"
#include "df/plant_tree_info.h"
#include "df/plant_tree_tile.h"
#include "df/region_map_entry.h"
@ -805,14 +806,16 @@ void MapExtras::BlockInfo::prepare(Block *mblock)
// 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;
bool has_tree_tile = false;
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[-1 - z_diff][xx + (yy*info->dim_x)];
if (tile.whole && !(tile.bits.blocked))
{
if (z_diff >= 0) {
df::plant_tree_tile tile = info->body[z_diff][xx + (yy * info->dim_x)];
has_tree_tile = tile.whole && !(tile.bits.blocked);
} else {
df::plant_root_tile tile = info->roots[-1 - z_diff][xx + (yy * info->dim_x)];
has_tree_tile = tile.whole && !(tile.bits.blocked);
}
if (has_tree_tile) {
df::coord pos = pp->pos;
pos.x = pos.x - (info->dim_x / 2) + xx;
pos.y = pos.y - (info->dim_y / 2) + yy;

@ -57,6 +57,7 @@ using namespace std;
#include "df/flow_info.h"
#include "df/map_block_column.h"
#include "df/plant.h"
#include "df/plant_root_tile.h"
#include "df/plant_tree_info.h"
#include "df/plant_tree_tile.h"
#include "df/region_map_entry.h"

@ -1 +1 @@
Subproject commit 78a2008e4d20a47f0533f285c3457a278dba5556
Subproject commit eea005e8cec4448ab865862c744d6da16106f641

@ -76,7 +76,9 @@
#include "df/ocean_wave.h"
#include "df/physical_attribute_type.h"
#include "df/plant.h"
#include "df/plant_tree_tile.h"
#include "df/plant_raw_flags.h"
#include "df/plant_root_tile.h"
#include "df/projectile.h"
#include "df/proj_itemst.h"
#include "df/proj_unitst.h"
@ -971,17 +973,18 @@ void CopyBlock(df::map_block * DfBlock, RemoteFortressReader::MapBlock * NetBloc
|| yyy >= 16
)
continue;
df::plant_tree_tile tile;
if (-localPos.z < 0)
{
tile = tree_info->roots[-1 + localPos.z][xx + (yy*tree_info->dim_x)];
df::plant_root_tile tile = tree_info->roots[-1 + localPos.z][xx + (yy * tree_info->dim_x)];
if (!tile.whole || tile.bits.blocked)
continue;
}
else
{
tile = tree_info->body[-localPos.z][xx + (yy*tree_info->dim_x)];
df::plant_tree_tile tile = tree_info->body[-localPos.z][xx + (yy * tree_info->dim_x)];
if (!tile.whole || tile.bits.blocked)
continue;
}
if (!tile.whole || tile.bits.blocked)
continue;
if (tree_info->body_height <= 1)
trunk_percent[xxx][yyy] = 0;
else

@ -1 +1 @@
Subproject commit 3e494d9d968add443ebd63cc167933cc813f0eee
Subproject commit 9046525c91fd91e90685dfc071aa952bfe906155