Don't redefine MAX_PATH in bot code

This commit is contained in:
Zack Middleton 2017-10-04 22:13:41 -05:00
parent 39b0702550
commit 815c898bf5
8 changed files with 14 additions and 30 deletions

View file

@ -220,10 +220,9 @@ void AAS_ProjectPointOntoVector( vec3_t point, vec3_t vStart, vec3_t vEnd, vec3_
int AAS_LoadFiles(const char *mapname) int AAS_LoadFiles(const char *mapname)
{ {
int errnum; int errnum;
char aasfile[MAX_PATH]; char aasfile[MAX_QPATH];
// char bspfile[MAX_PATH];
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 //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 // the AAS link heap and BSP link heap are reset after respectively the
// AAS file and BSP file are loaded // AAS file and BSP file are loaded
@ -232,7 +231,7 @@ int AAS_LoadFiles(const char *mapname)
AAS_LoadBSPFile(); AAS_LoadBSPFile();
//load the aas file //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); errnum = AAS_LoadAASFile(aasfile);
if (errnum != BLERR_NOERROR) if (errnum != BLERR_NOERROR)
return errnum; return errnum;

View file

@ -268,7 +268,7 @@ itemconfig_t *LoadItemConfig(char *filename)
{ {
int max_iteminfo; int max_iteminfo;
token_t token; token_t token;
char path[MAX_PATH]; char path[MAX_QPATH];
source_t *source; source_t *source;
itemconfig_t *ic; itemconfig_t *ic;
iteminfo_t *ii; iteminfo_t *ii;

View file

@ -199,7 +199,7 @@ weaponconfig_t *LoadWeaponConfig(char *filename)
{ {
int max_weaponinfo, max_projectileinfo; int max_weaponinfo, max_projectileinfo;
token_t token; token_t token;
char path[MAX_PATH]; char path[MAX_QPATH];
int i, j; int i, j;
source_t *source; source_t *source;
weaponconfig_t *wc; weaponconfig_t *wc;

View file

@ -971,7 +971,7 @@ int PC_Directive_include(source_t *source)
{ {
script_t *script; script_t *script;
token_t token; token_t token;
char path[MAX_PATH]; char path[MAX_QPATH];
#ifdef QUAKE #ifdef QUAKE
foundfile_t file; foundfile_t file;
#endif //QUAKE #endif //QUAKE

View file

@ -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 #ifndef PATH_SEPERATORSTR
#if defined(WIN32)|defined(_WIN32)|defined(__NT__)|defined(__WINDOWS__)|defined(__WINDOWS_386__) #if defined(WIN32)|defined(_WIN32)|defined(__NT__)|defined(__WINDOWS__)|defined(__WINDOWS_386__)
#define PATHSEPERATOR_STR "\\" #define PATHSEPERATOR_STR "\\"

View file

@ -160,9 +160,7 @@ punctuation_t default_punctuations[] =
{NULL, 0} {NULL, 0}
}; };
#ifdef BSPC #ifdef BOTLIB
char basefolder[MAX_PATH];
#else
char basefolder[MAX_QPATH]; char basefolder[MAX_QPATH];
#endif #endif
@ -1441,9 +1439,7 @@ void FreeScript(script_t *script)
//============================================================================ //============================================================================
void PS_SetBaseFolder(char *path) void PS_SetBaseFolder(char *path)
{ {
#ifdef BSPC #ifdef BOTLIB
sprintf(basefolder, path);
#else
Com_sprintf(basefolder, sizeof(basefolder), "%s", path); Com_sprintf(basefolder, sizeof(basefolder), "%s", path);
#endif #endif
} //end of the function PS_SetBaseFolder } //end of the function PS_SetBaseFolder

View file

@ -30,8 +30,5 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/ *****************************************************************************/
#define Vector2Angles(v,a) vectoangles(v,a) #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 Maximum(x,y) (x > y ? x : y)
#define Minimum(x,y) (x < y ? x : y) #define Minimum(x,y) (x < y ? x : y)

View file

@ -55,10 +55,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "inv.h" #include "inv.h"
#include "syn.h" #include "syn.h"
#ifndef MAX_PATH
#define MAX_PATH 144
#endif
//bot states //bot states
bot_state_t *botstates[MAX_CLIENTS]; bot_state_t *botstates[MAX_CLIENTS];
@ -1174,7 +1170,7 @@ BotAISetupClient
============== ==============
*/ */
int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean restart) { 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; bot_state_t *bs;
int errnum; int errnum;
@ -1206,7 +1202,7 @@ int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean resta
//allocate a goal state //allocate a goal state
bs->gs = trap_BotAllocGoalState(client); bs->gs = trap_BotAllocGoalState(client);
//load the item weights //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); errnum = trap_BotLoadItemWeights(bs->gs, filename);
if (errnum != BLERR_NOERROR) { if (errnum != BLERR_NOERROR) {
trap_BotFreeGoalState(bs->gs); trap_BotFreeGoalState(bs->gs);
@ -1215,7 +1211,7 @@ int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean resta
//allocate a weapon state //allocate a weapon state
bs->ws = trap_BotAllocWeaponState(); bs->ws = trap_BotAllocWeaponState();
//load the weapon weights //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); errnum = trap_BotLoadWeaponWeights(bs->ws, filename);
if (errnum != BLERR_NOERROR) { if (errnum != BLERR_NOERROR) {
trap_BotFreeGoalState(bs->gs); trap_BotFreeGoalState(bs->gs);
@ -1225,8 +1221,8 @@ int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean resta
//allocate a chat state //allocate a chat state
bs->cs = trap_BotAllocChatState(); bs->cs = trap_BotAllocChatState();
//load the chat file //load the chat file
trap_Characteristic_String(bs->character, CHARACTERISTIC_CHAT_FILE, filename, MAX_PATH); trap_Characteristic_String(bs->character, CHARACTERISTIC_CHAT_FILE, filename, sizeof(filename));
trap_Characteristic_String(bs->character, CHARACTERISTIC_CHAT_NAME, name, MAX_PATH); trap_Characteristic_String(bs->character, CHARACTERISTIC_CHAT_NAME, name, sizeof(name));
errnum = trap_BotLoadChatFile(bs->cs, filename, name); errnum = trap_BotLoadChatFile(bs->cs, filename, name);
if (errnum != BLERR_NOERROR) { if (errnum != BLERR_NOERROR) {
trap_BotFreeChatState(bs->cs); trap_BotFreeChatState(bs->cs);
@ -1235,7 +1231,7 @@ int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean resta
return qfalse; return qfalse;
} }
//get the gender characteristic //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 //set the chat gender
if (*gender == 'f' || *gender == 'F') trap_BotSetChatGender(bs->cs, CHAT_GENDERFEMALE); if (*gender == 'f' || *gender == 'F') trap_BotSetChatGender(bs->cs, CHAT_GENDERFEMALE);
else if (*gender == 'm' || *gender == 'M') trap_BotSetChatGender(bs->cs, CHAT_GENDERMALE); else if (*gender == 'm' || *gender == 'M') trap_BotSetChatGender(bs->cs, CHAT_GENDERMALE);