Handles a log/journal of the player's playthrough.
More...
#include "shiplog.h"
#include <inttypes.h>
Go to the source code of this file.
|
| static ShipLogEntry * | shiplog_removeEntry (ShipLogEntry *e) |
| | removes an entry from the log
|
| int | shiplog_create (const char *idstr, const char *logname, const char *type, int overwrite, int maxLen) |
| | Creates a new log with given title of given type.
|
| int | shiplog_append (const char *idstr, const char *msg) |
| | Appends to the log file.
|
| int | shiplog_appendByID (int logid, const char *msg) |
| | Adds to the log file.
|
| void | shiplog_delete (int logid) |
| | Deletes a log (e.g. a cancelled mission may wish to do this, or the user might).
|
| void | shiplog_setRemove (int logid, ntime_t when) |
| | Sets the remove flag for a log - it will be removed once time increases, eg after a player takes off.
|
| void | shiplog_deleteType (const char *type) |
| | Deletes all logs of given type.
|
| void | shiplog_clear (void) |
| | Clear the shiplog.
|
| void | shiplog_new (void) |
| | Set up the shiplog.
|
| int | shiplog_save (xmlTextWriterPtr writer) |
| int | shiplog_load (xmlNodePtr parent) |
| | Loads the logfiile.
|
| void | shiplog_listTypes (int *ntypes, char ***logTypes, int includeAll) |
| void | shiplog_listLogsOfType (const char *type, int *nlogs, char ***logsOut, int **logIDs, int includeAll) |
| | Lists matching logs (which haven't expired via "removeAfter") into the provided arrays.
|
| int | shiplog_getIdOfLogOfType (const char *type, int selectedLog) |
| void | shiplog_listLog (int logid, const char *type, int *nentries, char ***logentries, int incempty) |
| | Get all log entries matching logid, or if logid==LOG_ID_ALL, matching type, or if type==NULL, all.
|
| int | shiplog_getID (const char *idstr) |
| | Checks to see if the log family exists.
|
Handles a log/journal of the player's playthrough.
Definition in file shiplog.c.
◆ shiplog_append()
| int shiplog_append |
( |
const char * | idstr, |
|
|
const char * | msg ) |
Appends to the log file.
- Parameters
-
| idstr | of the log to add to |
| msg | Message to be added. |
- Returns
- 0 on success, -1 on failure.
Definition at line 183 of file shiplog.c.
◆ shiplog_appendByID()
| int shiplog_appendByID |
( |
int | logid, |
|
|
const char * | msg ) |
Adds to the log file.
- Parameters
-
| logid | of the log to add to. |
| msg | Message to be added. |
- Returns
- 0 on success, -1 on failure.
Definition at line 211 of file shiplog.c.
◆ shiplog_clear()
| void shiplog_clear |
( |
void | | ) |
|
Clear the shiplog.
Definition at line 367 of file shiplog.c.
◆ shiplog_create()
| int shiplog_create |
( |
const char * | idstr, |
|
|
const char * | logname, |
|
|
const char * | type, |
|
|
int | overwrite, |
|
|
int | maxLen ) |
Creates a new log with given title of given type.
- Parameters
-
| idstr | ID string for this logset, or NULL if an ID string not required. |
| logname | Name of the log (title) |
| type | Type of the log, e.g. travel, shipping, etc |
| overwrite | Whether to overwrite an existing log of this type and logname (if 1), or all logs of this type (if 2). |
| maxLen | Maximum number of entries for this log (longer ones will be purged). |
- Returns
- log ID.
Definition at line 56 of file shiplog.c.
◆ shiplog_delete()
| void shiplog_delete |
( |
int | logid | ) |
|
Deletes a log (e.g. a cancelled mission may wish to do this, or the user might).
- Parameters
-
| logid | of the log to remove, or LOG_ID_ALL |
Definition at line 277 of file shiplog.c.
◆ shiplog_deleteType()
| void shiplog_deleteType |
( |
const char * | type | ) |
|
Deletes all logs of given type.
- Parameters
-
Definition at line 351 of file shiplog.c.
◆ shiplog_getID()
| int shiplog_getID |
( |
const char * | idstr | ) |
|
Checks to see if the log family exists.
- Parameters
-
| idstr | ID string for the log family |
Definition at line 696 of file shiplog.c.
◆ shiplog_getIdOfLogOfType()
| int shiplog_getIdOfLogOfType |
( |
const char * | type, |
|
|
int | selectedLog ) |
◆ shiplog_listLog()
| void shiplog_listLog |
( |
int | logid, |
|
|
const char * | type, |
|
|
int * | nentries, |
|
|
char *** | logentries, |
|
|
int | incempty ) |
Get all log entries matching logid, or if logid==LOG_ID_ALL, matching type, or if type==NULL, all.
Definition at line 635 of file shiplog.c.
◆ shiplog_listLogsOfType()
| void shiplog_listLogsOfType |
( |
const char * | type, |
|
|
int * | nlogs, |
|
|
char *** | logsOut, |
|
|
int ** | logIDs, |
|
|
int | includeAll ) |
Lists matching logs (which haven't expired via "removeAfter") into the provided arrays.
- Parameters
-
| type | The log-type to match (or NULL to match any type). |
| [out] | nlogs | Number of logs emitted. |
| [out] | logsOut | Matching log-names. Will be reallocated as needed. Emitted strings must be freed. |
| [out] | logIDs | Matching log ID lists. Will be reallocated as needed. Emitted lists are owned by the shipLog. |
| includeAll | Whether to include the special "All" log. |
Definition at line 547 of file shiplog.c.
◆ shiplog_listTypes()
| void shiplog_listTypes |
( |
int * | ntypes, |
|
|
char *** | logTypes, |
|
|
int | includeAll ) |
◆ shiplog_load()
| int shiplog_load |
( |
xmlNodePtr | parent | ) |
|
Loads the logfiile.
- Parameters
-
| parent | Parent node for economy. |
- Returns
- 0 on success.
Definition at line 434 of file shiplog.c.
◆ shiplog_new()
| void shiplog_new |
( |
void | | ) |
|
Set up the shiplog.
Definition at line 382 of file shiplog.c.
◆ shiplog_removeEntry()
removes an entry from the log
- Parameters
-
- Returns
- the next entry.
Definition at line 612 of file shiplog.c.
◆ shiplog_save()
| int shiplog_save |
( |
xmlTextWriterPtr | writer | ) |
|
◆ shiplog_setRemove()
| void shiplog_setRemove |
( |
int | logid, |
|
|
ntime_t | when ) |
Sets the remove flag for a log - it will be removed once time increases, eg after a player takes off.
- Parameters
-
| logid | the ID of the log |
| when | the time at which to remove. If 0, uses current time, if <0, adds abs to current time, if >0, uses as the time to remove. Rationale: Allows a player to review the log while still landed, and then clears it up once takes off. |
Definition at line 330 of file shiplog.c.
◆ shipLog
The player's ship log.
Definition at line 36 of file shiplog.c.