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

develop
lethosor 2015-09-06 16:24:05 -04:00
commit fa9a851eb0
3 changed files with 21 additions and 6 deletions

@ -3252,7 +3252,7 @@ on DF world events.
List of events List of events
-------------- --------------
1. ``onReactionComplete(reaction,unit,input_items,input_reagents,output_items,call_native)`` 1. ``onReactionComplete(reaction,reaction_product,unit,input_items,input_reagents,output_items,call_native)``
Auto activates if detects reactions starting with ``LUA_HOOK_``. Is called when reaction finishes. Auto activates if detects reactions starting with ``LUA_HOOK_``. Is called when reaction finishes.

@ -178,6 +178,11 @@ message UnitDefinition
optional int32 pos_y = 4; optional int32 pos_y = 4;
optional int32 pos_z = 5; optional int32 pos_z = 5;
optional MatPair race = 6; optional MatPair race = 6;
optional ColorDefinition profession_color = 7;
optional uint32 flags1 = 8;
optional uint32 flags2 = 9;
optional uint32 flags3 = 10;
} }
message UnitList message UnitList

@ -57,6 +57,7 @@
#include "modules/Translation.h" #include "modules/Translation.h"
#include "modules/Items.h" #include "modules/Items.h"
#include "modules/Buildings.h" #include "modules/Buildings.h"
#include "modules/Units.h"
#include "TileTypes.h" #include "TileTypes.h"
#include "MiscUtils.h" #include "MiscUtils.h"
@ -179,20 +180,25 @@ uint16_t fletcher16(uint8_t const *data, size_t bytes)
return sum2 << 8 | sum1; 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) if (!df::global::enabler)
return; return;
auto enabler = df::global::enabler; auto enabler = df::global::enabler;
int index = in[0] + 8 * in[1];
out->set_red((int)(enabler->ccolor[index][0] * 255)); out->set_red((int)(enabler->ccolor[index][0] * 255));
out->set_green((int)(enabler->ccolor[index][1] * 255)); out->set_green((int)(enabler->ccolor[index][1] * 255));
out->set_blue((int)(enabler->ccolor[index][2] * 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) RemoteFortressReader::TiletypeMaterial TranslateMaterial(df::tiletype_material material)
{ {
switch (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->set_pos_z(unit->pos.z);
send_unit->mutable_race()->set_mat_type(unit->race); send_unit->mutable_race()->set_mat_type(unit->race);
send_unit->mutable_race()->set_mat_index(unit->caste); 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; return CR_OK;
} }