Logo Search packages:      
Sourcecode: warzone2100 version File versions

structure.c File Reference

Detailed Description

Store Structure stats. WARNING!!!!!! Something wicked this way comes. This file is almost as evil as HCI.c

Definition in file structure.c.

#include <string.h>
#include "lib/framework/frame.h"
#include "lib/framework/strres.h"
#include "lib/framework/frameresource.h"
#include "objects.h"
#include "ai.h"
#include "map.h"
#include "lib/gamelib/gtime.h"
#include "visibility.h"
#include "structure.h"
#include "research.h"
#include "hci.h"
#include "power.h"
#include "miscimd.h"
#include "effects.h"
#include "combat.h"
#include "lib/sound/audio.h"
#include "lib/sound/audio_id.h"
#include "stats.h"
#include "lib/framework/math-help.h"
#include "edit3d.h"
#include "anim_id.h"
#include "lib/gamelib/anim.h"
#include "display3d.h"
#include "geometry.h"
#include "lib/ivis_opengl/piematrix.h"
#include "order.h"
#include "droid.h"
#include "lib/script/script.h"
#include "scripttabs.h"
#include "scriptcb.h"
#include "formationdef.h"
#include "formation.h"
#include "text.h"
#include "action.h"
#include "group.h"
#include "transporter.h"
#include "fpath.h"
#include "mission.h"
#include "levels.h"
#include "console.h"
#include "cmddroid.h"
#include "feature.h"
#include "mapgrid.h"
#include "projectile.h"
#include "cluster.h"
#include "intdisplay.h"
#include "display.h"
#include "difficulty.h"
#include "scriptextern.h"
#include "keymap.h"
#include "game.h"
#include "advvis.h"
#include "multiplay.h"
#include "lib/netplay/netplay.h"
#include "multigifts.h"
#include "loop.h"
#include "scores.h"
#include "gateway.h"

Go to the source code of this file.


#define MAX_IN_RUN   9
#define MAX_INCLINE   50
#define MAX_UNIT_MESSAGE_PAUSE   20000
#define REARM_FACTOR   10
#define WALL_CORNER   2
#define WALL_HORIZ   0
#define WALL_VERT   1


