Add careful movement type to proto. Not used yet.

develop
Japa Mala Illo 2017-12-26 12:34:46 +05:30
parent f5fc7fe1a1
commit e9e5113ff7
4 changed files with 86 additions and 49 deletions

@ -56,6 +56,23 @@ enum AdvmodeMenu
Build = 46;
}
enum CarefulMovementType
{
DEFAULT_MOVEMENT = 0;
RELEASE_ITEM_HOLD = 1;
RELEASE_TILE_HOLD = 2;
ATTACK_CREATURE = 3;
HOLD_TILE = 4;
MOVE = 5;
CLIMB = 6;
HOLD_ITEM = 7;
BUILDING_INTERACT = 8;
ITEM_INTERACT = 9;
ITEM_INTERACT_GUIDE = 10;
ITEM_INTERACT_RIDE = 11;
ITEM_INTERACT_PUSH = 12;
}
message MoveCommandParams
{
optional RemoteFortressReader.Coord direction = 1;
@ -66,6 +83,7 @@ message MovementOption
optional RemoteFortressReader.Coord dest = 1;
optional RemoteFortressReader.Coord source = 2;
optional RemoteFortressReader.Coord grab = 3;
optional CarefulMovementType movement_type = 4;
}
message MenuContents

@ -188,6 +188,7 @@ command_result MoveCommand(DFHack::color_ostream &stream, const MoveCommandParam
}
return CR_OK;
}
command_result JumpCommand(DFHack::color_ostream &stream, const MoveCommandParams *in)
{
if (!in->has_direction())
@ -262,3 +263,18 @@ command_result MenuQuery(DFHack::color_ostream &stream, const EmptyMessage *in,
return CR_OK;
}
command_result MovementSelectCommand(DFHack::color_ostream &stream, const dfproto::IntMessage *in)
{
if (!(df::global::ui_advmode->menu == ui_advmode_menu::MoveCarefully))
return CR_OK;
int choice = in->value();
int page = choice / 5;
int select = choice % 5;
for (int i = 0; i < page; i++)
{
keyQueue.push(interface_key::SECONDSCROLL_PAGEDOWN);
}
keyQueue.push((interface_key::interface_key)(interface_key::OPTION1 + select));
return CR_OK;
}

@ -7,6 +7,8 @@
DFHack::command_result MoveCommand(DFHack::color_ostream &stream, const AdventureControl::MoveCommandParams *in);
DFHack::command_result JumpCommand(DFHack::color_ostream &stream, const AdventureControl::MoveCommandParams *in);
DFHack::command_result MenuQuery(DFHack::color_ostream &stream, const dfproto::EmptyMessage *in, AdventureControl::MenuContents *out);
DFHack::command_result MovementSelectCommand(DFHack::color_ostream &stream, const dfproto::IntMessage *in);
void KeyUpdate();

@ -294,6 +294,7 @@ DFhackCExport RPCService *plugin_rpcconnect(color_ostream &)
svc->addFunction("MoveCommand", MoveCommand, SF_ALLOW_REMOTE);
svc->addFunction("JumpCommand", JumpCommand, SF_ALLOW_REMOTE);
svc->addFunction("MenuQuery", MenuQuery, SF_ALLOW_REMOTE);
svc->addFunction("MovementSelectCommand", MovementSelectCommand, SF_ALLOW_REMOTE);
return svc;
}