diff options
| author | Will Rogers | 2012-04-10 20:41:54 -0400 |
|---|---|---|
| committer | Will Rogers | 2012-04-10 20:41:54 -0400 |
| commit | 6cf8220f28001c9b044cf7dc2717c882fe2d2ecc (patch) | |
| tree | 3fe448549ab561ab82802fb03bc7f8d5e43edb8c /library/RemoteTools.cpp | |
| parent | 585de77489f8325fc40807723017fb52e1618a62 (diff) | |
| download | dfhack-6cf8220f28001c9b044cf7dc2717c882fe2d2ecc.tar.gz dfhack-6cf8220f28001c9b044cf7dc2717c882fe2d2ecc.tar.bz2 dfhack-6cf8220f28001c9b044cf7dc2717c882fe2d2ecc.tar.xz | |
Add SetUnitLabors protobuf API.
Diffstat (limited to 'library/RemoteTools.cpp')
| -rw-r--r-- | library/RemoteTools.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/library/RemoteTools.cpp b/library/RemoteTools.cpp index 00344d6a..7f86134b 100644 --- a/library/RemoteTools.cpp +++ b/library/RemoteTools.cpp @@ -614,6 +614,20 @@ static command_result ListSquads(color_ostream &stream, return CR_OK; } +static command_result SetUnitLabors(color_ostream &stream, const SetUnitLaborsIn *in) +{ + for (size_t i = 0; i < in->change_size(); i++) + { + auto change = in->change(i); + auto unit = df::unit::find(change.unit_id()); + + if (unit) + unit->status.labors[change.labor()] = change.value(); + } + + return CR_OK; +} + CoreService::CoreService() { suspend_depth = 0; @@ -637,6 +651,8 @@ CoreService::CoreService() { addFunction("ListMaterials", ListMaterials, SF_CALLED_ONCE); addFunction("ListUnits", ListUnits); addFunction("ListSquads", ListSquads); + + addFunction("SetUnitLabors", SetUnitLabors); } CoreService::~CoreService() |
