/*
    Living Realms is a primate evolution simulator.
    Copyright (C) 2011  Sterling Pickens

    This program 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.

    This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef __LIFE_H__
#define __LIFE_H__

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <sys/time.h>
#include <stdint.h>
#include <sys/types.h>
#include <string.h>
#include "Globals.h"
#include "DEM.h"
#include "config.h"
//#include "Random.h"

extern struct Species ***life;
extern struct Stats *stats;
extern struct Stats_T stats_t;
extern struct image_attr *ia;
extern struct Thread_I *Actions_t_info;
extern char *life_speed_up_X;
extern char *life_speed_up_Y;
#ifndef LRSTATS_COMPILE
#ifndef WITHOUT_HOST_PT_BARRIER
extern pthread_barrier_t Barrier1;
extern pthread_barrier_t Barrier2;
extern pthread_barrier_t Barrier3;
#else
extern lrpthread_barrier_t Barrier1;
extern lrpthread_barrier_t Barrier2;
extern lrpthread_barrier_t Barrier3;
#endif
extern pthread_mutex_t Mutex1;
extern pthread_mutex_t Mutex2;
extern pthread_mutex_t Mutex3;
extern pthread_mutex_t Region_Mutexes[HEIGHT/5];
#endif
extern unsigned char Region_Handled[HEIGHT/5];
extern int Stats_Handled;
extern double Year_Runtime;
extern double Backup_Freq_Runtime;
extern uint32_t Backup_Freq;
extern int No_Exit;
extern uint32_t Thread_Step;
extern struct timeval Year_Starttime,Year_Endtime;
extern unsigned char **Alive;
extern unsigned char **Fought;
extern unsigned char **Mated;

void Allocate_Life_Array(void);
//void Add_First_Life(struct Species *one);
//#ifndef LRSTATS_COMPILE
void *Tribe_Actions(void *tid);
//#endif

#endif