Fixed a potential compatibility problem.

The plain int type is only guaranteed to be at least 16 bits, and
yet the flags variable was expecting at least 22 bits. This turns
out to be true for x86 and x86-64 systems, but to ensure compatibility,
the variable has been changed to an unsigned long int. Also added
the "L" suffix to flags that were more than 16 bits.
This commit is contained in:
onpon4 2015-03-31 13:02:09 -04:00
parent 08260b1d6c
commit e0809c02b0
5 changed files with 19 additions and 13 deletions

View File

@ -146,7 +146,7 @@ one attempt per call (one call per frame) to find a suitable target. If the targ
it picks is dead or outside the screen range, then it returns NULL. A suitable
target will be returned as the object address.
*/
static object *getRandomEnemy(object *bullet)
static object *bullet_getTarget(object *bullet)
{
int i;
@ -240,8 +240,8 @@ void doBullets()
{
if (bullet->flags & WF_HOMING)
{
if (bullet->target == NULL)
bullet->target = getRandomEnemy(bullet);
if (bullet->target == NULL)
bullet->target = bullet_getTarget(bullet);
if (bullet->owner->flags & FL_FRIEND)
homingMissileSpeed = 0.25;

View File

@ -36,7 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Compile-time options
#ifndef VERSION
#define VERSION "devbuild"
#define VERSION "???"
#endif
#ifndef DATADIR
@ -64,13 +64,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define FL_RUNSAWAY 8192
#define FL_ALWAYSFACE 16384 // Kline doesn't turn his back on you! ;)
#define FL_CIRCLES 32768 // Kline can circle around
#define FL_CONTINUOUS_FIRE 65536 // Go absolutely nutts(!)
#define FL_DEPLOYDRONES 131072 // Deploys small drone - Used by Boss 2
#define FL_CANCLOAK 262144
#define FL_ISCLOAKED 524288
#define FL_ACTIVATE 1048576
#define FL_HASMINIMUMSPEED 2097152
#define FL_FIRELASER 4194304
#define FL_CONTINUOUS_FIRE 65536L // Go absolutely nutts(!)
#define FL_DEPLOYDRONES 131072L // Deploys small drone - Used by Boss 2
#define FL_CANCLOAK 262144L
#define FL_ISCLOAKED 524288L
#define FL_ACTIVATE 1048576L
#define FL_HASMINIMUMSPEED 2097152L
#define FL_FIRELASER 4194304L
// Explosions
#define E_SMALL_EXPLOSION 4

View File

@ -173,7 +173,7 @@ void blit(SDL_Surface *image, int x, int y, SDL_Surface *dest)
showErrorAndExit(2, "");
}
// Only ff it is to the screen, mark the region as damaged
// Only if it is to the screen, mark the region as damaged
if (dest == screen)
addBuffer(blitRect.x, blitRect.y, blitRect.w, blitRect.h);
}

View File

@ -86,7 +86,9 @@ void loadGameGraphics()
switch (shipShape[i]->format->BitsPerPixel)
{
case 32:
SDL_LockSurface(shipShape[i]);
p32 = (Uint32 *)shipShape[i]->pixels;
SDL_UnlockSurface(shipShape[i]);
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
{
if (p32[j])
@ -95,7 +97,9 @@ void loadGameGraphics()
break;
case 16:
SDL_LockSurface(shipShape[i]);
p16 = (Uint16 *)shipShape[i]->pixels;
SDL_UnlockSurface(shipShape[i]);
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
{
if (p16[j])
@ -104,7 +108,9 @@ void loadGameGraphics()
break;
case 8:
SDL_LockSurface(shipShape[i]);
p8 = (Uint8 *)shipShape[i]->pixels;
SDL_UnlockSurface(shipShape[i]);
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
{
if (p8[j])

View File

@ -60,7 +60,7 @@ struct object {
int collectType; // What the object is carrying
int collectValue; // What it is worth
int flags; // Various flags for an object
unsigned long int flags; // Various flags for an object
float x, y, dx, dy;