Burp
Data Structures | Functions
arene.c File Reference
#include "arene.h"
Include dependency graph for arene.c:

Data Structures

struct  arena_impl
 

Functions

arenacreate_arena ()
 
int add_missile (arena *arena, missile *m)
 
bool remove_missile (arena *arena, missile *m)
 
int add_robot (arena *arena, robot *rob)
 
bool remove_robot (arena *arena, robot *rob)
 
void freeArena (arena **arena)
 
int get_nb_missiles_arena (arena *arena)
 
int get_nb_robot_arena (arena *arena)
 
robotget_robot_per_id (arena *arena, int id)
 
robotget_robot_index (arena *arena, int indx)
 
missileget_missile_index (arena *arena, int indx)
 

Function Documentation

◆ add_missile()

int add_missile ( arena arena,
missile m 
)

Add a missile [m] to the arena [arena]. If there is already NB_ROBOT * NB_MISSILES_ROBOT present in the arena [arena], it'll not add [m] to the arena and return -1. If the operation succeed, it'll return the index of the missile [m] in the list of missiles present in the arena [arena]

◆ add_robot()

int add_robot ( arena arena,
robot rob 
)

Add a robot [rob] to the arena [arena]. If there is already NB_ROBOT present in the arena, it'll not add [rob] to the arena and return -1. If the operation succeed, it'll return the index of the robot [rob] in the list of robot present in the arena [arena]

◆ create_arena()

arena* create_arena ( )

Allocate an arena in memory and return it

◆ freeArena()

void freeArena ( arena **  arena)

Free an arena [arena] and all its robot/missile still present in it.

Here is the call graph for this function:

◆ get_missile_index()

missile* get_missile_index ( arena arena,
int  indx 
)

Return the missile present in the arena [arena] which has the index [indx]. If the given index is invalid, it'll return NULL, else it'll return the missile at the indx [index].

◆ get_nb_missiles_arena()

int get_nb_missiles_arena ( arena arena)

Return the number of missiles present in the arena [arena].

◆ get_nb_robot_arena()

int get_nb_robot_arena ( arena arena)

Return the number of robots present in the arena [arena].

◆ get_robot_index()

robot* get_robot_index ( arena arena,
int  indx 
)

Return the robot present in the arena [arena] which has the index [indx]. If the given index is invalid, it'll return NULL, else it'll return the robot at the indx [index].

◆ get_robot_per_id()

robot* get_robot_per_id ( arena arena,
int  id 
)

Return the robot present in the arena [arena] which has the id [id]. If [id] is not present it'll return NULL, else it'll return the robot corresponding to the given id.

Here is the call graph for this function:

◆ remove_missile()

bool remove_missile ( arena arena,
missile mis 
)

Remove a missile [mis] from the arena [arena]. The operation will fail and return false if the missile [mis] is not present in the arena. If the missile [mis] is in the arena [arena], it'll free the missile and return true.

Here is the call graph for this function:

◆ remove_robot()

bool remove_robot ( arena arena,
robot rob 
)

Remove a missile [mis] from the arena [arena]. The operation will fail and return false if the missile [mis] is not present in the arena. If the missile [mis] is in the arena [arena], it'll free the missile and return true.