#undef error
#undef movetogoal
#undef objerror
+#undef remove
#undef walkmove
#ifdef MENUQC
#define error builtin_error
#define movetogoal builtin_movetogoal
#define objerror builtin_objerror
+#define remove builtin_remove
#define walkmove builtin_walkmove
#include "matrix/_mod.inc"
+#ifndef SVQC
+#define objerror_safe(e)
+#else
+void make_safe_for_remove(entity this);
+ #define objerror_safe(e) make_safe_for_remove(e)
+#endif
+
+#define objerror(this, msg) MACRO_BEGIN { \
+ LOG_WARNING("======OBJECT ERROR======"); \
+ entity _e = (this); \
+ eprint(_e); \
+ objerror_safe(_e); \
+ delete(_e); \
+ LOG_WARNINGF("%s OBJECT ERROR in %s:\n%s\nTip: read above for entity information", PROGNAME, __FUNC__, msg); \
+} MACRO_END
+
#ifdef MENUQC
void _m_init();
void m_init() { if (_m_init) _m_init(); }
} MACRO_END
// TODO: this sucks, lets find a better way to do backtraces?
-#ifdef SVQC
- void builtin_remove(entity);
- #define _backtrace() builtin_remove(NULL)
-#else
- void remove(entity);
- #define _backtrace() remove(NULL)
-#endif
+#define _backtrace() builtin_remove(NULL)
noref int autocvar_developer;
noref bool autocvar_prvm_backtraceforwarnings;
[[accumulate]] void ONREMOVE(entity this) {}
+#ifndef SVQC
+ #define delete_fn builtin_remove
+#endif
+
#define delete(this) MACRO_BEGIN { \
entity _this = (this); \
void(entity) _dtor = _this.dtor; \
ONREMOVE(this); \
- if (_dtor) _dtor(_this); else remove(_this); \
+ if (_dtor) _dtor(_this); else delete_fn(_this); \
/* this = NULL; */ \
} MACRO_END
#define spawn_1(this)
#define _vtbl NULL
CLASS(Object, );
- DESTRUCTOR(Object) { remove(this); }
+ DESTRUCTOR(Object) { builtin_remove(this); }
#define remove(this) delete(this)
METHOD(Object, describe, string(Object this))
{
#endif
#define error(...) (__self = (NULL), builtin_error(__VA_ARGS__))
#define movetogoal(e, ...) (__self = (e), builtin_movetogoal(__VA_ARGS__))
-#ifndef SVQC
- #define objerror(e, ...) (__self = (e), builtin_objerror(__VA_ARGS__))
-#else
- void make_safe_for_remove(entity this);
- #define objerror(e, ...) (__self = (e), make_safe_for_remove(__self), builtin_objerror(__VA_ARGS__))
-#endif
#define walkmove(e, ...) (__self = (e), builtin_walkmove(__VA_ARGS__))
#ifndef MENUQC
cvar_string = cvar_string_normal;
cvar_set = cvar_set_normal;
- remove = remove_unsafely;
+ delete_fn = remove_unsafely;
entity e = spawn();
setthink(e, GotoFirstMap);
error("world already spawned - you may have EXACTLY ONE worldspawn!");
world_already_spawned = true;
- remove = remove_safely; // during spawning, watch what you remove!
+ delete_fn = remove_safely; // during spawning, watch what you remove!
cvar_changes_init(); // do this very early now so it REALLY matches the server config
{
entity startoflist = initialize_entity_first;
initialize_entity_first = NULL;
- remove = remove_except_protected;
+ delete_fn = remove_except_protected;
for (entity e = startoflist; e; e = e.initialize_entity_next)
{
e.remove_except_protected_forbidden = 1;
}
e = next;
}
- remove = remove_unsafely;
+ delete_fn = remove_unsafely;
}
.float(entity) isEliminated;
execute_next_frame();
if (autocvar_sv_autopause && !server_is_dedicated) Pause_TryPause(true);
- remove = remove_unsafely; // not during spawning!
+ delete_fn = remove_unsafely; // not during spawning!
serverprevtime = servertime;
servertime = time;
serverframetime = frametime;
var float(string name) cvar;
var string(string name) cvar_string;
var void(string name, string value) cvar_set;
-var void remove(entity e);
+var void delete_fn(entity e);
#undef IT_SHOTGUN
#undef IT_SUPER_SHOTGUN
#pragma once
#define droptofloor builtin_droptofloor
-#define remove builtin_remove
#define cvar_set builtin_cvar_set
#define cvar_string builtin_cvar_string
#define cvar builtin_cvar