From 6794689f122acf95658dd7378155b9dee5293921 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 13 Dec 2015 10:54:26 +1100 Subject: [PATCH] etof: avoid tempstring --- qcsrc/client/main.qc | 6 +++--- qcsrc/common/debug.qh | 4 ++-- qcsrc/common/effects/qc/gibs.qc | 4 ++-- qcsrc/common/minigames/cl_minigames.qc | 4 ++-- qcsrc/common/minigames/sv_minigames.qc | 14 +++++++------- qcsrc/common/movetypes/movetypes.qc | 4 ++-- qcsrc/common/sounds/all.qc | 2 +- qcsrc/common/triggers/target/music.qc | 2 +- qcsrc/common/triggers/target/spawn.qc | 2 +- .../common/vehicles/vehicle/bumblebee_weapons.qc | 2 +- qcsrc/common/weapons/weapon/shockwave.qc | 2 +- qcsrc/common/weapons/weapon/vaporizer.qc | 2 +- qcsrc/lib/misc.qh | 8 ++++++-- qcsrc/lib/unsafe.qh | 15 ++++++++++++++- qcsrc/server/_all.qh | 4 ++-- qcsrc/server/cheats.qc | 2 +- qcsrc/server/cl_client.qc | 8 ++++---- qcsrc/server/command/common.qc | 4 ++-- qcsrc/server/command/sv_cmd.qc | 4 ++-- qcsrc/server/command/vote.qc | 2 +- qcsrc/server/g_hook.qc | 2 +- qcsrc/server/miscfunctions.qc | 2 +- qcsrc/server/scores.qc | 4 ++-- qcsrc/server/spawnpoints.qc | 2 +- 24 files changed, 61 insertions(+), 44 deletions(-) diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 3ee92bd6f..8e9e14a3a 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -359,7 +359,7 @@ NET_HANDLE(ENT_CLIENT_SCORES, bool isnew) if(!isNew && n != this.sv_entnum) { //print("A CSQC entity changed its owner!\n"); - LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", num_for_edict(this), this.classname); + LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", etof(this), this.classname); isNew = true; Ent_Remove(); } @@ -738,7 +738,7 @@ void CSQC_Ent_Update(bool isnew) { if (t != this.enttype || isnew) { - LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", num_for_edict(this), this.entnum, this.enttype, t); + LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", etof(this), this.entnum, this.enttype, t); Ent_Remove(); clearentity(this); isnew = true; @@ -748,7 +748,7 @@ void CSQC_Ent_Update(bool isnew) { if (!isnew) { - LOG_INFOF("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", num_for_edict(this), this.entnum, t); + LOG_INFOF("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", etof(this), this.entnum, t); isnew = true; } } diff --git a/qcsrc/common/debug.qh b/qcsrc/common/debug.qh index c5345b32a..7470235f1 100644 --- a/qcsrc/common/debug.qh +++ b/qcsrc/common/debug.qh @@ -28,7 +28,7 @@ REGISTER_NET_TEMP(net_debug) int channel = MSG_ONE; msg_entity = to; WriteHeader(channel, net_debug); - WriteShort(channel, num_for_edict(this)); + WriteShort(channel, etof(this)); WriteByte(channel, is_pure(this)); WriteCoord(channel, this.origin.x); WriteCoord(channel, this.origin.y); @@ -71,7 +71,7 @@ bool autocvar_debugdraw; pos.z = 0; pos.y += ofs * size; drawcolorcodedstring2(pos, - sprintf("%d: '%s'@%s:%d", (e.debug ? e.sv_entnum : num_for_edict(e)), + sprintf("%d: '%s'@%s:%d", (e.debug ? e.sv_entnum : etof(e)), e.classname, e.sourceLocFile, e.sourceLocLine), size * '1 1 0', rgb, 0.5, DRAWFLAG_NORMAL); ++ofs; diff --git a/qcsrc/common/effects/qc/gibs.qc b/qcsrc/common/effects/qc/gibs.qc index 3c778b52b..19f47500e 100644 --- a/qcsrc/common/effects/qc/gibs.qc +++ b/qcsrc/common/effects/qc/gibs.qc @@ -34,9 +34,9 @@ void Violence_GibSplash_At(vector org, vector dir, float type, float amount, ent // if this is a copied dead body, send the num of its player instead // TODO: remove this field, read from model txt files if(self.classname == "body") - e.team = num_for_edict(self.enemy); + e.team = etof(self.enemy); else - e.team = num_for_edict(self); + e.team = etof(self); setorigin(e, org); e.velocity = dir; diff --git a/qcsrc/common/minigames/cl_minigames.qc b/qcsrc/common/minigames/cl_minigames.qc index a9f4a4f4c..ea5596f08 100644 --- a/qcsrc/common/minigames/cl_minigames.qc +++ b/qcsrc/common/minigames/cl_minigames.qc @@ -74,7 +74,7 @@ MINIGAME_SIMPLELINKED_ENTITIES void minigame_autoclean_entity(entity e) { - LOG_DEBUG("CL Auto-cleaned: ",ftos(num_for_edict(e)), " (",e.classname,")\n"); + LOG_DEBUG("CL Auto-cleaned: ",ftos(etof(e)), " (",e.classname,")\n"); remove(e); } @@ -235,7 +235,7 @@ NET_HANDLE(ENT_CLIENT_MINIGAME, bool isnew) if ( sf & MINIG_SF_CREATE ) { - LOG_DEBUG("CL Reading entity: ",ftos(num_for_edict(self)), + LOG_DEBUG("CL Reading entity: ",ftos(etof(self)), " classname:",self.classname," enttype:",ftos(self.enttype) ); LOG_DEBUG(" sf:",ftos(sf)," netname:",self.netname,"\n\n"); } diff --git a/qcsrc/common/minigames/sv_minigames.qc b/qcsrc/common/minigames/sv_minigames.qc index 672f7f0bd..ca111e6c8 100644 --- a/qcsrc/common/minigames/sv_minigames.qc +++ b/qcsrc/common/minigames/sv_minigames.qc @@ -25,7 +25,7 @@ void minigame_rmplayer(entity minigame_session, entity player) } minigame_session.minigame_event(minigame_session,"part",player); GameLogEcho(strcat(":minigame:part:",minigame_session.netname,":", - ftos(num_for_edict(player)),":",player.netname)); + ftos(etof(player)),":",player.netname)); minigame_session.minigame_players = p.list_next; remove ( p ); player_clear_minigame(player); @@ -38,7 +38,7 @@ void minigame_rmplayer(entity minigame_session, entity player) { minigame_session.minigame_event(minigame_session,"part",player); GameLogEcho(strcat(":minigame:part:",minigame_session.netname,":", - ftos(num_for_edict(player)),":",player.netname)); + ftos(etof(player)),":",player.netname)); p.list_next = e.list_next; remove(e); player_clear_minigame(player); @@ -86,7 +86,7 @@ bool minigame_SendEntity(entity this, entity to, int sf) if ( sf & MINIG_SF_CREATE ) { WriteString(MSG_ENTITY,self.owner.netname); - WriteLong(MSG_ENTITY,num_for_edict(self.minigame_players)); + WriteLong(MSG_ENTITY,etof(self.minigame_players)); } if ( sf & MINIG_SF_UPDATE ) WriteByte(MSG_ENTITY,self.team); @@ -155,7 +155,7 @@ int minigame_addplayer(entity minigame_session, entity player) } else { remove(player_pointer); } GameLogEcho(strcat(":minigame:join",(mgteam?"":"fail"),":",minigame_session.netname,":", - ftos(num_for_edict(player)),":",player.netname)); + ftos(etof(player)),":",player.netname)); return mgteam; } @@ -169,7 +169,7 @@ entity start_minigame(entity player, string minigame ) if ( e ) { entity minig = new(minigame); - minig.netname = strzone(strcat(e.netname,"_",ftos(num_for_edict(minig)))); + minig.netname = strzone(strcat(e.netname,"_",ftos(etof(minig)))); minig.descriptor = e; minig.minigame_event = e.minigame_event; minig.minigame_event(minig,"start"); @@ -235,7 +235,7 @@ void end_minigame(entity minigame_session) while( (e = findentity(e, owner, minigame_session)) ) if ( e.minigame_autoclean ) { - LOG_TRACE("SV Auto-cleaned: ",ftos(num_for_edict(e)), " (",e.classname,")\n"); + LOG_TRACE("SV Auto-cleaned: ",ftos(etof(e)), " (",e.classname,")\n"); remove(e); } @@ -274,7 +274,7 @@ string invite_minigame(entity inviter, entity player) inviter.active_minigame.netname, inviter.netname ); GameLogEcho(strcat(":minigame:invite:",inviter.active_minigame.netname,":", - ftos(num_for_edict(player)),":",player.netname)); + ftos(etof(player)),":",player.netname)); return ""; } diff --git a/qcsrc/common/movetypes/movetypes.qc b/qcsrc/common/movetypes/movetypes.qc index f6b52dae0..debe1a319 100644 --- a/qcsrc/common/movetypes/movetypes.qc +++ b/qcsrc/common/movetypes/movetypes.qc @@ -442,11 +442,11 @@ bool _Movetype_UnstickEntity(entity this) // SV_UnstickEntity if(!_Movetype_TestEntityPosition(this, '0 0 1' * i)) goto success; } LOG_DEBUG("Can't unstick an entity (edict: %d, classname: %s, origin: %s)\n", - num_for_edict(this), this.classname, vtos(this.move_origin)); + etof(this), this.classname, vtos(this.move_origin)); return false; : success; LOG_DEBUG("Sucessfully unstuck an entity (edict: %d, classname: %s, origin: %s)\n", - num_for_edict(this), this.classname, vtos(this.move_origin)); + etof(this), this.classname, vtos(this.move_origin)); _Movetype_LinkEdict(this, true); return true; } diff --git a/qcsrc/common/sounds/all.qc b/qcsrc/common/sounds/all.qc index 92c5ef059..0ec413c37 100644 --- a/qcsrc/common/sounds/all.qc +++ b/qcsrc/common/sounds/all.qc @@ -76,7 +76,7 @@ void soundat(entity e, vector o, int chan, string samp, float vol, float _atten) void stopsoundto(int _dest, entity e, int chan) { if (!sound_allowed(_dest, e)) return; - int entno = num_for_edict(e); + int entno = etof(e); if (entno >= 8192 || chan < 0 || chan > 7) { int idx = precache_sound_index(SND(Null)); diff --git a/qcsrc/common/triggers/target/music.qc b/qcsrc/common/triggers/target/music.qc index 7f97668c8..1d8864f2c 100644 --- a/qcsrc/common/triggers/target/music.qc +++ b/qcsrc/common/triggers/target/music.qc @@ -23,7 +23,7 @@ REGISTER_NET_LINKED(ENT_CLIENT_TRIGGER_MUSIC) void target_music_sendto(float to, float is) {SELFPARAM(); WriteHeader(to, TE_CSQC_TARGET_MUSIC); - WriteShort(to, num_for_edict(self)); + WriteShort(to, etof(self)); WriteByte(to, self.volume * 255.0 * is); WriteByte(to, self.fade_time * 16.0); WriteByte(to, self.fade_rate * 16.0); diff --git a/qcsrc/common/triggers/target/spawn.qc b/qcsrc/common/triggers/target/spawn.qc index b95837127..59737cb99 100644 --- a/qcsrc/common/triggers/target/spawn.qc +++ b/qcsrc/common/triggers/target/spawn.qc @@ -157,7 +157,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity if(valuefield == "") { if(value == "") - value = ftos(num_for_edict(valueent)); + value = ftos(etof(valueent)); } else { diff --git a/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc b/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc index 8ff604579..11ee8ebc7 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc @@ -37,7 +37,7 @@ bool bumble_raygun_send(entity this, entity to, float sf) WriteByte(MSG_ENTITY, sf); if(sf & BRG_SETUP) { - WriteByte(MSG_ENTITY, num_for_edict(self.realowner)); + WriteByte(MSG_ENTITY, etof(self.realowner)); WriteByte(MSG_ENTITY, self.realowner.team); WriteByte(MSG_ENTITY, self.cnt); } diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index bc1d768d2..fb5fbf4bb 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -352,7 +352,7 @@ void W_Shockwave_Send() WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance)); WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255)); WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255)); - WriteByte(MSG_BROADCAST, num_for_edict(self)); + WriteByte(MSG_BROADCAST, etof(self)); } void W_Shockwave_Attack() diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 529435d35..d3c47ee5f 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -75,7 +75,7 @@ void SendCSQCVaporizerBeamParticle(entity player, int hit) { WriteCoord(MSG_BROADCAST, v.y); WriteCoord(MSG_BROADCAST, v.z); WriteByte(MSG_BROADCAST, hit); - WriteByte(MSG_BROADCAST, num_for_edict(player)); + WriteByte(MSG_BROADCAST, etof(player)); WriteByte(MSG_BROADCAST, player.team); } #elif defined(CSQC) diff --git a/qcsrc/lib/misc.qh b/qcsrc/lib/misc.qh index 9ce52dfb5..589783ae9 100644 --- a/qcsrc/lib/misc.qh +++ b/qcsrc/lib/misc.qh @@ -33,9 +33,13 @@ // already defined #endif -#undef etof // avoid bounds checks -#define etof(e) stof(sprintf("%i", e)) +#undef etof +#if 1 + #define etof(e) ITOF(reinterpret_cast(int, e)) +#else + #define etof(e) stof(sprintf("%i", e)) +#endif #define GET(name) name##get #define GETTER(type, name) type GET(name)() { return name; } diff --git a/qcsrc/lib/unsafe.qh b/qcsrc/lib/unsafe.qh index f8fa38280..b218b660a 100644 --- a/qcsrc/lib/unsafe.qh +++ b/qcsrc/lib/unsafe.qh @@ -3,6 +3,8 @@ #define reinterpret_cast(T, it) _unsafe_cast_##T(0, it) #define X(T) T _unsafe_cast_##T(int dummy, ...) { return ...(0, T); } +X(bool) +X(int) X(float) X(entity) X(string) @@ -10,6 +12,17 @@ typedef float(...) rawfunc; X(rawfunc) #undef X -#define strid(s) etof(reinterpret_cast(entity, s)) +#define strid(s) ITOF(reinterpret_cast(int, s)) + +.int _unsafe_fld1, _unsafe_fld2; +int INTEGER_ONE; + +#define FTOI(f) ((f) * INTEGER_ONE) +#define ITOF(i) ((i) / INTEGER_ONE) + +STATIC_INIT(INTEGER_ONE) +{ + INTEGER_ONE = reinterpret_cast(int, _unsafe_fld2) - reinterpret_cast(int, _unsafe_fld1); +} #endif diff --git a/qcsrc/server/_all.qh b/qcsrc/server/_all.qh index a53ab2435..f277af62a 100644 --- a/qcsrc/server/_all.qh +++ b/qcsrc/server/_all.qh @@ -20,7 +20,7 @@ const string STR_OBSERVER = "observer"; #define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE) #define IS_TURRET(v) (v.turret_flags & TUR_FLAG_ISTURRET) -#define FOR_EACH_CLIENTSLOT(v) for (v = world; (v = nextent(v)) && (num_for_edict(v) <= maxclients); ) +#define FOR_EACH_CLIENTSLOT(v) for (v = world; (v = nextent(v)) && (etof(v) <= maxclients); ) #define FOR_EACH_CLIENT(v) FOR_EACH_CLIENTSLOT(v) if (IS_CLIENT(v)) #define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if (IS_REAL_CLIENT(v)) @@ -32,7 +32,7 @@ const string STR_OBSERVER = "observer"; #define FOREACH_CLIENT(cond, body) \ MACRO_BEGIN { \ int i = 0; \ - for (entity it = NULL; (it = nextent(it)) && (num_for_edict(it) <= maxclients); ++i) \ + for (entity it = NULL; (it = nextent(it)) && (etof(it) <= maxclients); ++i) \ { \ if (!IS_CLIENT(it)) continue; \ if (cond) { LAMBDA(body) } \ diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 996058f1d..7718f96fb 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -599,7 +599,7 @@ float CheatCommand(float argc) { if(vlen(oldself.origin - start) < vlen(e.origin - start)) ++effectnum; - else if(vlen(oldself.origin - start) == vlen(e.origin - start) && num_for_edict(oldself) < num_for_edict(e)) + else if(vlen(oldself.origin - start) == vlen(e.origin - start) && etof(oldself) < etof(e)) ++effectnum; } fputs(f, strcat("\"race_place\" \"", ftos(effectnum), "\"\n")); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 7a113d24a..d3d14a5cf 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -987,7 +987,7 @@ void ClientPreConnect () { GameLogEcho(sprintf(":connect:%d:%d:%s", self.playerid, - num_for_edict(self), + etof(self), ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot") )); } @@ -1122,7 +1122,7 @@ void ClientConnect () PlayerStats_GameReport_AddPlayer(self); if(autocvar_sv_eventlog) - GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":", ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot"), ":", self.netname)); + GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(etof(self)), ":", ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot"), ":", self.netname)); LogTeamchange(self.playerid, self.team, 1); @@ -2481,9 +2481,9 @@ void PlayerPreThink () float oldspectatee_status; oldspectatee_status = self.spectatee_status; if(IS_SPEC(self)) - self.spectatee_status = num_for_edict(self.enemy); + self.spectatee_status = etof(self.enemy); else if(IS_OBSERVER(self)) - self.spectatee_status = num_for_edict(self); + self.spectatee_status = etof(self); else self.spectatee_status = 0; if(self.spectatee_status != oldspectatee_status) diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index 69f0222cb..484ecb210 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -155,7 +155,7 @@ float GetFilteredNumber(string input) entity selection = GetFilteredEntity(input); float output; - output = num_for_edict(selection); + output = etof(selection); return output; } @@ -791,7 +791,7 @@ void CommonCommand_who(float request, entity caller, float argc) } print_to(caller, sprintf(strreplace(" ", separator, " #%-3d %-20.20s %-5d %-3d %-9s %-16s %s "), - num_for_edict(tmp_player), + etof(tmp_player), tmp_player.netname, tmp_player.ping, tmp_player.ping_packetloss, diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 38e6222d6..1cb379112 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -559,7 +559,7 @@ void GameCommand_defer_clear_all(float request) FOR_EACH_CLIENT(client) { - argc = tokenize_console(strcat("defer_clear ", ftos(num_for_edict(client)))); + argc = tokenize_console(strcat("defer_clear ", ftos(etof(client)))); GameCommand_defer_clear(CMD_REQUEST_COMMAND, argc); ++i; } @@ -1402,7 +1402,7 @@ void GameCommand_shuffleteams(float request) } else { - shuffleteams_players[i] = num_for_edict(tmp_player); + shuffleteams_players[i] = etof(tmp_player); break; } } diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index a023594a5..d1598e239 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -697,7 +697,7 @@ float VoteCommand_parse(entity caller, string vote_command, string vote_list, fl if (first_command == "kickban") command_arguments = strcat(ftos(autocvar_g_ban_default_bantime), " ", ftos(autocvar_g_ban_default_masksize), " ~"); else command_arguments = reason; - vote_parsed_command = strcat(first_command, " # ", ftos(num_for_edict(victim)), " ", command_arguments); + vote_parsed_command = strcat(first_command, " # ", ftos(etof(victim)), " ", command_arguments); vote_parsed_display = strcat("^1", vote_command, " (^7", victim.netname, "^1): ", reason); } else { print_to(caller, strcat("vcall: ", GetClientErrorString(accepted, argv(startpos + 1)), ".\n")); return false; } diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 360078d2a..06c49907b 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -113,7 +113,7 @@ bool GrapplingHookSend(entity this, entity to, int sf) WriteByte(MSG_ENTITY, sf); if(sf & 1) { - WriteByte(MSG_ENTITY, num_for_edict(self.realowner)); + WriteByte(MSG_ENTITY, etof(self.realowner)); } if(sf & 2) { diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index d5e41b947..7e8f4cfd3 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -1060,7 +1060,7 @@ float SUB_NoImpactCheck() if(trace_dphitcontents == 0) { //dprint("A hit happened with zero hit contents... DEBUG THIS, this should never happen for projectiles! Projectile will self-destruct.\n"); - LOG_TRACEF("A hit from a projectile happened with no hit contents! DEBUG THIS, this should never happen for projectiles! Profectile will self-destruct. (edict: %d, classname: %s, origin: %s)\n", num_for_edict(self), self.classname, vtos(self.origin)); + LOG_TRACEF("A hit from a projectile happened with no hit contents! DEBUG THIS, this should never happen for projectiles! Profectile will self-destruct. (edict: %d, classname: %s, origin: %s)\n", etof(self), self.classname, vtos(self.origin)); checkclient(); } if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 8b740ef88..e29d1723b 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -235,7 +235,7 @@ bool PlayerScore_SendEntity(entity this, entity to, float sendflags) float i, p, longflags; WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES); - WriteByte(MSG_ENTITY, num_for_edict(self.owner)); + WriteByte(MSG_ENTITY, etof(self.owner)); longflags = 0; for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2) @@ -383,7 +383,7 @@ float PlayerScore_Compare(entity t1, entity t2, float strict) } if (result.x == 0 && strict) - result.x = num_for_edict(t1.owner) - num_for_edict(t2.owner); + result.x = etof(t1.owner) - etof(t2.owner); return result.x; } diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 36b08008e..55662892a 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -30,7 +30,7 @@ bool SpawnEvent_Send(entity this, entity to, int sf) if(autocvar_g_spawn_alloweffects) { - WriteByte(MSG_ENTITY, num_for_edict(self.owner)); + WriteByte(MSG_ENTITY, etof(self.owner)); WriteShort(MSG_ENTITY, self.owner.origin.x); WriteShort(MSG_ENTITY, self.owner.origin.y); WriteShort(MSG_ENTITY, self.owner.origin.z); -- 2.39.2