From: Samual Lenks Date: Fri, 31 May 2013 17:14:42 +0000 (-0400) Subject: Fix some !STRING usage X-Git-Tag: xonotic-v0.7.0~27 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=d0abb65b9338843beb83d5402c4d942520c5e3fe;p=xonotic%2Fxonotic-data.pk3dir.git Fix some !STRING usage --- diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 8daed9205..342db3078 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -985,21 +985,22 @@ void ctf_FlagSetup(float teamnumber, entity flag) // called when spawning a flag flag.nextthink = time + FLAG_THINKRATE; flag.ctf_status = FLAG_BASE; - if(!flag.model) { flag.model = ((teamnumber) ? autocvar_g_ctf_flag_red_model : autocvar_g_ctf_flag_blue_model); } - if(!flag.scale) { flag.scale = FLAG_SCALE; } - if(!flag.skin) { flag.skin = ((teamnumber) ? autocvar_g_ctf_flag_red_skin : autocvar_g_ctf_flag_blue_skin); } - if(!flag.toucheffect) { flag.toucheffect = ((teamnumber) ? "redflag_touch" : "blueflag_touch"); } - if(!flag.passeffect) { flag.passeffect = ((teamnumber) ? "red_pass" : "blue_pass"); } - if(!flag.capeffect) { flag.capeffect = ((teamnumber) ? "red_cap" : "blue_cap"); } + + if(flag.model == "") { flag.model = ((teamnumber) ? autocvar_g_ctf_flag_red_model : autocvar_g_ctf_flag_blue_model); } + if(!flag.scale) { flag.scale = FLAG_SCALE; } + if(!flag.skin) { flag.skin = ((teamnumber) ? autocvar_g_ctf_flag_red_skin : autocvar_g_ctf_flag_blue_skin); } + if(flag.toucheffect == "") { flag.toucheffect = ((teamnumber) ? "redflag_touch" : "blueflag_touch"); } + if(flag.passeffect == "") { flag.passeffect = ((teamnumber) ? "red_pass" : "blue_pass"); } + if(flag.capeffect == "") { flag.capeffect = ((teamnumber) ? "red_cap" : "blue_cap"); } // sound - if(!flag.snd_flag_taken) { flag.snd_flag_taken = ((teamnumber) ? "ctf/red_taken.wav" : "ctf/blue_taken.wav"); } - if(!flag.snd_flag_returned) { flag.snd_flag_returned = ((teamnumber) ? "ctf/red_returned.wav" : "ctf/blue_returned.wav"); } - if(!flag.snd_flag_capture) { flag.snd_flag_capture = ((teamnumber) ? "ctf/red_capture.wav" : "ctf/blue_capture.wav"); } // blue team scores by capturing the red flag - if(!flag.snd_flag_respawn) { flag.snd_flag_respawn = "ctf/flag_respawn.wav"; } // if there is ever a team-based sound for this, update the code to match. - if(!flag.snd_flag_dropped) { flag.snd_flag_dropped = ((teamnumber) ? "ctf/red_dropped.wav" : "ctf/blue_dropped.wav"); } - if(!flag.snd_flag_touch) { flag.snd_flag_touch = "ctf/touch.wav"; } // again has no team-based sound - if(!flag.snd_flag_pass) { flag.snd_flag_pass = "ctf/pass.wav"; } // same story here + if(flag.snd_flag_taken == "") { flag.snd_flag_taken = ((teamnumber) ? "ctf/red_taken.wav" : "ctf/blue_taken.wav"); } + if(flag.snd_flag_returned == "") { flag.snd_flag_returned = ((teamnumber) ? "ctf/red_returned.wav" : "ctf/blue_returned.wav"); } + if(flag.snd_flag_capture == "") { flag.snd_flag_capture = ((teamnumber) ? "ctf/red_capture.wav" : "ctf/blue_capture.wav"); } // blue team scores by capturing the red flag + if(flag.snd_flag_respawn == "") { flag.snd_flag_respawn = "ctf/flag_respawn.wav"; } // if there is ever a team-based sound for this, update the code to match. + if(flag.snd_flag_dropped == "") { flag.snd_flag_dropped = ((teamnumber) ? "ctf/red_dropped.wav" : "ctf/blue_dropped.wav"); } + if(flag.snd_flag_touch == "") { flag.snd_flag_touch = "ctf/touch.wav"; } // again has no team-based sound + if(flag.snd_flag_pass == "") { flag.snd_flag_pass = "ctf/pass.wav"; } // same story here // precache precache_sound(flag.snd_flag_taken); diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index ba70a6cda..78d9d7076 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -479,7 +479,7 @@ void SpawnBall(void) // balls += 4; // using the remaining bits to count balls will leave more than the max edict count, so it's fine - if(!self.model) + if(self.model == "") { self.model = "models/nexball/ball.md3"; self.scale = 1.3; @@ -505,13 +505,13 @@ void SpawnBall(void) if(!autocvar_g_nexball_sound_bounce) self.noise = ""; - else if(!self.noise) + else if(self.noise == "") self.noise = "sound/nexball/bounce.wav"; //bounce sound placeholder (FIXME) - if(!self.noise1) + if(self.noise1 == "") self.noise1 = "sound/nexball/drop.wav"; //ball drop sound placeholder (FIXME) - if(!self.noise2) + if(self.noise2 == "") self.noise2 = "sound/nexball/steal.wav"; //stealing sound placeholder (FIXME) if(self.noise) precache_sound(self.noise); @@ -568,7 +568,7 @@ void SpawnGoal(void) } EXACTTRIGGER_INIT; self.classname = "nexball_goal"; - if(!self.noise) + if(self.noise == "") self.noise = "ctf/respawn.wav"; precache_sound(self.noise); self.touch = GoalTouch; @@ -598,7 +598,7 @@ void spawnfunc_nexball_pinkgoal(void) void spawnfunc_nexball_fault(void) { self.team = GOAL_FAULT; - if(!self.noise) + if(self.noise == "") self.noise = "misc/typehit.wav"; SpawnGoal(); } @@ -606,7 +606,7 @@ void spawnfunc_nexball_fault(void) void spawnfunc_nexball_out(void) { self.team = GOAL_OUT; - if(!self.noise) + if(self.noise == "") self.noise = "misc/typehit.wav"; SpawnGoal(); } diff --git a/qcsrc/server/mutators/mutator_superspec.qc b/qcsrc/server/mutators/mutator_superspec.qc index a8e442abd..eea3979c4 100644 --- a/qcsrc/server/mutators/mutator_superspec.qc +++ b/qcsrc/server/mutators/mutator_superspec.qc @@ -82,7 +82,7 @@ float superspec_filteritem(entity _for, entity _item) { float i; - if(!_for.superspec_itemfilter) + if(_for.superspec_itemfilter == "") return TRUE; if(_for.superspec_itemfilter == "") diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index cf5d82f87..01119829f 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -72,7 +72,7 @@ entity sandbox_ObjectEdit_Get(float permissions) return world; // entity is not an object if(!permissions) return trace_ent; // don't check permissions, anyone can edit this object - if(!trace_ent.crypto_idfp) + if(trace_ent.crypto_idfp == "") return trace_ent; // the player who spawned this object did not have an UID, so anyone can edit it if not(trace_ent.realowner != self && autocvar_g_sandbox_editor_free < 2) return trace_ent; // object does not belong to the player, and players can only edit their own objects on this server @@ -389,7 +389,7 @@ void sandbox_Database_Load() for(;;) { file_read = fgets(file_get); - if(!file_read) + if(file_read == "") break; if(substring(file_read, 0, 2) == "//") continue; @@ -538,7 +538,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) return TRUE; } self.object_flood = time + autocvar_g_sandbox_editor_flood; - if(!argv(3)) // no object in clipboard + if(argv(3) == "") // no object in clipboard { print_to(self, "^1SANDBOX - WARNING: ^7No object in clipboard. You must copy an object before you can paste it"); return TRUE; @@ -610,7 +610,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) // ---------------- COMMAND: OBJECT, EDIT ---------------- case "object_edit": - if(!argv(2)) + if(argv(2) == "") { print_to(self, "^1SANDBOX - WARNING: ^7Too few parameters. You must specify a property to edit"); return TRUE;