docs, rework, rename

develop
20k 2023-01-30 07:11:42 +00:00
parent 3912c6290f
commit d84b118767
6 changed files with 21 additions and 16 deletions

@ -171,6 +171,12 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- ``Screen::Pen``: now accepts ``top_of_text`` and ``bottom_of_text`` properties to support offset text in graphics mode
- `overlay`: overlay widgets can now specify a default enabled state if they are not already set in the player's overlay config file
- ``Lua::Push``: now supports ``std::unordered_map``
- `Military`: New module for military functionality
- `Military`: new ``makeSquad`` to create a squad
- `Military`: changed ``getSquadName`` to take a squad identifier
- `Military`: new ``updateRoomAssignments`` for assigning a squad to a barracks and archery range
- ``Maps::GetBiomeType`` renamed to ``Maps::getBiomeType`` for consistency
- ``Maps::GetBiomeTypeRef`` renamed to ``Maps::getBiomeTypeRef`` for consistency
## Lua
- `helpdb`: new function: ``helpdb.refresh()`` to force a refresh of the database. Call if you are a developer adding new scripts, loading new plugins, or changing help text during play
@ -181,6 +187,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
-@ ``gui.ZScreen``: new attribute: ``defocusable`` for controlling whether a window loses keyboard focus when the map is clicked
- ``widgets.Label``: token ``tile`` properties can now be either pens or numeric texture ids
- `tiletypes`: now has a Lua API! ``tiletypes_setTile``
- ``maps.getBiomeType``: exposed preexisting function to Lua
## Removed
- `autohauler`: no plans to port to v50, as it just doesn't make sense with the new work detail system

@ -1594,16 +1594,16 @@ Military Module API
* ``dfhack.military.makeSquad(assignment_id)``
Creates a new squad associated with the assignment. Fails if one already exists
Note: This function does not name the squad, but they are otherwise complete
Creates a new squad associated with the assignment. Fails if one already exists.
Note: This function does not name the squad, but they are otherwise complete.
* ``dfhack.military.updateRoomAssignments(squad_id, assignment_id, squad_use_flags)``
Sets the sleep, train, indiv_eq, and squad_eq flags when training at a barracks
Sets the sleep, train, indiv_eq, and squad_eq flags when training at a barracks.
* ``dfhack.military.getSquadName(squad)``
* ``dfhack.military.getSquadName(squad_id)``
Returns the name of a squad
Returns the name of a squad/
Action Timer API
~~~~~~~~~~~~~~~~

@ -1940,7 +1940,7 @@ static const luaL_Reg dfhack_units_funcs[] = {
/***** Military Module *****/
static const LuaWrapper::FunctionReg dfhack_military_module[] = {
WRAPM(Military, makeSquad),
WRAPM(Military, makeSquad),
WRAPM(Military, updateRoomAssignments),
WRAPM(Military, getSquadName),
{ NULL, NULL }

@ -10,10 +10,10 @@ namespace DFHack
{
namespace Military
{
DFHACK_EXPORT std::string getSquadName(df::unit *unit);
DFHACK_EXPORT std::string getSquadName(int32_t squad_id);
DFHACK_EXPORT df::squad* makeSquad(int32_t assignment_id);
DFHACK_EXPORT void updateRoomAssignments(int32_t squad_id, int32_t civzone_id, df::squad_use_flags flags);
}
}
}

@ -22,12 +22,9 @@ using namespace df::enums;
using df::global::world;
using df::global::plotinfo;
std::string Military::getSquadName(df::unit *unit)
std::string Military::getSquadName(int32_t squad_id)
{
CHECK_NULL_POINTER(unit);
if (unit->military.squad_id == -1)
return "";
df::squad *squad = df::squad::find(unit->military.squad_id);
df::squad *squad = df::squad::find(squad_id);
if (!squad)
return "";
if (squad->alias.size() > 0)
@ -304,4 +301,4 @@ void Military::updateRoomAssignments(int32_t squad_id, int32_t civzone_id, df::s
}
}
}
}
}

@ -8,6 +8,7 @@
#include <modules/Screen.h>
#include <modules/Translation.h>
#include <modules/Units.h>
#include <modules/Military.h>
#include <modules/Filesystem.h>
#include <modules/Job.h>
#include <vector>
@ -1305,7 +1306,7 @@ void viewscreen_unitlaborsst::refreshNames()
cur->job_mode = UnitInfo::JOB;
}
if (unit->military.squad_id > -1) {
cur->squad_effective_name = Units::getSquadName(unit);
cur->squad_effective_name = Military::getSquadName(unit->military.squad_id);
cur->squad_info = stl_sprintf("%i", unit->military.squad_position + 1) + "." + cur->squad_effective_name;
} else {
cur->squad_effective_name = "";