|
|
@ -60,6 +60,7 @@ using namespace std;
|
|
|
|
#include "df/flow_info.h"
|
|
|
|
#include "df/flow_info.h"
|
|
|
|
#include "df/job.h"
|
|
|
|
#include "df/job.h"
|
|
|
|
#include "df/plant.h"
|
|
|
|
#include "df/plant.h"
|
|
|
|
|
|
|
|
#include "df/plant_root_tile.h"
|
|
|
|
#include "df/plant_tree_info.h"
|
|
|
|
#include "df/plant_tree_info.h"
|
|
|
|
#include "df/plant_tree_tile.h"
|
|
|
|
#include "df/plant_tree_tile.h"
|
|
|
|
#include "df/region_map_entry.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
|
|
|
|
// If the block is at or above the plant's base level, we use the body array
|
|
|
|
// otherwise we use the roots.
|
|
|
|
// otherwise we use the roots.
|
|
|
|
// TODO: verify that the tree bounds intersect the block.
|
|
|
|
// 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;
|
|
|
|
int z_diff = block->map_pos.z - pp->pos.z;
|
|
|
|
if (z_diff >= 0)
|
|
|
|
if (z_diff >= 0) {
|
|
|
|
tile = info->body[z_diff][xx + (yy*info->dim_x)];
|
|
|
|
df::plant_tree_tile tile = info->body[z_diff][xx + (yy * info->dim_x)];
|
|
|
|
else
|
|
|
|
has_tree_tile = tile.whole && !(tile.bits.blocked);
|
|
|
|
tile = info->roots[-1 - z_diff][xx + (yy*info->dim_x)];
|
|
|
|
} else {
|
|
|
|
if (tile.whole && !(tile.bits.blocked))
|
|
|
|
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;
|
|
|
|
df::coord pos = pp->pos;
|
|
|
|
pos.x = pos.x - (info->dim_x / 2) + xx;
|
|
|
|
pos.x = pos.x - (info->dim_x / 2) + xx;
|
|
|
|
pos.y = pos.y - (info->dim_y / 2) + yy;
|
|
|
|
pos.y = pos.y - (info->dim_y / 2) + yy;
|
|
|
|