Skip to content

Commit

Permalink
const qualify killed() and its dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Jul 2, 2024
1 parent 180062d commit 2780edb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ namespace game

VARP(teamcolorfrags, 0, 1, 1);

void killed(gameent *d, gameent *actor)
void killed(gameent *d, const gameent *actor)
{
vec dloc = d->o; //need to make a local copy of d->o because sub() is a destructive operation
int fragdist = static_cast<int>(dloc.sub(actor->o).magnitude()/8);
Expand Down Expand Up @@ -856,7 +856,7 @@ namespace game
}
}

bool duplicatename(gameent *d, const char *name = nullptr, const char *alt = nullptr)
bool duplicatename(const gameent *d, const char *name = nullptr, const char *alt = nullptr)
{
if(!name)
{
Expand All @@ -876,7 +876,7 @@ namespace game
return false;
}

const char *colorname(gameent *d, const char *name, const char * alt, const char *color)
const char *colorname(const gameent *d, const char *name, const char * alt, const char *color)
{
if(!name)
{
Expand All @@ -896,7 +896,7 @@ namespace game

VARP(teamcolortext, 0, 1, 1);

const char *teamcolorname(gameent *d, const char *alt)
const char *teamcolorname(const gameent *d, const char *alt)
{
if(!teamcolortext || modecheck(gamemode, Mode_Team) || !validteam(d->team) || d->state == ClientState_Spectator)
{
Expand Down
6 changes: 3 additions & 3 deletions game/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -947,8 +947,8 @@ namespace game
extern void edittrigger(const selinfo &sel, int op, int arg1 = 0, int arg2 = 0, int arg3 = 0, const VSlot *vs = nullptr);
extern gameent *getclient(int cn);
extern gameent *newclient(int cn);
extern const char *colorname(gameent *d, const char *name = nullptr, const char *alt = nullptr, const char *color = "");
extern const char *teamcolorname(gameent *d, const char *alt = "you");
extern const char *colorname(const gameent *d, const char *name = nullptr, const char *alt = nullptr, const char *color = "");
extern const char *teamcolorname(const gameent *d, const char *alt = "you");
extern const char *teamcolor(const char *prefix, const char *suffix, int team, const char *alt);
extern void teamsound(bool sameteam, int n, const vec *loc = nullptr);
extern void teamsound(gameent *d, int n, const vec *loc = nullptr);
Expand All @@ -964,7 +964,7 @@ namespace game
extern void spawnplayer(gameent *);
extern void deathstate(gameent *d, bool restore = false);
extern void damaged(int damage, gameent *d, gameent *actor, bool local = true);
extern void killed(gameent *d, gameent *actor);
extern void killed(gameent *d, const gameent *actor);
extern void timeupdate(int timeremain);
extern void msgsound(int n, physent *d = nullptr);
extern void drawicon(int icon, float x, float y, float sz = 120);
Expand Down
4 changes: 2 additions & 2 deletions game/gameclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ namespace game
}

VARP(teamcolorchat, 0, 1, 1);
const char *chatcolorname(gameent *d)
const char *chatcolorname(const gameent *d)
{
return teamcolorchat ? teamcolorname(d, nullptr) : colorname(d);
}
Expand Down Expand Up @@ -1861,7 +1861,7 @@ namespace game
case NetMsg_SayTeam:
{
int tcn = getint(p);
gameent *t = getclient(tcn);
const gameent *t = getclient(tcn);
getstring(text, p);
filtertext(text, text, true, true);
if(!t || isignored(t->clientnum))
Expand Down

0 comments on commit 2780edb

Please sign in to comment.