diff --git a/src/bridge.h b/src/bridge.h index 049a63939..e6dfaa2f0 100644 --- a/src/bridge.h +++ b/src/bridge.h @@ -31,7 +31,7 @@ typedef struct _bridge_info { -UDWORD startX,startY,endX,endY; // Copy of coordinates of bridge. +UDWORD startX,startY,endX,endY; // Copy of coordinates of bridge. UDWORD heightChange; // How much to raise lowest end by. UDWORD bridgeHeight; // How high are the sections? UDWORD bridgeLength; // How many tiles long? diff --git a/src/combat.h b/src/combat.h index d8aa5e72d..7b5a2dde5 100644 --- a/src/combat.h +++ b/src/combat.h @@ -52,7 +52,7 @@ extern void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTar if any support a counter battery sensor*/ extern void counterBatteryFire(BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget); -extern float objDamage(BASE_OBJECT *psObj, UDWORD damage, UDWORD originalhp, UDWORD weaponClass, +extern float objDamage(BASE_OBJECT *psObj, UDWORD damage, UDWORD originalhp, UDWORD weaponClass, UDWORD weaponSubClass, HIT_SIDE impactSide); #endif // __INCLUDED_SRC_COMBAT_H__ diff --git a/src/console.c b/src/console.c index 1f861efe0..ecd136808 100644 --- a/src/console.c +++ b/src/console.c @@ -294,7 +294,7 @@ static BOOL _addConsoleMessage(const char *messageText, CONSOLE_TEXT_JUSTIFICATI } /// Wrapper for _addConsoleMessage -BOOL addConsoleMessage(const char *messageText, CONSOLE_TEXT_JUSTIFICATION jusType, +BOOL addConsoleMessage(const char *messageText, CONSOLE_TEXT_JUSTIFICATION jusType, CONSOLE_TEXT_TYPE textType) { return _addConsoleMessage(messageText, jusType, textType); diff --git a/src/fpath.c b/src/fpath.c index 098ad87b1..cebde09f9 100644 --- a/src/fpath.c +++ b/src/fpath.c @@ -1037,7 +1037,7 @@ FPATH_RETVAL fpathRoute(BASE_OBJECT *psObj, MOVE_CONTROL *psMoveCntl, // Does this code work? - Per targetX = clearX; targetY = clearY; - objTrace(LOG_MOVEMENT, psObj->id, "Unit %d: end point is blocked, going to (%d, %d) instead", + objTrace(LOG_MOVEMENT, psObj->id, "Unit %d: end point is blocked, going to (%d, %d) instead", (int)psObj->id, (int)clearX, (int)clearY); } @@ -1046,7 +1046,7 @@ FPATH_RETVAL fpathRoute(BASE_OBJECT *psObj, MOVE_CONTROL *psMoveCntl, { if (psPartialRouteObj != NULL) { - objTrace(LOG_MOVEMENT, psObj->id, "fpathRoute droid %d: found existing route during multi-frame path", + objTrace(LOG_MOVEMENT, psObj->id, "fpathRoute droid %d: found existing route during multi-frame path", (int)psObj->id); } else diff --git a/src/fpath.h b/src/fpath.h index 7d5e06006..c30aaa1ac 100644 --- a/src/fpath.h +++ b/src/fpath.h @@ -64,7 +64,7 @@ extern void fpathSetBlockingTile( UBYTE ubPropulsionType ); extern void fpathSetCurrentObject( BASE_OBJECT *psDroid ); /** - * Set direct path to position. Plan a path from psObj's current position to given position + * Set direct path to position. Plan a path from psObj's current position to given position * without taking obstructions into consideration. Used for instance by VTOLs. */ extern void fpathSetDirectRoute(BASE_OBJECT *psObj, SDWORD targetX, SDWORD targetY); diff --git a/src/hci.h b/src/hci.h index 500613eab..451d66ab6 100644 --- a/src/hci.h +++ b/src/hci.h @@ -241,7 +241,7 @@ /* maximum array sizes */ #define MAXSTRUCTURES 200 //bumped up from 80. NOTE: was used for max # in build menus. #define MAXRESEARCH 200 //was 80 topic displayed " " -#define MAXTEMPLATES 80 //was 20 +#define MAXTEMPLATES 80 //was 20 #define MAXFEATURES 80 #define MAXCOMPONENT 80 #define MAXEXTRASYS 80 diff --git a/src/ingameop.h b/src/ingameop.h index b02b900f3..a4720d15e 100644 --- a/src/ingameop.h +++ b/src/ingameop.h @@ -24,7 +24,7 @@ #ifndef __INCLUDED_SRC_INGAMEOP_H__ #define __INCLUDED_SRC_INGAMEOP_H__ -// functions +// functions extern BOOL intAddInGameOptions (void); extern BOOL intCloseInGameOptions (BOOL bPutUpLoadSave, BOOL bResetMissionWidgets); extern void intCloseInGameOptionsNoAnim (BOOL bResetMissionWidgets); @@ -49,7 +49,7 @@ extern BOOL InGameOpUp; // game options // initial options -#define INTINGAMEOP_W 120 +#define INTINGAMEOP_W 120 #define INTINGAMEOP_H 124 #define INTINGAMEOP_HS 88 diff --git a/src/keybind.c b/src/keybind.c index 34003a837..131d0652f 100644 --- a/src/keybind.c +++ b/src/keybind.c @@ -400,7 +400,7 @@ void kf_ToggleSamples(void) //Displays number of sound sample in the sound queue /* Writes out the frame rate */ void kf_FrameRate( void ) { - CONPRINTF(ConsoleString,(ConsoleString, _("FPS %d; FPS-Limit: %d; PIEs %d; polys %d; Terr. polys %d; States %d"), + CONPRINTF(ConsoleString,(ConsoleString, _("FPS %d; FPS-Limit: %d; PIEs %d; polys %d; Terr. polys %d; States %d"), frameGetAverageRate(), getFramerateLimit(), loopPieCount, loopPolyCount, loopTileCount, loopStateChanges)); if (runningMultiplayer()) { CONPRINTF(ConsoleString,(ConsoleString, @@ -2260,13 +2260,13 @@ float available_speed[] = { // Since some of these values can ruin a SP game, we disallow them in normal mode. 1.f / 8.f, // n 1.f / 5.f, // n - 1.f / 3.f, // p + 1.f / 3.f, // p 3.f / 4.f, // p - 1.f / 1.f, // p + 1.f / 1.f, // p 5.f / 4.f, // p 3.f / 2.f, // p 2.f / 1.f, // p (in debug mode only) - 5.f / 2.f, // n + 5.f / 2.f, // n 3.f / 1.f, // n 10.f / 1.f, // n 20.f / 1.f // n @@ -2296,7 +2296,7 @@ void kf_SpeedUp( void ) mod = available_speed[i]; // only in debug/cheat mode do we enable all time compression speeds. if (!getDebugMappingStatus()) - { + { if (mod >= 2.f / 1.f) // max officialy allowed time compression break; } @@ -2337,7 +2337,7 @@ void kf_SlowDown( void ) mod = available_speed[i]; // only in debug/cheat mode do we enable all time compression speeds. if( !getDebugMappingStatus() ) - { + { if (mod < 1.f / 3.f) break; } diff --git a/src/keymap.h b/src/keymap.h index 7a9a3f070..8bc91e14d 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -59,7 +59,7 @@ char *pName; struct _keyMapping *psNext; } KEY_MAPPING; -extern KEY_MAPPING *keyAddMapping ( KEY_STATUS status, KEY_CODE metaCode, KEY_CODE subcode, +extern KEY_MAPPING *keyAddMapping ( KEY_STATUS status, KEY_CODE metaCode, KEY_CODE subcode, KEY_ACTION action, void (*pKeyMapFunc)(void), const char *name ); extern BOOL keyRemoveMapping ( KEY_CODE metaCode, KEY_CODE subCode ); extern KEY_MAPPING *keyGetMappingFromFunction(void *function); @@ -80,8 +80,8 @@ extern void keySetMappingStatus ( KEY_MAPPING *psMapping, BOOL state ); extern void processDebugMappings ( BOOL val ); extern BOOL getDebugMappingStatus ( void ); extern BOOL keyReAssignMappingName(char *pName, KEY_CODE newMetaCode, KEY_CODE newSubCode); - -extern BOOL keyReAssignMapping( KEY_CODE origMetaCode, KEY_CODE origSubCode, + +extern BOOL keyReAssignMapping( KEY_CODE origMetaCode, KEY_CODE origSubCode, KEY_CODE newMetaCode, KEY_CODE newSubCode ); extern KEY_MAPPING *getKeyMapFromName(char *pName); diff --git a/src/move.c b/src/move.c index 973a099bb..47d3abf84 100644 --- a/src/move.c +++ b/src/move.c @@ -1931,7 +1931,7 @@ SDWORD moveCalcDroidSpeed(DROID *psDroid) speed = (MAX_SPEED_PITCH - pitch) * speed / MAX_SPEED_PITCH; if (speed <= 0) { - // Very nasty hack to deal with buggy maps, where some cliffs are + // Very nasty hack to deal with buggy maps, where some cliffs are // not properly marked as being cliffs, but too steep to drive over. // This confuses the heck out of the path-finding code! - Per speed = 10; diff --git a/src/objects.h b/src/objects.h index 92b34a6b5..06706d110 100644 --- a/src/objects.h +++ b/src/objects.h @@ -41,7 +41,7 @@ extern BOOL objInitialise(void); /* Shutdown the object system */ extern BOOL objShutdown(void); -/*goes thru' the list passed in reversing the order so the first entry becomes +/*goes thru' the list passed in reversing the order so the first entry becomes the last and the last entry becomes the first!*/ extern void reverseObjectList(BASE_OBJECT **ppsList); diff --git a/src/objmem.h b/src/objmem.h index c2d65eaac..b584e9420 100644 --- a/src/objmem.h +++ b/src/objmem.h @@ -78,7 +78,7 @@ void killStruct(STRUCTURE *psDel); extern void freeAllStructs(void); /*Remove a single Structure from a list*/ -extern void removeStructureFromList(STRUCTURE *psStructToRemove, +extern void removeStructureFromList(STRUCTURE *psStructToRemove, STRUCTURE *pList[MAX_PLAYERS]); /* Create a new Feature */ diff --git a/src/order.h b/src/order.h index b38d3cb28..80b132f69 100644 --- a/src/order.h +++ b/src/order.h @@ -236,7 +236,7 @@ extern const char* getDroidOrderName(DROID_ORDER order); extern DROID *FindATransporter(void); -/*For a given constructor droid, check if there are any damaged buildings within +/*For a given constructor droid, check if there are any damaged buildings within a defined range*/ extern BASE_OBJECT * checkForDamagedStruct(DROID *psDroid, STRUCTURE *psTarget); diff --git a/src/power.h b/src/power.h index af941cbed..f1cbd9c43 100644 --- a/src/power.h +++ b/src/power.h @@ -71,7 +71,7 @@ extern UDWORD updateExtractedPower(STRUCTURE *psBuilding); extern void updatePlayerPower(UDWORD player); /** Used in multiplayer to force power levels. */ -extern void setPower(UDWORD player, UDWORD avail); +extern void setPower(UDWORD player, UDWORD avail); /** Get the amount of power current held by the given player. */ extern UDWORD getPower(UDWORD player); diff --git a/src/projectile.c b/src/projectile.c index 30768c8a2..b61f9c456 100644 --- a/src/projectile.c +++ b/src/projectile.c @@ -327,7 +327,7 @@ static void proj_UpdateKills(PROJECTILE *psObj, float experienceInc) /***************************************************************************/ -BOOL proj_SendProjectile(WEAPON *psWeap, BASE_OBJECT *psAttacker, int player, int tarX, int tarY, int tarZ, +BOOL proj_SendProjectile(WEAPON *psWeap, BASE_OBJECT *psAttacker, int player, int tarX, int tarY, int tarZ, BASE_OBJECT *psTarget, BOOL bVisible, BOOL bPenetrate, int weapon_slot) { PROJECTILE *psObj = malloc(sizeof(PROJECTILE)); diff --git a/src/projectile.h b/src/projectile.h index 793d41270..bc918b100 100644 --- a/src/projectile.h +++ b/src/projectile.h @@ -59,7 +59,7 @@ PROJECTILE * proj_GetFirst( void ); PROJECTILE * proj_GetNext( void ); void proj_FreeAllProjectiles( void ); -BOOL proj_SendProjectile(WEAPON *psWeap, BASE_OBJECT *psAttacker, int player, int tarX, int tarY, int tarZ, +BOOL proj_SendProjectile(WEAPON *psWeap, BASE_OBJECT *psAttacker, int player, int tarX, int tarY, int tarZ, BASE_OBJECT *psTarget, BOOL bVisible, BOOL bPenetrate, int weapon_slot); // return whether a weapon is direct or indirect diff --git a/src/raycast.h b/src/raycast.h index ad13b99dc..5adcdb5cb 100644 --- a/src/raycast.h +++ b/src/raycast.h @@ -60,7 +60,7 @@ extern SDWORD rayPointDist(SDWORD x1,SDWORD y1, SDWORD x2,SDWORD y2, // point to the edge of the grid extern void getBestPitchToEdgeOfGrid(UDWORD x, UDWORD y, UDWORD direction, SDWORD *pitch); -extern void getPitchToHighestPoint( UDWORD x, UDWORD y, UDWORD direction, +extern void getPitchToHighestPoint( UDWORD x, UDWORD y, UDWORD direction, UDWORD thresholdDistance, SDWORD *pitch ); #endif // __INCLUDED_SRC_RAYCAST_H__ diff --git a/src/scores.c b/src/scores.c index 1b22c04bb..55e82a9fd 100644 --- a/src/scores.c +++ b/src/scores.c @@ -124,15 +124,15 @@ static PIELIGHT getColour(int id) switch (id) { case STR_MR_STR_LOST : - case STR_MR_UNITS_LOST : + case STR_MR_UNITS_LOST : return WZCOL_MENU_SCORE_LOSS; case STR_MR_STR_BLOWN_UP : - case STR_MR_UNITS_KILLED : + case STR_MR_UNITS_KILLED : return WZCOL_MENU_SCORE_DESTROYED; case STR_MR_UNITS_BUILT : case STR_MR_UNITS_NOW : case STR_MR_STR_BUILT : - case STR_MR_STR_NOW : + case STR_MR_STR_NOW : return WZCOL_MENU_SCORE_BUILT; case STR_MR_LEVEL_ROOKIE : case STR_MR_LEVEL_GREEN : diff --git a/src/scriptai.h b/src/scriptai.h index a51a0b2e3..28092ac20 100644 --- a/src/scriptai.h +++ b/src/scriptai.h @@ -30,7 +30,7 @@ extern BOOL scrGroupAddDroid(void); // Add droids in an area to a group extern BOOL scrGroupAddArea(void); -// Add groupless droids in an area to a group +// Add groupless droids in an area to a group extern BOOL scrGroupAddAreaNoGroup(void); // Move the droids from one group to another diff --git a/src/scriptcb.c b/src/scriptcb.c index 3e5cdb1c3..791f03e14 100644 --- a/src/scriptcb.c +++ b/src/scriptcb.c @@ -845,7 +845,7 @@ BOOL scrCallConsole(void) SDWORD *player; char **ConsoleText = NULL; - if (!stackPopParams(2, VAL_REF | VAL_INT, &player, VAL_REF | VAL_STRING, &ConsoleText) ) + if (!stackPopParams(2, VAL_REF | VAL_INT, &player, VAL_REF | VAL_STRING, &ConsoleText) ) { debug(LOG_ERROR, "scrCallConsole(): stack failed"); return false; @@ -881,7 +881,7 @@ BOOL scrCallBeacon(void) if (!stackPopParams(5, VAL_INT, &playerTo, VAL_REF | VAL_INT, &playerFrom, VAL_REF | VAL_INT, &locX, VAL_REF | VAL_INT, &locY, - VAL_REF | VAL_STRING, &BeaconText)) + VAL_REF | VAL_STRING, &BeaconText)) { debug(LOG_ERROR, "scrCallBeacon() - failed to pop parameters."); return false; @@ -902,7 +902,7 @@ BOOL scrCallBeacon(void) if(MultiMsgPlayerTo == playerTo) { strcpy(*BeaconText,MultiplayMsg); - + *playerFrom = MultiMsgPlayerFrom; *locX = beaconX; *locY = beaconY; @@ -935,7 +935,7 @@ BOOL scrCallBeacon(void) { return false; } - + return true; } @@ -946,7 +946,7 @@ BOOL scrCallMultiMsg(void) SDWORD *player, playerTo; char **ConsoleText = NULL; - if (!stackPopParams(3, VAL_INT, &playerTo, VAL_REF | VAL_INT, &player, VAL_REF | VAL_STRING, &ConsoleText) ) + if (!stackPopParams(3, VAL_INT, &playerTo, VAL_REF | VAL_INT, &player, VAL_REF | VAL_STRING, &ConsoleText) ) { debug(LOG_ERROR, "scrCallMultiMsg() failed to pop parameters."); return false; @@ -963,7 +963,7 @@ BOOL scrCallMultiMsg(void) if(MultiMsgPlayerTo == playerTo) { strcpy(*ConsoleText,MultiplayMsg); - + *player = MultiMsgPlayerFrom; scrFunctionResult.v.bval = true; @@ -995,7 +995,7 @@ BOOL scrCallMultiMsg(void) debug(LOG_ERROR, "scrCallMultiMsg: stackPushResult failed"); return false; } - + return true; } @@ -1010,7 +1010,7 @@ BOOL scrCBStructBuilt(void) BOOL triggered = false; DROID **ppsDroid; - if (!stackPopParams(3, VAL_INT, &player, VAL_REF|ST_DROID, &ppsDroid, VAL_REF|ST_STRUCTURE, &ppsStructure) ) + if (!stackPopParams(3, VAL_INT, &player, VAL_REF|ST_DROID, &ppsDroid, VAL_REF|ST_STRUCTURE, &ppsStructure) ) { debug(LOG_ERROR, "scrCBStructBuilt() failed to pop parameters."); return false; diff --git a/src/scriptobj.c b/src/scriptobj.c index eff7215bd..358340d74 100644 --- a/src/scriptobj.c +++ b/src/scriptobj.c @@ -1476,7 +1476,7 @@ BOOL scrValDefLoad(SDWORD version, INTERP_VAL *psVal, char *pBuffer, UDWORD size { // find empty id and set track vals index = audio_SetTrackVals(pName, false, 100, 1800); - if (!index) //this is a NON fatal error. + if (!index) //this is a NON fatal error. { // We can't find filename of the sound for some reason. debug(LOG_ERROR, "Sound ID not available %s not found", pName); diff --git a/src/selection.h b/src/selection.h index c98e17e9a..9957a1cf5 100644 --- a/src/selection.h +++ b/src/selection.h @@ -41,7 +41,7 @@ DST_ALL_SAME } SELECTIONTYPE; // EXTERNALLY REFERENCED FUNCTIONS -extern UDWORD selDroidSelection( UDWORD player, SELECTION_CLASS droidClass, +extern UDWORD selDroidSelection( UDWORD player, SELECTION_CLASS droidClass, SELECTIONTYPE droidType, BOOL bOnScreen ); extern UDWORD selDroidDeselect ( UDWORD player ); extern UDWORD selNumSelected ( UDWORD player ); diff --git a/src/structure.c b/src/structure.c index 151d00ffc..18ac38dfa 100644 --- a/src/structure.c +++ b/src/structure.c @@ -1169,37 +1169,39 @@ BOOL structureStatsShutDown(void) // TODO: The abandoned code needs to be factored out, see: saveMissionData void handleAbandonedStructures() { + // FIXME: We should control the calling frequency externally from this + // function, rather than controlling the amount of times this + // function performs work internally. static int lastHandled = 0; - int reductionAmount = 8; - int i; - + int player; + // We only need to run once every two seconds (2000ms) if (gameTime - lastHandled < 2000) { return; } - + // Update when we last ran lastHandled = gameTime; - - for (i = 0; i < MAX_PLAYERS; i++) + + for (player = 0; player < MAX_PLAYERS; ++player) { STRUCTURE *psCurr, *psNext; - - for (psCurr = apsStructLists[i]; psCurr; psCurr = psNext) + + for (psCurr = apsStructLists[player]; psCurr; psCurr = psNext) { // Save the next structure in the list psNext = psCurr->psNext; - + // We are only interested in structures accruing if (psCurr->status == SS_BEING_BUILT && psCurr->currentPowerAccrued < structPowerToBuild(psCurr)) { DROID *psDroid; - bool beingBuilt = false; - + bool beingBuilt = false; + // See is there are any droids building it - for (psDroid = apsDroidLists[i]; + for (psDroid = apsDroidLists[player]; psDroid; psDroid = psDroid->psNext) { @@ -1210,7 +1212,7 @@ void handleAbandonedStructures() break; } } - + // Being worked on, nothing to see here if (beingBuilt) { @@ -1219,13 +1221,15 @@ void handleAbandonedStructures() // Abandoned else { + int reductionAmount = 8; + // Work out how much power to deduct CLIP(reductionAmount, 0, psCurr->currentPowerAccrued); - + // Do the reduction psCurr->currentPowerAccrued -= reductionAmount; - addPower(i, reductionAmount); - + addPower(player, reductionAmount); + // Remove the structure if no power is accrued if (!psCurr->currentPowerAccrued) { @@ -5133,7 +5137,7 @@ SDWORD getStructStatFromName(char *pName) { UDWORD inc; STRUCTURE_STATS *psStat; - + for (inc = 0; inc < numStructureStats; inc++) { psStat = &asStructureStats[inc]; @@ -6191,7 +6195,7 @@ BOOL electronicDamage(BASE_OBJECT *psTarget, UDWORD damage, UBYTE attackPlayer) if (bMultiPlayer) { uint8_t giftType = DROID_GIFT, droid_count = 1; - + NETbeginEncode(NET_GIFT, NET_ALL_PLAYERS); { // We need to distinguish between gift types @@ -6855,10 +6859,10 @@ void factoryProdAdjust(STRUCTURE *psStructure, DROID_TEMPLATE *psTemplate, BOOL { if (asProductionRun[factoryType][factoryInc][inc].psTemplate == psTemplate) { - //adjust the prod run + //adjust the prod run if (add) //user left clicked, so increase # in queue { - // Allows us to queue up more units up to MAX_IN_RUN instead of ignoring how many we have built from that queue + // Allows us to queue up more units up to MAX_IN_RUN instead of ignoring how many we have built from that queue quantity = ++asProductionRun[factoryType][factoryInc][inc].quantity; built = asProductionRun[factoryType][factoryInc][inc].built; remaining = quantity - built;