home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / source / conqsrc.lha / Conquest / src / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-03  |  2.1 KB  |  79 lines

  1. /* Main.c: main() and *all* global variables */
  2.  
  3. #include <stdio.h>
  4. #include "defs.h"
  5. #include "structs.h"
  6. #include "vars.h"
  7. #include "protos.h"
  8.  
  9. /* Initialization of global variables, to 0/FALSE default */
  10. struct config conf;
  11.  
  12. int tf_stars[MAX_NUM_STARS+1][2], col_stars[MAX_NUM_STARS+1][2];
  13.  
  14. char en_research;
  15.  
  16. #define EMPSEC {' ', '.', ' '}
  17. #define EMPTY_LINE { {0,0,0}, EMPSEC, EMPSEC, EMPSEC, EMPSEC, EMPSEC, EMPSEC,\
  18. EMPSEC, EMPSEC, EMPSEC, EMPSEC, EMPSEC, EMPSEC, EMPSEC, EMPSEC, EMPSEC }
  19.  
  20. struct ssector board[MAX_BOARD_SIZE+1][MAX_BOARD_SIZE+1] =
  21. { /* Empty line in top (should go) */EMPTY_LINE,
  22.     EMPTY_LINE, EMPTY_LINE, EMPTY_LINE, EMPTY_LINE, EMPTY_LINE, EMPTY_LINE, 
  23.     EMPTY_LINE, EMPTY_LINE, EMPTY_LINE, EMPTY_LINE, EMPTY_LINE, EMPTY_LINE, 
  24.     EMPTY_LINE, EMPTY_LINE, EMPTY_LINE};
  25.  
  26. #define EMPSTAR {0,0,NULL,{0,0}}
  27.  
  28. struct ststar stars[MAX_NUM_STARS+1] =
  29. { EMPSTAR, EMPSTAR, EMPSTAR, EMPSTAR, EMPSTAR, EMPSTAR, EMPSTAR, EMPSTAR,
  30.     EMPSTAR, EMPSTAR, EMPSTAR, EMPSTAR, EMPSTAR, EMPSTAR, EMPSTAR, EMPSTAR,
  31.     EMPSTAR, EMPSTAR, EMPSTAR, EMPSTAR, EMPSTAR, EMPSTAR};
  32.  
  33. struct sttf tf[2][27];
  34.  
  35. float growth_rate[2] = { 0.5, 0.3}; /* Enemy and players growth rate! */
  36.  
  37. int weap_req[11] =
  38. {0, 0, 0, 0, 50, 70, 90, 120, 150, 250, 350};
  39.  
  40. int ran_req[MAX_BOARD_SIZE+1] = 
  41. {0, 0, 0, 0, 0, 0, 20, 40, 70, 100, 150, 200, 300, 400, 600, 900};
  42.  
  43. int vel_req[MAX_VEL+1] =
  44. {0, 0, 40, 60, 80, 120, 150, 200, 250, 300, 400, 500, 600};
  45.  
  46. /* Enemy and players initial research */
  47. int vel[2] = {INIT_VEL, INIT_VEL}, range[2] = {INIT_RANGE+2, INIT_RANGE}, weapons[2] = {INIT_WEAPONS, INIT_WEAPONS};
  48. int weap_working[2],ran_working[2],vel_working[2];
  49. int turn = 1, production_year = 1;
  50. int enemy_arrivals[MAX_NUM_STARS+1], en_departures[MAX_NUM_STARS+1], player_arrivals[MAX_NUM_STARS+1];
  51. int game_over, bottom_field;
  52.  
  53. termtype terminal_type = unknown;
  54.  
  55. int x_cursor, y_cursor, saved_game, left_line[25], debug;
  56.  
  57. FILE *raw_fd;
  58.  
  59. int main()
  60. {
  61.   startup();
  62.   do
  63.   {
  64.     inputplayer();
  65.     if (!game_over) 
  66.     {
  67.       inputmach();
  68.       move_ships();
  69.       battle();
  70.       if (production_year == 4 && turn < 100) 
  71.     invest();
  72.       up_year();
  73.     }
  74.     check_game_over();
  75.   }
  76.   while (!game_over);
  77.   exit(0);
  78. }
  79.