fix various issues

This commit is contained in:
Walter Julius Hennecke 2020-06-19 23:12:40 +02:00
parent 2e8d94e925
commit fbf9131d2c
13 changed files with 4393 additions and 4452 deletions

View file

@ -24,38 +24,40 @@
#include "be_ai_goal.h"
#include "be_ai_move.h"
#include "be_ai_weap.h"
//
#include "ai_main.h"
#include "ai_dmq3.h"
#include "ai_chat.h"
#include "ai_cmd.h"
#include "ai_dmnet.h"
//
#include "chars.h" //characteristics
#include "inv.h" //indexes into the inventory
#include "syn.h" //synonyms
#include "match.h" //string matching types and vars
#include <string>
#include <vector>
/*
==================
BotNumActivePlayers
==================
*/
int BotNumActivePlayers(void) {
int i, num;
char buf[MAX_INFO_STRING];
static int maxclis;
int BotNumActivePlayers() {
static int maxclis = 0;
if (!maxclis)
if (maxclis == 0) {
maxclis = trap_Cvar_VariableIntegerValue("sv_maxclients");
}
num = 0;
for (i = 0; i < maxclis && i < MAX_CLIENTS; i++) {
trap_GetConfigstring(CS_PLAYERS + i, buf, sizeof(buf));
auto num = 0;
for (auto i = 0; i < maxclis && i < MAX_CLIENTS; i++) {
auto config_string = trap_GetConfigstring(CS_PLAYERS + i, MAX_INFO_STRING);
//if no config string or no name
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
if (config_string.empty() || Info_ValueForKey(config_string, "n").empty()) { continue; }
//skip spectators
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue;
if (std::stoi(Info_ValueForKey(config_string, "t")) == TEAM_SPECTATOR) continue;
//
num++;
}

View file

@ -14,32 +14,35 @@
*
*****************************************************************************/
//
int BotChat_EnterGame(bot_state_t *bs);
//
int BotChat_ExitGame(bot_state_t *bs);
//
int BotChat_StartLevel(bot_state_t *bs);
//
int BotChat_EndLevel(bot_state_t *bs);
//
int BotChat_HitTalking(bot_state_t *bs);
//
int BotChat_HitNoDeath(bot_state_t *bs);
//
int BotChat_HitNoKill(bot_state_t *bs);
//
int BotChat_Death(bot_state_t *bs);
//
int BotChat_Kill(bot_state_t *bs);
//
int BotChat_EnemySuicide(bot_state_t *bs);
//
int BotChat_Random(bot_state_t *bs);
//! time the selected chat takes to type in
float BotChatTime(bot_state_t *bs);
//! returns true if the bot can chat at the current position
int BotValidChatPosition(bot_state_t *bs);
//! test the initial bot chats
void BotChatTest(bot_state_t *bs);

View file

@ -628,7 +628,7 @@ qboolean BotShouldDetonateDetPack(bot_state_t *bs) {
// find the location of the DetPack
gentity_t *detpack = NULL;
char *classname = BG_FindClassnameForHoldable(HI_DETPACK);
const char *classname = BG_FindClassnameForHoldable(HI_DETPACK);
if (!classname) {
return qfalse;

View file

@ -991,7 +991,7 @@ gitem_t *BG_FindItemWithClassname(const char *name)
* Finds the classname for a holdable.
* \return classname for holdable
*/
char *BG_FindClassnameForHoldable(holdable_t pw)
const char *BG_FindClassnameForHoldable(holdable_t pw)
{
gitem_t *item = BG_FindItemForHoldable(pw);
@ -999,7 +999,7 @@ char *BG_FindClassnameForHoldable(holdable_t pw)
{
return item->classname;
}
return NULL;
return nullptr;
}
/**

View file

@ -525,7 +525,7 @@ typedef enum {
* in the UI and actual command
*/
typedef struct {
char *consoleName; //!<item you gotz to plug into the console for this shizzie
const char *consoleName; //!<item you gotz to plug into the console for this shizzie
int giveType; //!<eNum depicting which type this val is
int giveValue; //!<items such as weapons+holdables reference to here
} giveItem_t;
@ -972,7 +972,7 @@ extern int bg_numEmotes; //TiM - added a counter variable since it'd be easier t
extern int bg_numGiveItems;
gitem_t *BG_FindItemWithClassname(const char *name);
char *BG_FindClassnameForHoldable(holdable_t pw);
const char *BG_FindClassnameForHoldable(holdable_t pw);
gitem_t *BG_FindItem(const char *pickupName/*const char *classname*/ );//RPG-X: RedTechie - Attempting to fix give cmd
gitem_t *BG_FindItemForWeapon(weapon_t weapon);
gitem_t *BG_FindItemForAmmo(weapon_t weapon);

File diff suppressed because it is too large Load diff

View file

@ -26,7 +26,7 @@ void UpdateTournamentInfo( void ) {
int mvpNum = -1, mvpPoints = 0, winningCaptures = 0, winningPoints = 0;
int winningTeam=0;
int loseCaptures = 0, losePoints = 0;
char *mvpName = "";
const char *mvpName = "";
gclient_t *cl = NULL;
gclient_t *cl2= NULL;
int secondPlaceTied=0;

File diff suppressed because it is too large Load diff

View file

@ -176,7 +176,7 @@ int weaponFromMOD[MOD_MAX] =
WP_0, // MOD_FORCEDSUICIDE
};
char *weaponNameFromIndex[WP_NUM_WEAPONS] =
const char *weaponNameFromIndex[WP_NUM_WEAPONS] =
{
"No Weapon",
"Phaser",

File diff suppressed because it is too large Load diff

View file

@ -122,7 +122,7 @@ int G_FindConfigstringIndex( const char *name, int start, int max, qboolean crea
return i;
}
int G_ModelIndex( char *name ) {
int G_ModelIndex( const char *name ) {
return G_FindConfigstringIndex (name, CS_MODELS, MAX_MODELS, qtrue);
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff