Skip to content

Commit 2780edb

Browse files
committed
const qualify killed() and its dependencies
1 parent 180062d commit 2780edb

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

game/game.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ namespace game
551551

552552
VARP(teamcolorfrags, 0, 1, 1);
553553

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

859-
bool duplicatename(gameent *d, const char *name = nullptr, const char *alt = nullptr)
859+
bool duplicatename(const gameent *d, const char *name = nullptr, const char *alt = nullptr)
860860
{
861861
if(!name)
862862
{
@@ -876,7 +876,7 @@ namespace game
876876
return false;
877877
}
878878

879-
const char *colorname(gameent *d, const char *name, const char * alt, const char *color)
879+
const char *colorname(const gameent *d, const char *name, const char * alt, const char *color)
880880
{
881881
if(!name)
882882
{
@@ -896,7 +896,7 @@ namespace game
896896

897897
VARP(teamcolortext, 0, 1, 1);
898898

899-
const char *teamcolorname(gameent *d, const char *alt)
899+
const char *teamcolorname(const gameent *d, const char *alt)
900900
{
901901
if(!teamcolortext || modecheck(gamemode, Mode_Team) || !validteam(d->team) || d->state == ClientState_Spectator)
902902
{

game/game.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -947,8 +947,8 @@ namespace game
947947
extern void edittrigger(const selinfo &sel, int op, int arg1 = 0, int arg2 = 0, int arg3 = 0, const VSlot *vs = nullptr);
948948
extern gameent *getclient(int cn);
949949
extern gameent *newclient(int cn);
950-
extern const char *colorname(gameent *d, const char *name = nullptr, const char *alt = nullptr, const char *color = "");
951-
extern const char *teamcolorname(gameent *d, const char *alt = "you");
950+
extern const char *colorname(const gameent *d, const char *name = nullptr, const char *alt = nullptr, const char *color = "");
951+
extern const char *teamcolorname(const gameent *d, const char *alt = "you");
952952
extern const char *teamcolor(const char *prefix, const char *suffix, int team, const char *alt);
953953
extern void teamsound(bool sameteam, int n, const vec *loc = nullptr);
954954
extern void teamsound(gameent *d, int n, const vec *loc = nullptr);
@@ -964,7 +964,7 @@ namespace game
964964
extern void spawnplayer(gameent *);
965965
extern void deathstate(gameent *d, bool restore = false);
966966
extern void damaged(int damage, gameent *d, gameent *actor, bool local = true);
967-
extern void killed(gameent *d, gameent *actor);
967+
extern void killed(gameent *d, const gameent *actor);
968968
extern void timeupdate(int timeremain);
969969
extern void msgsound(int n, physent *d = nullptr);
970970
extern void drawicon(int icon, float x, float y, float sz = 120);

game/gameclient.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,7 @@ namespace game
12851285
}
12861286

12871287
VARP(teamcolorchat, 0, 1, 1);
1288-
const char *chatcolorname(gameent *d)
1288+
const char *chatcolorname(const gameent *d)
12891289
{
12901290
return teamcolorchat ? teamcolorname(d, nullptr) : colorname(d);
12911291
}
@@ -1861,7 +1861,7 @@ namespace game
18611861
case NetMsg_SayTeam:
18621862
{
18631863
int tcn = getint(p);
1864-
gameent *t = getclient(tcn);
1864+
const gameent *t = getclient(tcn);
18651865
getstring(text, p);
18661866
filtertext(text, text, true, true);
18671867
if(!t || isignored(t->clientnum))

0 commit comments

Comments
 (0)