From: Rudolf Polzer Date: Thu, 3 Jan 2013 20:27:37 +0000 (+0100) Subject: fix some !string uses X-Git-Tag: xonotic-v0.7.0~137 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7775140ea10633a9ca9eefc5baec9d8ea971346f;p=xonotic%2Fxonotic-data.pk3dir.git fix some !string uses --- diff --git a/qcsrc/common/net_notice.qc b/qcsrc/common/net_notice.qc index 6d786fb69..625e091dc 100644 --- a/qcsrc/common/net_notice.qc +++ b/qcsrc/common/net_notice.qc @@ -15,7 +15,7 @@ void sv_notice_join_think() void sv_notice_join() { // to-do: make sv_join_notices support per-entry times - if(!autocvar_sv_join_notices || autocvar_sv_join_notices == "") + if(autocvar_sv_join_notices == "") return; entity n = spawn(); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 4f5671df0..165460eeb 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -3075,7 +3075,7 @@ void PlayerPostThink (void) if((g_cts || g_race) && self.cvar_cl_allow_uidtracking == 1 && self.cvar_cl_allow_uid2name == 1) { - if(!self.stored_netname) + if not(self.stored_netname) self.stored_netname = strzone(uid2name(self.crypto_idfp)); if(self.stored_netname != self.netname) { diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 34446fdfc..abdae75d5 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -483,7 +483,7 @@ string ValidateMap(string validated_map, entity caller) { validated_map = MapInfo_FixName(validated_map); - if(!validated_map) + if not(validated_map) { print_to(caller, "This map is not available on this server."); return string_null; diff --git a/qcsrc/server/domination.qc b/qcsrc/server/domination.qc index 0a2fe02b6..6a0dcdf8b 100644 --- a/qcsrc/server/domination.qc +++ b/qcsrc/server/domination.qc @@ -355,7 +355,7 @@ void dom_controlpoint_setup() self.cnt = -1; - if(!self.message) + if(self.message == "") self.message = " has captured a control point"; if(self.DOMPOINTFRAGS <= 0) diff --git a/qcsrc/server/g_triggers.qc b/qcsrc/server/g_triggers.qc index fe1cd207d..293c78f00 100644 --- a/qcsrc/server/g_triggers.qc +++ b/qcsrc/server/g_triggers.qc @@ -66,7 +66,7 @@ void SUB_UseTargets() if(clienttype(activator) == CLIENTTYPE_REAL) { centerprint (activator, self.message); - if (!self.noise) + if (self.noise == "") play2(activator, "misc/talk.wav"); } } @@ -508,9 +508,9 @@ void spawnfunc_trigger_hurt() self.enemy = world; // I hate you all if (!self.dmg) self.dmg = 1000; - if (!self.message) + if (self.message == "") self.message = "was in the wrong place"; - if (!self.message2) + if (self.message2 == "") self.message2 = "was thrown into a world of hurt by"; // self.message = "someone like %s always gets wrongplaced"; @@ -1339,9 +1339,9 @@ void spawnfunc_misc_laser() if(self.colormod == '0 0 0') if(!self.alpha) self.colormod = '1 0 0'; - if(!self.message) + if(self.message == "") self.message = "saw the light"; - if (!self.message2) + if (self.message2 == "") self.message2 = "was pushed into a laser by"; if(!self.scale) self.scale = 1; diff --git a/qcsrc/server/ipban.qc b/qcsrc/server/ipban.qc index 38a1e249d..08fd83fe3 100644 --- a/qcsrc/server/ipban.qc +++ b/qcsrc/server/ipban.qc @@ -431,8 +431,12 @@ float Ban_IsClientBanned(entity client, float idx) if(ban_idfp == s) return TRUE; } if(ipbanned) - if(!autocvar_g_banned_list_idmode || !ban_idfp) + { + if(!autocvar_g_banned_list_idmode) + return TRUE; + if not(ban_idfp) return TRUE; + } return FALSE; } diff --git a/qcsrc/server/item_key.qc b/qcsrc/server/item_key.qc index 626e535b4..1b423f502 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/server/item_key.qc @@ -186,7 +186,7 @@ void spawnfunc_item_key() { _netname = "FLUFFY PINK keycard"; _colormod = '1 1 1'; - if (!self.netname) { + if (self.netname == "") { objerror("item_key doesn't have a default name for this key and a custom one was not specified!"); remove(self); return; @@ -203,14 +203,14 @@ void spawnfunc_item_key() { _model = "models/keys/key.md3"; } else if (self.itemkeys >= ITEM_KEY_BIT(3) && self.itemkeys <= ITEM_KEY_BIT(5)) { _model = "models/keys/key.md3"; // FIXME: replace it by a keycard model! - } else if (!self.model) { + } else if (self.model == "") { objerror("item_key doesn't have a default model for this key and a custom one was not specified!"); remove(self); return; } // set defailt netname - if (!self.netname) + if (self.netname == "") self.netname = _netname; // set default colormod @@ -218,14 +218,14 @@ void spawnfunc_item_key() { self.colormod = _colormod; // set default model - if (!self.model) + if (self.model == "") self.model = _model; // set default pickup message - if (!self.message) + if (self.message == "") self.message = strzone(strcat("You've picked up the ", self.netname, "!")); - if (!self.noise) + if (self.noise == "") self.noise = "misc/itempickup.wav"; // save the name for later @@ -391,11 +391,11 @@ void spawnfunc_trigger_keylock(void) { } // set unlocked message - if (!self.message) + if (self.message == "") self.message = "Unlocked!"; // set default unlock noise - if (!self.noise) { + if (self.noise == "") { if (self.sounds == 1) self.noise = "misc/secret.wav"; else if (self.sounds == 2) @@ -405,11 +405,11 @@ void spawnfunc_trigger_keylock(void) { } // set default use key sound - if (!self.noise1) + if (self.noise1 == "") self.noise1 = "misc/decreasevalue.wav"; // set closed sourd - if (!self.noise2) + if (self.noise2 == "") self.noise2 = "misc/talk.wav"; // delay between triggering message2 and trigger2 diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index 33b53385b..bd6b9962c 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -504,17 +504,17 @@ void Item_RespawnCountdown (void) rgb = '1 0 0'; } } - if(!name) - { - print("Unknown powerup-marked item is wanting to respawn\n"); - localcmd(sprintf("prvm_edict server %d\n", num_for_edict(self))); - } if(name) { WaypointSprite_Spawn(name, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE, RADARICON_POWERUP, rgb); if(self.waypointsprite_attached) WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, time + ITEM_RESPAWN_TICKS); } + else + { + print("Unknown powerup-marked item is wanting to respawn\n"); + localcmd(sprintf("prvm_edict server %d\n", num_for_edict(self))); + } } sound (self, CH_TRIGGER, "misc/itemrespawncountdown.wav", VOL_BASE, ATTN_NORM); // play respawn sound if(self.waypointsprite_attached) diff --git a/qcsrc/server/t_plats.qc b/qcsrc/server/t_plats.qc index df511c637..0b9da88fa 100644 --- a/qcsrc/server/t_plats.qc +++ b/qcsrc/server/t_plats.qc @@ -191,9 +191,9 @@ void spawnfunc_func_plat() if(self.spawnflags & 4) self.dmg = 10000; - if(self.dmg && (!self.message)) + if(self.dmg && (self.message == "")) self.message = "was squished"; - if(self.dmg && (!self.message2)) + if(self.dmg && (self.message2 == "")) self.message2 = "was squished by"; if (self.sounds == 1) @@ -282,7 +282,7 @@ void train_next() targ = find(world, targetname, self.target); self.enemy = targ; self.target = targ.target; - if (!self.target) + if (self.target == "") objerror("train_next: no next target"); self.wait = targ.wait; if (!self.wait) @@ -302,7 +302,7 @@ void func_train_find() entity targ; targ = find(world, targetname, self.target); self.target = targ.target; - if (!self.target) + if (self.target == "") objerror("func_train_find: no next target"); setorigin(self, targ.origin - self.mins); self.nextthink = self.ltime + 1; @@ -319,7 +319,7 @@ void spawnfunc_func_train() if (self.noise != "") precache_sound(self.noise); - if (!self.target) + if (self.target == "") objerror("func_train without a target"); if (!self.speed) self.speed = 100; @@ -332,9 +332,9 @@ void spawnfunc_func_train() InitializeEntity(self, func_train_find, INITPRIO_SETLOCATION); self.blocked = generic_plat_blocked; - if(self.dmg & (!self.message)) + if(self.dmg && (self.message == "")) self.message = " was squished"; - if(self.dmg && (!self.message2)) + if(self.dmg && (self.message2 == "")) self.message2 = "was squished by"; if(self.dmg && (!self.dmgtime)) self.dmgtime = 0.25; @@ -395,9 +395,9 @@ void spawnfunc_func_rotating() self.pos1 = self.avelocity; - if(self.dmg & (!self.message)) + if(self.dmg && (self.message == "")) self.message = " was squished"; - if(self.dmg && (!self.message2)) + if(self.dmg && (self.message2 == "")) self.message2 = "was squished by"; @@ -469,9 +469,9 @@ void spawnfunc_func_bobbing() // damage when blocked self.blocked = generic_plat_blocked; - if(self.dmg & (!self.message)) + if(self.dmg && (self.message == "")) self.message = " was squished"; - if(self.dmg && (!self.message2)) + if(self.dmg && (self.message2 == "")) self.message2 = "was squished by"; if(self.dmg && (!self.dmgtime)) self.dmgtime = 0.25; @@ -542,9 +542,9 @@ void spawnfunc_func_pendulum() self.speed = 30; // not initializing self.dmg to 2, to allow damageless pendulum - if(self.dmg & (!self.message)) + if(self.dmg && (self.message == "")) self.message = " was squished"; - if(self.dmg && (!self.message2)) + if(self.dmg && (self.message2 == "")) self.message2 = "was squished by"; if(self.dmg && (!self.dmgtime)) self.dmgtime = 0.25; @@ -1303,9 +1303,9 @@ void LinkDoors() { if(t.health && !self.health) self.health = t.health; - if(t.targetname && !self.targetname) + if((t.targetname != "") && (self.targetname == "")) self.targetname = t.targetname; - if(t.message != "" && self.message == "") + if((t.message != "") && (self.message == "")) self.message = t.message; if (t.absmin_x < cmins_x) cmins_x = t.absmin_x; @@ -1420,9 +1420,9 @@ void spawnfunc_func_door() // if(self.spawnflags & 8) // self.dmg = 10000; - if(self.dmg && (!self.message)) + if(self.dmg && (self.message == "")) self.message = "was squished"; - if(self.dmg && (!self.message2)) + if(self.dmg && (self.message2 == "")) self.message2 = "was squished by"; if (self.sounds > 0) @@ -1546,9 +1546,9 @@ void spawnfunc_func_door_rotating() if(self.spawnflags & 8) self.dmg = 10000; - if(self.dmg && (!self.message)) + if(self.dmg && (self.message == "")) self.message = "was squished"; - if(self.dmg && (!self.message2)) + if(self.dmg && (self.message2 == "")) self.message2 = "was squished by"; if (self.sounds > 0) @@ -1893,9 +1893,9 @@ void spawnfunc_func_fourier() self.cnt = 360 / self.speed; self.blocked = generic_plat_blocked; - if(self.dmg & (!self.message)) + if(self.dmg && (self.message == "")) self.message = " was squished"; - if(self.dmg && (!self.message2)) + if(self.dmg && (self.message2 == "")) self.message2 = "was squished by"; if(self.dmg && (!self.dmgtime)) self.dmgtime = 0.25; @@ -2056,9 +2056,9 @@ void spawnfunc_func_vectormamamam() self.target4normal = normalize(self.target4normal); self.blocked = generic_plat_blocked; - if(self.dmg & (!self.message)) + if(self.dmg && (self.message == "")) self.message = " was squished"; - if(self.dmg && (!self.message2)) + if(self.dmg && (self.message == "")) self.message2 = "was squished by"; if(self.dmg && (!self.dmgtime)) self.dmgtime = 0.25;