Added a simple function to get the current sidebar mode in fort mode.

develop
JapaMala 2018-06-24 14:45:57 +05:30
parent dc367f212e
commit 93c3418f97
6 changed files with 87 additions and 0 deletions

@ -0,0 +1,12 @@
syntax = "proto2";
package DwarfControl;
//Attempts to provide a complete framework for reading everything from a fortress needed for vizualization
option optimize_for = LITE_RUNTIME;
import "ui_sidebar_mode.proto";
message SidebarState
{
optional proto.enums.ui_sidebar_mode.ui_sidebar_mode mode = 1;
}

@ -0,0 +1,63 @@
package proto.enums.ui_sidebar_mode;
//Attempts to provide a complete framework for reading everything from a fortress needed for vizualization
option optimize_for = LITE_RUNTIME;
enum ui_sidebar_mode
{
Default = 1;
Squads = 2;
DesignateMine = 3;
DesignateRemoveRamps = 4;
DesignateUpStair = 5;
DesignateDownStair = 6;
DesignateUpDownStair = 7;
DesignateUpRamp = 8;
DesignateChannel = 9;
DesignateGatherPlants = 10;
DesignateRemoveDesignation = 11;
DesignateSmooth = 12;
DesignateCarveTrack = 13;
DesignateEngrave = 14;
DesignateCarveFortification = 15;
Stockpiles = 16;
Build = 17;
QueryBuilding = 18;
Orders = 19;
OrdersForbid = 20;
OrdersRefuse = 21;
OrdersWorkshop = 22;
OrdersZone = 23;
BuildingItems = 24;
ViewUnits = 25;
LookAround = 26;
DesignateItemsClaim = 27;
DesignateItemsForbid = 28;
DesignateItemsMelt = 29;
DesignateItemsUnmelt = 30;
DesignateItemsDump = 31;
DesignateItemsUndump = 32;
DesignateItemsHide = 33;
DesignateItemsUnhide = 34;
DesignateChopTrees = 35;
DesignateToggleEngravings = 36;
DesignateToggleMarker = 37;
Hotkeys = 38;
DesignateTrafficHigh = 39;
DesignateTrafficNormal = 40;
DesignateTrafficLow = 41;
DesignateTrafficRestricted = 42;
Zones = 43;
ZonesPenInfo = 44;
ZonesPitInfo = 45;
ZonesHospitalInfo = 46;
ZonesGatherInfo = 47;
DesignateRemoveConstruction = 48;
DepotAccess = 49;
NotesPoints = 50;
NotesRoutes = 51;
Burrows = 52;
Hauling = 53;
ArenaWeather = 54;
ArenaTrees = 55;
}

@ -20,6 +20,8 @@ SET(PROJECT_PROTO
${CMAKE_CURRENT_SOURCE_DIR}/../proto/RemoteFortressReader.pb.cc
${CMAKE_CURRENT_SOURCE_DIR}/../proto/AdventureControl.pb.cc
${CMAKE_CURRENT_SOURCE_DIR}/../proto/ItemdefInstrument.pb.cc
${CMAKE_CURRENT_SOURCE_DIR}/../proto/DwarfControl.pb.cc
${CMAKE_CURRENT_SOURCE_DIR}/../proto/ui_sidebar_mode.pb.cc
)
SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE)

@ -4,6 +4,7 @@
#include "df/job.h"
#include "df/job_list_link.h"
#include "df/ui.h"
#include "df/world.h"
#include "modules/Buildings.h"
@ -15,6 +16,7 @@
using namespace DFHack;
using namespace RemoteFortressReader;
command_result SendDigCommand(color_ostream &stream, const DigCommand *in)
{
MapExtras::MapCache mc;
@ -99,3 +101,8 @@ command_result SetPauseState(color_ostream &stream, const SingleBool *in)
DFHack::World::SetPauseState(in->value());
return CR_OK;
}
command_result GetSideMenu(DFHack::color_ostream &stream, const dfproto::EmptyMessage *in, DwarfControl::SidebarState *out)
{
out->set_mode((proto::enums::ui_sidebar_mode::ui_sidebar_mode)df::global::ui->main.mode);
}

@ -3,9 +3,11 @@
#include "RemoteClient.h"
#include "RemoteFortressReader.pb.h"
#include "DwarfControl.pb.h"
DFHack::command_result SendDigCommand(DFHack::color_ostream &stream, const RemoteFortressReader::DigCommand *in);
DFHack::command_result SetPauseState(DFHack::color_ostream &stream, const RemoteFortressReader::SingleBool *in);
DFHack::command_result GetSideMenu(DFHack::color_ostream &stream, const dfproto::EmptyMessage *in, DwarfControl::SidebarState *out);
#endif // !DWARF_CONTROL_H

@ -328,6 +328,7 @@ DFhackCExport RPCService *plugin_rpcconnect(color_ostream &)
svc->addFunction("MovementSelectCommand", MovementSelectCommand, SF_ALLOW_REMOTE);
svc->addFunction("MiscMoveCommand", MiscMoveCommand, SF_ALLOW_REMOTE);
svc->addFunction("GetLanguage", GetLanguage, SF_ALLOW_REMOTE);
svc->addFunction("GetSideMenu", GetSideMenu, SF_ALLOW_REMOTE);
return svc;
}