add ocean waves to RFR

develop
Japa 2018-03-14 16:08:37 +05:30
parent a810960bde
commit 09bc1c3169
2 changed files with 23 additions and 0 deletions

@ -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;
}

@ -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;
}