Merge branch 'develop' of https://github.com/dfhack/dfhack into develop

develop
lethosor 2015-11-03 14:22:12 -05:00
commit 731fb4eb0a
2 changed files with 121 additions and 9 deletions

@ -92,6 +92,14 @@ enum WorldPoles
BOTH_POLES = 3;
}
enum BuildingDirection
{
NORTH = 0;
EAST = 1;
SOUTH = 2;
WEST = 3;
}
message Tiletype
{
required int32 id = 1;
@ -132,7 +140,7 @@ message BuildingInstance
optional uint32 building_flags = 10;
optional bool is_room = 11;
optional BuildingExtents room = 12;
optional int32 direction = 13; //Doesn't mean anything forall buildings
optional BuildingDirection direction = 13; //Doesn't mean anything for most buildings
}
message MapBlock

@ -38,6 +38,7 @@
#include "df/building_windmillst.h"
#include "df/building_siegeenginest.h"
#include "df/building_rollersst.h"
#include "df/building_bridgest.h"
#include "df/descriptor_color.h"
#include "df/descriptor_pattern.h"
@ -254,7 +255,6 @@ void CopyBuilding(int buildingIndex, RemoteFortressReader::BuildingInstance * re
}
}
remote_build->set_direction(0);
switch (type)
{
@ -299,7 +299,33 @@ void CopyBuilding(int buildingIndex, RemoteFortressReader::BuildingInstance * re
case df::enums::building_type::Well:
break;
case df::enums::building_type::Bridge:
break;
{
auto actual = strict_virtual_cast<df::building_bridgest>(local_build);
if (actual)
{
auto direction = actual->direction;
switch (direction)
{
case df::building_bridgest::Retracting:
break;
case df::building_bridgest::Left:
remote_build->set_direction(WEST);
break;
case df::building_bridgest::Right:
remote_build->set_direction(EAST);
break;
case df::building_bridgest::Up:
remote_build->set_direction(NORTH);
break;
case df::building_bridgest::Down:
remote_build->set_direction(SOUTH);
break;
default:
break;
}
}
}
break;
case df::enums::building_type::RoadDirt:
break;
case df::enums::building_type::RoadPaved:
@ -308,7 +334,26 @@ void CopyBuilding(int buildingIndex, RemoteFortressReader::BuildingInstance * re
{
auto actual = strict_virtual_cast<df::building_siegeenginest>(local_build);
if (actual)
remote_build->set_direction(actual->facing);
{
auto facing = actual->facing;
switch (facing)
{
case df::building_siegeenginest::Left:
remote_build->set_direction(WEST);
break;
case df::building_siegeenginest::Up:
remote_build->set_direction(NORTH);
break;
case df::building_siegeenginest::Right:
remote_build->set_direction(EAST);
break;
case df::building_siegeenginest::Down:
remote_build->set_direction(SOUTH);
break;
default:
break;
}
}
}
break;
case df::enums::building_type::Trap:
@ -335,7 +380,26 @@ void CopyBuilding(int buildingIndex, RemoteFortressReader::BuildingInstance * re
{
auto actual = strict_virtual_cast<df::building_screw_pumpst>(local_build);
if (actual)
remote_build->set_direction(actual->direction);
{
auto direction = actual->direction;
switch (direction)
{
case df::enums::screw_pump_direction::FromNorth:
remote_build->set_direction(NORTH);
break;
case df::enums::screw_pump_direction::FromEast:
remote_build->set_direction(EAST);
break;
case df::enums::screw_pump_direction::FromSouth:
remote_build->set_direction(SOUTH);
break;
case df::enums::screw_pump_direction::FromWest:
remote_build->set_direction(WEST);
break;
default:
break;
}
}
}
break;
case df::enums::building_type::Construction:
@ -356,7 +420,12 @@ void CopyBuilding(int buildingIndex, RemoteFortressReader::BuildingInstance * re
{
auto actual = strict_virtual_cast<df::building_axle_horizontalst>(local_build);
if (actual)
remote_build->set_direction(actual->is_vertical);
{
if(actual->is_vertical)
remote_build->set_direction(NORTH);
else
remote_build->set_direction(EAST);
}
}
break;
case df::enums::building_type::AxleVertical:
@ -365,14 +434,30 @@ void CopyBuilding(int buildingIndex, RemoteFortressReader::BuildingInstance * re
{
auto actual = strict_virtual_cast<df::building_water_wheelst>(local_build);
if (actual)
remote_build->set_direction(actual->is_vertical);
{
if (actual->is_vertical)
remote_build->set_direction(NORTH);
else
remote_build->set_direction(EAST);
}
}
break;
case df::enums::building_type::Windmill:
{
auto actual = strict_virtual_cast<df::building_windmillst>(local_build);
if (actual)
remote_build->set_direction(actual->orient_angle);
{
if (actual->orient_x < 0)
remote_build->set_direction(WEST);
else if (actual->orient_x > 0)
remote_build->set_direction(EAST);
else if (actual->orient_y < 0)
remote_build->set_direction(NORTH);
else if (actual->orient_y > 0)
remote_build->set_direction(SOUTH);
else
remote_build->set_direction(WEST);
}
}
break;
case df::enums::building_type::TractionBench:
@ -389,7 +474,26 @@ void CopyBuilding(int buildingIndex, RemoteFortressReader::BuildingInstance * re
{
auto actual = strict_virtual_cast<df::building_rollersst>(local_build);
if (actual)
remote_build->set_direction(actual->direction);
{
auto direction = actual->direction;
switch (direction)
{
case df::enums::screw_pump_direction::FromNorth:
remote_build->set_direction(NORTH);
break;
case df::enums::screw_pump_direction::FromEast:
remote_build->set_direction(EAST);
break;
case df::enums::screw_pump_direction::FromSouth:
remote_build->set_direction(SOUTH);
break;
case df::enums::screw_pump_direction::FromWest:
remote_build->set_direction(WEST);
break;
default:
break;
}
}
}
break;
default: