@ -39,279 +39,279 @@ void SetCoord(df::coord in, RemoteFortressReader::Coord *out)
command_result MoveCommand ( DFHack : : color_ostream & stream , const MoveCommandParams * in )
command_result MoveCommand ( DFHack : : color_ostream & stream , const MoveCommandParams * in )
{
{
auto viewScreen = getCurViewscreen ( ) ;
//auto viewScreen = getCurViewscreen();
if ( ! in - > has_direction ( ) )
//if (!in->has_direction())
return CR_WRONG_USAGE ;
// return CR_WRONG_USAGE;
if ( ! df : : global : : ui_advmode - > menu = = ui_advmode_menu : : Default )
//if (!df::global::ui_advmode->menu == ui_advmode_menu::Default)
return CR_OK ;
// return CR_OK;
auto dir = in - > direction ( ) ;
//auto dir = in->direction();
switch ( dir . x ( ) )
//switch (dir.x())
{
//{
case - 1 :
//case -1:
switch ( dir . y ( ) )
// switch (dir.y())
{
// {
case - 1 :
// case -1:
switch ( dir . z ( ) )
// switch (dir.z())
{
// {
case - 1 :
// case -1:
viewScreen - > feed_key ( interface_key : : A_MOVE_NW_DOWN ) ;
// viewScreen->feed_key(interface_key::A_MOVE_NW_DOWN);
break ;
// break;
case 0 :
// case 0:
viewScreen - > feed_key ( interface_key : : A_MOVE_NW ) ;
// viewScreen->feed_key(interface_key::A_MOVE_NW);
break ;
// break;
case 1 :
// case 1:
viewScreen - > feed_key ( interface_key : : A_MOVE_NW_UP ) ;
// viewScreen->feed_key(interface_key::A_MOVE_NW_UP);
break ;
// break;
}
// }
break ;
// break;
case 0 :
// case 0:
switch ( dir . z ( ) )
// switch (dir.z())
{
// {
case - 1 :
// case -1:
viewScreen - > feed_key ( interface_key : : A_MOVE_W_DOWN ) ;
// viewScreen->feed_key(interface_key::A_MOVE_W_DOWN);
break ;
// break;
case 0 :
// case 0:
viewScreen - > feed_key ( interface_key : : A_MOVE_W ) ;
// viewScreen->feed_key(interface_key::A_MOVE_W);
break ;
// break;
case 1 :
// case 1:
viewScreen - > feed_key ( interface_key : : A_MOVE_W_UP ) ;
// viewScreen->feed_key(interface_key::A_MOVE_W_UP);
break ;
// break;
}
// }
break ;
// break;
case 1 :
// case 1:
switch ( dir . z ( ) )
// switch (dir.z())
{
// {
case - 1 :
// case -1:
viewScreen - > feed_key ( interface_key : : A_MOVE_SW_DOWN ) ;
// viewScreen->feed_key(interface_key::A_MOVE_SW_DOWN);
break ;
// break;
case 0 :
// case 0:
viewScreen - > feed_key ( interface_key : : A_MOVE_SW ) ;
// viewScreen->feed_key(interface_key::A_MOVE_SW);
break ;
// break;
case 1 :
// case 1:
viewScreen - > feed_key ( interface_key : : A_MOVE_SW_UP ) ;
// viewScreen->feed_key(interface_key::A_MOVE_SW_UP);
break ;
// break;
}
// }
break ;
// break;
}
// }
break ;
// break;
case 0 :
//case 0:
switch ( dir . y ( ) )
// switch (dir.y())
{
// {
case - 1 :
// case -1:
switch ( dir . z ( ) )
// switch (dir.z())
{
// {
case - 1 :
// case -1:
viewScreen - > feed_key ( interface_key : : A_MOVE_N_DOWN ) ;
// viewScreen->feed_key(interface_key::A_MOVE_N_DOWN);
break ;
// break;
case 0 :
// case 0:
viewScreen - > feed_key ( interface_key : : A_MOVE_N ) ;
// viewScreen->feed_key(interface_key::A_MOVE_N);
break ;
// break;
case 1 :
// case 1:
viewScreen - > feed_key ( interface_key : : A_MOVE_N_UP ) ;
// viewScreen->feed_key(interface_key::A_MOVE_N_UP);
break ;
// break;
}
// }
break ;
// break;
case 0 :
// case 0:
switch ( dir . z ( ) )
// switch (dir.z())
{
// {
case - 1 :
// case -1:
viewScreen - > feed_key ( interface_key : : A_MOVE_DOWN ) ;
// viewScreen->feed_key(interface_key::A_MOVE_DOWN);
break ;
// break;
case 1 :
// case 1:
viewScreen - > feed_key ( interface_key : : A_MOVE_UP ) ;
// viewScreen->feed_key(interface_key::A_MOVE_UP);
break ;
// break;
}
// }
break ;
// break;
case 1 :
// case 1:
switch ( dir . z ( ) )
// switch (dir.z())
{
// {
case - 1 :
// case -1:
viewScreen - > feed_key ( interface_key : : A_MOVE_S_DOWN ) ;
// viewScreen->feed_key(interface_key::A_MOVE_S_DOWN);
break ;
// break;
case 0 :
// case 0:
viewScreen - > feed_key ( interface_key : : A_MOVE_S ) ;
// viewScreen->feed_key(interface_key::A_MOVE_S);
break ;
// break;
case 1 :
// case 1:
viewScreen - > feed_key ( interface_key : : A_MOVE_S_UP ) ;
// viewScreen->feed_key(interface_key::A_MOVE_S_UP);
break ;
// break;
}
// }
break ;
// break;
}
// }
break ;
// break;
case 1 :
//case 1:
switch ( dir . y ( ) )
// switch (dir.y())
{
// {
case - 1 :
// case -1:
switch ( dir . z ( ) )
// switch (dir.z())
{
// {
case - 1 :
// case -1:
viewScreen - > feed_key ( interface_key : : A_MOVE_NE_DOWN ) ;
// viewScreen->feed_key(interface_key::A_MOVE_NE_DOWN);
break ;
// break;
case 0 :
// case 0:
viewScreen - > feed_key ( interface_key : : A_MOVE_NE ) ;
// viewScreen->feed_key(interface_key::A_MOVE_NE);
break ;
// break;
case 1 :
// case 1:
viewScreen - > feed_key ( interface_key : : A_MOVE_NE_UP ) ;
// viewScreen->feed_key(interface_key::A_MOVE_NE_UP);
break ;
// break;
}
// }
break ;
// break;
case 0 :
// case 0:
switch ( dir . z ( ) )
// switch (dir.z())
{
// {
case - 1 :
// case -1:
viewScreen - > feed_key ( interface_key : : A_MOVE_E_DOWN ) ;
// viewScreen->feed_key(interface_key::A_MOVE_E_DOWN);
break ;
// break;
case 0 :
// case 0:
viewScreen - > feed_key ( interface_key : : A_MOVE_E ) ;
// viewScreen->feed_key(interface_key::A_MOVE_E);
break ;
// break;
case 1 :
// case 1:
viewScreen - > feed_key ( interface_key : : A_MOVE_E_UP ) ;
// viewScreen->feed_key(interface_key::A_MOVE_E_UP);
break ;
// break;
}
// }
break ;
// break;
case 1 :
// case 1:
switch ( dir . z ( ) )
// switch (dir.z())
{
// {
case - 1 :
// case -1:
viewScreen - > feed_key ( interface_key : : A_MOVE_SE_DOWN ) ;
// viewScreen->feed_key(interface_key::A_MOVE_SE_DOWN);
break ;
// break;
case 0 :
// case 0:
viewScreen - > feed_key ( interface_key : : A_MOVE_SE ) ;
// viewScreen->feed_key(interface_key::A_MOVE_SE);
break ;
// break;
case 1 :
// case 1:
viewScreen - > feed_key ( interface_key : : A_MOVE_SE_UP ) ;
// viewScreen->feed_key(interface_key::A_MOVE_SE_UP);
break ;
// break;
}
// }
break ;
// break;
}
// }
break ;
// break;
}
//}
return CR_OK ;
return CR_OK ;
}
}
command_result JumpCommand ( DFHack : : color_ostream & stream , const MoveCommandParams * in )
command_result JumpCommand ( DFHack : : color_ostream & stream , const MoveCommandParams * in )
{
{
if ( ! in - > has_direction ( ) )
//if (!in->has_direction())
return CR_WRONG_USAGE ;
// return CR_WRONG_USAGE;
if ( ! df : : global : : ui_advmode - > menu = = ui_advmode_menu : : Default )
//if (!df::global::ui_advmode->menu == ui_advmode_menu::Default)
return CR_OK ;
// return CR_OK;
auto dir = in - > direction ( ) ;
//auto dir = in->direction();
keyQueue . push ( interface_key : : A_JUMP ) ;
//keyQueue.push(interface_key::A_JUMP);
int x = dir . x ( ) ;
//int x = dir.x();
int y = dir . y ( ) ;
//int y = dir.y();
if ( x > 0 )
//if (x > 0)
{
//{
for ( int i = 0 ; i < x ; i + + )
// for (int i = 0; i < x; i++)
{
// {
keyQueue . push ( interface_key : : CURSOR_RIGHT ) ;
// keyQueue.push(interface_key::CURSOR_RIGHT);
}
// }
}
//}
if ( x < 0 )
//if (x < 0)
{
//{
for ( int i = 0 ; i > x ; i - - )
// for (int i = 0; i > x; i--)
{
// {
keyQueue . push ( interface_key : : CURSOR_LEFT ) ;
// keyQueue.push(interface_key::CURSOR_LEFT);
}
// }
}
//}
if ( y > 0 )
//if (y > 0)
{
//{
for ( int i = 0 ; i < y ; i + + )
// for (int i = 0; i < y; i++)
{
// {
keyQueue . push ( interface_key : : CURSOR_DOWN ) ;
// keyQueue.push(interface_key::CURSOR_DOWN);
}
// }
}
//}
if ( y < 0 )
//if (y < 0)
{
//{
for ( int i = 0 ; i > y ; i - - )
// for (int i = 0; i > y; i--)
{
// {
keyQueue . push ( interface_key : : CURSOR_UP ) ;
// keyQueue.push(interface_key::CURSOR_UP);
}
// }
}
//}
keyQueue . push ( interface_key : : SELECT ) ;
//keyQueue.push(interface_key::SELECT);
return CR_OK ;
return CR_OK ;
}
}
command_result MenuQuery ( DFHack : : color_ostream & stream , const EmptyMessage * in , MenuContents * out )
command_result MenuQuery ( DFHack : : color_ostream & stream , const EmptyMessage * in , MenuContents * out )
{
{
auto advUi = df : : global : : ui_advmode ;
//auto advUi = df::global::ui_advmode;
if ( advUi = = NULL )
//if (advUi == NULL)
return CR_FAILURE ;
// return CR_FAILURE;
out - > set_current_menu ( ( AdvmodeMenu ) advUi - > menu ) ;
//out->set_current_menu((AdvmodeMenu)advUi->menu);
// Fixme: Needs a proper way to control it, but for now, this is the only way to allow Armok Vision to keep going without the user needing to switch to DF.
// // Fixme: Needs a proper way to control it, but for now, this is the only way to allow Armok Vision to keep going without the user needing to switch to DF.
if ( advUi - > menu = = ui_advmode_menu : : FallAction )
//if (advUi->menu == ui_advmode_menu::FallAction)
{
//{
getCurViewscreen ( ) - > feed_key ( interface_key : : OPTION1 ) ;
// getCurViewscreen()->feed_key(interface_key::OPTION1);
}
//}
switch ( advUi - > menu )
//switch (advUi->menu)
{
//{
case ui_advmode_menu : : MoveCarefully :
//case ui_advmode_menu::MoveCarefully:
for ( size_t i = 0 ; i < advUi - > movements . size ( ) ; i + + )
// for (size_t i = 0; i < advUi->movements.size(); i++)
{
// {
auto movement = advUi - > movements [ i ] ;
// auto movement = advUi->movements[i];
auto send_movement = out - > add_movements ( ) ;
// auto send_movement = out->add_movements();
SetCoord ( movement - > source , send_movement - > mutable_source ( ) ) ;
// SetCoord(movement->source, send_movement->mutable_source());
SetCoord ( movement - > dest , send_movement - > mutable_dest ( ) ) ;
// SetCoord(movement->dest, send_movement->mutable_dest());
STRICT_VIRTUAL_CAST_VAR ( climbMovement , df : : adventure_movement_climbst , movement ) ;
// STRICT_VIRTUAL_CAST_VAR(climbMovement, df::adventure_movement_climbst, movement);
if ( climbMovement )
// if (climbMovement)
{
// {
SetCoord ( climbMovement - > grab , send_movement - > mutable_grab ( ) ) ;
// SetCoord(climbMovement->grab, send_movement->mutable_grab());
send_movement - > set_movement_type ( CarefulMovementType : : CLIMB ) ;
// send_movement->set_movement_type(CarefulMovementType::CLIMB);
}
// }
STRICT_VIRTUAL_CAST_VAR ( holdTileMovement , df : : adventure_movement_hold_tilest , movement ) ;
// STRICT_VIRTUAL_CAST_VAR(holdTileMovement, df::adventure_movement_hold_tilest, movement);
if ( holdTileMovement )
// if (holdTileMovement)
{
// {
SetCoord ( holdTileMovement - > grab , send_movement - > mutable_grab ( ) ) ;
// SetCoord(holdTileMovement->grab, send_movement->mutable_grab());
send_movement - > set_movement_type ( CarefulMovementType : : HOLD_TILE ) ;
// send_movement->set_movement_type(CarefulMovementType::HOLD_TILE);
}
// }
}
// }
default :
//default:
break ;
// break;
}
//}
return CR_OK ;
return CR_OK ;
}
}
command_result MovementSelectCommand ( DFHack : : color_ostream & stream , const dfproto : : IntMessage * in )
command_result MovementSelectCommand ( DFHack : : color_ostream & stream , const dfproto : : IntMessage * in )
{
{
if ( ! ( df : : global : : ui_advmode - > menu = = ui_advmode_menu : : MoveCarefully ) )
//if (!(df::global::ui_advmode->menu == ui_advmode_menu::MoveCarefully))
return CR_OK ;
// return CR_OK;
int choice = in - > value ( ) ;
//int choice = in->value();
int page = choice / 5 ;
//int page = choice / 5;
int select = choice % 5 ;
//int select = choice % 5;
for ( int i = 0 ; i < page ; i + + )
//for (int i = 0; i < page; i++)
{
//{
keyQueue . push ( interface_key : : SECONDSCROLL_PAGEDOWN ) ;
// keyQueue.push(interface_key::SECONDSCROLL_PAGEDOWN);
}
//}
keyQueue . push ( ( interface_key : : interface_key ) ( interface_key : : OPTION1 + select ) ) ;
//keyQueue.push((interface_key::interface_key)(interface_key::OPTION1 + select));
return CR_OK ;
return CR_OK ;
}
}
command_result MiscMoveCommand ( DFHack : : color_ostream & stream , const MiscMoveParams * in )
command_result MiscMoveCommand ( DFHack : : color_ostream & stream , const MiscMoveParams * in )
{
{
if ( ! df : : global : : ui_advmode - > menu = = ui_advmode_menu : : Default )
//if (!df::global::ui_advmode->menu == ui_advmode_menu::Default)
return CR_OK ;
// return CR_OK;
auto type = in - > type ( ) ;
//auto type = in->type();
switch ( type )
//switch (type)
{
//{
case AdventureControl : : SET_CLIMB :
//case AdventureControl::SET_CLIMB:
getCurViewscreen ( ) - > feed_key ( interface_key : : A_HOLD ) ;
// getCurViewscreen()->feed_key(interface_key::A_HOLD);
break ;
// break;
case AdventureControl : : SET_STAND :
//case AdventureControl::SET_STAND:
getCurViewscreen ( ) - > feed_key ( interface_key : : A_STANCE ) ;
// getCurViewscreen()->feed_key(interface_key::A_STANCE);
break ;
// break;
case AdventureControl : : SET_CANCEL :
//case AdventureControl::SET_CANCEL:
getCurViewscreen ( ) - > feed_key ( interface_key : : LEAVESCREEN ) ;
// getCurViewscreen()->feed_key(interface_key::LEAVESCREEN);
break ;
// break;
default :
//default:
break ;
// break;
}
//}
return CR_OK ;
return CR_OK ;
}
}