OF_FACT.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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_FACT.H
  21. //Description : Header of FirmFactory
  22. #ifndef __OF_FACT_H
  23. #define __OF_FACT_H
  24. #ifndef __OFIRM_H
  25. #include <OFIRM.h>
  26. #endif
  27. //------- Define class FirmFactory --------//
  28. #pragma pack(1)
  29. class FirmFactory : public Firm
  30. {
  31. public:
  32. int product_raw_id; // the raw id. of the product
  33. float stock_qty; // mined raw materials stock
  34. float max_stock_qty;
  35. float raw_stock_qty; // raw materials stock
  36. float max_raw_stock_qty;
  37. float cur_month_production;
  38. float last_month_production;
  39. float production_30days() { return last_month_production*(30-info.game_day)/30 +
  40. cur_month_production; }
  41. short next_output_link_id;
  42. short next_output_firm_recno;
  43. int is_operating() { return productivity > 0 && production_30days() > 0; }
  44. int ai_has_excess_worker();
  45. public:
  46. FirmFactory();
  47. ~FirmFactory();
  48. void init_derived();
  49. void draw(int displayLayer=1);
  50. void put_info(int refreshFlag);
  51. void detect_info();
  52. void next_day();
  53. void next_month();
  54. void set_product(int rawId) { product_raw_id = rawId; };
  55. virtual FirmFactory* cast_to_FirmFactory() { return this; };
  56. //-------------- multiplayer checking codes ---------------//
  57. virtual UCHAR crc8();
  58. virtual void clear_ptr();
  59. private:
  60. void auto_set_product();
  61. void disp_factory_info(int dispY1, int refreshFlag);
  62. void change_production();
  63. void set_production(int newProductId);
  64. void set_next_output_firm();
  65. void production();
  66. void input_raw();
  67. void manufacture(float maxMftQty);
  68. //--------------- AI actions ----------------//
  69. void process_ai();
  70. int think_build_market();
  71. int think_inc_productivity();
  72. int think_change_production();
  73. };
  74. #pragma pack()
  75. //--------------------------------------//
  76. #endif