Tests About Natural Selection In Virtual Environment
c
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

map.h 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. Copyright (C) 2011 Weber Yann, Schuck Clement
  3. This file is part of Tansive.
  4. Tansive is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. Tansive is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with Tansive. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #ifndef MAP_H
  16. #define MAP_H
  17. #include<pthread.h>
  18. #include"creature.h"
  19. /*
  20. Map.h :
  21. Defines struct and functions for map's management
  22. */
  23. #define MAP_ELT_EMPTY 0
  24. #define MAP_ELT_VEGET 1
  25. #define MAP_ELT_CREAT 2
  26. #define MAP_VEG_REGEN 1500
  27. #define MAP_VEG_SPAWN 8000
  28. #define MAP_VEG_COEFPROX 99
  29. #define MAP_VEG_MIN_TIMELEFT 1
  30. #define MAP_VEG_MAX_TIMELEFT 50
  31. //Store one element of the map
  32. typedef struct _t_map_element
  33. {
  34. char type; //Take values in MAP_ELT_*
  35. t_creature* creat; //A pointer on the creat if type == MAP_ELT_CREAT
  36. unsigned char timeleft_veget; //Timeleft for the vegetal if type == MAP_ELT_VEGET
  37. }t_map_element;
  38. //Store the map
  39. typedef struct _t_map
  40. {
  41. t_map_element** map;
  42. //Map size
  43. int x;
  44. int y;
  45. }t_map;
  46. //Initialize the map
  47. t_map* create_map(int x, int y);
  48. //Re-generation of the vegetals
  49. void map_regen_veget(t_map* mp);
  50. //Print a sample of the map on stdout
  51. void disp_map(t_map* mp, int xbeg, int ybeg, int xend, int yend);
  52. #endif