From 6998d3c10219961585216b306e4e5b7c7c2e8b54 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Mon, 31 Dec 2012 12:02:30 +0100 Subject: [PATCH] make it compile with gmqcc; strict function types YEAH --- qcsrc/Makefile | 3 +-- qcsrc/client/Main.qc | 4 ++-- qcsrc/common/util.qh | 5 +++++ qcsrc/server/command/common.qc | 4 ++-- qcsrc/server/command/vote.qc | 2 +- qcsrc/server/defs.qh | 2 +- qcsrc/server/miscfunctions.qc | 4 ++-- qcsrc/server/pathlib.qc | 4 ++-- qcsrc/server/pathlib/movenode.qc | 8 ++++---- qcsrc/server/pathlib/pathlib.qh | 6 +++--- qcsrc/server/t_plats.qc | 8 ++++++-- qcsrc/server/vehicles/racer.qc | 10 ++++++---- qcsrc/server/w_hagar.qc | 2 +- qcsrc/server/w_seeker.qc | 4 ++-- 14 files changed, 38 insertions(+), 28 deletions(-) diff --git a/qcsrc/Makefile b/qcsrc/Makefile index c6cc796ee..1ffb727a8 100644 --- a/qcsrc/Makefile +++ b/qcsrc/Makefile @@ -11,14 +11,13 @@ QCCFLAGS ?= \ -Werror -Wall \ -Wno-field-redeclared \ -Wno-double-declaration \ - -Wno-assign-function-types \ -Wno-unused-variable \ -Wno-uninitialized-global \ -O3 \ -fftepp \ -ftranslatable-strings \ -fadjust-vector-fields \ - -fassign-function-types \ + -fno-assign-function-types \ -fcorrect-ternary \ -fcorrect-logic \ -ftrue-empty-strings \ diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 77a979216..c389540fd 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -120,7 +120,7 @@ void CSQC_Init(void) draw_endBoldFont(); menu_visible = FALSE; menu_show = menu_show_error; - menu_action = menu_sub_null; + menu_action = func_null; for(i = 0; i < 255; ++i) if(getplayerkeyvalue(i, "viewentity") == "") @@ -398,7 +398,7 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary) if (MapVote_InputEvent(bInputType, nPrimary, nSecondary)) return true; - if(menu_visible) + if(menu_visible && menu_action) if(menu_action(bInputType, nPrimary, nSecondary)) return TRUE; diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 2bdaf1f1d..10e680e56 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -224,8 +224,13 @@ void WriteInt24_t(float dest, float val); #endif // the NULL function +#ifdef GMQCC +#define func_null nil +#define string_null nil +#else var void func_null(void); var string string_null; +#endif float float2range11(float f); float float2range01(float f); diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index eae71b045..53ad41d35 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -572,7 +572,7 @@ void CommonCommand_timeout(float request, entity caller) // DEAR GOD THIS COMMAN { if(caller) { caller.allowed_timeouts -= 1; } - bprint(GetCallerName(caller), " ^7called a timeout", (caller ? strcat(" (", ftos(caller.allowed_timeouts), " timeout(s) left)") : string_null), "!\n"); // write a bprint who started the timeout (and how many they have left) + bprint(GetCallerName(caller), " ^7called a timeout", (caller ? strcat(" (", ftos(caller.allowed_timeouts), " timeout(s) left)") : ""), "!\n"); // write a bprint who started the timeout (and how many they have left) timeout_status = TIMEOUT_LEADTIME; timeout_caller = caller; @@ -614,7 +614,7 @@ void CommonCommand_who(float request, entity caller, float argc) string separator = strreplace("%", " ", strcat((argv(1) ? argv(1) : " "), "^7")); string tmp_netaddress, tmp_crypto_idfp; - print_to(caller, strcat("List of client information", (privacy ? " (some data is hidden for privacy)" : string_null), ":")); + print_to(caller, strcat("List of client information", (privacy ? " (some data is hidden for privacy)" : ""), ":")); print_to(caller, sprintf(strreplace(" ", separator, " %-4s %-20s %-5s %-3s %-9s %-16s %s "), "ent", "nickname", "ping", "pl", "time", "ip", "crypto_id")); diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 56484a2a9..34446fdfc 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -172,7 +172,7 @@ void VoteSpam(float notvoters, float mincount, string result) strcat("^2:^1", ftos(vote_reject_count)), ((mincount >= 0) ? strcat("^2 (^1", ftos(mincount), "^2 needed)") : "^2"), strcat(", ^1", ftos(vote_abstain_count), "^2 didn't care"), - strcat(", ^1", ftos(notvoters), strcat("^2 didn't ", ((mincount >= 0) ? string_null : "have to "), "vote\n")))); + strcat(", ^1", ftos(notvoters), strcat("^2 didn't ", ((mincount >= 0) ? "" : "have to "), "vote\n")))); if(autocvar_sv_eventlog) { diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index e0a29d87a..f77725413 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -624,7 +624,7 @@ string deathmessage; #define ACTIVE_BUSY 2 #define ACTIVE_TOGGLE 3 .float active; -.float (float act_state) setactive; +.void (float act_state) setactive; .entity realowner; .float nex_charge; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 07bdf8793..9317e2340 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -1824,7 +1824,7 @@ void InitializeEntitiesRun() self = e_old; } //dprint("Delayed initialization: ", self.classname, "\n"); - if(func != func_null) + if(func) func(); else { @@ -1850,7 +1850,7 @@ void SetCustomizer(entity e, float(void) customizer, void(void) uncustomizer) { e.customizeentityforclient = customizer; e.uncustomizeentityforclient = uncustomizer; - e.uncustomizeentityforclient_set = (uncustomizer != func_null); + e.uncustomizeentityforclient_set = !!uncustomizer; } .float nottargeted; diff --git a/qcsrc/server/pathlib.qc b/qcsrc/server/pathlib.qc index ce4c2b4b8..3cb4ca750 100644 --- a/qcsrc/server/pathlib.qc +++ b/qcsrc/server/pathlib.qc @@ -214,7 +214,7 @@ float edge_show(vector point,float fsize) #endif var vector pathlib_movenode(vector start,vector end,float doedge); -vector pathlib_wateroutnode(vector start,vector end) +vector pathlib_wateroutnode(vector start,vector end,float doedge) { vector surface; @@ -248,7 +248,7 @@ vector pathlib_wateroutnode(vector start,vector end) return end; } -vector pathlib_swimnode(vector start,vector end) +vector pathlib_swimnode(vector start,vector end,float doedge) { pathlib_movenode_goodnode = 0; diff --git a/qcsrc/server/pathlib/movenode.qc b/qcsrc/server/pathlib/movenode.qc index 9369fb4d6..c45ac0dee 100644 --- a/qcsrc/server/pathlib/movenode.qc +++ b/qcsrc/server/pathlib/movenode.qc @@ -1,4 +1,4 @@ -vector pathlib_wateroutnode(vector start,vector end) +vector pathlib_wateroutnode(vector start,vector end, float doedge) { vector surface; @@ -32,7 +32,7 @@ vector pathlib_wateroutnode(vector start,vector end) return end; } -vector pathlib_swimnode(vector start,vector end) +vector pathlib_swimnode(vector start,vector end, float doedge) { pathlib_movenode_goodnode = 0; @@ -43,7 +43,7 @@ vector pathlib_swimnode(vector start,vector end) end_y = fsnap(end_y, pathlib_gridsize); if(pointcontents(end) == CONTENT_EMPTY) - return pathlib_wateroutnode( start, end); + return pathlib_wateroutnode( start, end, doedge); tracebox(start, movenode_boxmin,movenode_boxmax, end, MOVE_WORLDONLY, self); if(trace_fraction == 1) @@ -52,7 +52,7 @@ vector pathlib_swimnode(vector start,vector end) return end; } -vector pathlib_flynode(vector start,vector end) +vector pathlib_flynode(vector start,vector end, float doedge) { pathlib_movenode_goodnode = 0; diff --git a/qcsrc/server/pathlib/pathlib.qh b/qcsrc/server/pathlib/pathlib.qh index 71d13caa4..d1b6667d7 100644 --- a/qcsrc/server/pathlib/pathlib.qh +++ b/qcsrc/server/pathlib/pathlib.qh @@ -75,9 +75,9 @@ vector movenode_boxmax; vector movenode_boxmin; float pathlib_movenode_goodnode; -vector pathlib_wateroutnode(vector start, vector end); -vector pathlib_swimnode(vector start, vector end); -vector pathlib_flynode(vector start, vector end); +vector pathlib_wateroutnode(vector start, vector end, float doedge); +vector pathlib_swimnode(vector start, vector end, float doedge); +vector pathlib_flynode(vector start, vector end, float doedge); vector pathlib_walknode(vector start, vector end, float doedge); var vector pathlib_movenode(vector start, vector end, float doedge); diff --git a/qcsrc/server/t_plats.qc b/qcsrc/server/t_plats.qc index 7c21c4e2e..df511c637 100644 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@ -1615,7 +1615,6 @@ float SECRET_1ST_DOWN = 4; // 1st move is down from arrow float SECRET_NO_SHOOT = 8; // only opened by trigger float SECRET_YES_SHOOT = 16; // shootable even if targeted - void fd_secret_use() { float temp; @@ -1666,6 +1665,11 @@ void fd_secret_use() sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTN_NORM); } +void fd_secret_damage(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) +{ + fd_secret_use(); +} + // Wait after first movement... void fd_secret_move1() { @@ -1822,7 +1826,7 @@ void spawnfunc_func_door_secret() { self.health = 10000; self.takedamage = DAMAGE_YES; - self.event_damage = fd_secret_use; + self.event_damage = fd_secret_damage; } self.oldorigin = self.origin; if (!self.wait) diff --git a/qcsrc/server/vehicles/racer.qc b/qcsrc/server/vehicles/racer.qc index ad7bd2dcf..93b27df97 100644 --- a/qcsrc/server/vehicles/racer.qc +++ b/qcsrc/server/vehicles/racer.qc @@ -74,7 +74,7 @@ float autocvar_g_vehicle_racer_bouncestop; vector autocvar_g_vehicle_racer_bouncepain; var vector racer_force_from_tag(string tag_name, float spring_length, float max_power); -void racer_spawn(float _spawnflag); +void racer_spawn_default(); void racer_align4point(float _delta) { @@ -545,7 +545,7 @@ void racer_blowup() DEATH_WAKIBLOWUP, world); self.nextthink = time + autocvar_g_vehicle_racer_respawntime; - self.think = racer_spawn; + self.think = racer_spawn_default; self.movetype = MOVETYPE_NONE; self.effects = EF_NODRAW; @@ -554,8 +554,6 @@ void racer_blowup() self.velocity = '0 0 0'; setorigin(self, self.pos1); - self.think = racer_spawn; - self.nextthink = time + autocvar_g_vehicle_racer_respawntime; } void racer_deadtouch() @@ -626,6 +624,10 @@ void racer_spawn(float _spawnflag) self.damageforcescale = 0.5; //self.destvec = autocvar_g_vehicle_racer_bouncepain; } +void racer_spawn_default() +{ + racer_spawn(0); +} diff --git a/qcsrc/server/w_hagar.qc b/qcsrc/server/w_hagar.qc index de444cb31..55e361ebb 100644 --- a/qcsrc/server/w_hagar.qc +++ b/qcsrc/server/w_hagar.qc @@ -351,7 +351,7 @@ float w_hagar(float req) else if (req == WR_THINK) { float loadable_secondary; - loadable_secondary = autocvar_g_balance_hagar_secondary_load && autocvar_g_balance_hagar_secondary; + loadable_secondary = (autocvar_g_balance_hagar_secondary_load && autocvar_g_balance_hagar_secondary); if (loadable_secondary) W_Hagar_Attack2_Load(); // must always run each frame diff --git a/qcsrc/server/w_seeker.qc b/qcsrc/server/w_seeker.qc index 9bdd89013..975449f5d 100644 --- a/qcsrc/server/w_seeker.qc +++ b/qcsrc/server/w_seeker.qc @@ -495,8 +495,8 @@ void Seeker_Fire_Tag() missile.solid = SOLID_BBOX; missile.takedamage = DAMAGE_YES; - missile.event_damage = Seeker_Tag_Explode; - missile.health = autocvar_g_balance_seeker_tag_health; + missile.event_damage = Seeker_Tag_Damage; + missile.health = autocvar_g_balance_seeker_tag_health; missile.damageforcescale = autocvar_g_balance_seeker_tag_damageforcescale; setorigin (missile, w_shotorg); -- 2.39.2