send item imrpovements

develop
Japa 2018-01-19 08:25:16 +05:30
parent a63347cf7a
commit 58bef276de
3 changed files with 24 additions and 5 deletions

@ -907,8 +907,8 @@ enum ImprovementType
message ItemImprovement message ItemImprovement
{ {
optional MatPair mat_type = 1; optional MatPair material = 1;
optional ImprovementType type = 2; optional ImprovementType type = 2;
optional int32 shape = 3; optional int32 shape = 3;
optional int32 specific_type= 4;
} }

@ -8,6 +8,9 @@
#include "df/item_toolst.h" #include "df/item_toolst.h"
#include "df/item_smallgemst.h" #include "df/item_smallgemst.h"
#include "df/itemimprovement.h" #include "df/itemimprovement.h"
#include "df/itemimprovement_bandsst.h"
#include "df/itemimprovement_coveredst.h"
#include "df/itemimprovement_itemspecificst.h"
#include "df/itemimprovement_threadst.h" #include "df/itemimprovement_threadst.h"
#include "df/itemdef.h" #include "df/itemdef.h"
#include "df/map_block.h" #include "df/map_block.h"
@ -287,22 +290,38 @@ void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem)
improvement_type::improvement_type impType = improvement->getType(); improvement_type::improvement_type impType = improvement->getType();
auto netImp = NetItem->add_improvements();
netImp->set_type((ImprovementType)impType);
auto mat = netImp->mutable_material();
mat->set_mat_type(improvement->mat_type);
mat->set_mat_index(improvement->mat_index);
switch (impType) switch (impType)
{ {
case df::enums::improvement_type::ART_IMAGE: case df::enums::improvement_type::ART_IMAGE:
break; break;
case df::enums::improvement_type::COVERED: case df::enums::improvement_type::COVERED:
{ {
VIRTUAL_CAST_VAR(covered, df::itemimprovement_coveredst, improvement);
netImp->set_shape(covered->shape);
break; break;
} }
case df::enums::improvement_type::RINGS_HANGING: case df::enums::improvement_type::RINGS_HANGING:
break; break;
case df::enums::improvement_type::BANDS: case df::enums::improvement_type::BANDS:
{
VIRTUAL_CAST_VAR(bands, df::itemimprovement_bandsst, improvement);
netImp->set_shape(bands->shape);
break; break;
case df::enums::improvement_type::SPIKES: }
break;
case df::enums::improvement_type::ITEMSPECIFIC: case df::enums::improvement_type::ITEMSPECIFIC:
{
VIRTUAL_CAST_VAR(specific, df::itemimprovement_itemspecificst, improvement);
netImp->set_specific_type(specific->type);
break; break;
}
case df::enums::improvement_type::THREAD: case df::enums::improvement_type::THREAD:
{ {
VIRTUAL_CAST_VAR(improvement_thread, df::itemimprovement_threadst, improvement); VIRTUAL_CAST_VAR(improvement_thread, df::itemimprovement_threadst, improvement);

@ -15,7 +15,7 @@ namespace df
namespace MapExtras namespace MapExtras
{ {
struct MapCache; class MapCache;
} }
DFHack::command_result GetItemList(DFHack::color_ostream &stream, const DFHack::EmptyMessage *in, RemoteFortressReader::MaterialList *out); DFHack::command_result GetItemList(DFHack::color_ostream &stream, const DFHack::EmptyMessage *in, RemoteFortressReader::MaterialList *out);