|
|
|
@ -57,6 +57,7 @@
|
|
|
|
|
#include "modules/Translation.h"
|
|
|
|
|
#include "modules/Items.h"
|
|
|
|
|
#include "modules/Buildings.h"
|
|
|
|
|
#include "modules/Units.h"
|
|
|
|
|
#include "TileTypes.h"
|
|
|
|
|
#include "MiscUtils.h"
|
|
|
|
|
|
|
|
|
@ -179,20 +180,25 @@ uint16_t fletcher16(uint8_t const *data, size_t bytes)
|
|
|
|
|
return sum2 << 8 | sum1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ConvertDfColor(int16_t in[3], RemoteFortressReader::ColorDefinition * out)
|
|
|
|
|
void ConvertDfColor(int16_t index, RemoteFortressReader::ColorDefinition * out)
|
|
|
|
|
{
|
|
|
|
|
if (!df::global::enabler)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
auto enabler = df::global::enabler;
|
|
|
|
|
|
|
|
|
|
int index = in[0] + 8 * in[1];
|
|
|
|
|
|
|
|
|
|
out->set_red((int)(enabler->ccolor[index][0] * 255));
|
|
|
|
|
out->set_green((int)(enabler->ccolor[index][1] * 255));
|
|
|
|
|
out->set_blue((int)(enabler->ccolor[index][2] * 255));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ConvertDfColor(int16_t in[3], RemoteFortressReader::ColorDefinition * out)
|
|
|
|
|
{
|
|
|
|
|
int index = in[0] + 8 * in[1];
|
|
|
|
|
ConvertDfColor(index, out);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RemoteFortressReader::TiletypeMaterial TranslateMaterial(df::tiletype_material material)
|
|
|
|
|
{
|
|
|
|
|
switch (material)
|
|
|
|
@ -955,6 +961,10 @@ static command_result GetUnitList(color_ostream &stream, const EmptyMessage *in,
|
|
|
|
|
send_unit->set_pos_z(unit->pos.z);
|
|
|
|
|
send_unit->mutable_race()->set_mat_type(unit->race);
|
|
|
|
|
send_unit->mutable_race()->set_mat_index(unit->caste);
|
|
|
|
|
ConvertDfColor(Units::getProfessionColor(unit), send_unit->mutable_profession_color());
|
|
|
|
|
send_unit->set_flags1(unit->flags1.whole);
|
|
|
|
|
send_unit->set_flags2(unit->flags2.whole);
|
|
|
|
|
send_unit->set_flags3(unit->flags3.whole);
|
|
|
|
|
}
|
|
|
|
|
return CR_OK;
|
|
|
|
|
}
|
|
|
|
|