From c4409487fdb2822309b9d8cf79bcd7d3895b8390 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Wed, 22 Apr 2020 02:36:36 +0200 Subject: [PATCH] Const correct (most) strings At least those cases that are reported by gcc and/or clang. --- src/avp/cconvars.cpp | 2 +- src/avp/gamecmds.cpp | 6 +- src/avp/gamedef.h | 2 +- src/avp/hmodel.c | 40 +++++----- src/avp/hmodel.h | 28 +++---- src/avp/hud.c | 4 +- src/avp/huddefs.h | 2 +- src/avp/language.c | 2 +- src/avp/language.h | 6 +- src/avp/messagehistory.c | 2 +- src/avp/pmove.c | 2 +- src/avp/psnd.c | 4 +- src/avp/psnd.h | 2 +- src/avp/secstats.c | 14 ++-- src/avp/support/consbind.cpp | 2 +- src/avp/support/consbind.hpp | 2 +- src/avp/support/consbtch.cpp | 2 +- src/avp/support/consbtch.hpp | 2 +- src/avp/support/strtab.cpp | 4 +- src/avp/support/strtab.hpp | 4 +- src/avp/win95/d3d_hud.cpp | 2 +- src/avp/win95/d3d_render.cpp | 22 +++--- src/avp/win95/directplay.c | 16 ++-- src/avp/win95/frontend/avp_intro.cpp | 4 +- src/avp/win95/frontend/avp_menugfx.cpp | 38 +++++----- src/avp/win95/frontend/avp_menugfx.hpp | 10 +-- src/avp/win95/frontend/avp_menus.c | 74 +++++++++--------- src/avp/win95/frontend/avp_mp_config.cpp | 12 +-- src/avp/win95/frontend/avp_mp_config.h | 4 +- src/avp/win95/gadgets/conscmnd.cpp | 96 ++++++++++++------------ src/avp/win95/gadgets/conscmnd.hpp | 30 ++++---- src/avp/win95/gadgets/conssym.cpp | 2 +- src/avp/win95/gadgets/conssym.hpp | 2 +- src/avp/win95/gadgets/consvar.cpp | 32 ++++---- src/avp/win95/gadgets/consvar.hpp | 14 ++-- src/avp/win95/gadgets/gadget.cpp | 2 +- src/avp/win95/gadgets/gadget.h | 12 +-- src/avp/win95/gadgets/hudgadg.cpp | 2 +- src/avp/win95/gadgets/hudgadg.hpp | 2 +- src/avp/win95/gadgets/textin.cpp | 8 +- src/avp/win95/gadgets/textin.hpp | 6 +- src/avp/win95/langplat.c | 2 +- src/avp/win95/pcmenus.cpp | 4 +- src/avp/win95/platsup.c | 6 +- src/avp/win95/pldnet.c | 12 +-- src/avp/win95/pldnet.h | 2 +- src/avp/win95/progress_bar.cpp | 2 +- src/avp/win95/projload.cpp | 10 +-- src/avp/win95/projload.hpp | 2 +- src/avp/win95/system.c | 2 +- src/fixer.h | 2 +- src/main.c | 4 +- src/main2.c | 4 +- src/menus.c | 44 +++++------ src/opengl.c | 30 ++++---- src/opengl.h | 6 +- src/version.c | 4 +- src/win95/chunk.cpp | 2 +- src/win95/enumchnk.cpp | 2 +- src/win95/enumchnk.hpp | 2 +- src/win95/envchunk.cpp | 2 +- src/win95/envchunk.hpp | 2 +- src/win95/gsprchnk.cpp | 2 +- src/win95/gsprchnk.hpp | 2 +- src/win95/mishchnk.cpp | 2 +- src/win95/mishchnk.hpp | 4 +- src/win95/obchunk.cpp | 2 +- src/win95/obchunk.hpp | 2 +- src/win95/shpchunk.cpp | 2 +- src/win95/shpchunk.hpp | 2 +- src/win95/videomodes.cpp | 6 +- src/winapi.c | 2 +- 72 files changed, 347 insertions(+), 347 deletions(-) diff --git a/src/avp/cconvars.cpp b/src/avp/cconvars.cpp index f914b6d..eefd7dc 100644 --- a/src/avp/cconvars.cpp +++ b/src/avp/cconvars.cpp @@ -105,7 +105,7 @@ extern int mx,my,mz; extern int RATweak; extern TEMPLATE_WEAPON_DATA TemplateWeapon[MAX_NO_OF_WEAPON_TEMPLATES]; -extern void NewOnScreenMessage(unsigned char *messagePtr); +extern void NewOnScreenMessage(const unsigned char *messagePtr); extern int GlobalAmbience; int Old_GlobalAmbience=ONE_FIXED; diff --git a/src/avp/gamecmds.cpp b/src/avp/gamecmds.cpp index a9b0796..c1af6a3 100644 --- a/src/avp/gamecmds.cpp +++ b/src/avp/gamecmds.cpp @@ -222,14 +222,14 @@ extern void ShowMultiplayerScores(void) ShowMultiplayerScoreTimer=5*ONE_FIXED; } -extern void AddNetMsg_ChatBroadcast(char *string,BOOL same_species_only); +extern void AddNetMsg_ChatBroadcast(const char *string,BOOL same_species_only); -static void DoMultiplayerSay(char* string) +static void DoMultiplayerSay(const char* string) { AddNetMsg_ChatBroadcast(string,FALSE); } -static void DoMultiplayerSaySpecies(char* string) +static void DoMultiplayerSaySpecies(const char* string) { AddNetMsg_ChatBroadcast(string,TRUE); } diff --git a/src/avp/gamedef.h b/src/avp/gamedef.h index bd3aaa3..aa70c16 100644 --- a/src/avp/gamedef.h +++ b/src/avp/gamedef.h @@ -228,7 +228,7 @@ extern int IDemandTurnLeft(); typedef struct environment_list_object{ - char* main; + const char* main; }ELO; diff --git a/src/avp/hmodel.c b/src/avp/hmodel.c index a1d96d5..77b941e 100644 --- a/src/avp/hmodel.c +++ b/src/avp/hmodel.c @@ -195,12 +195,12 @@ void New_Preprocess_Keyframe(KEYFRAME_DATA *this_keyframe, KEYFRAME_DATA *next_k } -void Preprocess_Section(SECTION *this_section, char *riffname ,VECTORCH* offset_to_return) { +void Preprocess_Section(SECTION *this_section, const char *riffname ,VECTORCH* offset_to_return) { KEYFRAME_DATA *this_keyframe; VECTORCH cumulative_gore_direction; VECTORCH next_one_down; - SECTION_ATTACHMENT *sec_att; + const SECTION_ATTACHMENT *sec_att; int a; if (this_section->ShapeName!=NULL) { @@ -319,7 +319,7 @@ void Preprocess_Section(SECTION *this_section, char *riffname ,VECTORCH* offset_ } -void Preprocess_HModel(SECTION *root, char *riffname) { +void Preprocess_HModel(SECTION *root, const char *riffname) { /* One-time preprocessor, prerocesses the 'deltas' for all sequences. */ GLOBALASSERT(root); /* Stop messin' about... */ @@ -2838,7 +2838,7 @@ int Splice_HModels(HMODELCONTROLLER *new_controller,SECTION_DATA *top_section_da } -SECTION_DATA *GetSectionData_Recursion(SECTION_DATA *this_section_data,char *name) { +SECTION_DATA *GetSectionData_Recursion(SECTION_DATA *this_section_data,const char *name) { SECTION_DATA *sdptr; @@ -2871,7 +2871,7 @@ SECTION_DATA *GetSectionData_Recursion(SECTION_DATA *this_section_data,char *nam } -SECTION_DATA *GetThisSectionData(SECTION_DATA *root,char *name) { +SECTION_DATA *GetThisSectionData(SECTION_DATA *root,const char *name) { if ((root==NULL)||(name==NULL)) { return(NULL); @@ -2881,7 +2881,7 @@ SECTION_DATA *GetThisSectionData(SECTION_DATA *root,char *name) { } -SECTION *GetSection_Recursion(SECTION *this_section,char *name) { +SECTION *GetSection_Recursion(SECTION *this_section,const char *name) { SECTION *sptr; @@ -2915,7 +2915,7 @@ SECTION *GetSection_Recursion(SECTION *this_section,char *name) { } -SECTION *GetThisSection(SECTION *root,char *name) { +SECTION *GetThisSection(SECTION *root,const char *name) { if ((root==NULL)||(name==NULL)) { return(NULL); @@ -3440,7 +3440,7 @@ static void FindHeatSource_Recursion(HMODELCONTROLLER *controllerPtr, SECTION_DA } } -DELTA_CONTROLLER *Get_Delta_Sequence(HMODELCONTROLLER *controller,char *id) { +DELTA_CONTROLLER *Get_Delta_Sequence(HMODELCONTROLLER *controller,const char *id) { DELTA_CONTROLLER *delta_controller; @@ -3459,7 +3459,7 @@ DELTA_CONTROLLER *Get_Delta_Sequence(HMODELCONTROLLER *controller,char *id) { return(delta_controller); } -void Remove_Delta_Sequence(HMODELCONTROLLER *controller,char *id) { +void Remove_Delta_Sequence(HMODELCONTROLLER *controller,const char *id) { DELTA_CONTROLLER *delta_controller; DELTA_CONTROLLER **source; @@ -3486,7 +3486,7 @@ void Remove_Delta_Sequence(HMODELCONTROLLER *controller,char *id) { } } -DELTA_CONTROLLER *Add_Delta_Sequence(HMODELCONTROLLER *controller,char *id,int sequence_type,int sub_sequence, int seconds_for_sequence) { +DELTA_CONTROLLER *Add_Delta_Sequence(HMODELCONTROLLER *controller,const char *id,int sequence_type,int sub_sequence, int seconds_for_sequence) { KEYFRAME_DATA *sequence_start; SEQUENCE *this_sequence; @@ -3587,7 +3587,7 @@ void Delta_Sequence_ChangeSpeed(DELTA_CONTROLLER *delta_controller,int seconds_f } -SECTION *Get_Corresponding_Section(SECTION **List_Ptr,char *Name) { +SECTION *Get_Corresponding_Section(SECTION **List_Ptr,const char *Name) { SECTION **child_list_ptr=List_Ptr; @@ -3601,7 +3601,7 @@ SECTION *Get_Corresponding_Section(SECTION **List_Ptr,char *Name) { return(*child_list_ptr); } -SECTION_DATA *GetThisSectionData_FromChildrenOnly(SECTION_DATA *parent,char *name) { +SECTION_DATA *GetThisSectionData_FromChildrenOnly(SECTION_DATA *parent,const char *name) { SECTION_DATA *sdptr; @@ -4185,7 +4185,7 @@ SECTION_DATA *PointInHModel(HMODELCONTROLLER *controller,VECTORCH *point) { } -SECTION *Get_Corresponding_Section_Recursive(SECTION *this_section,char *Name) { +SECTION *Get_Corresponding_Section_Recursive(SECTION *this_section,const char *Name) { SECTION **child_list_ptr; @@ -4486,7 +4486,7 @@ void InitHModelTweening_ToTheMiddle(HMODELCONTROLLER *controller, int seconds_fo } -void Verify_Positions_Recursion(HMODELCONTROLLER *controller,SECTION_DATA *this_section_data,VECTORCH *parent_position,char *callCode) { +void Verify_Positions_Recursion(HMODELCONTROLLER *controller,SECTION_DATA *this_section_data,VECTORCH *parent_position,const char *callCode) { /* Verify positions... */ @@ -4543,7 +4543,7 @@ void Verify_Positions_Recursion(HMODELCONTROLLER *controller,SECTION_DATA *this_ } -void Verify_Positions_In_HModel(STRATEGYBLOCK *sbPtr,HMODELCONTROLLER *controller,char *callCode) { +void Verify_Positions_In_HModel(STRATEGYBLOCK *sbPtr,HMODELCONTROLLER *controller,const char *callCode) { /* Verify position integrity. */ @@ -4862,7 +4862,7 @@ void LoadHierarchy(SAVE_BLOCK_HEADER* header,HMODELCONTROLLER* controller) //get the names from just after the block { - char* buffer=(char*) header; + const char* buffer=(char*) header; buffer+=sizeof(*block); Hierarchy_Name = buffer; @@ -4995,8 +4995,8 @@ void SaveHierarchy(HMODELCONTROLLER* controller) { char* buffer; - char* Hierarchy_Name = controller->Root_Section->Hierarchy_Name; - char* Rif_Name = controller->Root_Section->Rif_Name; + const char* Hierarchy_Name = controller->Root_Section->Hierarchy_Name; + const char* Rif_Name = controller->Root_Section->Rif_Name; //increase the block size by enough to hold these names block->header.size+= strlen(Hierarchy_Name)+strlen(Rif_Name)+2; @@ -5049,7 +5049,7 @@ static void LoadHierarchyDelta(SAVE_BLOCK_HEADER* header,HMODELCONTROLLER* contr { DELTA_CONTROLLER* delta; HIERARCHY_DELTA_SAVE_BLOCK* block = (HIERARCHY_DELTA_SAVE_BLOCK*) header; - char* name = (char*) (block+1); + const char* name = (char*) (block+1); delta = Get_Delta_Sequence(controller,name); if(!delta) @@ -5142,7 +5142,7 @@ typedef struct hierarchy_section_save_block //defines for load/save macros #define SAVELOAD_BEHAV section -extern HIERARCHY_SHAPE_REPLACEMENT* GetHierarchyAlternateShapeFromId(const char* rif_name,int replacement_id,char* section_name); +extern HIERARCHY_SHAPE_REPLACEMENT* GetHierarchyAlternateShapeFromId(const char* rif_name,int replacement_id,const char* section_name); static void LoadHierarchySection(SECTION_DATA* section) diff --git a/src/avp/hmodel.h b/src/avp/hmodel.h index 86cfaf1..294a897 100644 --- a/src/avp/hmodel.h +++ b/src/avp/hmodel.h @@ -141,8 +141,8 @@ typedef struct section { SHAPEHEADER *Shape; char *ShapeName; char *Section_Name; - char *Hierarchy_Name; - char *Rif_Name; + const char *Hierarchy_Name; + const char *Rif_Name; struct section **Children; int num_sequences; SEQUENCE *sequence_array; @@ -155,7 +155,7 @@ typedef struct section { typedef struct section_attachment { char *Riffname; char *Section_Name; - char **Hierarchy_Name; + const char **Hierarchy_Name; struct damageblock StartingStats; int flags; } SECTION_ATTACHMENT; @@ -345,12 +345,12 @@ typedef struct hitlocationtable { } HITLOCATIONTABLE; -extern SECTION_ATTACHMENT Global_Section_Attachments[]; -extern SECTION_ATTACHMENT Default_Stats; +extern const SECTION_ATTACHMENT Global_Section_Attachments[]; +extern const SECTION_ATTACHMENT Default_Stats; struct strategyblock; -extern void Preprocess_HModel(SECTION *root,char *riffname); +extern void Preprocess_HModel(SECTION *root,const char *riffname); extern void Create_HModel(HMODELCONTROLLER *controller,SECTION *root); extern void InitHModelSequence(HMODELCONTROLLER *controller, int sequence_type, int subsequence, int seconds_for_sequence); extern void DoHModel(HMODELCONTROLLER *controller, struct displayblock *dptr); @@ -362,18 +362,18 @@ extern int Prune_HModel_Virtual(SECTION_DATA *top_section); extern void Correlate_HModel_Instances(SECTION_DATA *victim,SECTION_DATA *templat); extern int GetSequenceID(int sequence_type,int sub_sequence); extern SEQUENCE *GetSequencePointer(int sequence_type,int sub_sequence,SECTION *this_section); -extern SECTION_ATTACHMENT *GetThisSectionAttachment(char *riffname,char *section_name,char *hierarchy_name); +extern const SECTION_ATTACHMENT *GetThisSectionAttachment(const char *riffname,const char *section_name,const char *hierarchy_name); extern void Extreme_Gibbing(struct strategyblock *sbPtr,SECTION_DATA *this_section_data, int probability); extern int Splice_HModels(HMODELCONTROLLER *new_controller,SECTION_DATA *top_section_data); extern void HModel_ChangeSpeed(HMODELCONTROLLER *controller, int seconds_for_sequence); -extern SECTION_DATA *GetThisSectionData(SECTION_DATA *root,char *name); -extern SECTION *GetThisSection(SECTION *root,char *name); +extern SECTION_DATA *GetThisSectionData(SECTION_DATA *root,const char *name); +extern SECTION *GetThisSection(SECTION *root,const char *name); extern void InitHModelTweening(HMODELCONTROLLER *controller, int seconds_for_tweening, int target_sequence_type, int target_subsequence, int target_seconds_for_sequence, int loop); extern void InitHModelTweening_Backwards(HMODELCONTROLLER *controller, int seconds_for_tweening, int target_sequence_type, int target_subsequence, int target_seconds_for_sequence, int loop); extern void InitHModelTweening_ToTheMiddle(HMODELCONTROLLER *controller, int seconds_for_tweening,int target_sequence_type, int target_subsequence, int target_seconds_for_sequence, int target_sequence_timer, int loop); -extern DELTA_CONTROLLER *Add_Delta_Sequence(HMODELCONTROLLER *controller,char *id,int sequence_type,int sub_sequence, int seconds_for_sequence); -extern DELTA_CONTROLLER *Get_Delta_Sequence(HMODELCONTROLLER *controller,char *id); -extern void Remove_Delta_Sequence(HMODELCONTROLLER *controller,char *id); +extern DELTA_CONTROLLER *Add_Delta_Sequence(HMODELCONTROLLER *controller,const char *id,int sequence_type,int sub_sequence, int seconds_for_sequence); +extern DELTA_CONTROLLER *Get_Delta_Sequence(HMODELCONTROLLER *controller,const char *id); +extern void Remove_Delta_Sequence(HMODELCONTROLLER *controller,const char *id); extern void Transmogrify_HModels(struct strategyblock *sbPtr,HMODELCONTROLLER *controller,SECTION *new_template, int frag, int newsections, int regrowsections); extern void TrimToTemplate(struct strategyblock *sbPtr,HMODELCONTROLLER *controller,SECTION *new_template, int frag); extern void Start_Delta_Sequence(DELTA_CONTROLLER *delta_controller,int sequence_type,int sub_sequence,int seconds_for_sequence); @@ -386,12 +386,12 @@ extern void HModel_Regen(HMODELCONTROLLER *controller,int time); extern int HModelAnimation_IsFinished(HMODELCONTROLLER *controller); extern int DeltaAnimation_IsFinished(DELTA_CONTROLLER *controller); extern SECTION_DATA *PointInHModel(HMODELCONTROLLER *controller,VECTORCH *point); -extern SECTION *Get_Corresponding_Section_Recursive(SECTION *this_section,char *Name); +extern SECTION *Get_Corresponding_Section_Recursive(SECTION *this_section,const char *Name); extern SECTION_DATA *GetThisSectionData_FromID(SECTION_DATA *root,int IDnumber); extern void PlayHierarchySound(HIERARCHY_SOUND* sound,VECTORCH* location); extern void HModel_SetToolsRelativeSpeed(HMODELCONTROLLER *controller, int factor); extern void Setup_Texture_Animation_For_Section(SECTION_DATA *this_section_data); -extern void Verify_Positions_In_HModel(struct strategyblock *sbPtr,HMODELCONTROLLER *controller,char *callCode); +extern void Verify_Positions_In_HModel(struct strategyblock *sbPtr,HMODELCONTROLLER *controller,const char *callCode); extern int HModel_DepthTest(HMODELCONTROLLER *controller,SECTION_DATA *test_section_data,int depth); extern void DeInitialise_HModel(HMODELCONTROLLER *controller); diff --git a/src/avp/hud.c b/src/avp/hud.c index 066f831..709966a 100644 --- a/src/avp/hud.c +++ b/src/avp/hud.c @@ -1750,7 +1750,7 @@ void DrawWristDisplay(void) extern HMODELCONTROLLER PlayersWeaponHModelController; SECTION_DATA *sectionPtr; - char *sectionName[]= {"Dum bar display","Dum 1 display","Dum 2 display","Dum 3 display","Dum 4 display"}; + const char *sectionName[]= {"Dum bar display","Dum 1 display","Dum 2 display","Dum 3 display","Dum 4 display"}; sectionPtr=GetThisSectionData(PlayersWeaponHModelController.section_data,sectionName[0]); if (!sectionPtr) return; @@ -2028,7 +2028,7 @@ int Fast2dMagnitude(int dx, int dy) * On screen messaging system * *************************KJL*/ -extern void NewOnScreenMessage(unsigned char *messagePtr) +extern void NewOnScreenMessage(const unsigned char *messagePtr) { GADGET_NewOnScreenMessage( messagePtr ); } diff --git a/src/avp/huddefs.h b/src/avp/huddefs.h index c1e81ee..46762f8 100644 --- a/src/avp/huddefs.h +++ b/src/avp/huddefs.h @@ -237,7 +237,7 @@ extern void KillHUD(void); /* KJL 11:00:22 05/20/97 - On-screen messaging system */ #define ON_SCREEN_MESSAGE_LIFETIME (ONE_FIXED*2) -extern void NewOnScreenMessage(unsigned char *messagePtr); +extern void NewOnScreenMessage(const unsigned char *messagePtr); /*KJL******************************************************************** * The text pointed to by the messagePtr will be displayed on screen for * * the time defined in ON_SCREEN_MESSAGE_LIFETIME. Any previous message * diff --git a/src/avp/language.c b/src/avp/language.c index 49bf319..3c83e97 100644 --- a/src/avp/language.c +++ b/src/avp/language.c @@ -32,7 +32,7 @@ static char *TextBufferPtr; void InitTextStrings(void) { - char *filename; + const char *filename; char *textPtr; int i; diff --git a/src/avp/language.h b/src/avp/language.h index 9d95f23..5b1577c 100644 --- a/src/avp/language.h +++ b/src/avp/language.h @@ -4,7 +4,7 @@ #include "langenum.h" #define ENGLISH_TEXT_FILENAME "ENGLISH.TXT" -extern unsigned char *LanguageFilename[]; +extern const unsigned char *LanguageFilename[]; extern void InitTextStrings(void); /*KJL*************************************************************** @@ -25,13 +25,13 @@ extern char *GetTextString(enum TEXTSTRING_ID stringID); -extern char *LoadTextFile(char *filename); +extern char *LoadTextFile(const char *filename); /*KJL***************************************************** * Platform specific function, which loads the named file * * and returns a pointer to the start of the file's data. * *****************************************************KJL*/ -extern void UnloadTextFile(char *filename, char *bufferPtr); +extern void UnloadTextFile(const char *filename, char *bufferPtr); /*KJL********************************************************** * Platform specific function, which unloads the named file * * and frees the memory pointed to by the bufferPtr. You may * diff --git a/src/avp/messagehistory.c b/src/avp/messagehistory.c index 6c46413..1e8a938 100644 --- a/src/avp/messagehistory.c +++ b/src/avp/messagehistory.c @@ -8,7 +8,7 @@ #define MAX_NO_OF_MESSAGES_IN_HISTORY 64 -extern void NewOnScreenMessage(unsigned char *messagePtr); +extern void NewOnScreenMessage(const unsigned char *messagePtr); struct MessageHistory { diff --git a/src/avp/pmove.c b/src/avp/pmove.c index ada4c1c..b24d3fd 100644 --- a/src/avp/pmove.c +++ b/src/avp/pmove.c @@ -123,7 +123,7 @@ static void NetPlayerDeadProcessing(STRATEGYBLOCK* sbPtr); static void CorpseMovement(STRATEGYBLOCK *sbPtr); extern SECTION * GetNamedHierarchyFromLibrary(const char * rif_name, const char * hier_name); -extern void NewOnScreenMessage(unsigned char *messagePtr); +extern void NewOnScreenMessage(const unsigned char *messagePtr); extern void RemoveAllThisPlayersDiscs(void); int timeInContactWithFloor; diff --git a/src/avp/psnd.c b/src/avp/psnd.c index ccb41cb..4642f0a 100644 --- a/src/avp/psnd.c +++ b/src/avp/psnd.c @@ -331,7 +331,7 @@ void SoundSys_ChangeVolume(int volume) /* Patrick 5/6/97 ------------------------------------------------------------- Functions for playing and controlling individual sounds ----------------------------------------------------------------------------*/ -void Sound_Play(SOUNDINDEX soundNumber, char *format, ...) +void Sound_Play(SOUNDINDEX soundNumber, const char *format, ...) { int newIndex; int loop = 0; @@ -368,7 +368,7 @@ void Sound_Play(SOUNDINDEX soundNumber, char *format, ...) /* examine the format string: if it is null, ignore it */ if(format) { - char *nextChar = format; + const char *nextChar = format; va_list argPtr; va_start(argPtr,format); diff --git a/src/avp/psnd.h b/src/avp/psnd.h index 77ad9af..e6349ff 100644 --- a/src/avp/psnd.h +++ b/src/avp/psnd.h @@ -135,7 +135,7 @@ extern void SoundSys_FadeOutFast(void); 'h': play sound with maximum priority (minimum is the default) 'm': flag for marines to ignore. -----------------------------------------------------------------------------*/ -extern void Sound_Play(SOUNDINDEX soundNumber, char* format, ...); +extern void Sound_Play(SOUNDINDEX soundNumber, const char* format, ...); /* Patrick 5/6/97 -------------------------------------------------------------- The remaining functions are used to modify existing playing sounds. All take a handle to a sound. If an invalid handle is passed, the functions have no diff --git a/src/avp/secstats.c b/src/avp/secstats.c index 9778529..1028ac0 100644 --- a/src/avp/secstats.c +++ b/src/avp/secstats.c @@ -992,7 +992,7 @@ HITLOCATIONTABLEENTRY SGGL[] = { {NULL, centre_aspect, 0}, }; -HITLOCATIONTABLE Global_Hitlocation_Tables[] = { +const HITLOCATIONTABLE Global_Hitlocation_Tables[] = { { /* MARINE */ "marine with pulse rifle", @@ -1149,7 +1149,7 @@ HITLOCATIONTABLE Global_Hitlocation_Tables[] = { }, }; -SECTION_ATTACHMENT Default_Stats = { +const SECTION_ATTACHMENT Default_Stats = { NULL, NULL, NULL, @@ -1170,7 +1170,7 @@ SECTION_ATTACHMENT Default_Stats = { section_flag_doesnthurtsb|section_flag_passdamagetoparent, }; -char *Android_Hierarchy_Names[] = { +const char *Android_Hierarchy_Names[] = { "Android shotgun", "Android Shotgun Special", "Android Pistol Special", @@ -1178,7 +1178,7 @@ char *Android_Hierarchy_Names[] = { NULL, }; -SECTION_ATTACHMENT Global_Section_Attachments[] = { +const SECTION_ATTACHMENT Global_Section_Attachments[] = { /* FACEHUGGERS! */ { "hnpchugger", @@ -10251,10 +10251,10 @@ SECTION_ATTACHMENT Global_Section_Attachments[] = { }, }; -SECTION_ATTACHMENT *GetThisSectionAttachment(char *riffname,char *section_name,char *hierarchy_name) { +const SECTION_ATTACHMENT *GetThisSectionAttachment(const char *riffname,const char *section_name,const char *hierarchy_name) { int a; - SECTION_ATTACHMENT *result; + const SECTION_ATTACHMENT *result; a=0; result=NULL; @@ -10268,7 +10268,7 @@ SECTION_ATTACHMENT *GetThisSectionAttachment(char *riffname,char *section_name,c /* If hierarchy_name is provided, it must match. */ if (hierarchy_name) { if (Global_Section_Attachments[a].Hierarchy_Name) { - char **this_name; + const char **this_name; /* Now, this is an array... */ this_name=Global_Section_Attachments[a].Hierarchy_Name; while (*this_name) { diff --git a/src/avp/support/consbind.cpp b/src/avp/support/consbind.cpp index 527210a..119a900 100644 --- a/src/avp/support/consbind.cpp +++ b/src/avp/support/consbind.cpp @@ -366,7 +366,7 @@ KeyBinding :: ListAllBindings(void) } // static -void KeyBinding :: WriteToConfigFile(char* Filename) +void KeyBinding :: WriteToConfigFile(const char* Filename) { // overwrites the file with a batch file that'll // restore current bindings diff --git a/src/avp/support/consbind.hpp b/src/avp/support/consbind.hpp index 593ecfd..ebb670c 100644 --- a/src/avp/support/consbind.hpp +++ b/src/avp/support/consbind.hpp @@ -95,7 +95,7 @@ static void ListAllBindings(void); - static void WriteToConfigFile(char* Filename); + static void WriteToConfigFile(const char* Filename); // overwrites the file with a batch file that'll // restore current bindings // Also destroys all current bindings, so that diff --git a/src/avp/support/consbtch.cpp b/src/avp/support/consbtch.cpp index 5440b38..42ddf23 100644 --- a/src/avp/support/consbtch.cpp +++ b/src/avp/support/consbtch.cpp @@ -70,7 +70,7 @@ // public: // static OurBool -BatchFileProcessing :: Run(char* Filename) +BatchFileProcessing :: Run(const char* Filename) { // Tries to find the file, if it finds it it reads it, // adds the non-comment lines to the pending list, and returns Yes diff --git a/src/avp/support/consbtch.hpp b/src/avp/support/consbtch.hpp index a9b3456..85a0a8b 100644 --- a/src/avp/support/consbtch.hpp +++ b/src/avp/support/consbtch.hpp @@ -31,7 +31,7 @@ class BatchFileProcessing { public: - static OurBool Run(char* Filename); + static OurBool Run(const char* Filename); // Tries to find the file, if it finds it it reads it, // adds the non-comment lines to the pending list, and returns Yes // If it can't find the file, it returns No diff --git a/src/avp/support/strtab.cpp b/src/avp/support/strtab.cpp index 74a367d..2e8bf00 100644 --- a/src/avp/support/strtab.cpp +++ b/src/avp/support/strtab.cpp @@ -80,7 +80,7 @@ } -/*STRINGTABLE_DECL_SPECIFIER*/ void StringTable :: Add( ProjChar* pProjChar ) +/*STRINGTABLE_DECL_SPECIFIER*/ void StringTable :: Add( const ProjChar* pProjChar ) { /* PRECONDITION */ { @@ -129,7 +129,7 @@ StringTable :: ~StringTable() // C-callable functions: #if OnlyOneStringTable -extern void AddToTable( ProjChar* pProjChar ) +extern void AddToTable( const ProjChar* pProjChar ) { /* PRECONDITION */ { diff --git a/src/avp/support/strtab.hpp b/src/avp/support/strtab.hpp index da4bd6d..801ee66 100644 --- a/src/avp/support/strtab.hpp +++ b/src/avp/support/strtab.hpp @@ -47,7 +47,7 @@ enum TEXTSTRING_ID stringID ); - STRINGTABLE_DECL_SPECIFIER void Add( ProjChar* pProjChar ); + STRINGTABLE_DECL_SPECIFIER void Add( const ProjChar* pProjChar ); #if OnlyOneStringTable static void Unload(void); @@ -66,7 +66,7 @@ /* Function prototypes **************************************************/ #if OnlyOneStringTable - extern void AddToTable( ProjChar* pProjChar ); + extern void AddToTable( const ProjChar* pProjChar ); extern void UnloadTable(void); #endif diff --git a/src/avp/win95/d3d_hud.cpp b/src/avp/win95/d3d_hud.cpp index 553a3b3..20489fd 100644 --- a/src/avp/win95/d3d_hud.cpp +++ b/src/avp/win95/d3d_hud.cpp @@ -29,7 +29,7 @@ extern "C" { #include "language.h" -extern void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour); +extern void D3D_RenderHUDString_Centred(const char *stringPtr, int centreX, int y, int colour); extern void D3D_RenderHUDNumber_Centred(unsigned int number,int x,int y,int colour); extern "C++" diff --git a/src/avp/win95/d3d_render.cpp b/src/avp/win95/d3d_render.cpp index 4a88351..9e7a531 100644 --- a/src/avp/win95/d3d_render.cpp +++ b/src/avp/win95/d3d_render.cpp @@ -8683,9 +8683,9 @@ void r2rect :: AlphaFill #endif } extern void D3D_RenderHUDNumber_Centred(unsigned int number,int x,int y,int colour); -extern void D3D_RenderHUDString(char *stringPtr,int x,int y,int colour); -extern void D3D_RenderHUDString_Clipped(char *stringPtr,int x,int y,int colour); -extern void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour); +extern void D3D_RenderHUDString(const char *stringPtr,int x,int y,int colour); +extern void D3D_RenderHUDString_Clipped(const char *stringPtr,int x,int y,int colour); +extern void D3D_RenderHUDString_Centred(const char *stringPtr, int centreX, int y, int colour); extern void D3D_RenderHUDNumber_Centred(unsigned int number,int x,int y,int colour) { @@ -8750,7 +8750,7 @@ extern void D3D_RenderHUDNumber_Centred(unsigned int number,int x,int y,int colo } -extern void D3D_RenderHUDString(char *stringPtr,int x,int y,int colour) +extern void D3D_RenderHUDString(const char *stringPtr,int x,int y,int colour) { struct VertexTag quadVertices[4]; @@ -8792,7 +8792,7 @@ extern void D3D_RenderHUDString(char *stringPtr,int x,int y,int colour) x += AAFontWidths[c]; } } -extern void D3D_RenderHUDString_Clipped(char *stringPtr,int x,int y,int colour) +extern void D3D_RenderHUDString_Clipped(const char *stringPtr,int x,int y,int colour) { struct VertexTag quadVertices[4]; @@ -8839,10 +8839,10 @@ extern void D3D_RenderHUDString_Clipped(char *stringPtr,int x,int y,int colour) } } -void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour) +void D3D_RenderHUDString_Centred(const char *stringPtr, int centreX, int y, int colour) { int length = 0; - char *ptr = stringPtr; + const char *ptr = stringPtr; while(*ptr) { @@ -8907,15 +8907,15 @@ void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour extern "C" { -extern void RenderString(char *stringPtr, int x, int y, int colour) +extern void RenderString(const char *stringPtr, int x, int y, int colour) { D3D_RenderHUDString(stringPtr,x,y,colour); } -extern void RenderStringCentred(char *stringPtr, int centreX, int y, int colour) +extern void RenderStringCentred(const char *stringPtr, int centreX, int y, int colour) { int length = 0; - char *ptr = stringPtr; + const char *ptr = stringPtr; while(*ptr) { @@ -8924,7 +8924,7 @@ extern void RenderStringCentred(char *stringPtr, int centreX, int y, int colour) D3D_RenderHUDString(stringPtr,centreX-length/2,y,colour); } -extern void RenderStringVertically(char *stringPtr, int centreX, int bottomY, int colour) +extern void RenderStringVertically(const char *stringPtr, int centreX, int bottomY, int colour) { struct VertexTag quadVertices[4]; int y = bottomY; diff --git a/src/avp/win95/directplay.c b/src/avp/win95/directplay.c index d0e0a65..e7247d3 100644 --- a/src/avp/win95/directplay.c +++ b/src/avp/win95/directplay.c @@ -76,7 +76,7 @@ BOOL DirectPlay_UpdateSessionDescForLobbiedGame(int gamestyle,int level) if(!DirectPlay_GetSessionDesc(&sessionDesc)) return 0; { - char* customLevelName = GetCustomMultiplayerLevelName(level,gamestyle); + const char* customLevelName = GetCustomMultiplayerLevelName(level,gamestyle); if(customLevelName[0]) { //store the gamestyle and a too big level number in dwUser2 @@ -110,7 +110,7 @@ BOOL DirectPlay_UpdateSessionDescForLobbiedGame(int gamestyle,int level) return TRUE; } -int DirectPlay_HostGame(char *playerName, char *sessionName,int species,int gamestyle,int level) +int DirectPlay_HostGame(const char *playerName, const char *sessionName,int species,int gamestyle,int level) { int maxPlayers=DetermineAvailableCharacterTypes(FALSE); if(maxPlayers<1) maxPlayers=1; @@ -136,7 +136,7 @@ int DirectPlay_HostGame(char *playerName, char *sessionName,int species,int game /* create session */ { - char* customLevelName = GetCustomMultiplayerLevelName(level,gamestyle); + const char* customLevelName = GetCustomMultiplayerLevelName(level,gamestyle); if(customLevelName[0]) { //add the level name to the beginning of the session name @@ -198,7 +198,7 @@ int DirectPlay_JoinGame(void) return NumberOfSessionsFound; } -int DirectPlay_ConnectToSession(int sessionNumber, char *playerName) +int DirectPlay_ConnectToSession(int sessionNumber, const char *playerName) { extern unsigned char DebouncedKeyboardInput[]; @@ -301,7 +301,7 @@ int DirectPlay_InitLobbiedGame() #if 0 -int DirectPlay_ConnectToLobbiedGame(char *playerName) +int DirectPlay_ConnectToLobbiedGame(const char *playerName) { extern unsigned char DebouncedKeyboardInput[]; @@ -353,7 +353,7 @@ int DirectPlay_ConnectToLobbiedGame(char *playerName) return 1; } #else -int DirectPlay_ConnectingToLobbiedGame(char* playerName) +int DirectPlay_ConnectingToLobbiedGame(const char* playerName) { extern unsigned char DebouncedKeyboardInput[]; DPSESSIONDESC2 sessionDesc; @@ -766,7 +766,7 @@ BOOL InitialiseConnection() return ConnectionOk; } -static BOOL DirectPlay_CreatePlayer(char* FormalName,char* FriendlyName) +static BOOL DirectPlay_CreatePlayer(const char* FormalName,const char* FriendlyName) { HRESULT hr; @@ -890,4 +890,4 @@ BOOL DirectPlay_UpdateSessionList(int * SelectedItem) } return changed; -} \ No newline at end of file +} diff --git a/src/avp/win95/frontend/avp_intro.cpp b/src/avp/win95/frontend/avp_intro.cpp index 362f748..34cdc4a 100644 --- a/src/avp/win95/frontend/avp_intro.cpp +++ b/src/avp/win95/frontend/avp_intro.cpp @@ -207,7 +207,7 @@ void Show_Presents(void) { CheckForWindowsMessages(); { - char *textPtr = GetTextString(TEXTSTRING_FOXINTERACTIVE); + const char *textPtr = GetTextString(TEXTSTRING_FOXINTERACTIVE); int y = (480-AvPMenuGfxStorage[AVPMENUGFX_PRESENTS].Height)/2; PlayMenuMusic(); DrawMainMenusBackdrop(); @@ -253,7 +253,7 @@ void Show_ARebellionGame(void) { CheckForWindowsMessages(); { - char *textPtr = GetTextString(TEXTSTRING_PRESENTS); + const char *textPtr = GetTextString(TEXTSTRING_PRESENTS); int y = (480-AvPMenuGfxStorage[AVPMENUGFX_AREBELLIONGAME].Height)/2; DrawMainMenusBackdrop(); // DrawAvPMenuGfx(AVPMENUGFX_BACKDROP, 0, 0, ONE_FIXED+1,AVPMENUFORMAT_LEFTJUSTIFIED); diff --git a/src/avp/win95/frontend/avp_menugfx.cpp b/src/avp/win95/frontend/avp_menugfx.cpp index 54797fc..eb9ff93 100644 --- a/src/avp/win95/frontend/avp_menugfx.cpp +++ b/src/avp/win95/frontend/avp_menugfx.cpp @@ -14,7 +14,7 @@ #include "ffstdio.h" -extern void D3D_RenderHUDString(char *stringPtr,int x,int y,int colour); +extern void D3D_RenderHUDString(const char *stringPtr,int x,int y,int colour); extern "C" { @@ -115,7 +115,7 @@ AVPMENUGFX AvPMenuGfxStorage[MAX_NO_OF_AVPMENUGFXS] = static void LoadMenuFont(void); static void UnloadMenuFont(void); -static int RenderSmallFontString(char *textPtr,int sx,int sy,int alpha, int red, int green, int blue); +static int RenderSmallFontString(const char *textPtr,int sx,int sy,int alpha, int red, int green, int blue); static void CalculateWidthsOfAAFont(void); extern void DrawAvPMenuGlowyBar(int topleftX, int topleftY, int alpha, int length); extern void DrawAvPMenuGlowyBar_Clipped(int topleftX, int topleftY, int alpha, int length, int topY, int bottomY); @@ -136,7 +136,7 @@ static void UnloadMenuFont(void) { IndexedFont :: UnloadFont( IntroFont_Light ); } -extern int LengthOfMenuText(char *textPtr) +extern int LengthOfMenuText(const char *textPtr) { IndexedFont* pFont = IndexedFont :: GetFont(IntroFont_Light); @@ -198,7 +198,7 @@ extern int RenderMenuText(const char *textPtr, int x, int y, int alpha, enum AVP } return R2Pos_StartOfRow.x; } -extern int RenderMenuText_Clipped(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int topY, int bottomY) +extern int RenderMenuText_Clipped(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int topY, int bottomY) { IndexedFont* pFont = IndexedFont :: GetFont(IntroFont_Light); r2pos R2Pos_StartOfRow; @@ -256,7 +256,7 @@ extern int RenderMenuText_Clipped(char *textPtr, int x, int y, int alpha, enum A } -extern int RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format) +extern int RenderSmallMenuText(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format) { switch(format) { @@ -270,7 +270,7 @@ extern int RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPM case AVPMENUFORMAT_RIGHTJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { @@ -283,7 +283,7 @@ extern int RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPM case AVPMENUFORMAT_CENTREJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { @@ -300,7 +300,7 @@ extern int RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPM x = RenderSmallFontString(textPtr,x,y,alpha,ONE_FIXED,ONE_FIXED,ONE_FIXED); return x; } -extern int RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue) +extern int RenderSmallMenuText_Coloured(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue) { switch(format) { @@ -314,7 +314,7 @@ extern int RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha, case AVPMENUFORMAT_RIGHTJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { @@ -327,7 +327,7 @@ extern int RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha, case AVPMENUFORMAT_CENTREJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { @@ -345,7 +345,7 @@ extern int RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha, return x; } -extern int Hardware_RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format) +extern int Hardware_RenderSmallMenuText(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format) { switch(format) { @@ -359,7 +359,7 @@ extern int Hardware_RenderSmallMenuText(char *textPtr, int x, int y, int alpha, case AVPMENUFORMAT_RIGHTJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { @@ -372,7 +372,7 @@ extern int Hardware_RenderSmallMenuText(char *textPtr, int x, int y, int alpha, case AVPMENUFORMAT_CENTREJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { @@ -395,7 +395,7 @@ extern int Hardware_RenderSmallMenuText(char *textPtr, int x, int y, int alpha, return x; } -extern int Hardware_RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue) +extern int Hardware_RenderSmallMenuText_Coloured(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue) { switch(format) { @@ -409,7 +409,7 @@ extern int Hardware_RenderSmallMenuText_Coloured(char *textPtr, int x, int y, in case AVPMENUFORMAT_RIGHTJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { @@ -422,7 +422,7 @@ extern int Hardware_RenderSmallMenuText_Coloured(char *textPtr, int x, int y, in case AVPMENUFORMAT_CENTREJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { @@ -542,7 +542,7 @@ extern void RenderHighlightRectangle(int x1,int y1,int x2,int y2, int r, int g, } } -static int RenderSmallFontString(char *textPtr,int sx,int sy,int alpha, int red, int green, int blue) +static int RenderSmallFontString(const char *textPtr,int sx,int sy,int alpha, int red, int green, int blue) { DDSURFACEDESC ddsdimage; unsigned short *destPtr; @@ -664,7 +664,7 @@ extern void RenderSmallFontString_Wrapped(const char *textPtr,RECT* area,int alp Determine area used by text , so we can draw it centrally */ { - char* textPtr2=textPtr; + const char* textPtr2=textPtr; while( *textPtr2) { //find the width of the next word @@ -755,7 +755,7 @@ extern void RenderSmallFontString_Wrapped(const char *textPtr,RECT* area,int alp while( *textPtr ) { //find the width of the next word - char* textPtr2=textPtr; + const char* textPtr2=textPtr; wordWidth=0; // get width used by spaces before this word diff --git a/src/avp/win95/frontend/avp_menugfx.hpp b/src/avp/win95/frontend/avp_menugfx.hpp index 94bf8e5..b5fa8c7 100644 --- a/src/avp/win95/frontend/avp_menugfx.hpp +++ b/src/avp/win95/frontend/avp_menugfx.hpp @@ -99,13 +99,13 @@ extern void ReleaseAllAvPMenuGfx(void); extern int RenderMenuText(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format); -extern int RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format); -extern int RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue); +extern int RenderSmallMenuText(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format); +extern int RenderSmallMenuText_Coloured(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue); -extern int Hardware_RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format); -extern int Hardware_RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue); +extern int Hardware_RenderSmallMenuText(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format); +extern int Hardware_RenderSmallMenuText_Coloured(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue); -extern int RenderMenuText_Clipped(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int topY, int bottomY); +extern int RenderMenuText_Clipped(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int topY, int bottomY); extern void RenderSmallFontString_Wrapped(const char *textPtr,RECT* area,int alpha,int* output_x,int* output_y); extern void Hardware_RenderKeyConfigRectangle(int alpha); extern void RenderKeyConfigRectangle(int alpha); diff --git a/src/avp/win95/frontend/avp_menus.c b/src/avp/win95/frontend/avp_menus.c index 8964de7..a5a59da 100644 --- a/src/avp/win95/frontend/avp_menus.c +++ b/src/avp/win95/frontend/avp_menus.c @@ -48,9 +48,9 @@ extern void EndMenuBackgroundBink(void); extern int IDemandSelect(void); -extern char *GetVideoModeDescription(void); -extern char *GetVideoModeDescription2(void); -extern char *GetVideoModeDescription3(void); +extern const char *GetVideoModeDescription(void); +extern const char *GetVideoModeDescription2(void); +extern const char *GetVideoModeDescription3(void); extern void PreviousVideoMode(void); extern void PreviousVideoMode2(void); extern void NextVideoMode(void); @@ -77,9 +77,9 @@ extern void PlayIntroSequence(void); extern void MinimalNetCollectMessages(void); -extern int DirectPlay_HostGame(char *playerName, char *sessionName,int species,int gamestyle,int level); +extern int DirectPlay_HostGame(const char *playerName, const char *sessionName,int species,int gamestyle,int level); extern int DirectPlay_JoinGame(void); -extern int DirectPlay_ConnectToSession(int sessionNumber, char *playerName); +extern int DirectPlay_ConnectToSession(int sessionNumber, const char *playerName); extern int DirectPlay_Disconnect(void); extern void ShowSplashScreens(void); @@ -113,7 +113,7 @@ static int HeightOfMenuElement(AVPMENU_ELEMENT *elementPtr); void DisplayVideoModeUnavailableScreen(void); void CheckForCredits(void); void DoCredits(void); -BOOL RollCreditsText(int position, unsigned char *textPtr); +BOOL RollCreditsText(int position, const unsigned char *textPtr); extern void SelectMenuDisplayMode(void); static void InitMainMenusBackdrop(void); extern void DrawMainMenusBackdrop(void); @@ -206,7 +206,7 @@ static int Brightness[16]; static unsigned char MultipleAssignments[2][32]; -static char *GetDescriptionOfKey(unsigned char key); +static const char *GetDescriptionOfKey(unsigned char key); static int OkayToPlayNextEpisode(void); static PLAYER_INPUT_CONFIGURATION PlayerInputPrimaryConfig; static PLAYER_INPUT_CONFIGURATION PlayerInputSecondaryConfig; @@ -1397,7 +1397,7 @@ static void RenderMenu(void) /* Render Menu Title */ if (AvPMenus.MenusState == MENUSSTATE_MAINMENUS) { - char *textPtr = GetTextString(AvPMenusData[AvPMenus.CurrentMenu].MenuTitle); + const char *textPtr = GetTextString(AvPMenusData[AvPMenus.CurrentMenu].MenuTitle); RenderMenuText(textPtr,MENU_CENTREX,70,ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED); #if 1 // and now we've been told to remove the "Gamers Edition" etc. :) @@ -1410,7 +1410,7 @@ static void RenderMenu(void) #if 0 else { - char *textPtr = GetTextString(AvPMenusData[AvPMenus.CurrentMenu].MenuTitle); + const char *textPtr = GetTextString(AvPMenusData[AvPMenus.CurrentMenu].MenuTitle); Hardware_RenderSmallMenuText(textPtr,MENU_CENTREX,70,ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED); } #endif @@ -1502,7 +1502,7 @@ static void RenderEpisodeSelectMenu(void) } } { - char *textPtr = GetTextString(AvPMenusData[AvPMenus.CurrentMenu].MenuTitle); + const char *textPtr = GetTextString(AvPMenusData[AvPMenus.CurrentMenu].MenuTitle); RenderMenuText(textPtr,MENU_CENTREX,70,ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED); } for (i=0; i<=elementPtr->b.MaxSliderValue; i++) @@ -1513,7 +1513,7 @@ static void RenderEpisodeSelectMenu(void) if (y>=-150 && y<=150) { - char *textPtr = GetTextString(elementPtr->a.TextDescription+i); + const char *textPtr = GetTextString(elementPtr->a.TextDescription+i); int b; int targetBrightness; @@ -1552,7 +1552,7 @@ static void RenderEpisodeSelectMenu(void) if (MaximumSelectableLevel>=i) { - char *completedTextPtr; + const char *completedTextPtr; if (i=2) { @@ -1784,7 +1784,7 @@ static void RenderScrollyMenu() AVPMENU_ELEMENT *elementPtr = AvPMenus.MenuElements; { //draw the title - char *textPtr = GetTextString(AvPMenusData[AvPMenus.CurrentMenu].MenuTitle); + const char *textPtr = GetTextString(AvPMenusData[AvPMenus.CurrentMenu].MenuTitle); RenderMenuText(textPtr,MENU_CENTREX,70,ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED); } @@ -1880,7 +1880,7 @@ static void RenderUserProfileSelectMenu(void) int i; AVP_USER_PROFILE *profilePtr = GetFirstUserProfile(); { - char *textPtr = GetTextString(AvPMenusData[AvPMenus.CurrentMenu].MenuTitle); + const char *textPtr = GetTextString(AvPMenusData[AvPMenus.CurrentMenu].MenuTitle); RenderMenuText(textPtr,MENU_CENTREX,70,ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED); } @@ -1892,7 +1892,7 @@ static void RenderUserProfileSelectMenu(void) if (y>=-150 && y<=150) { - char *textPtr = profilePtr->Name; + const char *textPtr = profilePtr->Name; time_t FileTime = profilePtr->FileTime; int b; int targetBrightness; @@ -1954,7 +1954,7 @@ static void RenderLoadGameMenu(void) AVPMENU_ELEMENT *elementPtr = AvPMenus.MenuElements; int e; int y; - int (*RenderText)(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format); + int (*RenderText)(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format); if (AvPMenus.MenusState == MENUSSTATE_MAINMENUS) { @@ -2069,12 +2069,12 @@ static void RenderLoadGameMenu(void) /* Render Menu Title */ if (AvPMenus.MenusState == MENUSSTATE_MAINMENUS) { - char *textPtr = GetTextString(AvPMenusData[AvPMenus.CurrentMenu].MenuTitle); + const char *textPtr = GetTextString(AvPMenusData[AvPMenus.CurrentMenu].MenuTitle); RenderMenuText(textPtr,MENU_CENTREX,70,ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED); } else { - char *textPtr = GetTextString(AvPMenusData[AvPMenus.CurrentMenu].MenuTitle); + const char *textPtr = GetTextString(AvPMenusData[AvPMenus.CurrentMenu].MenuTitle); AVPMENU_ELEMENT *elementPtr = &AvPMenus.MenuElements[AvPMenus.CurrentlySelectedElement]; y = (ScreenDescriptorBlock.SDB_Height - AvPMenus.MenuHeight)/2 - 30; RenderText(textPtr,MENU_CENTREX,y,ONE_FIXED,AVPMENUFORMAT_CENTREJUSTIFIED); @@ -3027,7 +3027,7 @@ static void InteractWithMenuElement(enum AVPMENU_ELEMENT_INTERACTION_ID interact { if (interactionID == AVPMENU_ELEMENT_INTERACTION_SELECT) { - extern int DirectPlay_HostGame(char *playerName, char *sessionName,int species,int gamestyle,int level); + extern int DirectPlay_HostGame(const char *playerName, const char *sessionName,int species,int gamestyle,int level); extern char MP_PlayerName[]; extern char MP_SessionName[]; extern int MP_Species; @@ -3385,14 +3385,14 @@ static void InteractWithMenuElement(enum AVPMENU_ELEMENT_INTERACTION_ID interact } -int LengthOfMenuText(char *textPtr); -int LengthOfSmallMenuText(char *textPtr); +int LengthOfMenuText(const char *textPtr); +int LengthOfSmallMenuText(const char *textPtr); static void RenderMenuElement(AVPMENU_ELEMENT *elementPtr, int e, int y) { - int (*RenderText)(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format); - int (*RenderText_Coloured)(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int r, int g, int b); - int (*MenuTextLength)(char *textPtr); + int (*RenderText)(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format); + int (*RenderText_Coloured)(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int r, int g, int b); + int (*MenuTextLength)(const char *textPtr); if (AvPMenus.FontToUse==AVPMENU_FONT_BIG) { @@ -3441,7 +3441,7 @@ static void RenderMenuElement(AVPMENU_ELEMENT *elementPtr, int e, int y) case AVPMENU_ELEMENT_DELETEMPCONFIG: case AVPMENU_ELEMENT_SAVESETTINGS: { - char *textPtr = GetTextString(elementPtr->a.TextDescription); + const char *textPtr = GetTextString(elementPtr->a.TextDescription); RenderText(textPtr,MENU_CENTREX,y,elementPtr->Brightness,AVPMENUFORMAT_CENTREJUSTIFIED); break; } @@ -3450,7 +3450,7 @@ static void RenderMenuElement(AVPMENU_ELEMENT *elementPtr, int e, int y) case AVPMENU_ELEMENT_STARTMARINEGAME: case AVPMENU_ELEMENT_STARTPREDATORGAME: { - char *textPtr = GetTextString(elementPtr->a.TextDescription); + const char *textPtr = GetTextString(elementPtr->a.TextDescription); RenderText(textPtr,MENU_LEFTXEDGE,MENU_BOTTOMYEDGE,elementPtr->Brightness,AVPMENUFORMAT_LEFTJUSTIFIED); break; } @@ -3459,7 +3459,7 @@ static void RenderMenuElement(AVPMENU_ELEMENT *elementPtr, int e, int y) case AVPMENU_ELEMENT_ALIENEPISODE: case AVPMENU_ELEMENT_PREDATOREPISODE: { - char *textPtr = GetTextString(elementPtr->a.TextDescription+*(elementPtr->SliderValuePtr)); + const char *textPtr = GetTextString(elementPtr->a.TextDescription+*(elementPtr->SliderValuePtr)); RenderText(textPtr,MENU_LEFTXEDGE,MENU_TOPYEDGE,elementPtr->Brightness,AVPMENUFORMAT_LEFTJUSTIFIED); break; } @@ -3474,7 +3474,7 @@ static void RenderMenuElement(AVPMENU_ELEMENT *elementPtr, int e, int y) case AVPMENU_ELEMENT_CHEATMODE_SPECIES_TEXTSLIDER: case AVPMENU_ELEMENT_CHEATMODE_ENVIRONMENT_TEXTSLIDER: { - char *textPtr = ""; + const char *textPtr = ""; if(elementPtr->ElementID == AVPMENU_ELEMENT_TEXTSLIDER_POINTER || elementPtr->ElementID == AVPMENU_ELEMENT_DUMMYTEXTSLIDER_POINTER) { @@ -3825,8 +3825,8 @@ static void RenderMenuElement(AVPMENU_ELEMENT *elementPtr, int e, int y) } case AVPMENU_ELEMENT_KEYCONFIG: { - unsigned char *primaryKey = ((unsigned char*)&PlayerInputPrimaryConfig)+e-2; - unsigned char *secondaryKey = ((unsigned char*)&PlayerInputSecondaryConfig)+e-2; + const unsigned char *primaryKey = ((unsigned char*)&PlayerInputPrimaryConfig)+e-2; + const unsigned char *secondaryKey = ((unsigned char*)&PlayerInputSecondaryConfig)+e-2; if (e==AvPMenus.CurrentlySelectedElement) { int x,g; @@ -4022,10 +4022,10 @@ static int HeightOfMenuElement(AVPMENU_ELEMENT *elementPtr) return h; } -static char *GetDescriptionOfKey(unsigned char key) +static const char *GetDescriptionOfKey(unsigned char key) { static char KeyDescBuffer[2]="\0\0"; - char *textPtr; + const char *textPtr; switch (key) { @@ -4681,7 +4681,7 @@ void DoCredits(void) UnloadTextFile("credits.txt",creditsPtr); } -BOOL RollCreditsText(int position, unsigned char *textPtr) +BOOL RollCreditsText(int position, const unsigned char *textPtr) { int y=0; @@ -5212,8 +5212,8 @@ static void TestValidityOfCheatMenu(void) CheatMode_GetNextAllowedEnvironment(AvPMenus.MenuElements[2].c.SliderValuePtr,TRUE); } -static unsigned char *BriefingTextString[5]; -static unsigned char BlankLine[]=""; +static const unsigned char *BriefingTextString[5]; +static const unsigned char BlankLine[]=""; void SetBriefingTextForEpisode(int episode, I_PLAYER_TYPE playerID) { @@ -5442,7 +5442,7 @@ void RenderBriefingText(int centreY, int brightness) { int length = 0; { - char *ptr = BriefingTextString[i]; + const char *ptr = BriefingTextString[i]; while(*ptr) { diff --git a/src/avp/win95/frontend/avp_mp_config.cpp b/src/avp/win95/frontend/avp_mp_config.cpp index f9c6f77..853a10f 100644 --- a/src/avp/win95/frontend/avp_mp_config.cpp +++ b/src/avp/win95/frontend/avp_mp_config.cpp @@ -560,7 +560,7 @@ void BuildMultiplayerLevelNameArray() /* TODO: Have to use PERM until the load_rif code can handle CONFIG */ if ((gd = OpenGameDirectory("avp_rifs/Custom/", "*.rif", FILETYPE_PERM)) != NULL) { - char* custom_string = GetTextString(TEXTSTRING_CUSTOM_LEVEL); + const char* custom_string = GetTextString(TEXTSTRING_CUSTOM_LEVEL); int cs_len = strlen(custom_string); while ((gdf = ScanGameDirectory(gd)) != NULL) { @@ -600,7 +600,7 @@ void BuildMultiplayerLevelNameArray() if(i>=5) { //a new level - char* new_string = GetTextString(TEXTSTRING_NEW_LEVEL); + const char* new_string = GetTextString(TEXTSTRING_NEW_LEVEL); sprintf(buffer,"%s (%s)",level_name,new_string); //allocate memory and copy the string. @@ -624,7 +624,7 @@ void BuildMultiplayerLevelNameArray() if(i>=5) { //a new level - char* new_string = GetTextString(TEXTSTRING_NEW_LEVEL); + const char* new_string = GetTextString(TEXTSTRING_NEW_LEVEL); sprintf(buffer,"%s (%s)",level_name,new_string); //allocate memory and copy the string. @@ -686,11 +686,11 @@ void BuildMultiplayerLevelNameArray() //returns local index of a custom level (if it is a custom level) -int GetCustomMultiplayerLevelIndex(char* name,int gameType) +int GetCustomMultiplayerLevelIndex(const char* name,int gameType) { char buffer[256]; //tack ( custom) onto the end of the name , before doing the string compare - char* custom_string = GetTextString(TEXTSTRING_CUSTOM_LEVEL); + const char* custom_string = GetTextString(TEXTSTRING_CUSTOM_LEVEL); sprintf(buffer,"%s (%s)",name,custom_string); //find the index of a custom level from its name @@ -754,7 +754,7 @@ char* GetCustomMultiplayerLevelName(int index,int gameType) } -int GetLocalMultiplayerLevelIndex(int index,char* customLevelName,int gameType) +int GetLocalMultiplayerLevelIndex(int index,const char* customLevelName,int gameType) { if(customLevelName[0] == 0) { diff --git a/src/avp/win95/frontend/avp_mp_config.h b/src/avp/win95/frontend/avp_mp_config.h index 139b158..f3702c3 100644 --- a/src/avp/win95/frontend/avp_mp_config.h +++ b/src/avp/win95/frontend/avp_mp_config.h @@ -33,11 +33,11 @@ extern char** CoopLevelNames; extern void BuildMultiplayerLevelNameArray(); //returns local index of a custom level (if it is a custom level) -int GetCustomMultiplayerLevelIndex(char* name,int gameType); +int GetCustomMultiplayerLevelIndex(const char* name,int gameType); //returns name of custom level (without stuff tacked on the end) char* GetCustomMultiplayerLevelName(int index,int gameType); -int GetLocalMultiplayerLevelIndex(int index,char* customLevelName,int gameType); +int GetLocalMultiplayerLevelIndex(int index,const char* customLevelName,int gameType); #ifdef __cplusplus }; diff --git a/src/avp/win95/gadgets/conscmnd.cpp b/src/avp/win95/gadgets/conscmnd.cpp index b279302..ccb2153 100644 --- a/src/avp/win95/gadgets/conscmnd.cpp +++ b/src/avp/win95/gadgets/conscmnd.cpp @@ -57,12 +57,12 @@ public: ConsoleCommand_VoidVoid ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, void (*f) (void), OurBool Cheat = FALSE ); - void Execute(ProjChar* pProjCh_In); + void Execute(const ProjChar* pProjCh_In); private: void (*theFn) (void); @@ -72,12 +72,12 @@ public: ConsoleCommand_VoidInt ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, void (*f) (int), OurBool Cheat = FALSE ); - void Execute(ProjChar* pProjCh_In); + void Execute(const ProjChar* pProjCh_In); private: void (*theFn) (int); }; @@ -86,12 +86,12 @@ public: ConsoleCommand_IntVoid ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, int (*f) (void), OurBool Cheat = FALSE ); - void Execute(ProjChar* pProjCh_In); + void Execute(const ProjChar* pProjCh_In); private: int (*theFn) (void); }; @@ -100,12 +100,12 @@ public: ConsoleCommand_IntInt ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, int (*f) (int), OurBool Cheat = FALSE ); - void Execute(ProjChar* pProjCh_In); + void Execute(const ProjChar* pProjCh_In); private: int (*theFn) (int); }; @@ -114,14 +114,14 @@ public: ConsoleCommand_VoidCharP ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, - void (*f) (char*), + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, + void (*f) (const char*), OurBool Cheat = FALSE ); - void Execute(ProjChar* pProjCh_In); + void Execute(const ProjChar* pProjCh_In); private: - void (*theFn) (char*); + void (*theFn) (const char*); }; @@ -136,8 +136,8 @@ // Various factory methods: /*static*/ void ConsoleCommand :: Make ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, void (&f) (void), OurBool Cheat ) @@ -152,8 +152,8 @@ } /*static*/ void ConsoleCommand :: Make ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, void (&f) (int), OurBool Cheat ) @@ -168,8 +168,8 @@ } /*static*/ void ConsoleCommand :: Make ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, int (&f) (void), OurBool Cheat @@ -186,8 +186,8 @@ /*static*/ void ConsoleCommand :: Make ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, int (&f) (int), OurBool Cheat ) @@ -202,9 +202,9 @@ } /*static*/ void ConsoleCommand :: Make ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, - void (&f) (char*), + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, + void (&f) (const char*), OurBool Cheat ) { @@ -230,7 +230,7 @@ // looking for a match: { - ProjChar *commandPtr = pProjCh_In; + const ProjChar *commandPtr = pProjCh_In; ProjChar *argumentPtr = pProjCh_In; while(*argumentPtr!=0 && *argumentPtr!=' ') @@ -350,8 +350,8 @@ void ConsoleCommand :: Display(void) const // protected: ConsoleCommand :: ConsoleCommand ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, OurBool Cheat ) : ConsoleSymbol(pProjCh_ToUse), pSCString_Description( new SCString(pProjCh_Description_ToUse) ) @@ -367,7 +367,7 @@ void ConsoleCommand :: EchoResult(int Result) pSCString_Feedback -> R_Release(); } -int ConsoleCommand :: GetArg(ProjChar* pProjCh_Arg) +int ConsoleCommand :: GetArg(const ProjChar* pProjCh_Arg) { GLOBALASSERT( pProjCh_Arg ); @@ -380,8 +380,8 @@ int ConsoleCommand :: GetArg(ProjChar* pProjCh_Arg) // public: ConsoleCommand_VoidVoid :: ConsoleCommand_VoidVoid ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, void (*f) (void), OurBool Cheat @@ -394,7 +394,7 @@ ConsoleCommand_VoidVoid :: ConsoleCommand_VoidVoid theFn(f) { } -void ConsoleCommand_VoidVoid :: Execute(ProjChar* pProjCh_In) +void ConsoleCommand_VoidVoid :: Execute(const ProjChar* pProjCh_In) { GLOBALASSERT(theFn); GLOBALASSERT(pProjCh_In); @@ -404,8 +404,8 @@ void ConsoleCommand_VoidVoid :: Execute(ProjChar* pProjCh_In) // public: ConsoleCommand_VoidInt :: ConsoleCommand_VoidInt ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, void (*f) (int), OurBool Cheat @@ -418,7 +418,7 @@ ConsoleCommand_VoidInt :: ConsoleCommand_VoidInt theFn(f) { } -void ConsoleCommand_VoidInt :: Execute(ProjChar* pProjCh_In) +void ConsoleCommand_VoidInt :: Execute(const ProjChar* pProjCh_In) { GLOBALASSERT(theFn); GLOBALASSERT(pProjCh_In); @@ -431,8 +431,8 @@ void ConsoleCommand_VoidInt :: Execute(ProjChar* pProjCh_In) // public: ConsoleCommand_IntVoid :: ConsoleCommand_IntVoid ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, int (*f) (void), OurBool Cheat @@ -445,7 +445,7 @@ ConsoleCommand_IntVoid :: ConsoleCommand_IntVoid theFn(f) { } -void ConsoleCommand_IntVoid :: Execute(ProjChar* pProjCh_In) +void ConsoleCommand_IntVoid :: Execute(const ProjChar* pProjCh_In) { GLOBALASSERT(theFn); GLOBALASSERT(pProjCh_In); @@ -458,8 +458,8 @@ void ConsoleCommand_IntVoid :: Execute(ProjChar* pProjCh_In) // public: ConsoleCommand_IntInt :: ConsoleCommand_IntInt ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, int (*f) (int), OurBool Cheat ) : ConsoleCommand @@ -471,7 +471,7 @@ ConsoleCommand_IntInt :: ConsoleCommand_IntInt theFn(f) { } -void ConsoleCommand_IntInt :: Execute(ProjChar* pProjCh_In) +void ConsoleCommand_IntInt :: Execute(const ProjChar* pProjCh_In) { GLOBALASSERT(theFn); GLOBALASSERT(pProjCh_In); @@ -488,9 +488,9 @@ void ConsoleCommand_IntInt :: Execute(ProjChar* pProjCh_In) ConsoleCommand_VoidCharP :: ConsoleCommand_VoidCharP ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, - void (*f) (char*), + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, + void (*f) (const char*), OurBool Cheat ) : ConsoleCommand @@ -502,7 +502,7 @@ ConsoleCommand_VoidCharP :: ConsoleCommand_VoidCharP theFn(f) { } -void ConsoleCommand_VoidCharP :: Execute(ProjChar* pProjCh_In) +void ConsoleCommand_VoidCharP :: Execute(const ProjChar* pProjCh_In) { GLOBALASSERT(theFn); GLOBALASSERT(pProjCh_In); diff --git a/src/avp/win95/gadgets/conscmnd.hpp b/src/avp/win95/gadgets/conscmnd.hpp index 005959e..98d8f45 100644 --- a/src/avp/win95/gadgets/conscmnd.hpp +++ b/src/avp/win95/gadgets/conscmnd.hpp @@ -34,37 +34,37 @@ // Various factory methods: static void Make ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, void (&f) (void), OurBool Cheat = FALSE ); static void Make ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, void (&f) (int), OurBool Cheat = FALSE ); static void Make ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, int (&f) (void), OurBool Cheat = FALSE ); static void Make ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, int (&f) (int), OurBool Cheat = FALSE ); static void Make ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, - void (&f) (char*), + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, + void (&f) (const char*), OurBool Cheat = FALSE ); @@ -74,7 +74,7 @@ static void ListAll(void); - virtual void Execute( ProjChar* pProjCh_In ) = 0; + virtual void Execute( const ProjChar* pProjCh_In ) = 0; @@ -84,13 +84,13 @@ protected: ConsoleCommand ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, OurBool Cheat = FALSE ); void EchoResult(int Result); - int GetArg(ProjChar* pProjCh_Arg); + int GetArg(const ProjChar* pProjCh_Arg); private: SCString* pSCString_Description; diff --git a/src/avp/win95/gadgets/conssym.cpp b/src/avp/win95/gadgets/conssym.cpp index bf70a78..6da8c0a 100644 --- a/src/avp/win95/gadgets/conssym.cpp +++ b/src/avp/win95/gadgets/conssym.cpp @@ -62,7 +62,7 @@ // protected: ConsoleSymbol :: ConsoleSymbol ( - ProjChar* pProjCh_ToUse + const ProjChar* pProjCh_ToUse ) : pSCString_Symbol ( new SCString( pProjCh_ToUse ) diff --git a/src/avp/win95/gadgets/conssym.hpp b/src/avp/win95/gadgets/conssym.hpp index 5d16b51..a59cbd2 100644 --- a/src/avp/win95/gadgets/conssym.hpp +++ b/src/avp/win95/gadgets/conssym.hpp @@ -49,7 +49,7 @@ protected: ConsoleSymbol ( - ProjChar* pProjCh_ToUse + const ProjChar* pProjCh_ToUse ); diff --git a/src/avp/win95/gadgets/consvar.cpp b/src/avp/win95/gadgets/consvar.cpp index f229c06..f3d40a9 100644 --- a/src/avp/win95/gadgets/consvar.cpp +++ b/src/avp/win95/gadgets/consvar.cpp @@ -57,8 +57,8 @@ ConsoleVariable_Simple_Int ( int& Value_ToUse, - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, int MinVal_New, int MaxVal_New, OurBool Cheat = FALSE @@ -83,8 +83,8 @@ ConsoleVariable_Simple_FixP ( int& Value_ToUse, - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, int MinVal_New, int MaxVal_New, OurBool Cheat = FALSE @@ -121,8 +121,8 @@ /*static*/ ConsoleVariable* ConsoleVariable :: MakeSimpleConsoleVariable_Int ( int& Value_ToUse, - ProjChar* pProjCh_Symbol_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_Symbol_ToUse, + const ProjChar* pProjCh_Description_ToUse, int MinVal_New, int MaxVal_New, OurBool Cheat @@ -152,8 +152,8 @@ /*static*/ ConsoleVariable* ConsoleVariable :: MakeSimpleConsoleVariable_FixP ( int& Value_ToUse, - ProjChar* pProjCh_Symbol_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_Symbol_ToUse, + const ProjChar* pProjCh_Description_ToUse, int MinVal_New, int MaxVal_New, OurBool Cheat @@ -191,7 +191,7 @@ ConsoleVariable :: ~ConsoleVariable() ); } -/*static*/ OurBool ConsoleVariable :: Process( ProjChar* pProjCh_In ) +/*static*/ OurBool ConsoleVariable :: Process( const ProjChar* pProjCh_In ) { // used for proccesing input text. Could decide that the user // was requesting the value of a variable, or was setting a new @@ -237,7 +237,7 @@ ConsoleVariable :: ~ConsoleVariable() { // Find the point in the input text where the first word // ends (if there is one...): - ProjChar* pProjCh_Search = pProjCh_In; + const ProjChar* pProjCh_Search = pProjCh_In; int NumChars = 0; while @@ -332,8 +332,8 @@ ConsoleVariable :: ~ConsoleVariable() // protected: ConsoleVariable :: ConsoleVariable ( - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, int MinVal_New, int MaxVal_New, OurBool Cheat @@ -482,8 +482,8 @@ void ConsoleVariable :: OutputResultOfSetValue( int OldVal ) ConsoleVariable_Simple_Int :: ConsoleVariable_Simple_Int ( int& Value_ToUse, - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, int MinVal_New, int MaxVal_New, OurBool Cheat @@ -605,8 +605,8 @@ SCString* ConsoleVariable_Simple_Int :: MakeValueString(int Val) ConsoleVariable_Simple_FixP :: ConsoleVariable_Simple_FixP ( int& Value_ToUse, - ProjChar* pProjCh_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_ToUse, + const ProjChar* pProjCh_Description_ToUse, int MinVal_New, int MaxVal_New, OurBool Cheat diff --git a/src/avp/win95/gadgets/consvar.hpp b/src/avp/win95/gadgets/consvar.hpp index bdb450a..c3196f9 100644 --- a/src/avp/win95/gadgets/consvar.hpp +++ b/src/avp/win95/gadgets/consvar.hpp @@ -46,8 +46,8 @@ static ConsoleVariable* MakeSimpleConsoleVariable_Int ( int& Value_ToUse, - ProjChar* pProjCh_Symbol_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_Symbol_ToUse, + const ProjChar* pProjCh_Description_ToUse, int MinVal_New, int MaxVal_New, OurBool Cheat = FALSE @@ -55,8 +55,8 @@ static ConsoleVariable* MakeSimpleConsoleVariable_FixP ( int& Value_ToUse, - ProjChar* pProjCh_Symbol_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_Symbol_ToUse, + const ProjChar* pProjCh_Description_ToUse, int MinVal_New, // fixed point value int MaxVal_New, // fixed point value OurBool Cheat = FALSE @@ -68,7 +68,7 @@ virtual void SetValue(int Val_New) = 0; virtual void SetValue(float Val_New) = 0; - static OurBool Process( ProjChar* pProjCh_In ); + static OurBool Process( const ProjChar* pProjCh_In ); // used for proccesing input text. Could decide that the user // was requesting the value of a variable, or was setting a new // value etc; if so, acts accordingly. @@ -83,8 +83,8 @@ protected: ConsoleVariable ( - ProjChar* pProjCh_Symbol_ToUse, - ProjChar* pProjCh_Description_ToUse, + const ProjChar* pProjCh_Symbol_ToUse, + const ProjChar* pProjCh_Description_ToUse, int MinVal_New, int MaxVal_New, OurBool Cheat = FALSE diff --git a/src/avp/win95/gadgets/gadget.cpp b/src/avp/win95/gadgets/gadget.cpp index b6d77f7..6acf8be 100644 --- a/src/avp/win95/gadgets/gadget.cpp +++ b/src/avp/win95/gadgets/gadget.cpp @@ -214,7 +214,7 @@ extern void GADGET_ScreenModeChange_Cleanup(void) } } -extern void GADGET_NewOnScreenMessage( ProjChar* messagePtr ) +extern void GADGET_NewOnScreenMessage( const ProjChar* messagePtr ) { /* PRECONDITION */ { diff --git a/src/avp/win95/gadgets/gadget.h b/src/avp/win95/gadgets/gadget.h index 9ca8506..604e728 100644 --- a/src/avp/win95/gadgets/gadget.h +++ b/src/avp/win95/gadgets/gadget.h @@ -56,7 +56,7 @@ // ensure virtual destructor #if debug - char* GetDebugName(void); + const char* GetDebugName(void) const; void Render_Report ( const struct r2pos& R2Pos, @@ -71,7 +71,7 @@ #if debug Gadget ( - char* DebugName_New + const char* DebugName_New ) : DebugName( DebugName_New ) { // empty @@ -82,14 +82,14 @@ private: #if debug - char* DebugName; + const char* DebugName; #endif }; // end of class Gadget // Inline methods: #if debug - inline char* Gadget::GetDebugName(void) + inline const char* Gadget::GetDebugName(void) const { return DebugName; } @@ -118,7 +118,7 @@ GadgetWithSize ( #if debug - char* DebugName_New, + const char* DebugName_New, #endif r2size R2Size_New ) : Gadget @@ -180,7 +180,7 @@ /* expects to be called immediately after anything happens to the screen mode */ - extern void GADGET_NewOnScreenMessage( ProjChar* messagePtr ); + extern void GADGET_NewOnScreenMessage( const ProjChar* messagePtr ); extern void RemoveTheConsolePlease(void); diff --git a/src/avp/win95/gadgets/hudgadg.cpp b/src/avp/win95/gadgets/hudgadg.cpp index 537ef1b..36fbdd6 100644 --- a/src/avp/win95/gadgets/hudgadg.cpp +++ b/src/avp/win95/gadgets/hudgadg.cpp @@ -124,7 +124,7 @@ HUDGadget :: HUDGadget ( #if debug - char* DebugName + const char* DebugName #endif ) : Gadget ( diff --git a/src/avp/win95/gadgets/hudgadg.hpp b/src/avp/win95/gadgets/hudgadg.hpp index d2dd2e5..7c10afd 100644 --- a/src/avp/win95/gadgets/hudgadg.hpp +++ b/src/avp/win95/gadgets/hudgadg.hpp @@ -100,7 +100,7 @@ HUDGadget ( #if debug - char* DebugName + const char* DebugName #endif ); diff --git a/src/avp/win95/gadgets/textin.cpp b/src/avp/win95/gadgets/textin.cpp index 52b29fc..fdc6a70 100644 --- a/src/avp/win95/gadgets/textin.cpp +++ b/src/avp/win95/gadgets/textin.cpp @@ -400,7 +400,7 @@ void TextInputState :: Key_Delete(void) TextInputState :: TextInputState ( OurBool bForceUpperCase, - char* pProjCh_Init + const char* pProjCh_Init ) : #if LimitedLineLength NumChars(0), @@ -463,7 +463,7 @@ void TextInputState :: TryToInsertAt { #if LimitedLineLength { - ProjChar* pProjCh_I = pSCString_ToInsert -> pProjCh(); + const ProjChar* pProjCh_I = pSCString_ToInsert -> pProjCh(); while ( @@ -917,7 +917,7 @@ void TextInputState :: FullyManual(void) } OurBool TextInputState :: bManualMatch ( - ProjChar* pProjCh + const ProjChar* pProjCh ) const { /* Returns true iff there's a match with the manually-typed prefix of @@ -974,7 +974,7 @@ OurBool TextInputState :: bManualMatch } OurBool TextInputState :: bManualMatchInsensitive ( - ProjChar* pProjCh + const ProjChar* pProjCh ) const { /* Returns true iff there's a match with the manually-typed prefix of diff --git a/src/avp/win95/gadgets/textin.hpp b/src/avp/win95/gadgets/textin.hpp index 5bacf35..c645145 100644 --- a/src/avp/win95/gadgets/textin.hpp +++ b/src/avp/win95/gadgets/textin.hpp @@ -177,7 +177,7 @@ TextInputState ( OurBool bForceUpperCase, - char* pProjCh_Init + const char* pProjCh_Init // could be const ); @@ -225,11 +225,11 @@ */ OurBool bManualMatch ( - ProjChar* pProjCh + const ProjChar* pProjCh ) const; OurBool bManualMatchInsensitive ( - ProjChar* pProjCh + const ProjChar* pProjCh ) const; /* Returns true iff there's a match with the manually-typed prefix of the current state string and the input comparison string diff --git a/src/avp/win95/langplat.c b/src/avp/win95/langplat.c index ac564f7..3d60677 100644 --- a/src/avp/win95/langplat.c +++ b/src/avp/win95/langplat.c @@ -3,7 +3,7 @@ #include "language.h" /* KJL 12:07:26 05/02/97 - this will be buggered up if the enum in gamedef.h changes */ -unsigned char *LanguageFilename[] = +const unsigned char *LanguageFilename[] = { ENGLISH_TEXT_FILENAME, /* I_English */ ENGLISH_TEXT_FILENAME, /* I_French */ diff --git a/src/avp/win95/pcmenus.cpp b/src/avp/win95/pcmenus.cpp index f4a12d9..9d66c29 100644 --- a/src/avp/win95/pcmenus.cpp +++ b/src/avp/win95/pcmenus.cpp @@ -928,7 +928,7 @@ extern "C" /* KJL 17:11:26 19/07/98 - The 3 fns below are the interface between the video mode selection and the frontend menus. */ -extern char *GetVideoModeDescription(void) +extern const char *GetVideoModeDescription(void) { const VidModeInfo* pVidModeInfo = &avail_vidmodes[d3d_opt][sel_vidmode_index[d3d_opt]]; @@ -988,4 +988,4 @@ extern void SaveVideoModeSettings(void) fclose(fp); return; } -} \ No newline at end of file +} diff --git a/src/avp/win95/platsup.c b/src/avp/win95/platsup.c index fd06ca3..84c23f9 100644 --- a/src/avp/win95/platsup.c +++ b/src/avp/win95/platsup.c @@ -46,7 +46,7 @@ int IDemandPreviousWeapon(void); -void catpathandextension(char* dst, char* src) +void catpathandextension(char* dst, const char* src) { int len = lstrlen(dst); @@ -258,7 +258,7 @@ int IDemandChangeEnvironment() /* KJL 15:53:52 05/04/97 - Loaders/Unloaders for language internationalization code in language.c */ -char *LoadTextFile(char *filename) +char *LoadTextFile(const char *filename) { char *bufferPtr; long int save_pos, size_of_file; @@ -300,7 +300,7 @@ error: } -void UnloadTextFile(char *filename, char *bufferPtr) +void UnloadTextFile(const char *filename, char *bufferPtr) { if (bufferPtr) DeallocateMem(bufferPtr); } diff --git a/src/avp/win95/pldnet.c b/src/avp/win95/pldnet.c index 69fe736..1fb22a7 100644 --- a/src/avp/win95/pldnet.c +++ b/src/avp/win95/pldnet.c @@ -276,7 +276,7 @@ extern int DebouncedGotAnyKey; extern int LastHand; // For alien claws and two pistols extern void CreateSpearPossiblyWithFragment(DISPLAYBLOCK *dispPtr, VECTORCH *spearPositionPtr, VECTORCH *spearDirectionPtr); -extern void NewOnScreenMessage(unsigned char *messagePtr); +extern void NewOnScreenMessage(const char *messagePtr); /*---------------------------------------------------------------------- Some protoypes for this file ----------------------------------------------------------------------*/ @@ -4124,7 +4124,7 @@ void AddNetMsg_MakeDecal(enum DECAL_ID decalID, VECTORCH *normalPtr, VECTORCH *p } /* KJL 14:34:45 08/04/98 - broadcast a message to the other players */ -void AddNetMsg_ChatBroadcast(char *string,BOOL same_species_only) +void AddNetMsg_ChatBroadcast(const char *string,BOOL same_species_only) { NETMESSAGEHEADER *headerPtr; char *messagePtr; @@ -4143,7 +4143,7 @@ void AddNetMsg_ChatBroadcast(char *string,BOOL same_species_only) { - char *ptr = string; + const char *ptr = string; while(*ptr && stringLength<255) { stringLength++; @@ -4178,7 +4178,7 @@ void AddNetMsg_ChatBroadcast(char *string,BOOL same_species_only) /* fill out the message */ { - char *ptr = string; + const char *ptr = string; //first byte used to distinguish between SAY and SPECIES_SAY *messagePtr++=(char)same_species_only; @@ -10310,7 +10310,7 @@ void ChangeNetGameType_PredatorTag() */ static void NetworkGameConsoleMessage(enum TEXTSTRING_ID stringID,const char* name1,const char* name2) { - char* string; + const char* string; char* messageptr=&OnScreenMessageBuffer[0]; string=GetTextString(stringID); @@ -10346,7 +10346,7 @@ static void NetworkGameConsoleMessage(enum TEXTSTRING_ID stringID,const char* na static void NetworkGameConsoleMessageWithWeaponIcon(enum TEXTSTRING_ID stringID,const char* name1,const char* name2,const char* weaponSymbol) { - char* string; + const char* string; char* messageptr=&OnScreenMessageBuffer[0]; string=GetTextString(stringID); diff --git a/src/avp/win95/pldnet.h b/src/avp/win95/pldnet.h index 59c0e00..9a60685 100644 --- a/src/avp/win95/pldnet.h +++ b/src/avp/win95/pldnet.h @@ -1056,7 +1056,7 @@ extern void AddNetMsg_RequestPlatformLiftReverse(STRATEGYBLOCK *sbPtr); extern void AddNetMsg_PlayerAutoGunState(STRATEGYBLOCK *sbPtr); extern void AddNetMsg_EndGame(void); extern void AddNetMsg_MakeDecal(enum DECAL_ID decalID, VECTORCH *normalPtr, VECTORCH *positionPtr, int moduleIndex); -extern void AddNetMsg_ChatBroadcast(char *string,BOOL same_species_only); +extern void AddNetMsg_ChatBroadcast(const char *string,BOOL same_species_only); extern void AddNetMsg_MakeExplosion(VECTORCH *positionPtr, enum EXPLOSION_ID explosionID); extern void AddNetMsg_MakeFlechetteExplosion(VECTORCH *positionPtr, int seed); extern void AddNetMsg_MakePlasmaExplosion(VECTORCH *positionPtr, VECTORCH *fromPositionPtr, enum EXPLOSION_ID explosionID); diff --git a/src/avp/win95/progress_bar.cpp b/src/avp/win95/progress_bar.cpp index 80a5075..eef2a1e 100644 --- a/src/avp/win95/progress_bar.cpp +++ b/src/avp/win95/progress_bar.cpp @@ -27,7 +27,7 @@ extern int FadingGameInAfterLoading; extern void InGameFlipBuffers(); -extern void RenderStringCentred(char *stringPtr, int centreX, int y, int colour); +extern void RenderStringCentred(const char *stringPtr, int centreX, int y, int colour); extern void BltImage(RECT *dest, DDSurface *image, RECT *src); extern int CreateOGLTexture(D3DTexture *, unsigned char *); diff --git a/src/avp/win95/projload.cpp b/src/avp/win95/projload.cpp index b045cdf..47a2e61 100644 --- a/src/avp/win95/projload.cpp +++ b/src/avp/win95/projload.cpp @@ -68,7 +68,7 @@ extern FARENTRYPOINTSHEADER *FALLP_EntryPoints; extern RIFFHANDLE env_rif; -extern void NewOnScreenMessage(char *messagePtr); +extern void NewOnScreenMessage(const char *messagePtr); extern BOOL KeepMainRifFile; @@ -88,9 +88,9 @@ char const * FirstTex_Directory = "Graphics"; // currently relative to cwd char const * SecondTex_Directory = 0; // will be the src safe shadow for development builds //used for cd graphics directory in final version -char* Rif_Sound_Directory=0;//set for the main level rif +const char* Rif_Sound_Directory=0;//set for the main level rif -static char * light_set_name = "NORMALLT"; +static const char * light_set_name = "NORMALLT"; static Object_Chunk * * o_chunk_array; static int * aimodule_indeces; //array parallel to o_chunk_array @@ -402,7 +402,7 @@ void setup_placed_hierarchies(Environment_Data_Chunk * envd) //need to store the current sound directory , since it will get altered when loading the //hierarchy rif file. - char* Temp_Rif_Sound_Directory = Rif_Sound_Directory; + const char* Temp_Rif_Sound_Directory = Rif_Sound_Directory; PlacedHierarchyArray[phdc->hierarchy_index].load_rif(); @@ -847,7 +847,7 @@ void Global_Hierarchy_Store::delete_section(SECTION * s2d) } -SECTION * Global_Hierarchy_Store::build_hierarchy (Object_Hierarchy_Chunk * ohc,char* hierarchy_name) +SECTION * Global_Hierarchy_Store::build_hierarchy (Object_Hierarchy_Chunk * ohc,const char* hierarchy_name) { // iterative bit // should be called with the root node diff --git a/src/avp/win95/projload.hpp b/src/avp/win95/projload.hpp index 141d18c..c7b7b88 100644 --- a/src/avp/win95/projload.hpp +++ b/src/avp/win95/projload.hpp @@ -92,7 +92,7 @@ public: int get_time_from_sequence_id(int id); void build_time_list(Object_Hierarchy_Chunk* ohc); - SECTION * build_hierarchy (Object_Hierarchy_Chunk * ohc,char* hierarchy_name); + SECTION * build_hierarchy (Object_Hierarchy_Chunk * ohc,const char* hierarchy_name); void delete_section(SECTION *); diff --git a/src/avp/win95/system.c b/src/avp/win95/system.c index 6fc1279..5e3622e 100644 --- a/src/avp/win95/system.c +++ b/src/avp/win95/system.c @@ -590,7 +590,7 @@ ELO* Env_List[I_Num_Environments] = { &JunkEnv }; /**** Construct filename and go for it ***************/ -void catpathandextension(char*, char*); +void catpathandextension(char*, const char*); void DestroyActiveBlockList(void); void InitialiseObjectBlocks(void); diff --git a/src/fixer.h b/src/fixer.h index 288d22c..fff20c3 100644 --- a/src/fixer.h +++ b/src/fixer.h @@ -174,7 +174,7 @@ int CloseHandle(HANDLE file); int DeleteFile(const char *file); int DeleteFileA(const char *file); int GetDiskFreeSpace(int x, unsigned long *a, unsigned long *b, unsigned long *c, unsigned long *d); -int CreateDirectory(char *dir, int x); +int CreateDirectory(const char *dir, int x); int MoveFile(const char *newfile, const char *oldfile); int MoveFileA(const char *newfile, const char *oldfile); int CopyFile(const char *newfile, const char *oldfile, int x); diff --git a/src/main.c b/src/main.c index c3e3b67..45b4dc4 100644 --- a/src/main.c +++ b/src/main.c @@ -342,12 +342,12 @@ void NextVideoMode2() CurrentVideoMode = cur; } -char *GetVideoModeDescription2() +const char *GetVideoModeDescription2() { return "SDL"; } -char *GetVideoModeDescription3() +const char *GetVideoModeDescription3() { static char buf[64]; diff --git a/src/main2.c b/src/main2.c index c5f7ce5..c600d35 100644 --- a/src/main2.c +++ b/src/main2.c @@ -423,12 +423,12 @@ void NextVideoMode2() CurrentVideoMode = cur; } -char *GetVideoModeDescription2() +const char *GetVideoModeDescription2() { return "SDL2"; } -char *GetVideoModeDescription3() +const char *GetVideoModeDescription3() { static char buf[64]; diff --git a/src/menus.c b/src/menus.c index ec73820..00f7a83 100644 --- a/src/menus.c +++ b/src/menus.c @@ -118,7 +118,7 @@ AVPMENUGFX AvPMenuGfxStorage[MAX_NO_OF_AVPMENUGFXS] = static void DrawAvPMenuGlowyBar(int topleftX, int topleftY, int alpha, int length) { enum AVPMENUGFX_ID menuGfxID = AVPMENUGFX_GLOWY_MIDDLE; - unsigned char *srcPtr; + const unsigned char *srcPtr; unsigned short *destPtr; AVPMENUGFX *gfxPtr; D3DTexture *image; @@ -194,7 +194,7 @@ static void DrawAvPMenuGlowyBar(int topleftX, int topleftY, int alpha, int lengt static void DrawAvPMenuGlowyBar_Clipped(int topleftX, int topleftY, int alpha, int length, int topY, int bottomY) { enum AVPMENUGFX_ID menuGfxID = AVPMENUGFX_GLOWY_MIDDLE; - unsigned char *srcPtr; + const unsigned char *srcPtr; unsigned short *destPtr; AVPMENUGFX *gfxPtr; D3DTexture *image; @@ -323,7 +323,7 @@ static void LoadMenuFont() { D3DTexture *image = gfxPtr->ImagePtr; - unsigned char *srcPtr = image->buf; + const unsigned char *srcPtr = image->buf; int c; if ((image->w != 30) || ((image->h % 33) != 0)) { @@ -345,7 +345,7 @@ static void LoadMenuFont() int blank = 1; for (y=y1; yw) * 4]; + const unsigned char *s = &srcPtr[(x + y*image->w) * 4]; if (s[2]) { blank = 0; break; @@ -381,7 +381,7 @@ int LengthOfMenuText(const char *textPtr) return width; } -int LengthOfSmallMenuText(char *textPtr) +int LengthOfSmallMenuText(const char *textPtr) { int width = 0; @@ -424,7 +424,7 @@ int RenderMenuText(const char *textPtr, int sx, int sy, int alpha, enum AVPMENUF DrawAvPMenuGfx(AVPMENUGFX_GLOWY_RIGHT,sx+size,sy-8,alpha,AVPMENUFORMAT_LEFTJUSTIFIED); } { - unsigned char *srcPtr; + const unsigned char *srcPtr; unsigned short *destPtr; AVPMENUGFX *gfxPtr; D3DTexture *image; @@ -500,7 +500,7 @@ int RenderMenuText(const char *textPtr, int sx, int sy, int alpha, enum AVPMENUF } -int RenderMenuText_Clipped(char *textPtr, int sx, int sy, int alpha, enum AVPMENUFORMAT_ID format, int topY, int bottomY) +int RenderMenuText_Clipped(const char *textPtr, int sx, int sy, int alpha, enum AVPMENUFORMAT_ID format, int topY, int bottomY) { int width = LengthOfMenuText(textPtr); @@ -529,7 +529,7 @@ int RenderMenuText_Clipped(char *textPtr, int sx, int sy, int alpha, enum AVPMEN DrawAvPMenuGfx_Clipped(AVPMENUGFX_GLOWY_RIGHT,sx+size,sy-8,alpha,AVPMENUFORMAT_LEFTJUSTIFIED,topY,bottomY); } { - unsigned char *srcPtr; + const unsigned char *srcPtr; unsigned short *destPtr; AVPMENUGFX *gfxPtr; D3DTexture *image; @@ -609,9 +609,9 @@ int RenderMenuText_Clipped(char *textPtr, int sx, int sy, int alpha, enum AVPMEN } -static int RenderSmallFontString(char *textPtr,int sx,int sy,int alpha, int red, int green, int blue) +static int RenderSmallFontString(const char *textPtr,int sx,int sy,int alpha, int red, int green, int blue) { - unsigned char *srcPtr; + const unsigned char *srcPtr; unsigned short *destPtr; int alphaR = MUL_FIXED(alpha,red); int alphaG = MUL_FIXED(alpha,green); @@ -678,7 +678,7 @@ static int RenderSmallFontString(char *textPtr,int sx,int sy,int alpha, int red, void RenderSmallFontString_Wrapped(const char *textPtr,RECT* area,int alpha,int* output_x,int* output_y) { - unsigned char *srcPtr; + const unsigned char *srcPtr; unsigned short *destPtr; AVPMENUGFX *gfxPtr; D3DTexture *image; @@ -860,10 +860,10 @@ Determine area used by text , so we can draw it centrally if(output_y) *output_y=sy; } -int RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format) +int RenderSmallMenuText(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format) { int length; - char *ptr; + const char *ptr; switch(format) { default: @@ -898,10 +898,10 @@ int RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORM return RenderSmallFontString(textPtr,x,y,alpha,ONE_FIXED,ONE_FIXED,ONE_FIXED); } -int RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue) +int RenderSmallMenuText_Coloured(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue) { int length; - char *ptr; + const char *ptr; switch(format) { default: @@ -938,7 +938,7 @@ int RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha, enum AV static void CalculateWidthsOfAAFont() { - unsigned char *srcPtr; + const unsigned char *srcPtr; AVPMENUGFX *gfxPtr; D3DTexture *image; int c; @@ -961,7 +961,7 @@ static void CalculateWidthsOfAAFont() int blank = 1; for (y=y1; yw) * 4]; + const unsigned char *s = &srcPtr[(x + y*image->w) * 4]; if (s[2] >= 0x80) { blank = 0; break; @@ -1123,7 +1123,7 @@ void LoadAllAvPMenuGfx() LoadMenuFont(); { - unsigned char *srcPtr; + const unsigned char *srcPtr; AVPMENUGFX *gfxPtr = &AvPMenuGfxStorage[AVPMENUGFX_CLOUDY]; D3DTexture *image; @@ -1223,7 +1223,7 @@ void DrawAvPMenuGfx(enum AVPMENUGFX_ID menuGfxID, int topleftX, int topleftY, in { AVPMENUGFX *gfxPtr; D3DTexture *image; - unsigned char *srcPtr; + const unsigned char *srcPtr; unsigned short *destPtr; int length; @@ -1319,7 +1319,7 @@ void DrawAvPMenuGfx_CrossFade(enum AVPMENUGFX_ID menuGfxID,enum AVPMENUGFX_ID me { AVPMENUGFX *gfxPtr, *gfxPtr2; D3DTexture *image, *image2; - unsigned char *srcPtr, *srcPtr2; + const unsigned char *srcPtr, *srcPtr2; unsigned short *destPtr; int length; @@ -1399,7 +1399,7 @@ void DrawAvPMenuGfx_Faded(enum AVPMENUGFX_ID menuGfxID, int topleftX, int toplef { AVPMENUGFX *gfxPtr; D3DTexture *image; - unsigned char *srcPtr; + const unsigned char *srcPtr; unsigned short *destPtr; int length; @@ -1471,7 +1471,7 @@ void DrawAvPMenuGfx_Clipped(enum AVPMENUGFX_ID menuGfxID, int topleftX, int topl { AVPMENUGFX *gfxPtr; D3DTexture *image; - unsigned char *srcPtr; + const unsigned char *srcPtr; unsigned short *destPtr; int length; diff --git a/src/opengl.c b/src/opengl.c index dd89509..87539eb 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -2322,7 +2322,7 @@ void D3D_RenderHUDNumber_Centred(unsigned int number,int x,int y,int colour) } while (--noOfDigits); } -void D3D_RenderHUDString(char *stringPtr,int x,int y,int colour) +void D3D_RenderHUDString(const char *stringPtr,int x,int y,int colour) { struct VertexTag quadVertices[4]; @@ -2371,7 +2371,7 @@ void D3D_RenderHUDString(char *stringPtr,int x,int y,int colour) } } -void D3D_RenderHUDString_Clipped(char *stringPtr,int x,int y,int colour) +void D3D_RenderHUDString_Clipped(const char *stringPtr,int x,int y,int colour) { struct VertexTag quadVertices[4]; @@ -2422,10 +2422,10 @@ void D3D_RenderHUDString_Clipped(char *stringPtr,int x,int y,int colour) } } -void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour) +void D3D_RenderHUDString_Centred(const char *stringPtr, int centreX, int y, int colour) { int x, length = 0; - char *ptr = stringPtr; + const char *ptr = stringPtr; struct VertexTag quadVertices[4]; if (stringPtr == NULL) @@ -2481,15 +2481,15 @@ void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour } } -void RenderString(char *stringPtr, int x, int y, int colour) +void RenderString(const char *stringPtr, int x, int y, int colour) { D3D_RenderHUDString(stringPtr,x,y,colour); } -void RenderStringCentred(char *stringPtr, int centreX, int y, int colour) +void RenderStringCentred(const char *stringPtr, int centreX, int y, int colour) { int length = 0; - char *ptr = stringPtr; + const char *ptr = stringPtr; while(*ptr) { @@ -2498,7 +2498,7 @@ void RenderStringCentred(char *stringPtr, int centreX, int y, int colour) D3D_RenderHUDString(stringPtr,centreX-length/2,y,colour); } -void RenderStringVertically(char *stringPtr, int centreX, int bottomY, int colour) +void RenderStringVertically(const char *stringPtr, int centreX, int bottomY, int colour) { struct VertexTag quadVertices[4]; int y = bottomY; @@ -2511,7 +2511,7 @@ void RenderStringVertically(char *stringPtr, int centreX, int bottomY, int colou CheckFilteringModeIsCorrect(FILTERING_BILINEAR_OFF); while( *stringPtr ) { - char c = *stringPtr++; + const char c = *stringPtr++; { int topLeftU = 1+((c-32)&15)*16; @@ -2542,7 +2542,7 @@ void RenderStringVertically(char *stringPtr, int centreX, int bottomY, int colou } } -int Hardware_RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format) +int Hardware_RenderSmallMenuText(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format) { switch(format) { @@ -2558,7 +2558,7 @@ int Hardware_RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AV case AVPMENUFORMAT_RIGHTJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { @@ -2571,7 +2571,7 @@ int Hardware_RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AV case AVPMENUFORMAT_CENTREJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { @@ -2594,7 +2594,7 @@ int Hardware_RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AV return x; } -int Hardware_RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue) +int Hardware_RenderSmallMenuText_Coloured(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue) { switch(format) { @@ -2610,7 +2610,7 @@ int Hardware_RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha case AVPMENUFORMAT_RIGHTJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { @@ -2623,7 +2623,7 @@ int Hardware_RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha case AVPMENUFORMAT_CENTREJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { diff --git a/src/opengl.h b/src/opengl.h index c5262be..9beb239 100644 --- a/src/opengl.h +++ b/src/opengl.h @@ -33,9 +33,9 @@ void ThisFramesRenderingHasFinished(); void D3D_SkyPolygon_Output(POLYHEADER *inputPolyPtr, RENDERVERTEX *renderVerticesPtr); void D3D_DrawBackdrop(); void D3D_FadeDownScreen(int brightness, int colour); -void RenderString(char *stringPtr, int x, int y, int colour); -void RenderStringCentred(char *stringPtr, int centreX, int y, int colour); -void RenderStringVertically(char *stringPtr, int centreX, int bottomY, int colour); +void RenderString(const char *stringPtr, int x, int y, int colour); +void RenderStringCentred(const char *stringPtr, int centreX, int y, int colour); +void RenderStringVertically(const char *stringPtr, int centreX, int bottomY, int colour); void D3D_DecalSystem_Setup(); void D3D_DecalSystem_End(); void SecondFlushD3DZBuffer(); diff --git a/src/version.c b/src/version.c index 26686a5..8c73ee8 100644 --- a/src/version.c +++ b/src/version.c @@ -1,10 +1,10 @@ #include "version.h" -extern void NewOnScreenMessage(unsigned char *messagePtr); +extern void NewOnScreenMessage(const unsigned char *messagePtr); const char *AvPVersionString = "Aliens vs Predator Linux \n Build 000 (CVS) \n Based on Rebellion Developments AvP Gold source \n"; void GiveVersionDetails(void) { - NewOnScreenMessage((unsigned char *)AvPVersionString); + NewOnScreenMessage((const unsigned char *)AvPVersionString); } diff --git a/src/win95/chunk.cpp b/src/win95/chunk.cpp index b2914c4..122c4aa 100644 --- a/src/win95/chunk.cpp +++ b/src/win95/chunk.cpp @@ -8,7 +8,7 @@ #define twprintf printf -char * users_name = "Player"; +const char * users_name = "Player"; #include "hash_tem.hpp" Chunk * Parent_File; diff --git a/src/win95/enumchnk.cpp b/src/win95/enumchnk.cpp index c030e4a..a3400a4 100644 --- a/src/win95/enumchnk.cpp +++ b/src/win95/enumchnk.cpp @@ -48,7 +48,7 @@ const char * Enum_Chunk::get_head_id() } -void Enum_Chunk::set_lock_user (char * user) +void Enum_Chunk::set_lock_user (const char * user) { Enum_Header_Chunk * hdptr = get_header(); diff --git a/src/win95/enumchnk.hpp b/src/win95/enumchnk.hpp index 8b65a05..fc05268 100644 --- a/src/win95/enumchnk.hpp +++ b/src/win95/enumchnk.hpp @@ -22,7 +22,7 @@ public: BOOL file_equals (HANDLE &); const char * get_head_id(); - void set_lock_user(char *); + void set_lock_user(const char *); void post_input_processing(); diff --git a/src/win95/envchunk.cpp b/src/win95/envchunk.cpp index 04cc292..b3cf89d 100644 --- a/src/win95/envchunk.cpp +++ b/src/win95/envchunk.cpp @@ -69,7 +69,7 @@ const char * Environment_Data_Chunk::get_head_id() } -void Environment_Data_Chunk::set_lock_user (char * user) +void Environment_Data_Chunk::set_lock_user (const char * user) { Environment_Data_Header_Chunk * hdptr = get_header(); diff --git a/src/win95/envchunk.hpp b/src/win95/envchunk.hpp index 445a700..6a5a134 100644 --- a/src/win95/envchunk.hpp +++ b/src/win95/envchunk.hpp @@ -23,7 +23,7 @@ public: BOOL file_equals (HANDLE &); const char * get_head_id(); - void set_lock_user(char *); + void set_lock_user(const char *); void post_input_processing(); diff --git a/src/win95/gsprchnk.cpp b/src/win95/gsprchnk.cpp index f89987d..f83a379 100644 --- a/src/win95/gsprchnk.cpp +++ b/src/win95/gsprchnk.cpp @@ -47,7 +47,7 @@ const char * AllSprites_Chunk::get_head_id() } -void AllSprites_Chunk::set_lock_user (char * user) +void AllSprites_Chunk::set_lock_user (const char * user) { AllSprites_Header_Chunk * hdptr = get_header(); diff --git a/src/win95/gsprchnk.hpp b/src/win95/gsprchnk.hpp index a1ca067..f467e05 100644 --- a/src/win95/gsprchnk.hpp +++ b/src/win95/gsprchnk.hpp @@ -21,7 +21,7 @@ public: BOOL file_equals (HANDLE &); const char * get_head_id(); - void set_lock_user(char *); + void set_lock_user(const char *); void post_input_processing(); diff --git a/src/win95/mishchnk.cpp b/src/win95/mishchnk.cpp index c170364..b4521c3 100644 --- a/src/win95/mishchnk.cpp +++ b/src/win95/mishchnk.cpp @@ -12,7 +12,7 @@ // Class Lockable_Chunk_With_Children functions -extern char * users_name; +extern const char * users_name; //macro for helping to force inclusion of chunks when using libraries FORCE_CHUNK_INCLUDE_IMPLEMENT(mishchnk) diff --git a/src/win95/mishchnk.hpp b/src/win95/mishchnk.hpp index 438f99b..78d153a 100644 --- a/src/win95/mishchnk.hpp +++ b/src/win95/mishchnk.hpp @@ -12,7 +12,7 @@ #define twprintf printf -extern char * users_name; +extern const char * users_name; class File_Chunk; @@ -38,7 +38,7 @@ public: // to see if the current chunk is the same one virtual const char * get_head_id() = 0; - virtual void set_lock_user(char *) = 0; + virtual void set_lock_user(const char *) = 0; // this function will lock the chunk if it can - // will return true on success or if the chunk has diff --git a/src/win95/obchunk.cpp b/src/win95/obchunk.cpp index 2222370..c16f45f 100644 --- a/src/win95/obchunk.cpp +++ b/src/win95/obchunk.cpp @@ -175,7 +175,7 @@ const char * Object_Chunk::get_head_id() return(hdptr->identifier); } -void Object_Chunk::set_lock_user (char * user) +void Object_Chunk::set_lock_user (const char * user) { Object_Header_Chunk * hdptr = get_header(); diff --git a/src/win95/obchunk.hpp b/src/win95/obchunk.hpp index 29233f8..84ddf6c 100644 --- a/src/win95/obchunk.hpp +++ b/src/win95/obchunk.hpp @@ -81,7 +81,7 @@ public: BOOL file_equals (HANDLE &); const char * get_head_id(); - void set_lock_user(char *); + void set_lock_user(const char *); virtual void post_input_processing(); diff --git a/src/win95/shpchunk.cpp b/src/win95/shpchunk.cpp index 341e5e7..26058af 100644 --- a/src/win95/shpchunk.cpp +++ b/src/win95/shpchunk.cpp @@ -353,7 +353,7 @@ const char * Shape_Chunk::get_head_id() return(hdptr->identifier); } -void Shape_Chunk::set_lock_user (char * user) +void Shape_Chunk::set_lock_user (const char * user) { Shape_Header_Chunk * hdptr = get_header(); diff --git a/src/win95/shpchunk.hpp b/src/win95/shpchunk.hpp index 1aabd20..82ff779 100644 --- a/src/win95/shpchunk.hpp +++ b/src/win95/shpchunk.hpp @@ -101,7 +101,7 @@ public: BOOL file_equals (HANDLE &); const char * get_head_id(); - void set_lock_user(char *); + void set_lock_user(const char *); virtual void post_input_processing(); diff --git a/src/win95/videomodes.cpp b/src/win95/videomodes.cpp index a91af42..6c8c6e4 100644 --- a/src/win95/videomodes.cpp +++ b/src/win95/videomodes.cpp @@ -213,14 +213,14 @@ int EnumerateCardsAndVideoModes(void) } char buffer[32]; -extern char *GetVideoModeDescription2(void) +extern const char *GetVideoModeDescription2(void) { strncpy(buffer, DeviceDescriptions[CurrentlySelectedDevice].DeviceInfo.szDescription,24); buffer[24] = 0; return buffer; } -extern char *GetVideoModeDescription3(void) +extern const char *GetVideoModeDescription3(void) { DEVICEANDVIDEOMODESDESC *dPtr = &DeviceDescriptions[CurrentlySelectedDevice]; VIDEOMODEDESC *vmPtr = &(dPtr->VideoModes[CurrentlySelectedVideoMode]); @@ -384,4 +384,4 @@ extern void LoadDeviceAndVideoModePreferences(void) GetDeviceAndVideoModePrefences(); } -}; \ No newline at end of file +}; diff --git a/src/winapi.c b/src/winapi.c index 58ca183..eaa6ec4 100644 --- a/src/winapi.c +++ b/src/winapi.c @@ -141,7 +141,7 @@ int GetDiskFreeSpace(int x, unsigned long *a, unsigned long *b, unsigned long *c return 0; } -int CreateDirectory(char *dir, int lpSecurityAttributes) +int CreateDirectory(const char *dir, int lpSecurityAttributes) { fprintf(stderr, "CreateDirectory(%s, %d)\n", dir, lpSecurityAttributes);