naev 0.12.6
claim.c File Reference

Handles claiming of systems. More...

#include "claim.h"
#include "array.h"
#include "event.h"
#include "log.h"
#include "mission.h"
#include "space.h"
Include dependency graph for claim.c:

Go to the source code of this file.

Data Structures

struct  Claim_t
 The claim structure. More...

Functions

Claim_t * claim_create (int exclusive)
 Creates a system claim.
int claim_addStr (Claim_t *claim, const char *str)
 Adds a string claim to a claim.
int claim_addSys (Claim_t *claim, int ss_id)
 Adds a claim to a system claim.
int claim_isNull (const Claim_t *claim)
 See if a claim actually contains data.
int claim_test (const Claim_t *claim)
 Tests to see if a system claim would have collisions.
int claim_testStr (const Claim_t *claim, const char *str)
 Tests to see if a system is claimed by a system claim.
int claim_testSys (const Claim_t *claim, int sys)
 Tests to see if a system is claimed by a system claim.
void claim_destroy (Claim_t *claim)
 Destroys a system claim.
void claim_clear (void)
 Clears the claims on all systems.
void claim_activateAll (void)
 Activates all the claims.
void claim_activate (Claim_t *claim)
 Activates a claim on a system.
int claim_xmlSave (xmlTextWriterPtr writer, const Claim_t *claim)
 Saves all the systems in a claim in XML.
Claim_t * claim_xmlLoad (xmlNodePtr parent)
 Loads a claim.

Variables

static char ** claimed_strs = NULL

Detailed Description

Handles claiming of systems.

Definition in file claim.c.

Function Documentation

◆ claim_activate()

void claim_activate ( Claim_t * claim)

Activates a claim on a system.

Parameters
claimClaim to activate.

Definition at line 252 of file claim.c.

◆ claim_activateAll()

void claim_activateAll ( void )

Activates all the claims.

Definition at line 240 of file claim.c.

◆ claim_addStr()

int claim_addStr ( Claim_t * claim,
const char * str )

Adds a string claim to a claim.

Parameters
claimClaim to add system to.
strString to claim.

Definition at line 59 of file claim.c.

◆ claim_addSys()

int claim_addSys ( Claim_t * claim,
int ss_id )

Adds a claim to a system claim.

Parameters
claimClaim to add system to.
ss_idId of the system to add to the claim.

Definition at line 77 of file claim.c.

◆ claim_clear()

void claim_clear ( void )

Clears the claims on all systems.

Definition at line 222 of file claim.c.

◆ claim_create()

Claim_t * claim_create ( int exclusive)

Creates a system claim.

Parameters
exclusiveWhether or not this claim is exclusive.
Returns
Newly created system claim or NULL on error.

Definition at line 42 of file claim.c.

◆ claim_destroy()

void claim_destroy ( Claim_t * claim)

Destroys a system claim.

Parameters
claimSystem claim to destroy.

Definition at line 189 of file claim.c.

◆ claim_isNull()

int claim_isNull ( const Claim_t * claim)

See if a claim actually contains data.

Parameters
claimto test.
Returns
0 if claim contains something, 1 otherwise.

Definition at line 95 of file claim.c.

◆ claim_test()

int claim_test ( const Claim_t * claim)

Tests to see if a system claim would have collisions.

Parameters
claimSystem to test.
Returns
0 if no collision found, 1 if a collision was found.

Definition at line 112 of file claim.c.

◆ claim_testStr()

int claim_testStr ( const Claim_t * claim,
const char * str )

Tests to see if a system is claimed by a system claim.

Parameters
claimClaim to test.
strStringto see if is claimed by the claim.
Returns
0 if no collision is found, 1 otherwise.

Definition at line 148 of file claim.c.

◆ claim_testSys()

int claim_testSys ( const Claim_t * claim,
int sys )

Tests to see if a system is claimed by a system claim.

Parameters
claimSystem claim to test.
sysSystem to see if is claimed by the system claim.
Returns
0 if no collision is found, 1 otherwise.

Definition at line 170 of file claim.c.

◆ claim_xmlLoad()

Claim_t * claim_xmlLoad ( xmlNodePtr parent)

Loads a claim.

Parameters
parentParent node containing the claim data.
Returns
The system claim.

Definition at line 306 of file claim.c.

◆ claim_xmlSave()

int claim_xmlSave ( xmlTextWriterPtr writer,
const Claim_t * claim )

Saves all the systems in a claim in XML.

Use between xmlw_startElem and xmlw_endElem.

Parameters
writerXML Writer to use.
claimClaim to save.

Definition at line 279 of file claim.c.

Variable Documentation

◆ claimed_strs

char** claimed_strs = NULL
static

Global claimed strings.

Definition at line 34 of file claim.c.