Send the existence of all buildings on the map.

develop
Japa Illo 2017-07-17 15:29:23 +05:30
parent 48a61420b7
commit 1ee5debfba
2 changed files with 10 additions and 2 deletions

@ -287,7 +287,7 @@ DFHack::command_result GetBuildingDefList(DFHack::color_ostream &stream, const D
void CopyBuilding(int buildingIndex, RemoteFortressReader::BuildingInstance * remote_build) void CopyBuilding(int buildingIndex, RemoteFortressReader::BuildingInstance * remote_build)
{ {
df::building * local_build = df::global::world->buildings.all[buildingIndex]; df::building * local_build = df::global::world->buildings.all[buildingIndex];
remote_build->set_index(buildingIndex); remote_build->set_index(local_build->id);
int minZ = local_build->z; int minZ = local_build->z;
if (local_build->getType() == df::enums::building_type::Well) if (local_build->getType() == df::enums::building_type::Well)
{ {

@ -1,5 +1,5 @@
#include "df_version_int.h" #include "df_version_int.h"
#define RFR_VERSION "0.17.0" #define RFR_VERSION "0.17.1"
#include <cstdio> #include <cstdio>
#include <time.h> #include <time.h>
@ -1179,7 +1179,11 @@ void CopyBuildings(DFCoord min, DFCoord max, RemoteFortressReader::MapBlock * Ne
{ {
df::building * bld = df::global::world->buildings.all[i]; df::building * bld = df::global::world->buildings.all[i];
if (bld->x1 >= max.x || bld->y1 >= max.y || bld->x2 < min.x || bld->y2 < min.y) if (bld->x1 >= max.x || bld->y1 >= max.y || bld->x2 < min.x || bld->y2 < min.y)
{
auto out_bld = NetBlock->add_buildings();
out_bld->set_index(bld->id);
continue; continue;
}
int z2 = bld->z; int z2 = bld->z;
@ -1192,7 +1196,11 @@ void CopyBuildings(DFCoord min, DFCoord max, RemoteFortressReader::MapBlock * Ne
} }
} }
if (bld->z < min.z || z2 >= max.z) if (bld->z < min.z || z2 >= max.z)
{
auto out_bld = NetBlock->add_buildings();
out_bld->set_index(bld->id);
continue; continue;
}
auto out_bld = NetBlock->add_buildings(); auto out_bld = NetBlock->add_buildings();
CopyBuilding(i, out_bld); CopyBuilding(i, out_bld);
df::building_actual* actualBuilding = virtual_cast<df::building_actual>(bld); df::building_actual* actualBuilding = virtual_cast<df::building_actual>(bld);