|
Spellforce-Spell-framework
|
Central bookkeeping for mod errors, warnings and ID conflicts. More...
Classes | |
| struct | RegisteredMod |
| A mod as shown in the in-game mod list. More... | |
Enumerations | |
| enum | ConflictDomain { CONFLICT_SPELL_ID = 0 , CONFLICT_SPELL_EFFECT_ID , CONFLICT_BUILDING_ID , CONFLICT_CAMPAIGN_FOLDER , CONFLICT_CAMPAIGN_NAME , CONFLICT_CAMPAIGN_AVATAR_TYPE , CONFLICT_DOMAIN_COUNT } |
| Namespaces for conflict checking. More... | |
| enum | ModType { MOD_TYPE_FRAMEWORK = 0 , MOD_TYPE_CORE , MOD_TYPE_EXTERNAL } |
| What sort of mod an entry in the mod list is. More... | |
Functions | |
| void | append_mod_error (SFMod *mod, const char *format,...) |
| Appends a line to a mod's error buffer without logging it. | |
| void | report_mod_error (SFMod *mod, const char *format,...) |
| Logs an error, appends it to the mod's error buffer and counts it. | |
| void | report_mod_warning (SFMod *mod, const char *format,...) |
| Logs a warning against a mod at DEBUG_INFO, i.e. always shown. | |
| void | report_mod_warning (SFMod *mod, DebugLevel level, const char *format,...) |
Logs a warning against a mod, shown only at level or more verbose. | |
| void | clear_mod_errors (SFMod *mod) |
| Empties a mod's error buffer. | |
| bool | claim_numeric_id (ConflictDomain domain, uint32_t id, SFMod *mod, uint32_t vanilla_max, const char *id_label) |
| Claims a numeric ID within a domain for a mod. | |
| bool | claim_string_id (ConflictDomain domain, const char *key, SFMod *mod, const char *id_label) |
| Claims a string key within a domain for a mod. Comparison is case-insensitive, since the keys are Windows paths and menu labels. | |
| void | reset_conflict_domain (ConflictDomain domain) |
| Drops every claim in a domain. Intended for reloads and tests. | |
| const char * | get_mod_type_label (ModType type) |
| Tag rendered next to a mod in the list. Empty for external mods. | |
| void | register_mod_for_listing (SFMod *mod, ModType type) |
| Adds a mod to the list rendered by the in-game mod list screen. | |
| const std::list< RegisteredMod > & | get_registered_mods () |
| The mods known to the framework, grouped framework -> core -> external. | |
Central bookkeeping for mod errors, warnings and ID conflicts.
| enum ConflictDomain |
Namespaces for conflict checking.
| Enumerator | |
|---|---|
| CONFLICT_SPELL_ID | |
| CONFLICT_SPELL_EFFECT_ID | |
| CONFLICT_BUILDING_ID | |
| CONFLICT_CAMPAIGN_FOLDER | |
| CONFLICT_CAMPAIGN_NAME | |
| CONFLICT_CAMPAIGN_AVATAR_TYPE | |
| CONFLICT_DOMAIN_COUNT | |
Definition at line 22 of file sf_error_registry.h.
| enum ModType |
What sort of mod an entry in the mod list is.
The order matters: entries are kept grouped by type, lowest first, so the framework always heads the list, core modules follow it, and everything a player dropped in sfsf\ comes after. Within a group, registration order wins.
| Enumerator | |
|---|---|
| MOD_TYPE_FRAMEWORK | The Spellforce Spell Framework itself. |
| MOD_TYPE_CORE | Shipped with the framework, e.g. the Custom Campaign Module. |
| MOD_TYPE_EXTERNAL | A third party .sfm loaded from sfsf. |
Definition at line 40 of file sf_error_registry.h.
| void append_mod_error | ( | SFMod * | mod, |
| const char * | format, | ||
| ... ) |
Appends a line to a mod's error buffer without logging it.
Used when the log message and the player-facing message need to differ, or when the message belongs to a different mod than the one being processed. The buffer is bounded; once full, further appends are dropped.
Definition at line 46 of file sf_error_registry.cpp.

| bool claim_numeric_id | ( | ConflictDomain | domain, |
| uint32_t | id, | ||
| SFMod * | mod, | ||
| uint32_t | vanilla_max, | ||
| const char * | id_label ) |
Claims a numeric ID within a domain for a mod.
| domain | Which namespace to claim in. |
| id | The ID being claimed. |
| mod | The mod claiming it. |
| vanilla_max | IDs below this are engine-owned: taking one over is reported as a warning rather than a mod conflict. Pass 0 for domains with no vanilla range. |
| id_label | Human readable domain name for the report, e.g. "Spell ID". |
mod becomes the recorded owner, e.g the last mod to register will overtake the claim. Definition at line 114 of file sf_error_registry.cpp.


| bool claim_string_id | ( | ConflictDomain | domain, |
| const char * | key, | ||
| SFMod * | mod, | ||
| const char * | id_label ) |
Claims a string key within a domain for a mod. Comparison is case-insensitive, since the keys are Windows paths and menu labels.
Definition at line 153 of file sf_error_registry.cpp.

| void clear_mod_errors | ( | SFMod * | mod | ) |
Empties a mod's error buffer.
Definition at line 106 of file sf_error_registry.cpp.

| const char * get_mod_type_label | ( | ModType | type | ) |
Tag rendered next to a mod in the list. Empty for external mods.
Definition at line 192 of file sf_error_registry.cpp.

| const std::list< RegisteredMod > & get_registered_mods | ( | ) |
The mods known to the framework, grouped framework -> core -> external.
Ordering is enforced on insertion, so the list is correct no matter what order the subsystems happen to register in.
Definition at line 236 of file sf_error_registry.cpp.

Adds a mod to the list rendered by the in-game mod list screen.
Registration is idempotent. Mods that register no spells (the Custom Campaign Module, for instance) rely on this to be visible at all.
Definition at line 205 of file sf_error_registry.cpp.

| void report_mod_error | ( | SFMod * | mod, |
| const char * | format, | ||
| ... ) |
Logs an error, appends it to the mod's error buffer and counts it.
Definition at line 59 of file sf_error_registry.cpp.

| void report_mod_warning | ( | SFMod * | mod, |
| const char * | format, | ||
| ... ) |
Logs a warning against a mod at DEBUG_INFO, i.e. always shown.
Warnings never touch the mod's error buffer or the error count - they are advisory and must not fail a load.
Definition at line 78 of file sf_error_registry.cpp.


| void report_mod_warning | ( | SFMod * | mod, |
| DebugLevel | level, | ||
| const char * | format, | ||
| ... ) |
Logs a warning against a mod, shown only at level or more verbose.
Used for expected-but-noteworthy events during registration, such as a mod taking over a vanilla ID, which are normal enough that they should not be in the log by default.
Definition at line 92 of file sf_error_registry.cpp.

| void reset_conflict_domain | ( | ConflictDomain | domain | ) |
Drops every claim in a domain. Intended for reloads and tests.
Definition at line 183 of file sf_error_registry.cpp.