Send over rivers through remotefortressreader.cpp

develop
Japa 2016-05-02 20:58:36 +05:30
parent b8f5496b24
commit 56f2603097
2 changed files with 50 additions and 0 deletions

@ -160,6 +160,22 @@ message BuildingInstance
optional BuildingDirection direction = 13; //Doesn't mean anything for most buildings
}
message RiverEdge
{
optional int32 min_pos = 1;
optional int32 max_pos = 2;
optional int32 active = 3;
optional int32 elevation = 4;
}
message RiverTile
{
optional RiverEdge north = 1;
optional RiverEdge south = 2;
optional RiverEdge east = 3;
optional RiverEdge west = 4;
}
message MapBlock
{
required int32 map_x = 1;
@ -381,6 +397,7 @@ message WorldMap
optional int32 cur_year = 20;
optional int32 cur_year_tick = 21;
optional WorldPoles world_poles = 22;
repeated RiverTile river_tiles = 23;
}
message RegionMaps

@ -1966,6 +1966,39 @@ static void CopyLocalMap(df::world_data * worldData, df::world_region_details* w
out->add_elevation(worldRegionDetails->elevation[xx][yy]);
AddRegionTiles(out, ShiftCoords(df::coord2d(pos_x, pos_y), (worldRegionDetails->biome[xx][yy])), worldData);
}
if (xx == 16 || yy == 16)
{
out->add_river_tiles();
}
else
{
auto riverTile = out->add_river_tiles();
auto east = riverTile->mutable_east();
auto north = riverTile->mutable_north();
auto south = riverTile->mutable_south();
auto west = riverTile->mutable_west();
north->set_active(worldRegionDetails->rivers_vertical.active[xx][yy]);
north->set_elevation(worldRegionDetails->rivers_vertical.elevation[xx][yy]);
north->set_min_pos(worldRegionDetails->rivers_vertical.x_min[xx][yy]);
north->set_max_pos(worldRegionDetails->rivers_vertical.x_max[xx][yy]);
south->set_active(worldRegionDetails->rivers_vertical.active[xx][yy + 1]);
south->set_elevation(worldRegionDetails->rivers_vertical.elevation[xx][yy + 1]);
south->set_min_pos(worldRegionDetails->rivers_vertical.x_min[xx][yy + 1]);
south->set_max_pos(worldRegionDetails->rivers_vertical.x_max[xx][yy + 1]);
west->set_active(worldRegionDetails->rivers_horizontal.active[xx][yy]);
west->set_elevation(worldRegionDetails->rivers_horizontal.elevation[xx][yy]);
west->set_min_pos(worldRegionDetails->rivers_horizontal.y_min[xx][yy]);
west->set_max_pos(worldRegionDetails->rivers_horizontal.y_max[xx][yy]);
east->set_active(worldRegionDetails->rivers_horizontal.active[xx + 1][yy]);
east->set_elevation(worldRegionDetails->rivers_horizontal.elevation[xx + 1][yy]);
east->set_min_pos(worldRegionDetails->rivers_horizontal.y_min[xx + 1][yy]);
east->set_max_pos(worldRegionDetails->rivers_horizontal.y_max[xx + 1][yy]);
}
}
}