From 09bc1c3169336f85155aca12454a65edc0d5b52b Mon Sep 17 00:00:00 2001 From: Japa Date: Wed, 14 Mar 2018 16:08:37 +0530 Subject: [PATCH] add ocean waves to RFR --- plugins/proto/RemoteFortressReader.proto | 7 +++++++ .../remotefortressreader.cpp | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/plugins/proto/RemoteFortressReader.proto b/plugins/proto/RemoteFortressReader.proto index 0b4ce1ac7..3298d42fb 100644 --- a/plugins/proto/RemoteFortressReader.proto +++ b/plugins/proto/RemoteFortressReader.proto @@ -439,6 +439,7 @@ message BlockList optional int32 map_x = 2; optional int32 map_y = 3; repeated Engraving engravings = 4; + repeated Wave ocean_waves = 5; } message PlantDef @@ -1062,3 +1063,9 @@ message FlowInfo optional MatPair material = 9; optional MatPair item = 10; } + +message Wave +{ + optional Coord dest = 1; + optional Coord pos = 2; +} \ No newline at end of file diff --git a/plugins/remotefortressreader/remotefortressreader.cpp b/plugins/remotefortressreader/remotefortressreader.cpp index eea2902f0..d30b0a67e 100644 --- a/plugins/remotefortressreader/remotefortressreader.cpp +++ b/plugins/remotefortressreader/remotefortressreader.cpp @@ -72,6 +72,7 @@ #include "df/material_vec_ref.h" #include "df/matter_state.h" #include "df/mental_attribute_type.h" +#include "df/ocean_wave.h" #include "df/physical_attribute_type.h" #include "df/plant.h" #include "df/plant_raw_flags.h" @@ -400,6 +401,14 @@ void ConvertDFCoord(DFCoord in, RemoteFortressReader::Coord * out) out->set_z(in.z); } +void ConvertDFCoord(int x, int y, int z, RemoteFortressReader::Coord * out) +{ + out->set_x(x); + out->set_y(y); + out->set_z(z); +} + + RemoteFortressReader::TiletypeMaterial TranslateMaterial(df::tiletype_material material) { switch (material) @@ -1607,6 +1616,13 @@ static command_result GetBlockList(color_ostream &stream, const BlockRequest *in netEngraving->set_southwest(engraving->flags.bits.southwest); netEngraving->set_southeast(engraving->flags.bits.southeast); } + for (int i = 0; i < world->ocean_waves.size(); i++) + { + auto wave = world->ocean_waves[i]; + auto netWave = out->add_ocean_waves(); + ConvertDFCoord(wave->x1, wave->y1, wave->z, netWave->mutable_dest()); + ConvertDFCoord(wave->x2, wave->y2, wave->z, netWave->mutable_pos()); + } MC.trash(); return CR_OK; }