[ioquake3] 22/33: Don't redefine MAX_PATH in bot code

Simon McVittie smcv at debian.org
Mon Oct 30 14:00:28 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian/master
in repository ioquake3.

commit 815c898bf5717a1edff01f9434683a368b24c239
Author: Zack Middleton <zack at cloemail.com>
Date:   Wed Oct 4 22:13:41 2017 -0500

    Don't redefine MAX_PATH in bot code
---
 code/botlib/be_aas_main.c |  7 +++----
 code/botlib/be_ai_goal.c  |  2 +-
 code/botlib/be_ai_weap.c  |  2 +-
 code/botlib/l_precomp.c   |  2 +-
 code/botlib/l_precomp.h   |  4 ----
 code/botlib/l_script.c    |  8 ++------
 code/botlib/l_utils.h     |  3 ---
 code/game/ai_main.c       | 16 ++++++----------
 8 files changed, 14 insertions(+), 30 deletions(-)

diff --git a/code/botlib/be_aas_main.c b/code/botlib/be_aas_main.c
index f4ef606..bd55fda 100644
--- a/code/botlib/be_aas_main.c
+++ b/code/botlib/be_aas_main.c
@@ -220,10 +220,9 @@ void AAS_ProjectPointOntoVector( vec3_t point, vec3_t vStart, vec3_t vEnd, vec3_
 int AAS_LoadFiles(const char *mapname)
 {
 	int errnum;
-	char aasfile[MAX_PATH];
-//	char bspfile[MAX_PATH];
+	char aasfile[MAX_QPATH];
 
-	strcpy(aasworld.mapname, mapname);
+	Q_strncpyz(aasworld.mapname, mapname, sizeof(aasworld.mapname));
 	//NOTE: first reset the entity links into the AAS areas and BSP leaves
 	// the AAS link heap and BSP link heap are reset after respectively the
 	// AAS file and BSP file are loaded
@@ -232,7 +231,7 @@ int AAS_LoadFiles(const char *mapname)
 	AAS_LoadBSPFile();
 
 	//load the aas file
-	Com_sprintf(aasfile, MAX_PATH, "maps/%s.aas", mapname);
+	Com_sprintf(aasfile, sizeof(aasfile), "maps/%s.aas", mapname);
 	errnum = AAS_LoadAASFile(aasfile);
 	if (errnum != BLERR_NOERROR)
 		return errnum;
diff --git a/code/botlib/be_ai_goal.c b/code/botlib/be_ai_goal.c
index 7c56b56..0bbc6a5 100644
--- a/code/botlib/be_ai_goal.c
+++ b/code/botlib/be_ai_goal.c
@@ -268,7 +268,7 @@ itemconfig_t *LoadItemConfig(char *filename)
 {
 	int max_iteminfo;
 	token_t token;
-	char path[MAX_PATH];
+	char path[MAX_QPATH];
 	source_t *source;
 	itemconfig_t *ic;
 	iteminfo_t *ii;
diff --git a/code/botlib/be_ai_weap.c b/code/botlib/be_ai_weap.c
index 88fb197..df68511 100644
--- a/code/botlib/be_ai_weap.c
+++ b/code/botlib/be_ai_weap.c
@@ -199,7 +199,7 @@ weaponconfig_t *LoadWeaponConfig(char *filename)
 {
 	int max_weaponinfo, max_projectileinfo;
 	token_t token;
-	char path[MAX_PATH];
+	char path[MAX_QPATH];
 	int i, j;
 	source_t *source;
 	weaponconfig_t *wc;
diff --git a/code/botlib/l_precomp.c b/code/botlib/l_precomp.c
index 5c866b2..2fbc599 100644
--- a/code/botlib/l_precomp.c
+++ b/code/botlib/l_precomp.c
@@ -971,7 +971,7 @@ int PC_Directive_include(source_t *source)
 {
 	script_t *script;
 	token_t token;
-	char path[MAX_PATH];
+	char path[MAX_QPATH];
 #ifdef QUAKE
 	foundfile_t file;
 #endif //QUAKE
diff --git a/code/botlib/l_precomp.h b/code/botlib/l_precomp.h
index bdf8e9c..cce79db 100644
--- a/code/botlib/l_precomp.h
+++ b/code/botlib/l_precomp.h
@@ -29,10 +29,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  *
  *****************************************************************************/
 
-#ifndef MAX_PATH
-	#define MAX_PATH			MAX_QPATH
-#endif
-
 #ifndef PATH_SEPERATORSTR
 	#if defined(WIN32)|defined(_WIN32)|defined(__NT__)|defined(__WINDOWS__)|defined(__WINDOWS_386__)
 		#define PATHSEPERATOR_STR		"\\"
diff --git a/code/botlib/l_script.c b/code/botlib/l_script.c
index 2369438..c1c3266 100644
--- a/code/botlib/l_script.c
+++ b/code/botlib/l_script.c
@@ -160,9 +160,7 @@ punctuation_t default_punctuations[] =
 	{NULL, 0}
 };
 
-#ifdef BSPC
-char basefolder[MAX_PATH];
-#else
+#ifdef BOTLIB
 char basefolder[MAX_QPATH];
 #endif
 
@@ -1441,9 +1439,7 @@ void FreeScript(script_t *script)
 //============================================================================
 void PS_SetBaseFolder(char *path)
 {
-#ifdef BSPC
-	sprintf(basefolder, path);
-#else
+#ifdef BOTLIB
 	Com_sprintf(basefolder, sizeof(basefolder), "%s", path);
 #endif
 } //end of the function PS_SetBaseFolder
diff --git a/code/botlib/l_utils.h b/code/botlib/l_utils.h
index 6944d06..0c7e6fa 100644
--- a/code/botlib/l_utils.h
+++ b/code/botlib/l_utils.h
@@ -30,8 +30,5 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  *****************************************************************************/
 
 #define Vector2Angles(v,a)		vectoangles(v,a)
-#ifndef MAX_PATH
-#define MAX_PATH				MAX_QPATH
-#endif
 #define Maximum(x,y)			(x > y ? x : y)
 #define Minimum(x,y)			(x < y ? x : y)
diff --git a/code/game/ai_main.c b/code/game/ai_main.c
index 907a161..4b350d0 100644
--- a/code/game/ai_main.c
+++ b/code/game/ai_main.c
@@ -55,10 +55,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "inv.h"
 #include "syn.h"
 
-#ifndef MAX_PATH
-#define MAX_PATH		144
-#endif
-
 
 //bot states
 bot_state_t	*botstates[MAX_CLIENTS];
@@ -1174,7 +1170,7 @@ BotAISetupClient
 ==============
 */
 int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean restart) {
-	char filename[MAX_PATH], name[MAX_PATH], gender[MAX_PATH];
+	char filename[144], name[144], gender[144];
 	bot_state_t *bs;
 	int errnum;
 
@@ -1206,7 +1202,7 @@ int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean resta
 	//allocate a goal state
 	bs->gs = trap_BotAllocGoalState(client);
 	//load the item weights
-	trap_Characteristic_String(bs->character, CHARACTERISTIC_ITEMWEIGHTS, filename, MAX_PATH);
+	trap_Characteristic_String(bs->character, CHARACTERISTIC_ITEMWEIGHTS, filename, sizeof(filename));
 	errnum = trap_BotLoadItemWeights(bs->gs, filename);
 	if (errnum != BLERR_NOERROR) {
 		trap_BotFreeGoalState(bs->gs);
@@ -1215,7 +1211,7 @@ int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean resta
 	//allocate a weapon state
 	bs->ws = trap_BotAllocWeaponState();
 	//load the weapon weights
-	trap_Characteristic_String(bs->character, CHARACTERISTIC_WEAPONWEIGHTS, filename, MAX_PATH);
+	trap_Characteristic_String(bs->character, CHARACTERISTIC_WEAPONWEIGHTS, filename, sizeof(filename));
 	errnum = trap_BotLoadWeaponWeights(bs->ws, filename);
 	if (errnum != BLERR_NOERROR) {
 		trap_BotFreeGoalState(bs->gs);
@@ -1225,8 +1221,8 @@ int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean resta
 	//allocate a chat state
 	bs->cs = trap_BotAllocChatState();
 	//load the chat file
-	trap_Characteristic_String(bs->character, CHARACTERISTIC_CHAT_FILE, filename, MAX_PATH);
-	trap_Characteristic_String(bs->character, CHARACTERISTIC_CHAT_NAME, name, MAX_PATH);
+	trap_Characteristic_String(bs->character, CHARACTERISTIC_CHAT_FILE, filename, sizeof(filename));
+	trap_Characteristic_String(bs->character, CHARACTERISTIC_CHAT_NAME, name, sizeof(name));
 	errnum = trap_BotLoadChatFile(bs->cs, filename, name);
 	if (errnum != BLERR_NOERROR) {
 		trap_BotFreeChatState(bs->cs);
@@ -1235,7 +1231,7 @@ int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean resta
 		return qfalse;
 	}
 	//get the gender characteristic
-	trap_Characteristic_String(bs->character, CHARACTERISTIC_GENDER, gender, MAX_PATH);
+	trap_Characteristic_String(bs->character, CHARACTERISTIC_GENDER, gender, sizeof(gender));
 	//set the chat gender
 	if (*gender == 'f' || *gender == 'F') trap_BotSetChatGender(bs->cs, CHAT_GENDERFEMALE);
 	else if (*gender == 'm' || *gender == 'M') trap_BotSetChatGender(bs->cs, CHAT_GENDERMALE);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git



More information about the Pkg-games-commits mailing list