From 1b7be81f11d33b80e4fa1551700d351927807fe0 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 28 Sep 2010 18:41:38 +0900 Subject: [PATCH] Do a const-correct run. --- tools/Forge/Bundles/MapEdit/Dict.h | 22 ++++---- tools/Forge/Bundles/MapEdit/Dict.m | 29 +++++----- tools/Forge/Bundles/MapEdit/DictList.h | 4 +- tools/Forge/Bundles/MapEdit/DictList.m | 4 +- tools/Forge/Bundles/MapEdit/Entity.h | 9 ++- tools/Forge/Bundles/MapEdit/Entity.m | 5 +- tools/Forge/Bundles/MapEdit/EntityClass.h | 8 +-- tools/Forge/Bundles/MapEdit/EntityClass.m | 14 ++--- tools/Forge/Bundles/MapEdit/Map.h | 4 +- tools/Forge/Bundles/MapEdit/Map.m | 4 +- tools/Forge/Bundles/MapEdit/Preferences.h | 2 +- tools/Forge/Bundles/MapEdit/Preferences.m | 2 +- tools/Forge/Bundles/MapEdit/Project.h | 37 ++++++------- tools/Forge/Bundles/MapEdit/Project.m | 58 ++++++++++---------- tools/Forge/Bundles/MapEdit/QuakeEd.h | 8 +-- tools/Forge/Bundles/MapEdit/QuakeEd.m | 11 ++-- tools/Forge/Bundles/MapEdit/Storage.h | 16 +++--- tools/Forge/Bundles/MapEdit/TexturePalette.h | 15 ++--- tools/Forge/Bundles/MapEdit/TexturePalette.m | 17 +++--- tools/Forge/Bundles/MapEdit/Things.h | 2 +- tools/Forge/Bundles/MapEdit/Things.m | 6 +- 21 files changed, 131 insertions(+), 146 deletions(-) diff --git a/tools/Forge/Bundles/MapEdit/Dict.h b/tools/Forge/Bundles/MapEdit/Dict.h index 5d1cb37e7..9aafd02cd 100644 --- a/tools/Forge/Bundles/MapEdit/Dict.h +++ b/tools/Forge/Bundles/MapEdit/Dict.h @@ -16,27 +16,27 @@ typedef struct { -initFromFile:(FILE *) fp; --(id) parseMultipleFrom:(char *) value; --(int) getValueUnits:(char *) key; --delString:(char *)string fromValue:(char *) key; +-(id) parseMultipleFrom:(const char *) value; +-(int) getValueUnits:(const char *) key; +-delString:(const char *)string fromValue:(const char *) key; --addString:(char *)string toValue:(char *) key; +-addString:(const char *)string toValue:(const char *) key; -(char *) convertListToString:(id) list; --(char *) getStringFor:(char *) name; --removeKeyword:(char *) key; --(unsigned int) getValueFor:(char *) name; --changeStringFor:(char *)key to:(char *) value; +-(const char *) getStringFor:(const char *) name; +-removeKeyword:(const char *) key; +-(unsigned int) getValueFor:(const char *) name; +-changeStringFor:(const char *)key to:(const char *) value; --(dict_t *) findKeyword:(char *) key; +-(dict_t *) findKeyword:(const char *) key; -writeBlockTo:(FILE *) fp; --writeFile:(char *) path; +-writeFile:(const char *) path; // INTERNAL -init; -(id) parseBraceBlock:(FILE *) fp; --setupMultiple:(char *) value; +-setupMultiple:(const char *) value; -(char *) getNextParameter; @end diff --git a/tools/Forge/Bundles/MapEdit/Dict.m b/tools/Forge/Bundles/MapEdit/Dict.m index 57a8f0244..ce163afd3 100644 --- a/tools/Forge/Bundles/MapEdit/Dict.m +++ b/tools/Forge/Bundles/MapEdit/Dict.m @@ -86,7 +86,7 @@ JDC // // Write a single { } block out // --writeFile:(char *) path +-writeFile:(const char *) path { FILE *fp; @@ -114,7 +114,7 @@ JDC // Find a keyword in storage // Returns * to dict_t, otherwise NULL // --(dict_t *) findKeyword:(char *) key +-(dict_t *) findKeyword:(const char *) key { int max; int i; @@ -133,8 +133,7 @@ JDC // // Change a keyword's string // --changeStringFor:(char *) -key to:(char *) value +-changeStringFor:(const char *) key to:(const char *) value { dict_t *d; dict_t newd; @@ -157,7 +156,7 @@ key to:(char *) value // // Search for keyword, return the string * // --(char *) getStringFor:(char *) name +-(const char *) getStringFor:(const char *) name { dict_t *d; @@ -171,7 +170,7 @@ key to:(char *) value // // Search for keyword, return the value // --(unsigned int) getValueFor:(char *) name +-(unsigned int) getValueFor:(const char *) name { dict_t *d; @@ -185,7 +184,7 @@ key to:(char *) value // // Return # of units in keyword's value // --(int) getValueUnits:(char *) key +-(int) getValueUnits:(const char *) key { id temp; int count; @@ -224,7 +223,7 @@ key to:(char *) value // // JDC: I wrote this to simplify removing vectors // --removeKeyword:(char *) key +-removeKeyword:(const char *) key { dict_t *d; @@ -238,8 +237,7 @@ key to:(char *) value // // Delete string from keyword's value // --delString:(char *) -string fromValue:(char *) key +-delString:(const char *) string fromValue:(const char *) key { id temp; int count; @@ -269,8 +267,7 @@ string fromValue:(char *) key // // Add string to keyword's value // --addString:(char *) -string toValue:(char *) key +-addString:(const char *) string toValue:(const char *) key { char *newstr; char spacing[] = "\t"; @@ -295,10 +292,10 @@ string toValue:(char *) key // Use these for multiple parameters in a keyword value // //=============================================== -char *searchStr; +const char *searchStr; char item[4096]; --setupMultiple:(char *) value +-setupMultiple:(const char *) value { searchStr = value; return self; @@ -324,12 +321,12 @@ char item[4096]; // // Parses a keyvalue string & returns a Storage full of those items // --(id) parseMultipleFrom:(char *) key +-(id) parseMultipleFrom:(const char *) key { #define ITEMSIZE 128 id stuff; char string[ITEMSIZE]; - char *s; + const char *s; s =[self getStringFor:key]; if (s == NULL) diff --git a/tools/Forge/Bundles/MapEdit/DictList.h b/tools/Forge/Bundles/MapEdit/DictList.h index 40eb71a2e..07ce9acf0 100644 --- a/tools/Forge/Bundles/MapEdit/DictList.h +++ b/tools/Forge/Bundles/MapEdit/DictList.h @@ -9,8 +9,8 @@ } -initListFromFile:(FILE *) fp; --writeListFile:(char *) filename; --(id) findDictKeyword:(char *) key; +-writeListFile:(const char *) filename; +-(id) findDictKeyword:(const char *) key; @end #endif // DictList_h diff --git a/tools/Forge/Bundles/MapEdit/DictList.m b/tools/Forge/Bundles/MapEdit/DictList.m index 85e306dd2..c8eba578c 100644 --- a/tools/Forge/Bundles/MapEdit/DictList.m +++ b/tools/Forge/Bundles/MapEdit/DictList.m @@ -28,7 +28,7 @@ // // Write out list file // --writeListFile:(char *) filename +-writeListFile:(const char *) filename { FILE *fp; int i; @@ -52,7 +52,7 @@ // // Find the keyword in all the Dict objects // --(id) findDictKeyword:(char *) key +-(id) findDictKeyword:(const char *) key { int i; dict_t *d; diff --git a/tools/Forge/Bundles/MapEdit/Entity.h b/tools/Forge/Bundles/MapEdit/Entity.h index e7655d24f..3b940c45d 100644 --- a/tools/Forge/Bundles/MapEdit/Entity.h +++ b/tools/Forge/Bundles/MapEdit/Entity.h @@ -20,7 +20,7 @@ typedef struct epair_s { BOOL modifiable; } --initClass:(char *) classname; +-initClass:(const char *) classname; -initFromScript:(struct script_s *) script; -(void) dealloc; @@ -33,14 +33,13 @@ typedef struct epair_s { -writeToFILE:(FILE *)f region:(BOOL) reg; -(const char *) valueForQKey:(const char *) k; --getVector:(vec3_t)v forKey:(char *) k; +-getVector:(vec3_t)v forKey:(const char *) k; --setKey:(const char *) -k toValue:(const char *) v; +-setKey:(const char *) k toValue:(const char *) v; -(int) numPairs; -(epair_t *) epairs; --removeKeyPair:(char *) key; +-removeKeyPair:(const char *) key; @end #endif // Entity_h diff --git a/tools/Forge/Bundles/MapEdit/Entity.m b/tools/Forge/Bundles/MapEdit/Entity.m index 3f77e3c22..f6a2806c6 100644 --- a/tools/Forge/Bundles/MapEdit/Entity.m +++ b/tools/Forge/Bundles/MapEdit/Entity.m @@ -51,7 +51,7 @@ vec3_t bad_maxs = { 8, 8, 8 }; return self; } --initClass:(char *) classname +-initClass:(const char *) classname { id new; esize_t esize; @@ -139,8 +139,7 @@ vec3_t bad_maxs = { 8, 8, 8 }; return ""; } --getVector:(vec3_t) -v forKey:(char *) k +-getVector:(vec3_t) v forKey:(const char *) k { const char *c; diff --git a/tools/Forge/Bundles/MapEdit/EntityClass.h b/tools/Forge/Bundles/MapEdit/EntityClass.h index fde6f68b2..def8016e5 100644 --- a/tools/Forge/Bundles/MapEdit/EntityClass.h +++ b/tools/Forge/Bundles/MapEdit/EntityClass.h @@ -21,13 +21,13 @@ typedef enum { esize_model, esize_fixed } esize_t; -initFromText:(const char *)text source:(const char *) filename; --(char *) classname; +-(const char *) classname; -(esize_t) esize; -(float *) mins; // only for esize_fixed -(float *) maxs; // only for esize_fixed -(float *) drawColor; --(char *) comments; --(char *) flagName:(unsigned) flagnum; +-(const char *) comments; +-(const char *) flagName:(unsigned) flagnum; @end extern id entity_classes_i; @@ -38,7 +38,7 @@ typedef enum { esize_model, esize_fixed } esize_t; char *source_path; } --initForSourceDirectory:(char *) path; +-initForSourceDirectory:(const char *) path; -(id) classForName:(const char *) name; -(void) scanDirectory; diff --git a/tools/Forge/Bundles/MapEdit/EntityClass.m b/tools/Forge/Bundles/MapEdit/EntityClass.m index 05a2c6b8c..eeaffa614 100644 --- a/tools/Forge/Bundles/MapEdit/EntityClass.m +++ b/tools/Forge/Bundles/MapEdit/EntityClass.m @@ -110,7 +110,7 @@ parse_vector (script_t * script, vec3_t vec) return esize; } --(char *) classname +-(const char *) classname { return name; } @@ -130,13 +130,13 @@ parse_vector (script_t * script, vec3_t vec) return color; } --(char *) comments +-(const char *) comments { return comments; } --(char *) flagName:(unsigned) flagnum +-(const char *) flagName:(unsigned) flagnum { if (flagnum >= MAX_FLAGS) Sys_Error ("EntityClass flagName: bad number"); @@ -157,7 +157,7 @@ insertEC: */ - (void) insertEC:ec { - char *name; + const char *name; int i; name =[ec classname]; @@ -176,7 +176,7 @@ insertEC: scanFile ================= */ --(void) scanFile:(char *) filename +-(void) scanFile:(const char *) filename { int size, line; char *data; @@ -242,12 +242,12 @@ scanDirectory id entity_classes_i; --initForSourceDirectory:(char *) path +-initForSourceDirectory:(const char *) path { self = [super init]; array = [[NSMutableArray alloc] init]; - source_path = path; + source_path = strdup (path); //FIXME leak? [self scanDirectory]; entity_classes_i = self; diff --git a/tools/Forge/Bundles/MapEdit/Map.h b/tools/Forge/Bundles/MapEdit/Map.h index eabc83fce..5401a4bb4 100644 --- a/tools/Forge/Bundles/MapEdit/Map.h +++ b/tools/Forge/Bundles/MapEdit/Map.h @@ -21,8 +21,8 @@ extern id map_i; -writeStats; --readMapFile:(char *) fname; --writeMapFile:(char *)fname useRegion:(BOOL) reg; +-readMapFile:(const char *) fname; +-writeMapFile:(const char *)fname useRegion:(BOOL) reg; -entityConnect: (vec3_t) p1:(vec3_t) p2; diff --git a/tools/Forge/Bundles/MapEdit/Map.m b/tools/Forge/Bundles/MapEdit/Map.m index 17ca59e73..697753a01 100644 --- a/tools/Forge/Bundles/MapEdit/Map.m +++ b/tools/Forge/Bundles/MapEdit/Map.m @@ -222,7 +222,7 @@ FILE METHODS readMapFile ================= */ --readMapFile:(char *) fname +-readMapFile:(const char *) fname { char *dat; const char *wad, *cl; @@ -297,7 +297,7 @@ readMapFile writeMapFile ================= */ --writeMapFile:(char *) +-writeMapFile:(const char *) fname useRegion:(BOOL) reg { FILE *f; diff --git a/tools/Forge/Bundles/MapEdit/Preferences.h b/tools/Forge/Bundles/MapEdit/Preferences.h index 1d3d646b6..015741a1b 100644 --- a/tools/Forge/Bundles/MapEdit/Preferences.h +++ b/tools/Forge/Bundles/MapEdit/Preferences.h @@ -71,7 +71,7 @@ extern float lightaxis[3]; // -playBspSound; --(char *) getProjectPath; +-(const char *) getProjectPath; -(int) getBrushOffset; // get the state -(int) getShowBSP; // get the state diff --git a/tools/Forge/Bundles/MapEdit/Preferences.m b/tools/Forge/Bundles/MapEdit/Preferences.m index 9f0d15768..8d82d84c0 100644 --- a/tools/Forge/Bundles/MapEdit/Preferences.m +++ b/tools/Forge/Bundles/MapEdit/Preferences.m @@ -129,7 +129,7 @@ _atof (const char *c) return self; } --(char *) getProjectPath +-(const char *) getProjectPath { return projectpath; } diff --git a/tools/Forge/Bundles/MapEdit/Project.h b/tools/Forge/Bundles/MapEdit/Project.h index 415247771..925af3573 100644 --- a/tools/Forge/Bundles/MapEdit/Project.h +++ b/tools/Forge/Bundles/MapEdit/Project.h @@ -72,43 +72,40 @@ extern id project_i; -initProject; -initVars; --(char *) currentProjectFile; +-(const char *) currentProjectFile; -setTextureWad:(const char *) wf; --addToOutput:(char *) string; +-addToOutput:(const char *) string; -clearBspOutput:sender; -initProjSettings; --changeChar:(char) -f to:(char) -t in:(id) obj; +-changeChar:(char) f to:(char) t in:(id) obj; --(int) searchForString:(char *) -str in:(id) obj; +-(int) searchForString:(const char *) str in:(id) obj; -parseProjectFile; // read defaultsdatabase for project // path --openProjectFile:(char *) path; // called by openProject and newProject +-openProjectFile:(const char *) path; // called by openProject and newProject -openProject; -clickedOnMap:sender; // called if clicked on map in browser -clickedOnWad:sender; // called if clicked on wad in browser // methods to querie the project file --(char *) getMapDirectory; --(char *) getFinalMapDirectory; --(char *) getProgDirectory; +-(const char *) getMapDirectory; +-(const char *) getFinalMapDirectory; +-(const char *) getProgDirectory; --(char *) getWAD8; --(char *) getWAD9; --(char *) getWAD0; +-(const char *) getWAD8; +-(const char *) getWAD9; +-(const char *) getWAD0; --(char *) getFullVisCmd; --(char *) getFastVisCmd; --(char *) getNoVisCmd; --(char *) getRelightCmd; --(char *) getLeaktestCmd; --(char *) getEntitiesCmd; +-(const char *) getFullVisCmd; +-(const char *) getFastVisCmd; +-(const char *) getNoVisCmd; +-(const char *) getRelightCmd; +-(const char *) getLeaktestCmd; +-(const char *) getEntitiesCmd; @end void changeString (char cf, char ct, char *string); diff --git a/tools/Forge/Bundles/MapEdit/Project.m b/tools/Forge/Bundles/MapEdit/Project.m index 98258626a..5eeec364f 100644 --- a/tools/Forge/Bundles/MapEdit/Project.m +++ b/tools/Forge/Bundles/MapEdit/Project.m @@ -36,24 +36,25 @@ id project_i; //=========================================================== -initVars { - char *s; + const char *s; const char *pe; + char *ts; - s =[preferences_i getProjectPath]; - pe = QFS_SkipPath (s); - s[pe - s] = 0; - strcpy (path_basepath, s); + ts = strdup ([preferences_i getProjectPath]); + pe = QFS_SkipPath (ts); + ts[pe - ts] = 0; + strcpy (path_basepath, ts); - strcpy (path_progdir, s); + strcpy (path_progdir, ts); strcat (path_progdir, SUBDIR_ENT); - strcpy (path_mapdirectory, s); + strcpy (path_mapdirectory, ts); strcat (path_mapdirectory, SUBDIR_MAPS); // source dir - strcpy (path_finalmapdir, s); + strcpy (path_finalmapdir, ts); strcat (path_finalmapdir, SUBDIR_MAPS); // dest dir - [basepathinfo_i setStringValue: [NSString stringWithCString:s]]; + [basepathinfo_i setStringValue: [NSString stringWithCString:ts]]; // in Project Inspector #if 0 @@ -134,7 +135,7 @@ id project_i; // // Add text to the BSP Output window // --addToOutput:(char *) string +-addToOutput:(const char *) string { int end; @@ -184,9 +185,7 @@ id project_i; // // Change a character to another in a Storage list of strings // --changeChar:(char) -f to:(char) -t in:(id) obj +-changeChar:(char) f to:(char) t in:(id) obj { int i; int max; @@ -312,7 +311,7 @@ t in:(id) obj // -parseProjectFile { - char *path; + const char *path; int rtn; path =[preferences_i getProjectPath]; @@ -333,7 +332,7 @@ t in:(id) obj // // Loads and parses a project file // --openProjectFile:(char *) path +-openProjectFile:(const char *) path { FILE *fp; struct stat s; @@ -354,7 +353,7 @@ Sys_Printf ("openProjectFile: %s\n", path); return self; } --(char *) currentProjectFile +-(const char *) currentProjectFile { return path_projectinfo; } @@ -392,8 +391,7 @@ Sys_Printf ("openProjectFile: %s\n", path); // // Search for a string in a List of strings // --(int) searchForString:(char *) -str in:(id) obj +-(int) searchForString:(const char *) str in:(id) obj { int i; int max; @@ -408,17 +406,17 @@ str in:(id) obj return 0; } --(char *) getMapDirectory +-(const char *) getMapDirectory { return path_mapdirectory; } --(char *) getFinalMapDirectory +-(const char *) getFinalMapDirectory { return path_finalmapdir; } --(char *) getProgDirectory +-(const char *) getProgDirectory { return path_progdir; } @@ -427,7 +425,7 @@ str in:(id) obj // // Return the WAD name for cmd-8 // --(char *) getWAD8 +-(const char *) getWAD8 { if (!path_wad8[0]) return NULL; @@ -437,7 +435,7 @@ str in:(id) obj // // Return the WAD name for cmd-9 // --(char *) getWAD9 +-(const char *) getWAD9 { if (!path_wad9[0]) return NULL; @@ -447,7 +445,7 @@ str in:(id) obj // // Return the WAD name for cmd-0 // --(char *) getWAD0 +-(const char *) getWAD0 { if (!path_wad0[0]) return NULL; @@ -457,7 +455,7 @@ str in:(id) obj // // Return the FULLVIS cmd string // --(char *) getFullVisCmd +-(const char *) getFullVisCmd { if (!string_fullvis[0]) return NULL; @@ -467,7 +465,7 @@ str in:(id) obj // // Return the FASTVIS cmd string // --(char *) getFastVisCmd +-(const char *) getFastVisCmd { if (!string_fastvis[0]) return NULL; @@ -477,7 +475,7 @@ str in:(id) obj // // Return the NOVIS cmd string // --(char *) getNoVisCmd +-(const char *) getNoVisCmd { if (!string_novis[0]) return NULL; @@ -487,7 +485,7 @@ str in:(id) obj // // Return the RELIGHT cmd string // --(char *) getRelightCmd +-(const char *) getRelightCmd { if (!string_relight[0]) return NULL; @@ -497,14 +495,14 @@ str in:(id) obj // // Return the LEAKTEST cmd string // --(char *) getLeaktestCmd +-(const char *) getLeaktestCmd { if (!string_leaktest[0]) return NULL; return string_leaktest; } --(char *) getEntitiesCmd +-(const char *) getEntitiesCmd { if (!string_entities[0]) return NULL; diff --git a/tools/Forge/Bundles/MapEdit/QuakeEd.h b/tools/Forge/Bundles/MapEdit/QuakeEd.h index ff0759aad..a4da5de97 100644 --- a/tools/Forge/Bundles/MapEdit/QuakeEd.h +++ b/tools/Forge/Bundles/MapEdit/QuakeEd.h @@ -14,8 +14,6 @@ double I_FloatTime (void); void NopSound (void); -void qprintf (char *fmt, ...); // prints text to cmd_out_i - @interface QuakeEd:NSWindow { BOOL dirty; @@ -47,7 +45,7 @@ void qprintf (char *fmt, ...); // prints text to cmd_out_i } -setDefaultFilename; --(char *) currentFilename; +-(const char *) currentFilename; -updateAll; // when a model has been changed -updateCamera; // when the camera has moved @@ -87,9 +85,9 @@ void qprintf (char *fmt, ...); // prints text to cmd_out_i -save:sender; -saveAs:sender; --doOpen:(char *) fname; +-doOpen:(const char *) fname; --saveBSP:(char *)cmdline dialog:(BOOL)wt; +-saveBSP:(const char *)cmdline dialog:(BOOL)wt; -BSP_Full:sender; -BSP_FastVis:sender; diff --git a/tools/Forge/Bundles/MapEdit/QuakeEd.m b/tools/Forge/Bundles/MapEdit/QuakeEd.m index bd7768682..460997570 100644 --- a/tools/Forge/Bundles/MapEdit/QuakeEd.m +++ b/tools/Forge/Bundles/MapEdit/QuakeEd.m @@ -636,7 +636,7 @@ BSP PROCESSING */ void -ExpandCommand (char *in, char *out, char *src, char *dest) +ExpandCommand (const char *in, char *out, char *src, char *dest) { while (*in) { if (in[0] == '$') { @@ -661,15 +661,14 @@ ExpandCommand (char *in, char *out, char *src, char *dest) saveBSP ============= */ --saveBSP:(char *) -cmdline dialog:(BOOL) wt +-saveBSP:(const char *) cmdline dialog:(BOOL) wt { char expandedcmd[1024]; char mappath[1024]; char bsppath[1024]; int oldLightFilter; int oldPathFilter; - char *destdir; + const char *destdir; if (bsppid) { NSBeep (); @@ -799,7 +798,7 @@ doOpen: Called by open or the project panel ============== */ --doOpen:(char *) fname; +-doOpen:(const char *) fname; { strcpy (filename, fname); @@ -904,7 +903,7 @@ saveAs // // AJR - added this for Project info // --(char *) currentFilename +-(const char *) currentFilename { return filename; } diff --git a/tools/Forge/Bundles/MapEdit/Storage.h b/tools/Forge/Bundles/MapEdit/Storage.h index 4dda151e6..45a6b236c 100644 --- a/tools/Forge/Bundles/MapEdit/Storage.h +++ b/tools/Forge/Bundles/MapEdit/Storage.h @@ -43,8 +43,7 @@ /* Creating, freeing, initializing, and emptying */ -init; --initCount:(NSUInteger) -numSlots elementSize:(NSUInteger) sizeInBytes +-initCount:(NSUInteger) numSlots elementSize:(NSUInteger) sizeInBytes description:(const char *) elemDesc; -(void) dealloc; -empty; @@ -56,15 +55,13 @@ numSlots elementSize:(NSUInteger) sizeInBytes -(const char *) description; -(NSUInteger) count; -(void *) elementAt:(NSUInteger) index; --replaceElementAt:(NSUInteger) -index with:(void *) anElement; +-replaceElementAt:(NSUInteger) index with:(void *) anElement; -setNumSlots:(NSUInteger) numSlots; -setAvailableCapacity:(NSUInteger) numSlots; -addElement:(void *) anElement; -removeLastElement; --insertElement:(void *) -anElement at:(NSUInteger) index; +-insertElement:(void *) anElement at:(NSUInteger) index; -removeElementAt:(NSUInteger) index; @@ -76,11 +73,12 @@ anElement at:(NSUInteger) index; /* old-style creation */ +new; -+newCount:(NSUInteger) -count elementSize:(NSUInteger) sizeInBytes ++newCount:(NSUInteger) count elementSize:(NSUInteger) sizeInBytes description:(const char *) descriptor; -@end typedef struct { +@end + +typedef struct { @defs (Storage) } NXStorageId; diff --git a/tools/Forge/Bundles/MapEdit/TexturePalette.h b/tools/Forge/Bundles/MapEdit/TexturePalette.h index 70cc1d0e7..eff444b50 100644 --- a/tools/Forge/Bundles/MapEdit/TexturePalette.h +++ b/tools/Forge/Bundles/MapEdit/TexturePalette.h @@ -35,7 +35,7 @@ extern int tex_count; extern qtexture_t qtextures[MAX_TEXTURES]; void TEX_InitFromWad (const char *path); -qtexture_t *TEX_ForName (char *name); +qtexture_t *TEX_ForName (const char *name); typedef struct { @@ -70,7 +70,7 @@ extern id texturepalette_i; int selectedTexture; } --(char *) currentWad; +-(const char *) currentWad; -initPaletteFromWadfile:(const char *) wf; -computeTextureViewSize; -alphabetize; @@ -80,8 +80,8 @@ extern id texturepalette_i; -(int) getSelectedTexIndex; // Called externally --(char *) getSelTextureName; --setTextureByName:(char *) name; +-(const char *) getSelTextureName; +-setTextureByName:(const char *) name; // New methods to replace the 2 above ones -setTextureDef:(texturedef_t *) td; @@ -109,11 +109,8 @@ extern id texturepalette_i; -texturedefChanged:sender; -onlyShowMapTextures:sender; --(int) searchForTextureInPalette:(char *) texture; --setDisplayFlag:(int) -index -to:(int) - value; +-(int) searchForTextureInPalette:(const char *) texture; +-setDisplayFlag:(int) index to:(int) value; @end #endif // TexturePalette_h diff --git a/tools/Forge/Bundles/MapEdit/TexturePalette.m b/tools/Forge/Bundles/MapEdit/TexturePalette.m index ceaba8644..5c516c1cd 100644 --- a/tools/Forge/Bundles/MapEdit/TexturePalette.m +++ b/tools/Forge/Bundles/MapEdit/TexturePalette.m @@ -228,7 +228,7 @@ TEX_NumForName ================= */ qtexture_t * -TEX_ForName (char *name) +TEX_ForName (const char *name) { char newname[16]; int i; @@ -263,7 +263,7 @@ TEX_ForName (char *name) } --(char *) currentWad +-(const char *) currentWad { return currentwad; } @@ -488,7 +488,7 @@ TEX_ForName (char *name) // // Return the name of the selected texture // --(char *) getSelTextureName +-(const char *) getSelTextureName { texpal_t *t; @@ -501,21 +501,24 @@ TEX_ForName (char *name) // // Set selected texture by texture name // --setTextureByName:(char *) name +-setTextureByName:(const char *) name { texpal_t *t; int i; int max; + char *nm = strdup (name); max =[textureList_i count]; - CleanupName(name,name); + CleanupName(nm,nm); for (i = 0; i < max; i++) { t =[textureList_i elementAt:i]; - if (!strcmp (t->name, name)) { + if (!strcmp (t->name, nm)) { + free (nm); [self setSelectedTexture:i]; return self; } } + free (nm); return self; } @@ -717,7 +720,7 @@ field by:(int) amount // Search for texture in entire palette // Return index of texturedef, or -1 if unsuccessful // --(int) searchForTextureInPalette:(char *) texture +-(int) searchForTextureInPalette:(const char *) texture { int i; int max; diff --git a/tools/Forge/Bundles/MapEdit/Things.h b/tools/Forge/Bundles/MapEdit/Things.h index a517fb4ad..7de487014 100644 --- a/tools/Forge/Bundles/MapEdit/Things.h +++ b/tools/Forge/Bundles/MapEdit/Things.h @@ -29,7 +29,7 @@ extern id things_i; -setSelectedKey:(epair_t *) ep; -clearInputs; --(char *) spawnName; +-(const char *) spawnName; // UI targets -reloadEntityClasses:sender; diff --git a/tools/Forge/Bundles/MapEdit/Things.m b/tools/Forge/Bundles/MapEdit/Things.m index e479cb354..bda9ad8ee 100644 --- a/tools/Forge/Bundles/MapEdit/Things.m +++ b/tools/Forge/Bundles/MapEdit/Things.m @@ -43,7 +43,7 @@ id things_i; -initEntities { - char *path; + const char *path; path =[project_i getProgDirectory]; @@ -79,7 +79,7 @@ id things_i; return self; } --(char *) spawnName +-(const char *) spawnName { return[[entity_classes_i objectAtIndex:lastSelected] classname]; } @@ -91,7 +91,7 @@ id things_i; -reloadEntityClasses:sender { EntityClass *ent; - char *path; + const char *path; path = (char *)[prog_path_i stringValue]; if (!path || !path[0]) {