cp_produce.h

Go to the documentation of this file.
00001 
00006 /*
00007 Copyright (C) 2002-2010 UFO: Alien Invasion.
00008 
00009 This program is free software; you can redistribute it and/or
00010 modify it under the terms of the GNU General Public License
00011 as published by the Free Software Foundation; either version 2
00012 of the License, or (at your option) any later version.
00013 
00014 This program is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00017 
00018 See the GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00023 
00024 */
00025 
00026 #ifndef CLIENT_CP_PRODUCE
00027 #define CLIENT_CP_PRODUCE
00028 
00030 #define MAX_PRODUCTIONS     256
00031 #define MAX_PRODUCTIONS_PER_WORKSHOP 5
00032 
00033 #define MAX_PRODUCTION_AMOUNT 500
00034 
00036 #define UGV_SIZE 300
00037 
00038 extern const int PRODUCE_FACTOR;
00039 extern const int PRODUCE_DIVISOR;
00040 
00048 typedef struct production_s
00049 {
00050     int idx; 
00055     objDef_t *item;         
00056     struct aircraft_s *aircraft;    
00057     struct storedUFO_s *ufo;
00058 
00059     signed int amount;  
00060     float percentDone;      
00062     qboolean spaceMessage;  
00063     qboolean creditMessage; 
00065     qboolean production;    
00066 } production_t;
00067 
00072 typedef struct production_queue_s
00073 {
00074     int             numItems;       
00075     production_t    items[MAX_PRODUCTIONS]; 
00076 } production_queue_t;
00077 
00078 void PR_ProductionInit(void);
00079 void PR_ProductionRun(void);
00080 
00081 qboolean PR_ItemIsProduceable(const objDef_t const *item);
00082 
00083 base_t *PR_ProductionBase(production_t *production);
00084 base_t *PR_ProductionQueueBase (const production_queue_t const *queue);
00085 
00086 int PR_IncreaseProduction(production_t *prod, int amount);
00087 int PR_DecreaseProduction(production_t *prod, int amount);
00088 
00089 void PR_UpdateProductionCap(struct base_s *base);
00090 
00091 void PR_UpdateRequiredItemsInBasestorage(base_t *base, int amount, const requirements_t const *reqs);
00092 int PR_RequirementsMet(int amount, const requirements_t const *reqs, base_t *base);
00093 
00094 float PR_CalculateProductionPercentDone(const base_t *base, const technology_t *tech, const struct storedUFO_s *const storedUFO);
00095 
00096 production_t *PR_QueueNew(base_t *base, production_queue_t *queue, objDef_t *item, aircraft_t *aircraftTemplate, struct storedUFO_s *ufo, signed int amount);
00097 void PR_QueueMove(production_queue_t *queue, int index, int dir);
00098 void PR_QueueDelete(base_t *base, production_queue_t *queue, int index);
00099 void PR_QueueNext(base_t *base);
00100 int PR_QueueFreeSpace(const production_queue_t const *queue);
00101 
00102 #endif /* CLIENT_CP_PRODUCE */
00103 

Generated by  doxygen 1.6.2