const correctness

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4213 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-03-21 21:37:21 +00:00
parent 12f8bbbb31
commit 4d65c133b1
4 changed files with 21 additions and 21 deletions

View File

@ -1848,12 +1848,12 @@ proj_checkBurnDamage( BASE_OBJECT *apsList, PROJECTILE *psProj,
/***************************************************************************/
// return whether a weapon is direct or indirect
BOOL proj_Direct(WEAPON_STATS *psStats)
bool proj_Direct(const WEAPON_STATS* psStats)
{
ASSERT(psStats != NULL, "proj_Direct: called with NULL weapon!");
if (!psStats)
{
return TRUE; // arbitrary value in no-debug case
return true; // arbitrary value in no-debug case
}
ASSERT(psStats->movementModel < NUM_MOVEMENT_MODEL, "proj_Direct: invalid weapon stat");
@ -1863,26 +1863,26 @@ BOOL proj_Direct(WEAPON_STATS *psStats)
case MM_HOMINGDIRECT:
case MM_ERRATICDIRECT:
case MM_SWEEP:
return TRUE;
return true;
break;
case MM_INDIRECT:
case MM_HOMINGINDIRECT:
return FALSE;
return false;
break;
case NUM_MOVEMENT_MODEL:
case INVALID_MOVEMENT:
break; // error checking in assert above; this is for no-debug case
}
return TRUE; // just to satisfy compiler
return true; // just to satisfy compiler
}
/***************************************************************************/
// return the maximum range for a weapon
SDWORD proj_GetLongRange(WEAPON_STATS *psStats)
SDWORD proj_GetLongRange(const WEAPON_STATS* psStats)
{
return (SDWORD)psStats->longRange;
return psStats->longRange;
}

View File

@ -64,10 +64,10 @@ BOOL proj_SendProjectile( WEAPON *psWeap, BASE_OBJECT *psAttacker, SDWORD player
UDWORD tarX, UDWORD tarY, UDWORD tarZ, BASE_OBJECT *psTarget, BOOL bVisible, BOOL bPenetrate, int weapon_slot );
// return whether a weapon is direct or indirect
BOOL proj_Direct(WEAPON_STATS *psStats);
bool proj_Direct(const WEAPON_STATS* psStats);
// return the maximum range for a weapon
SDWORD proj_GetLongRange(WEAPON_STATS *psStats);
SDWORD proj_GetLongRange(const WEAPON_STATS* psStats);
// Watermelon:neighbour info ripped from droiddef.h
/* Info stored for each projectile neighbour */

View File

@ -321,11 +321,11 @@ BOOL statsAllocConstruct(UDWORD numStats)
ALLOC_STATS(numStats, asConstructStats, numConstructStats, CONSTRUCT_STATS);
}
const char *getStatName(void * Stat)
const char *getStatName(const void * Stat)
{
const BASE_STATS * psStats= (BASE_STATS*)Stat;
const BASE_STATS * const psStats= (const BASE_STATS*)Stat;
return(getName(psStats->pName));
return getName(psStats->pName);
}
@ -2939,7 +2939,7 @@ BOOL allocateName(char **ppStore, const char *pName)
/*Access functions for the upgradeable stats of a weapon*/
UDWORD weaponFirePause(WEAPON_STATS *psStats, UBYTE player)
UDWORD weaponFirePause(const WEAPON_STATS* psStats, UBYTE player)
{
if(psStats->reloadTime == 0)
{
@ -2959,19 +2959,19 @@ UDWORD weaponReloadTime(WEAPON_STATS *psStats, UBYTE player)
psStats->weaponSubClass].firePause)/100);
}
UDWORD weaponShortHit(WEAPON_STATS *psStats, UBYTE player)
UDWORD weaponShortHit(const WEAPON_STATS* psStats, UBYTE player)
{
return (psStats->shortHit + (psStats->shortHit * asWeaponUpgrade[player][
psStats->weaponSubClass].shortHit)/100);
}
UDWORD weaponLongHit(WEAPON_STATS *psStats, UBYTE player)
UDWORD weaponLongHit(const WEAPON_STATS* psStats, UBYTE player)
{
return (psStats->longHit + (psStats->longHit * asWeaponUpgrade[player][
psStats->weaponSubClass].longHit)/100);
}
UDWORD weaponDamage(WEAPON_STATS *psStats, UBYTE player)
UDWORD weaponDamage(const WEAPON_STATS* psStats, UBYTE player)
{
return (psStats->damage + (psStats->damage * asWeaponUpgrade[player][
psStats->weaponSubClass].damage)/100);

View File

@ -279,7 +279,7 @@ if doesn't compare with any*/
extern BOOL getBodySize(const char *pSize, UBYTE *pStore);
// Pass in a stat and get its name
extern const char* getStatName(void * pStat);
extern const char* getStatName(const void * pStat);
/*returns the propulsion type based on the string name passed in */
extern PROPULSION_TYPE getPropulsionType(const char *pType);
@ -288,11 +288,11 @@ extern WEAPON_EFFECT getWeaponEffect(const char *pWeaponEffect);
extern UWORD weaponROF(WEAPON_STATS *psStat, SBYTE player);
/*Access functions for the upgradeable stats of a weapon*/
extern UDWORD weaponFirePause(WEAPON_STATS *psStats, UBYTE player);
extern UDWORD weaponFirePause(const WEAPON_STATS* psStats, UBYTE player);
extern UDWORD weaponReloadTime(WEAPON_STATS *psStats, UBYTE player);
extern UDWORD weaponShortHit(WEAPON_STATS *psStats, UBYTE player);
extern UDWORD weaponLongHit(WEAPON_STATS *psStats, UBYTE player);
extern UDWORD weaponDamage(WEAPON_STATS *psStats, UBYTE player);
extern UDWORD weaponShortHit(const WEAPON_STATS* psStats, UBYTE player);
extern UDWORD weaponLongHit(const WEAPON_STATS* psStats, UBYTE player);
extern UDWORD weaponDamage(const WEAPON_STATS* psStats, UBYTE player);
extern UDWORD weaponRadDamage(WEAPON_STATS *psStats, UBYTE player);
extern UDWORD weaponIncenDamage(WEAPON_STATS *psStats, UBYTE player);
extern UDWORD weaponRadiusHit(WEAPON_STATS *psStats, UBYTE player);