From: TimePath Date: Mon, 28 Dec 2015 07:45:03 +0000 (+1100) Subject: s/make_pure/new_pure/ X-Git-Tag: xonotic-v0.8.2~1378 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2489e43ce71c67339a9eb359a20074083d0760d7;p=xonotic%2Fxonotic-data.pk3dir.git s/make_pure/new_pure/ --- diff --git a/qcsrc/client/hud/hud.qh b/qcsrc/client/hud/hud.qh index 0526fccc2..7baed9e91 100644 --- a/qcsrc/client/hud/hud.qh +++ b/qcsrc/client/hud/hud.qh @@ -12,8 +12,7 @@ REGISTER_REGISTRY(hud_panels) #define REGISTER_HUD_PANEL(id, draw_func, name, configflags, showflags) \ void draw_func(); \ - REGISTER(hud_panels, HUD_PANEL, id, m_id, new(hud_panel)) { \ - make_pure(this); \ + REGISTER(hud_panels, HUD_PANEL, id, m_id, new_pure(hud_panel)) { \ this.panel_id = this.m_id; \ this.panel_draw = draw_func; \ this.panel_name = #name; \ diff --git a/qcsrc/common/deathtypes/all.qh b/qcsrc/common/deathtypes/all.qh index 14304992a..b662b7e76 100644 --- a/qcsrc/common/deathtypes/all.qh +++ b/qcsrc/common/deathtypes/all.qh @@ -15,8 +15,7 @@ REGISTRY_CHECK(Deathtypes) int dt_identity(int i) { return i; } #define REGISTER_DEATHTYPE(id, msg_death, msg_death_by, extra) \ - REGISTER(Deathtypes, DEATH, id, m_id, new(deathtype)) { \ - make_pure(this); \ + REGISTER(Deathtypes, DEATH, id, m_id, new_pure(deathtype)) { \ this.m_id += DT_FIRST; \ this.nent_name = #id; \ this.death_msgextra = extra; \ diff --git a/qcsrc/common/effects/effect.qh b/qcsrc/common/effects/effect.qh index 0ae9b4893..e58d42ca7 100644 --- a/qcsrc/common/effects/effect.qh +++ b/qcsrc/common/effects/effect.qh @@ -27,8 +27,7 @@ entity Create_Effect_Entity(string eff_name, bool eff_trail) { - entity this = new(effect_entity); - make_pure(this); + entity this = new_pure(effect_entity); this.eent_eff_name = eff_name; this.eent_eff_trail = eff_trail; return this; diff --git a/qcsrc/common/effects/qc/globalsound.qh b/qcsrc/common/effects/qc/globalsound.qh index 1708f912e..1c2aa6461 100644 --- a/qcsrc/common/effects/qc/globalsound.qh +++ b/qcsrc/common/effects/qc/globalsound.qh @@ -10,9 +10,8 @@ REGISTRY(PlayerSounds, BITS(8) - 1) #define PlayerSounds_from(i) _PlayerSounds_from(i, NULL) #define REGISTER_PLAYERSOUND(id) \ .string _playersound_##id; \ - REGISTER(PlayerSounds, playersound, id, m_id, new(PlayerSound)) \ + REGISTER(PlayerSounds, playersound, id, m_id, new_pure(PlayerSound)) \ { \ - make_pure(this); \ this.m_playersoundstr = #id; \ this.m_playersoundfld = _playersound_##id; \ } @@ -41,9 +40,8 @@ REGISTER_PLAYERSOUND(pain75) .int m_playersoundvt; #define REGISTER_VOICEMSG(id, vt) \ .string _playersound_##id; \ - REGISTER(PlayerSounds, playersound, id, m_id, new(VoiceMessage)) \ + REGISTER(PlayerSounds, playersound, id, m_id, new_pure(VoiceMessage)) \ { \ - make_pure(this); \ this.instanceOfVoiceMessage = true; \ this.m_playersoundstr = #id; \ this.m_playersoundfld = _playersound_##id; \ @@ -86,9 +84,8 @@ REGISTER_VOICEMSG(teamshoot, VOICETYPE_LASTATTACKER) REGISTRY(GlobalSounds, BITS(8) - 1) #define GlobalSounds_from(i) _GlobalSounds_from(i, NULL) #define REGISTER_GLOBALSOUND(id, str) \ - REGISTER(GlobalSounds, GS, id, m_id, new(GlobalSound)) \ + REGISTER(GlobalSounds, GS, id, m_id, new_pure(GlobalSound)) \ { \ - make_pure(this); \ this.m_globalsoundstr = str; \ } REGISTER_REGISTRY(GlobalSounds) diff --git a/qcsrc/common/impulses/all.qh b/qcsrc/common/impulses/all.qh index 7f277b63b..433f2318d 100644 --- a/qcsrc/common/impulses/all.qh +++ b/qcsrc/common/impulses/all.qh @@ -20,9 +20,8 @@ REGISTRY_CHECK(IMPULSES) #define REGISTER_IMPULSE(id, n) _REGISTER_IMPULSE(IMP_##id, id, n) #define _REGISTER_IMPULSE(id, alias, n) \ - REGISTER(IMPULSES, id, m_id, new(Impulse)) \ + REGISTER(IMPULSES, id, m_id, new_pure(Impulse)) \ { \ - make_pure(this); \ this.impulse = n; \ IMPULSE_ALIAS(alias, "impulse " #n); \ } @@ -205,9 +204,8 @@ LEGACY_IMPULSE(g_waypointeditor_unreachable, 107, "navwaypoint_unreachable") #define CHIMPULSE(id, n) _CHIMPULSE(CHIMPULSE_##id, n) #define _CHIMPULSE(id, n) \ - REGISTER(IMPULSES, id, m_id, new(Impulse)) \ + REGISTER(IMPULSES, id, m_id, new_pure(Impulse)) \ { \ - make_pure(this); \ this.impulse = n; \ } diff --git a/qcsrc/common/minigames/cl_minigames.qh b/qcsrc/common/minigames/cl_minigames.qh index 3f10e89e9..a97cabbf9 100644 --- a/qcsrc/common/minigames/cl_minigames.qh +++ b/qcsrc/common/minigames/cl_minigames.qh @@ -116,7 +116,7 @@ REGISTRY(Minigames, BITS(4)) REGISTER_REGISTRY(Minigames) REGISTRY_CHECK(Minigames) #define REGISTER_MINIGAME(name,nicename) \ - REGISTER(Minigames, MINIGAME_##name, m_id, new(minigame_descriptor)); \ + REGISTER(Minigames, MINIGAME_##name, m_id, new_pure(minigame_descriptor)); \ void name##_hud_board(vector, vector); \ void name##_hud_status(vector, vector); \ int name##_client_event(entity, string, ...); \ diff --git a/qcsrc/common/minigames/sv_minigames.qh b/qcsrc/common/minigames/sv_minigames.qh index 2a8496932..cde614416 100644 --- a/qcsrc/common/minigames/sv_minigames.qh +++ b/qcsrc/common/minigames/sv_minigames.qh @@ -51,7 +51,7 @@ REGISTRY(Minigames, BITS(4)) REGISTER_REGISTRY(Minigames) REGISTRY_CHECK(Minigames) #define REGISTER_MINIGAME(name,nicename) \ - REGISTER(Minigames, MINIGAME_##name, m_id, new(minigame_descriptor)); \ + REGISTER(Minigames, MINIGAME_##name, m_id, new_pure(minigame_descriptor)); \ int name##_server_event(entity, string, ...); \ REGISTER_INIT_POST(MINIGAME_##name) { \ make_pure(this); \ diff --git a/qcsrc/common/mutators/mutator/waypoints/all.qh b/qcsrc/common/mutators/mutator/waypoints/all.qh index 9693d2809..17a103dd4 100644 --- a/qcsrc/common/mutators/mutator/waypoints/all.qh +++ b/qcsrc/common/mutators/mutator/waypoints/all.qh @@ -34,7 +34,7 @@ REGISTER_REGISTRY(RadarIcons) REGISTRY_CHECK(RadarIcons) .int m_radaricon; -#define REGISTER_RADARICON(id, num) REGISTER(RadarIcons, RADARICON, id, m_id, new(RadarIcon)) { make_pure(this); this.m_radaricon = num; this.netname = #id; } +#define REGISTER_RADARICON(id, num) REGISTER(RadarIcons, RADARICON, id, m_id, new_pure(RadarIcon)) { this.m_radaricon = num; this.netname = #id; } REGISTER_WAYPOINT(Null, "", '0 0 0', 1); diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index 2343206ca..6181edcec 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -523,8 +523,7 @@ void Create_Notification_Entity( // ===================== // Global Entity Setup // ===================== - entity notif = spawn(); - make_pure(notif); + entity notif = new_pure(notification); switch(typeId) { case MSG_ANNCE: diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.qh index 954c55473..742607177 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.qh @@ -205,8 +205,7 @@ X(reload_time, float) noref entity b = this.baseline; \ if (!b) \ { \ - b = this.baseline = new(baseline); \ - make_pure(b); \ + b = this.baseline = new_pure(baseline); \ b.baseline_target = this; \ } #ifdef SVQC diff --git a/qcsrc/lib/arraylist.qh b/qcsrc/lib/arraylist.qh index 1209ef5af..f9df9e6bf 100644 --- a/qcsrc/lib/arraylist.qh +++ b/qcsrc/lib/arraylist.qh @@ -8,8 +8,7 @@ typedef entity ArrayList; #define AL_NEW(this, n, default, T) \ MACRO_BEGIN \ { \ - ArrayList _al = this = new(ArrayList); \ - make_pure(_al); \ + ArrayList _al = this = new_pure(ArrayList); \ _al.al_buf = buf_create(); \ for (int i = 0, _n = _al.al_len = n; i < _n; ++i) \ { \ diff --git a/qcsrc/lib/oo.qh b/qcsrc/lib/oo.qh index 2f871ccf1..a2cc17e23 100644 --- a/qcsrc/lib/oo.qh +++ b/qcsrc/lib/oo.qh @@ -31,9 +31,20 @@ .string sourceLocFile; .int sourceLocLine; entity _spawn(); + +#ifndef SPAWN_PURE +#define SPAWN_PURE 0 +#endif + +#if SPAWN_PURE +entity spawn_pure() = #600; +#else +#define spawn_pure() _spawn() +#endif + entity __spawn(string _classname, string _sourceFile, int _sourceLine, bool pure) { - entity this = _spawn(); + entity this = pure ? spawn_pure() : _spawn(); this.classname = _classname; this.sourceLocFile = _sourceFile; this.sourceLocLine = _sourceLine; diff --git a/qcsrc/lib/registry.qh b/qcsrc/lib/registry.qh index 037cfe193..344ee83fb 100644 --- a/qcsrc/lib/registry.qh +++ b/qcsrc/lib/registry.qh @@ -81,8 +81,7 @@ REGISTRY(Registries, BITS(8)) } MACRO_END #define REGISTRY_RESERVE(registry, fld, id, suffix) MACRO_BEGIN { \ - entity e = new(registry_reserved); \ - make_pure(e); \ + entity e = new_pure(registry_reserved); \ e.registered_id = #id "/" #suffix; \ REGISTRY_PUSH(registry, fld, e); \ } MACRO_END diff --git a/qcsrc/lib/stats.qh b/qcsrc/lib/stats.qh index 22aff1b63..7e0dec5b2 100644 --- a/qcsrc/lib/stats.qh +++ b/qcsrc/lib/stats.qh @@ -27,9 +27,8 @@ typedef vector vectori; #define REGISTER_STAT_2(id, T) \ T _STAT(id); \ T CAT(_STAT(id), _prev); \ - REGISTER(Stats, STAT_##id, m_id, new(stat)) \ + REGISTER(Stats, STAT_##id, m_id, new_pure(stat)) \ { \ - make_pure(this); \ if (#T == "vector" || #T == "vectori") { \ REGISTRY_RESERVE(Stats, m_id, STAT_##id, y); \ REGISTRY_RESERVE(Stats, m_id, STAT_##id, z); \ @@ -77,9 +76,8 @@ typedef vector vectori; #define _STAT(id) stat_##id #define REGISTER_STAT_2(id, T) \ .T _STAT(id); \ - REGISTER(Stats, STAT_##id, m_id, new(stat)) \ + REGISTER(Stats, STAT_##id, m_id, new_pure(stat)) \ { \ - make_pure(this); \ if (#T == "vector" || #T == "vectori") { \ REGISTRY_RESERVE(Stats, m_id, STAT_##id, y); \ REGISTRY_RESERVE(Stats, m_id, STAT_##id, z); \