Add const to all char * function parameters.
This commit is contained in:
parent
87730b0687
commit
0910cd3db6
|
@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "structs.h"
|
||||
#include "classes.h"
|
||||
|
||||
extern void setRadioMessage(signed char face, char *in, int priority);
|
||||
extern void setRadioMessage(signed char face, const char *in, int priority);
|
||||
|
||||
extern object enemy[MAX_ALIENS];
|
||||
extern object player;
|
||||
|
|
|
@ -38,13 +38,13 @@ extern void addEngine(object *craft);
|
|||
extern void fireRay(object *attacker);
|
||||
extern void addDebris(int x, int y, int amount);
|
||||
extern void playSound(int sid);
|
||||
extern int locateDataInPak(char *file, signed char required);
|
||||
extern int locateDataInPak(const char *file, signed char required);
|
||||
extern object *addCargo(object *owner, int cargoType);
|
||||
extern void addCollectable(float x, float y, int type, int value, int life);
|
||||
extern void updateMissionRequirements(int type, int id, int value);
|
||||
extern void setInfoLine(char *in, int color);
|
||||
extern void setInfoLine(const char *in, int color);
|
||||
extern void addBullet(object *theWeapon, object *attacker, int y, int dy);
|
||||
extern void showErrorAndExit(int errorId, char *name);
|
||||
extern void showErrorAndExit(int errorId, const char *name);
|
||||
|
||||
extern globalEngineVariables engine;
|
||||
extern devVariables dev;
|
||||
|
|
|
@ -56,7 +56,7 @@ void playSound(int sid)
|
|||
}
|
||||
}
|
||||
|
||||
Mix_Chunk *loadSound(char *filename)
|
||||
Mix_Chunk *loadSound(const char *filename)
|
||||
{
|
||||
Mix_Chunk *chunk;
|
||||
|
||||
|
@ -70,7 +70,7 @@ Mix_Chunk *loadSound(char *filename)
|
|||
return chunk;
|
||||
}
|
||||
|
||||
void loadMusic(char *filename)
|
||||
void loadMusic(const char *filename)
|
||||
{
|
||||
if (Mix_PlayingMusic())
|
||||
Mix_HaltMusic();
|
||||
|
|
|
@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "defs.h"
|
||||
#include "structs.h"
|
||||
|
||||
extern void unpack(char *file, signed char fileType);
|
||||
extern void unpack(const char *file, signed char fileType);
|
||||
extern void freePackBuffer();
|
||||
|
||||
extern globalEngineVariables engine;
|
||||
|
|
|
@ -35,13 +35,13 @@ extern void updateMissionRequirements(int type, int id, int value);
|
|||
extern void addCollectable(float x, float y, int type, int value, int life);
|
||||
extern void addExplosion(float x, float y, int type);
|
||||
extern void generateShockWave(object *bullet);
|
||||
extern void setInfoLine(char *in, int color);
|
||||
extern void setInfoLine(const char *in, int color);
|
||||
extern void getKillMessage(object *ally);
|
||||
extern void getMissFireMessage(object *ally);
|
||||
extern void getPlayerHitMessage(object *ally);
|
||||
extern void checkMineBulletCollisions(object *bullet);
|
||||
extern void setKlineAttackMethod(object *theEnemy);
|
||||
extern void setRadioMessage(signed char face, char *in, int priority);
|
||||
extern void setRadioMessage(signed char face, const char *in, int priority);
|
||||
|
||||
extern globalEngineVariables engine;
|
||||
extern devVariables dev;
|
||||
|
|
|
@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "classes.h"
|
||||
|
||||
extern void addCollectable(float x, float y, int type, int value, int life);
|
||||
extern void setRadioMessage(signed char face, char *in, int priority);
|
||||
extern void setRadioMessage(signed char face, const char *in, int priority);
|
||||
|
||||
extern globalEngineVariables engine;
|
||||
extern Game currentGame;
|
||||
|
|
|
@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
*/
|
||||
|
||||
extern void showErrorAndExit(int errorId, char *name);
|
||||
extern void showErrorAndExit(int errorId, const char *name);
|
||||
|
||||
class Collision {
|
||||
|
||||
|
@ -333,7 +333,7 @@ class Graphics {
|
|||
In 16 bit mode this is slow. VERY slow. Don't write directly to a surface
|
||||
that constantly needs updating (eg - the main game screen)
|
||||
*/
|
||||
int renderString(char *in, int x, int y, int fontColor, signed char wrap, SDL_Surface *dest)
|
||||
int renderString(const char *in, int x, int y, int fontColor, signed char wrap, SDL_Surface *dest)
|
||||
{
|
||||
SDL_Rect area;
|
||||
area.x = x;
|
||||
|
@ -379,7 +379,7 @@ class Graphics {
|
|||
return area.y;
|
||||
}
|
||||
|
||||
int drawString(char *in, int x, int y, int fontColor, signed char wrap, SDL_Surface *dest)
|
||||
int drawString(const char *in, int x, int y, int fontColor, signed char wrap, SDL_Surface *dest)
|
||||
{
|
||||
renderString(in, x, y - 1, FONT_OUTLINE, wrap, dest);
|
||||
renderString(in, x, y + 1, FONT_OUTLINE, wrap, dest);
|
||||
|
@ -390,14 +390,14 @@ class Graphics {
|
|||
return renderString(in, x, y, fontColor, wrap, dest);
|
||||
}
|
||||
|
||||
int drawString(char *in, int x, int y, int fontColor, SDL_Surface *dest)
|
||||
int drawString(const char *in, int x, int y, int fontColor, SDL_Surface *dest)
|
||||
{
|
||||
if (x == -1)
|
||||
x = (dest->w - (strlen(in) * 9)) / 2;
|
||||
return drawString(in, x, y, fontColor, 0, dest);
|
||||
}
|
||||
|
||||
int drawString(char *in, int x, int y, int fontColor)
|
||||
int drawString(const char *in, int x, int y, int fontColor)
|
||||
{
|
||||
if (x == -1)
|
||||
x = (800 - (strlen(in) * 9)) / 2;
|
||||
|
@ -619,7 +619,7 @@ class Graphics {
|
|||
return newImage;
|
||||
}
|
||||
|
||||
SDL_Surface *textSurface(char *inString, int color)
|
||||
SDL_Surface *textSurface(const char *inString, int color)
|
||||
{
|
||||
SDL_Surface *surface = createSurface(strlen(inString) * 9, 16);
|
||||
|
||||
|
@ -628,7 +628,7 @@ class Graphics {
|
|||
return setTransparent(surface);
|
||||
}
|
||||
|
||||
void textSurface(int index, char *inString, int x, int y, int fontColor)
|
||||
void textSurface(int index, const char *inString, int x, int y, int fontColor)
|
||||
{
|
||||
strcpy(textShape[index].text, inString);
|
||||
textShape[index].x = x;
|
||||
|
@ -654,7 +654,7 @@ class Graphics {
|
|||
return surface;
|
||||
}
|
||||
|
||||
void createMessageBox(SDL_Surface *face, char *message, signed char transparent)
|
||||
void createMessageBox(SDL_Surface *face, const char *message, signed char transparent)
|
||||
{
|
||||
if (messageBox != NULL)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "classes.h"
|
||||
|
||||
extern void updateMissionRequirements(int type, int id, int value);
|
||||
extern void setInfoLine(char *in, int color);
|
||||
extern void setInfoLine(const char *in, int color);
|
||||
extern object *addCargo(object *owner, int cargoType);
|
||||
extern void addExplosion(float x, float y, int type);
|
||||
extern void playSound(int sid);
|
||||
|
|
|
@ -29,8 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "structs.h"
|
||||
#include "classes.h"
|
||||
|
||||
extern int locateDataInPak(char *file, signed char required);
|
||||
extern int getFace(char *face);
|
||||
extern int locateDataInPak(const char *file, signed char required);
|
||||
extern int getFace(const char *face);
|
||||
|
||||
extern globalEngineVariables engine;
|
||||
extern Game currentGame;
|
||||
|
|
|
@ -55,7 +55,7 @@ void compareLastKeyInputs()
|
|||
{engine.cheatCredits = 1; memset(lastKeyEvents, ' ', 25);}
|
||||
}
|
||||
|
||||
void addKeyEvent(char *keyName)
|
||||
void addKeyEvent(const char *keyName)
|
||||
{
|
||||
if (strlen(keyName) > 1)
|
||||
return;
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "graphics.h"
|
||||
|
||||
SDL_Surface *loadImage(char *filename)
|
||||
SDL_Surface *loadImage(const char *filename)
|
||||
{
|
||||
SDL_Surface *image, *newImage;
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "structs.h"
|
||||
#include "classes.h"
|
||||
|
||||
extern void unpack(char *file, signed char fileType);
|
||||
extern void showErrorAndExit(int errorId, char *name);
|
||||
extern void unpack(const char *file, signed char fileType);
|
||||
extern void showErrorAndExit(int errorId, const char *name);
|
||||
|
||||
extern Star star[200];
|
||||
extern globalEngineVariables engine;
|
||||
|
|
|
@ -48,7 +48,7 @@ Something went wrong. This stops the game, present the error message and
|
|||
prompts the user to press space or ctrl to exit the game. This is unlikely to
|
||||
be seen by people unless something really stoopid happens!
|
||||
*/
|
||||
void showErrorAndExit(int errorId, char *name)
|
||||
void showErrorAndExit(int errorId, const char *name)
|
||||
{
|
||||
graphics.clearScreen(graphics.black);
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
extern void freeSound();
|
||||
extern void resetLists();
|
||||
extern void getPlayerInput();
|
||||
extern void drawString(char *in, int x, int y, int fontColor);
|
||||
extern SDL_Surface *loadImage(char *filename);
|
||||
extern void drawString(const char *in, int x, int y, int fontColor);
|
||||
extern SDL_Surface *loadImage(const char *filename);
|
||||
|
||||
extern globalEngineVariables engine;
|
||||
extern Game currentGame;
|
||||
|
|
|
@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "structs.h"
|
||||
#include "classes.h"
|
||||
|
||||
extern SDL_Surface *loadImage(char *filename);
|
||||
extern SDL_Surface *loadImage(const char *filename);
|
||||
extern void doStarfield();
|
||||
extern void getPlayerInput();
|
||||
extern void showShop();
|
||||
|
@ -38,15 +38,15 @@ extern void initShop();
|
|||
extern int initSaveSlots();
|
||||
extern int showSaveSlots(SDL_Surface *savesSurface, signed char saveSlot);
|
||||
extern void saveGame(int slot);
|
||||
extern void loadMusic(char *filename);
|
||||
extern void loadBackground(char *filename);
|
||||
extern void loadMusic(const char *filename);
|
||||
extern void loadBackground(const char *filename);
|
||||
extern void createCommsSurface(SDL_Surface *comms);
|
||||
extern void updateCommsSurface(SDL_Surface *comms);
|
||||
extern void createSavesSurface(SDL_Surface *savesSurface, signed char clickedSlot);
|
||||
extern void checkForBossMission();
|
||||
extern void doComms(SDL_Surface *comms);
|
||||
extern int locateDataInPak(char *file, signed char required);
|
||||
extern int getFace(char *face);
|
||||
extern int locateDataInPak(const char *file, signed char required);
|
||||
extern int getFace(const char *face);
|
||||
extern void flushInput();
|
||||
|
||||
extern globalEngineVariables engine;
|
||||
|
|
|
@ -146,9 +146,9 @@ void getKillMessage(object *ally)
|
|||
setRadioMessage(faceToUse, in, 0);
|
||||
}
|
||||
|
||||
char *getKlineInsult()
|
||||
const char *getKlineInsult()
|
||||
{
|
||||
static char insult[][40] = {
|
||||
static const char insult[][40] = {
|
||||
"Pathetic", "How very disappointing...", "Heroic. And stupid", "Fool", "And now you're nothing but a DEAD hero"
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "defs.h"
|
||||
#include "structs.h"
|
||||
|
||||
extern void setRadioMessage(signed char face, char *in, int priority);
|
||||
extern void setRadioMessage(signed char face, const char *in, int priority);
|
||||
|
||||
char killMessage[10][50];
|
||||
char deathMessage[6][50];
|
||||
|
|
|
@ -41,7 +41,7 @@ string and colors. It will set the information to the first free infoline
|
|||
it finds (top to bottom). If it doesn't find any free ones, it will push
|
||||
all the other info lines down one and add itself to the top.
|
||||
*/
|
||||
void setInfoLine(char *in, int color)
|
||||
void setInfoLine(const char *in, int color)
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
|
@ -70,7 +70,7 @@ Sets a radio message that appears at the top of the screen. Used for
|
|||
script events, etc. We send a message priority too, since we don't want
|
||||
Phoebe or Ursula's banter to interrupt an important message
|
||||
*/
|
||||
void setRadioMessage(signed char face, char *in, int priority)
|
||||
void setRadioMessage(signed char face, const char *in, int priority)
|
||||
{
|
||||
if ((graphics.textShape[3].life > 0) && (priority == 0))
|
||||
return;
|
||||
|
@ -400,7 +400,7 @@ void doInfo()
|
|||
}
|
||||
}
|
||||
|
||||
int getFace(char *face)
|
||||
int getFace(const char *face)
|
||||
{
|
||||
for (int i = 0 ; i < 7 ; i++)
|
||||
{
|
||||
|
|
|
@ -29,16 +29,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "structs.h"
|
||||
#include "classes.h"
|
||||
|
||||
extern SDL_Surface *loadImage(char *file_name);
|
||||
extern SDL_Surface *loadImage(const char *file_name);
|
||||
extern void playRandomTrack();
|
||||
extern void getPlayerInput();
|
||||
extern void setInfoLine(char *in, int color);
|
||||
extern void setInfoLine(const char *in, int color);
|
||||
extern void loadGameGraphics();
|
||||
extern void killAllAliens();
|
||||
extern int locateDataInPak(char *file, signed char required);
|
||||
extern void setRadioMessage(signed char face, char *in, int priority);
|
||||
extern int locateDataInPak(const char *file, signed char required);
|
||||
extern void setRadioMessage(signed char face, const char *in, int priority);
|
||||
extern void syncScriptEvents();
|
||||
extern void loadMusic(char *filename);
|
||||
extern void loadMusic(const char *filename);
|
||||
extern void setTarget(int index);
|
||||
extern void flushInput();
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@ extern void fireBullet(object *attacker, int weaponType);
|
|||
extern void addExplosion(float x, float y, int type);
|
||||
extern void playSound(int sid);
|
||||
extern void addEngine(object *craft);
|
||||
extern void addKeyEvent(char *keyName);
|
||||
extern void addKeyEvent(const char *keyName);
|
||||
extern void addDebris(int x, int y, int amount);
|
||||
extern void setRadioMessage(signed char face, char *in, int priority);
|
||||
extern void setInfoLine(char *in, int color);
|
||||
extern void setRadioMessage(signed char face, const char *in, int priority);
|
||||
extern void setInfoLine(const char *in, int color);
|
||||
extern void getPlayerDeathMessage();
|
||||
extern void playSound(int sid);
|
||||
extern void setTarget(int index);
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "resources.h"
|
||||
|
||||
void loadBackground(char *filename)
|
||||
void loadBackground(const char *filename)
|
||||
{
|
||||
if (graphics.background != NULL)
|
||||
{
|
||||
|
|
|
@ -29,10 +29,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "structs.h"
|
||||
#include "classes.h"
|
||||
|
||||
extern void unpack(char *file, signed char fileType);
|
||||
extern SDL_Surface *loadImage(char *filename);
|
||||
extern Mix_Chunk *loadSound(char *filename);
|
||||
extern int locateDataInPak(char *file, signed char required);
|
||||
extern void unpack(const char *file, signed char fileType);
|
||||
extern SDL_Surface *loadImage(const char *filename);
|
||||
extern Mix_Chunk *loadSound(const char *filename);
|
||||
extern int locateDataInPak(const char *file, signed char required);
|
||||
extern void setAlienShapes();
|
||||
extern void setWeaponShapes();
|
||||
extern void loadGameGraphics();
|
||||
|
|
|
@ -32,14 +32,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
extern void doStarfield();
|
||||
extern void getPlayerInput();
|
||||
extern void loadGameGraphics();
|
||||
extern void loadBackground(char *filename);
|
||||
extern void setRadioMessage(signed char face, char *in, int priority);
|
||||
extern void loadBackground(const char *filename);
|
||||
extern void setRadioMessage(signed char face, const char *in, int priority);
|
||||
extern void doExplosions();
|
||||
extern void addEngine(object *craft);
|
||||
extern void doExplosions();
|
||||
extern void resetLists();
|
||||
extern int getFace(char *face);
|
||||
extern int locateDataInPak(char *file, signed char required);
|
||||
extern int getFace(const char *face);
|
||||
extern int locateDataInPak(const char *file, signed char required);
|
||||
extern void flushInput();
|
||||
|
||||
extern Game currentGame;
|
||||
|
|
|
@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "structs.h"
|
||||
#include "classes.h"
|
||||
|
||||
extern int locateDataInPak(char *file, signed char required);
|
||||
extern int locateDataInPak(const char *file, signed char required);
|
||||
|
||||
extern object player;
|
||||
extern globalEngineVariables engine;
|
||||
|
|
10
code/title.h
10
code/title.h
|
@ -29,9 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "structs.h"
|
||||
#include "classes.h"
|
||||
|
||||
extern SDL_Surface *loadImage(char *filename);
|
||||
extern void unpack(char *file);
|
||||
extern void loadMusic(char *filename);
|
||||
extern SDL_Surface *loadImage(const char *filename);
|
||||
extern void unpack(const char *file);
|
||||
extern void loadMusic(const char *filename);
|
||||
extern void doStarfield();
|
||||
extern void doExplosions();
|
||||
extern void addEngine(object *craft);
|
||||
|
@ -41,9 +41,9 @@ extern signed char loadGame(int slot);
|
|||
extern int initSaveSlots();
|
||||
extern void newGame();
|
||||
extern void loadGameGraphics();
|
||||
extern void loadBackground(char *filename);
|
||||
extern void loadBackground(const char *filename);
|
||||
extern void doCredits();
|
||||
extern int locateDataInPak(char *file, signed char required);
|
||||
extern int locateDataInPak(const char *file, signed char required);
|
||||
extern void flushInput();
|
||||
|
||||
extern globalEngineVariables engine;
|
||||
|
|
|
@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
Searches the pak file for the required data. When
|
||||
it is found, the data is read into a character buffer.
|
||||
*/
|
||||
void unpack(char *file, signed char fileType)
|
||||
void unpack(const char *file, signed char fileType)
|
||||
{
|
||||
unsigned char *packBuffer;
|
||||
char packFilename[60];
|
||||
|
@ -105,7 +105,7 @@ void unpack(char *file, signed char fileType)
|
|||
Search the data package for the required file.
|
||||
When it is found, return the location.
|
||||
*/
|
||||
int locateDataInPak(char *file, signed char required)
|
||||
int locateDataInPak(const char *file, signed char required)
|
||||
{
|
||||
//printf("Looking for %s...", file);
|
||||
|
||||
|
|
|
@ -30,6 +30,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "defs.h"
|
||||
#include "structs.h"
|
||||
|
||||
extern void showErrorAndExit(int errorId, char *name);
|
||||
extern void showErrorAndExit(int errorId, const char *name);
|
||||
|
||||
extern globalEngineVariables engine;
|
||||
|
|
|
@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "structs.h"
|
||||
#include "classes.h"
|
||||
|
||||
extern int locateDataInPak(char *file, signed char required);
|
||||
extern int locateDataInPak(const char *file, signed char required);
|
||||
|
||||
extern Graphics graphics;
|
||||
extern object weapon[MAX_WEAPONS];
|
||||
|
|
Loading…
Reference in New Issue