static void aiUpdateStructure (STRUCTURE *psStructure)
void alignStructure (STRUCTURE *psBuilding)
void assignFactoryCommandDroid (STRUCTURE *psStruct, DROID *psCommander)
static void buildFlatten (STRUCTURE_STATS *pStructureType, UDWORD x, UDWORD y, UDWORD h)
SWORD buildFoundation (STRUCTURE_STATS *psStructStats, UDWORD x, UDWORD y)
void buildingComplete (STRUCTURE *psBuilding)
STRUCTURE * buildStructure (STRUCTURE_STATS *pStructureType, UDWORD x, UDWORD y, UDWORD player, BOOL FromSave)
BOOL calcStructureMuzzleLocation (STRUCTURE *psStructure, Vector3i *muzzle, int weapon_slot)
static float CalcStructureSmokeInterval (float damage)
void cancelProduction (STRUCTURE *psBuilding)
static BOOL canSmoke (STRUCTURE *psStruct)
static void cbNewDroid (STRUCTURE *psFactory, DROID *psDroid)
void changeProductionPlayer (UBYTE player)
void checkDeliveryPoints (UDWORD version)
BOOL checkFactoryExists (UDWORD player, UDWORD factoryType, UDWORD inc)
void checkForPowerGen (STRUCTURE *psBuilding)
void checkForResExtractors (STRUCTURE *psBuilding)
BOOL CheckHaltOnMaxUnitsReached (STRUCTURE *psStructure)
BOOL checkLength (UDWORD maxRange, UDWORD x, UDWORD y, UDWORD *pDroidX, UDWORD *pDroidY)
UBYTE checkProductionForCommand (UBYTE player)
void checkResExtractorsActive (void)
BOOL checkSpecificStructExists (UDWORD structInc, UDWORD player)
BOOL checkStructureStats (void)
BOOL checkStructureStatus (STRUCTURE_STATS *psStats, UDWORD player, UDWORD status)
BOOL checkWidth (UDWORD maxRange, UDWORD x, UDWORD y, UDWORD *pDroidX, UDWORD *pDroidY)
void clearCommandDroidFactory (DROID *psDroid)
BOOL clearRearmPad (STRUCTURE *psStruct)
UWORD countAssignableFactories (UBYTE player, UWORD factoryType)
static unsigned int countAssignedDroids (const STRUCTURE *psStructure)
BOOL destroyStruct (STRUCTURE *psDel)
BOOL electronicDamage (BASE_OBJECT *psTarget, UDWORD damage, UBYTE attackPlayer)
static BOOL electronicReward (STRUCTURE *psStructure, UBYTE attackPlayer)
void ensureRearmPadClear (STRUCTURE *psStruct, DROID *psDroid)
void factoryLoopAdjust (STRUCTURE *psStruct, BOOL add)
void factoryProdAdjust (STRUCTURE *psStructure, DROID_TEMPLATE *psTemplate, BOOL add)
DROID_TEMPLATE * factoryProdUpdate (STRUCTURE *psStructure, DROID_TEMPLATE *psTemplate)
static void factoryReward (UBYTE losingPlayer, UBYTE rewardPlayer)
UDWORD fillStructureList (STRUCTURE_STATS **ppList, UDWORD selectedPlayer, UDWORD limit)
static void findAssemblyPointPosition (UDWORD *pX, UDWORD *pY, UDWORD player)
STRUCTURE * findDeliveryFactory (FLAG_POSITION *psDelPoint)
FLAG_POSITION * FindFactoryDelivery (STRUCTURE *Struct)
STRUCTURE * findNearestReArmPad (DROID *psDroid, STRUCTURE *psTarget, BOOL bClear)
BOOL FlagIsFactory (FLAG_POSITION *psCurrFlag)
BOOL getDroidDestination (BASE_STATS *psStats, UDWORD structX, UDWORD structY, UDWORD *pDroidX, UDWORD *pDroidY)
BOOL getHQExists (UDWORD player)
BOOL getLasSatExists (UDWORD player)
UDWORD getMaxDroids (UDWORD PlayerNumber)
STRUCTURE_STATS * getModuleStat (STRUCTURE *psStruct)
UDWORD getProductionBuilt (STRUCTURE *psStructure, DROID_TEMPLATE *psTemplate)
UDWORD getProductionQuantity (STRUCTURE *psStructure, DROID_TEMPLATE *psTemplate)
BOOL getSatUplinkExists (UDWORD player)
static const char * getStructName (const STRUCTURE_STATS *psStruct)
SDWORD getStructStatFromName (char *pName)
static UBYTE getStructStrength (const char *pStrength)
float getStructureDamage (const STRUCTURE *psStructure)
STRUCTURE * giftSingleStructure (STRUCTURE *psStructure, UBYTE attackPlayer, BOOL bFromScript)
void handleAbandonedStructures ()
void holdProduction (STRUCTURE *psBuilding)
void hqReward (UBYTE losingPlayer, UBYTE rewardPlayer)
static void informPowerGen (STRUCTURE *psStruct)
void initFactoryNumFlag (void)
static void initModulePIEs (char *PIEName, UDWORD i, STRUCTURE_STATS *psStructure)
void initStructLimits (void)
static BOOL IsFactoryCommanderGroupFull (FACTORY *psFactory)
BOOL IsPlayerDroidLimitReached (UDWORD PlayerNumber)
BOOL IsPlayerStructureLimitReached (UDWORD PlayerNumber)
BOOL IsStatExpansionModule (STRUCTURE_STATS *psStats)
BOOL lasSatStructSelected (STRUCTURE *psStruct)
BOOL loadStructureFunctions (const char *pFunctionData, UDWORD bufferSize)
BOOL loadStructureStats (const char *pStructData, UDWORD bufferSize)
BOOL loadStructureStrengthModifiers (const char *pStrengthModData, UDWORD bufferSize)
BOOL loadStructureWeapons (const char *pWeaponData, UDWORD bufferSize)
static BOOL maxDroidsByTypeReached (STRUCTURE *psStructure)
BOOL placeDroid (STRUCTURE *psStructure, UDWORD *droidX, UDWORD *droidY)
void printStructureInfo (STRUCTURE *psStructure)
void processDeliveryPoint (UDWORD player, UDWORD x, UDWORD y)
BOOL ptInStructure (STRUCTURE *psStruct, UDWORD x, UDWORD y)
void releasePowerGen (STRUCTURE *psRelease)
void releaseProduction (STRUCTURE *psBuilding)
void releaseResExtractor (STRUCTURE *psRelease)
BOOL removeStruct (STRUCTURE *psDel, BOOL bDestroy)
static void removeStructFromMap (STRUCTURE *psStruct)
static void repairFacilityReward (UBYTE losingPlayer, UBYTE rewardPlayer)
void resetFactoryNumFlag (void)
static void resetResistanceLag (STRUCTURE *psBuilding)
static void revealAll (UBYTE player)
void setAssemblyPoint (FLAG_POSITION *psAssemblyPoint, UDWORD x, UDWORD y, UDWORD player, BOOL bCheck)
void setCurrentStructQuantity (BOOL displayError)
static void setFlagPositionInc (FUNCTIONALITY *pFunctionality, UDWORD player, UBYTE factoryType)
static BOOL setFunctionality (STRUCTURE *psBuilding, STRUCTURE_TYPE functionType)
void setHQExists (BOOL state, UDWORD player)
void setLasSatExists (BOOL state, UDWORD player)
void setSatUplinkExists (BOOL state, UDWORD player)
BOOL structCBSensor (const STRUCTURE *psStruct)
static SDWORD structChooseWallType (UDWORD player, UDWORD mapX, UDWORD mapY)
static BOOL structClearTile (UWORD x, UWORD y)
STRUCTURE_STATS * structGetDemolishStat (void)
float structHeightScale (STRUCTURE *psStruct)
BOOL structIsDamaged (STRUCTURE *psStruct)
BOOL StructIsFactory (STRUCTURE *Struct)
static BOOL structPlaceDroid (STRUCTURE *psStructure, DROID_TEMPLATE *psTempl, DROID **ppsDroid)
UDWORD structPowerToBuild (STRUCTURE *psStruct)
BOOL structSensorDroidWeapon (STRUCTURE *psStruct, DROID *psDroid)
BOOL structSetManufacture (STRUCTURE *psStruct, DROID_TEMPLATE *psTempl, UBYTE quantity)
BOOL structStandardSensor (const STRUCTURE *psStruct)
static void structUpdateRecoil (STRUCTURE *psStruct)
UDWORD structureArmour (STRUCTURE_STATS *psStats, UBYTE player)
UDWORD structureBaseBody (const STRUCTURE *psStructure)
UDWORD structureBody (const STRUCTURE *psStructure)
BOOL structureCheckReferences (STRUCTURE *psVictimStruct)
void structureCompletedCallback (STRUCTURE_STATS *psStructType)
float structureDamage (STRUCTURE *psStructure, UDWORD damage, UDWORD weaponClass, UDWORD weaponSubClass, HIT_SIDE impactSide)
BOOL structureIdle (STRUCTURE *psBuilding)
void structureInitVars (void)
void structureRelease (STRUCTURE *psBuilding)
UDWORD structureResistance (STRUCTURE_STATS *psStats, UBYTE player)
BOOL structureStatsShutDown (void)
static STRUCTURE_TYPE structureType (const char *typeName)
void structureUpdate (STRUCTURE *psBuilding)
BOOL structVTOLCBSensor (const STRUCTURE *psStruct)
BOOL structVTOLSensor (const STRUCTURE *psStruct)
static SDWORD structWallScan (BOOL aWallPresent[5][5], SDWORD x, SDWORD y)
BOOL validLocation (BASE_STATS *psStats, UDWORD x, UDWORD y, UDWORD player, BOOL bCheckBuildQueue)
BOOL validStructResistance (STRUCTURE *psStruct)
BOOL validTemplateForFactory (DROID_TEMPLATE *psTemplate, STRUCTURE *psFactory)
BOOL vtolOnRearmPad (STRUCTURE *psStruct, DROID *psDroid)


STRUCTURE_STATS * asStructureStats
UDWORD factoryModuleStat
static STRUCTURE_STATS * g_psStatDestroyStruct = NULL
static UBYTE hqExists [MAX_PLAYERS]
static UBYTE lasSatExists [MAX_PLAYERS]
static UDWORD lastMaxUnitMessage
static UWORD MaxDroidsAllowedPerPlayer [MAX_PLAYERS] = {100, 999, 999, 999, 999, 999, 999, 999}
static UWORD MaxDroidsAllowedPerPlayerMultiPlayer [MAX_PLAYERS] = {300, 300, 300, 300, 300, 300, 300, 300}
UDWORD numStructureStats
iIMDShape * powerModuleIMDs [NUM_POWER_MODULES]
UDWORD powerModuleStat
SBYTE productionPlayer
STRUCTURE * psLastStructHit
iIMDShape * researchModuleIMDs [NUM_RESEARCH_MODULES]
UDWORD researchModuleStat
static UBYTE satUplinkExists [MAX_PLAYERS]
struct {
   const char *   typeName
structureTypeNames []

Generated by  Doxygen 1.6.0   Back to index