Skip to main content

Module map

Module map 

Source
Expand description

anvil-map.modes: map modes of the plugin’s own, each a button on the minimap’s list, a colour for each province and lines in the province’s tooltip (anvil_map.h).

Depend on anvil-map in plugin.toml ([[dependencies]] id = "anvil-map", version = "^1") and look the service up with MapModes::get. A mode changes nothing in the game’s state, so it needs no affects_gameplay = true.

The game paints the map and builds tooltips also in frames drawn inside a game update, where World may not be read. So the plugin computes its colours in a step of its own (SHOWN, a game event) and hands them over with MapModes::set_colors; the map shows the last buffer. Text is UTF-8; anvil-map writes it in the game’s encoding and shows it as written.

Structs§

MapModes
The anvil-map.modes service.
Mode
A registered mode; anvil-map keeps it until the process ends.
ModeChange
The payload of SHOWN and HIDDEN.
ModeInfo
What MapModes::register takes. The strings are copied.

Enums§

Tab
The tab of the minimap’s list where the mode’s button goes, named by the game’s modes it starts with. The buttons of the tabs stand two by two: political and diplomacy above, trade and terrain below.

Constants§

HIDDEN
anvil-map.hidden: a plugin mode stopped being the map mode shown (also at the end of a session). Published before shown of the next one.
LEGEND_MAX
The most entries a legend holds (MapModes::set_legend).
NO_COLOR
The colour that leaves a province as the political map mode shows it (sea, wasteland and empty land look as players know them).
SERVICE
The service’s name.
SHOWN
anvil-map.shown: a plugin mode became the map mode shown. On the main thread after a frame of the main loop, where World may be read.
VERSION
The service’s major version.

Functions§

rgb
A colour, 0x00RRGGBB.