OF_MINE.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Seven Kingdoms: Ancient Adversaries
  3. *
  4. * Copyright 1997,1998 Enlight Software Ltd.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. //Filename : OF_MINE.H
  21. //Description : Header of FirmMine
  22. #ifndef __OF_MINE_H
  23. #define __OF_MINE_H
  24. #ifndef __OFIRM_H
  25. #include <OFIRM.h>
  26. #endif
  27. #ifndef __ORAWRES_H
  28. #include <ORAWRES.h>
  29. #endif
  30. //-------- define constant ---------//
  31. #define DEFAULT_MINE_MAX_STOCK_QTY 500
  32. //------- Define class FirmMine --------//
  33. #pragma pack(1)
  34. class FirmMine : public Firm
  35. {
  36. public:
  37. short raw_id;
  38. short site_recno;
  39. float reserve_qty; // non-mined raw materials reserve
  40. float stock_qty; // mined raw materials stock
  41. float max_stock_qty;
  42. short next_output_link_id;
  43. short next_output_firm_recno;
  44. float cur_month_production;
  45. float last_month_production;
  46. float production_30days() { return last_month_production*(30-info.game_day)/30 +
  47. cur_month_production; }
  48. int is_operating() { return productivity > 0 && reserve_qty > 0; }
  49. int ai_has_excess_worker();
  50. public:
  51. FirmMine();
  52. ~FirmMine();
  53. void init_derived();
  54. void change_nation(int newNationRecno);
  55. void draw(int displayLayer=1);
  56. void put_info(int refreshFlag);
  57. void detect_info();
  58. void disp_mine_info(int dispY1, int refreshFlag);
  59. void next_day();
  60. void next_month();
  61. virtual FirmMine* cast_to_FirmMine() { return this; };
  62. void process_ai();
  63. //-------------- multiplayer checking codes ---------------//
  64. virtual UCHAR crc8();
  65. virtual void clear_ptr();
  66. private:
  67. void produce_raw();
  68. Location* scan_raw_site();
  69. void set_next_output_firm();
  70. //------------ AI actions ---------------//
  71. int think_build_market();
  72. int think_inc_productivity();
  73. };
  74. #pragma pack()
  75. //--------------------------------------//
  76. #endif