/*
Copyright (C) 2011 Weber Yann, Schuck Clement
This file is part of Tansive.
Tansive is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Tansive is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Tansive. If not, see .
*/
#ifndef CREATURE_H
#define CREATURE_H
#include
#include
#include
#include
#include"config.h"
#include"genome.h"
/*
creature.h :
Define struct and functions about creature management.
*/
//Store data about one creature
typedef struct _t_creature
{
t_tree_genome *genome_tree;
t_memory mem;
int energy;
int life;
int timeleft;
int reprotimer;
pthread_mutex_t* mutex;
int x;
int y;
}t_creature;
//Store one creature in the chain
typedef struct _t_chain_creature
{
t_creature *creat;
struct _t_chain_creature *next;
struct _t_chain_creature *prev;
}t_chain_creature;
//Return a pointer on a randomly generated creature
t_creature* create_random_creature();
//Return a pointer on a creature associated with the genome gnome
t_creature* create_gnome_creature(t_tree_genome* gnome);
//Usefull function to manage the t_chain_creature
t_chain_creature* create_creature_chain(t_creature* first);
t_chain_creature* add_creature_chain(t_chain_creature* lst_creat, t_creature* new_creat);
t_chain_creature* del_creature_chain(t_chain_creature** lst_creat, t_creature* dead_creat);
#endif