// Drawing stuff
if (hud_skin_prev != autocvar_hud_skin)
{
- if (hud_skin_path)
- strunzone(hud_skin_path);
- hud_skin_path = strzone(strcat("gfx/hud/", autocvar_hud_skin));
- if (hud_skin_prev)
- strunzone(hud_skin_prev);
- hud_skin_prev = strzone(autocvar_hud_skin);
+ strcpy(hud_skin_path, strcat("gfx/hud/", autocvar_hud_skin));
+ strcpy(hud_skin_prev, autocvar_hud_skin);
}
// draw the dock
LOG_TRACE("Automatically fixed wrong/missing panel numbers in _hud_panelorder");
cvar_set("_hud_panelorder", s);
- if(hud_panelorder_prev)
- strunzone(hud_panelorder_prev);
- hud_panelorder_prev = strzone(s);
+ strcpy(hud_panelorder_prev, s);
//now properly set panel_order
tokenize_console(s);
} \
} \
} \
- if (panel.current_panel_bg) \
- strunzone(panel.current_panel_bg); \
- panel.current_panel_bg = strzone(panel_bg); \
+ strcpy(panel.current_panel_bg, panel_bg); \
} MACRO_END
// Get value for panel_bg_color: if "" fetch default, else use panel_bg_color. Convert pants, shirt or teamcolor into a vector.
s = strcat(s, ftos(panel_order[i]), " ");
}
cvar_set("_hud_panelorder", s);
- if(hud_panelorder_prev)
- strunzone(hud_panelorder_prev);
- hud_panelorder_prev = strzone(autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
+ strcpy(hud_panelorder_prev, autocvar__hud_panelorder); // prevent HUD_Main from doing useless update, we already updated here
}
void HUD_Panel_Highlight(float allow_move)
cpm_index = CENTERPRINT_MAX_MSGS - 1;
j = cpm_index;
}
- if(centerprint_messages[j])
- strunzone(centerprint_messages[j]);
- centerprint_messages[j] = strzone(strMessage);
+ strcpy(centerprint_messages[j], strMessage);
centerprint_msgID[j] = new_id;
if (duration < 0)
{
panel_bg = strcat(hud_skin_path, "/border_default");
if(precache_pic(panel_bg) == "")
panel_bg = "gfx/hud/default/border_default";
- if(panel.current_panel_bg)
- strunzone(panel.current_panel_bg);
- panel.current_panel_bg = strzone(panel_bg);
+ strcpy(panel.current_panel_bg, panel_bg);
chat_panel_modified = true;
}
panel_bg_alpha = max(0.75, panel_bg_alpha);
if (race_status != race_status_prev || race_status_name != race_status_name_prev) {
race_status_time = time + 5;
race_status_prev = race_status;
- if (race_status_name_prev)
- strunzone(race_status_name_prev);
- race_status_name_prev = strzone(race_status_name);
+ strcpy(race_status_name_prev, race_status_name);
}
// race "awards"
{
TC(int, i);
//LOG_INFOF("^xc80 entry %d: %s, %s\n", i, s, s1);
- if (QuickMenu_Page_Description[i])
- strunzone(QuickMenu_Page_Description[i]);
- QuickMenu_Page_Description[i] = strzone(s);
- if (QuickMenu_Page_Command[i])
- strunzone(QuickMenu_Page_Command[i]);
- QuickMenu_Page_Command[i] = strzone(s1);
+ strcpy(QuickMenu_Page_Description[i], s);
+ strcpy(QuickMenu_Page_Command[i], s1);
}
void QuickMenu_Page_ClearEntry(int i)
++QuickMenu_Page;
z_submenu = strzone(target_submenu);
- if (QuickMenu_CurrentSubMenu)
- strunzone(QuickMenu_CurrentSubMenu);
- QuickMenu_CurrentSubMenu = strzone(z_submenu);
+ strcpy(QuickMenu_CurrentSubMenu, z_submenu);
QuickMenu_IsLastPage = true;
QuickMenu_Page_Entries = 0;
panel_bg = "gfx/hud/default/border_default"; // fallback
if(!radar_panel_modified && panel_bg != panel.current_panel_bg)
radar_panel_modified = true;
- if(panel.current_panel_bg)
- strunzone(panel.current_panel_bg);
- panel.current_panel_bg = strzone(panel_bg);
+ strcpy(panel.current_panel_bg, panel_bg);
switch(hud_panel_radar_maximized_zoommode)
{
continue;
}
- strunzone(sbt_field_title[sbt_num_fields]);
- sbt_field_title[sbt_num_fields] = strzone(TranslateScoresLabel(str));
+ strcpy(sbt_field_title[sbt_num_fields], TranslateScoresLabel(str));
sbt_field_size[sbt_num_fields] = stringwidth(sbt_field_title[sbt_num_fields], false, hud_fontsize);
str = strtolower(str);
}
else if(!have_separator)
{
- strunzone(sbt_field_title[sbt_num_fields]);
- sbt_field_title[sbt_num_fields] = strzone("|");
+ strcpy(sbt_field_title[sbt_num_fields], "|");
sbt_field_size[sbt_num_fields] = stringwidth("|", false, hud_fontsize);
sbt_field[sbt_num_fields] = SP_SEPARATOR;
++sbt_num_fields;
}
if(!have_secondary)
{
- strunzone(sbt_field_title[sbt_num_fields]);
- sbt_field_title[sbt_num_fields] = strzone(TranslateScoresLabel(scores_label(ps_secondary)));
+ strcpy(sbt_field_title[sbt_num_fields], TranslateScoresLabel(scores_label(ps_secondary)));
sbt_field_size[sbt_num_fields] = stringwidth(sbt_field_title[sbt_num_fields], false, hud_fontsize);
sbt_field[sbt_num_fields] = ps_secondary;
++sbt_num_fields;
}
if(!have_primary)
{
- strunzone(sbt_field_title[sbt_num_fields]);
- sbt_field_title[sbt_num_fields] = strzone(TranslateScoresLabel(scores_label(ps_primary)));
+ strcpy(sbt_field_title[sbt_num_fields], TranslateScoresLabel(scores_label(ps_primary)));
sbt_field_size[sbt_num_fields] = stringwidth(sbt_field_title[sbt_num_fields], false, hud_fontsize);
sbt_field[sbt_num_fields] = ps_primary;
++sbt_num_fields;
{
hud_fontsize = HUD_GetFontsize("hud_fontsize");
Scoreboard_initFieldSizes();
- if(hud_fontsize_str)
- strunzone(hud_fontsize_str);
- hud_fontsize_str = strzone(autocvar_hud_fontsize);
+ strcpy(hud_fontsize_str, autocvar_hud_fontsize);
}
}
else {
LOG_INFO(_("^1You must answer before entering hud configure mode"));
cvar_set("_hud_configure", "0");
}
- if(vote_called_vote)
- strunzone(vote_called_vote);
- vote_called_vote = strzone(_("^2Name ^7instead of \"^1Anonymous player^7\" in stats"));
+ strcpy(vote_called_vote, _("^2Name ^7instead of \"^1Anonymous player^7\" in stats"));
uid2name_dialog = 1;
}
if(weaponorder_bypriority != autocvar_cl_weaponpriority || !weaponorder[0])
{
int weapon_cnt;
- if(weaponorder_bypriority)
- strunzone(weaponorder_bypriority);
- if(weaponorder_byimpulse)
- strunzone(weaponorder_byimpulse);
-
- weaponorder_bypriority = strzone(autocvar_cl_weaponpriority);
- weaponorder_byimpulse = strzone(W_FixWeaponOrder_BuildImpulseList(W_FixWeaponOrder_ForceComplete(W_NumberWeaponOrder(weaponorder_bypriority))));
+ strcpy(weaponorder_bypriority, autocvar_cl_weaponpriority);
+ strcpy(weaponorder_byimpulse, W_FixWeaponOrder_BuildImpulseList(W_FixWeaponOrder_ForceComplete(W_NumberWeaponOrder(weaponorder_bypriority))));
weaponorder_cmp_str = strcat(" ", weaponorder_byimpulse, " ");
weapon_cnt = 0;
if(nags & BIT(7))
{
- if(vote_called_vote)
- strunzone(vote_called_vote);
- vote_called_vote = strzone(ReadString());
+ strcpy(vote_called_vote, ReadString());
}
if(nags & 1)
teamplay = _MapInfo_GetTeamPlayBool(gametype);
HUD_ModIcons_SetFunc();
FOREACH(Scores, true, {
- if (scores_label(it)) strunzone(scores_label(it));
- scores_label(it) = strzone(ReadString());
+ strcpy(scores_label(it), ReadString());
scores_flags(it) = ReadByte();
});
for (int i = 0; i < MAX_TEAMSCORE; ++i)
{
- if (teamscores_label(i)) strunzone(teamscores_label(i));
- teamscores_label(i) = strzone(ReadString());
+ strcpy(teamscores_label(i), ReadString());
teamscores_flags(i) = ReadByte();
}
return = true;
arc_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
arc_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
- if (forcefog) strunzone(forcefog);
- forcefog = strzone(ReadString());
+ strcpy(forcefog, ReadString());
armorblockpercent = ReadByte() / 255.0;
damagepush_speedfactor = ReadByte() / 255.0;
race_time = ReadInt24_t();
race_previousbesttime = ReadInt24_t();
race_mypreviousbesttime = ReadInt24_t();
- if(race_previousbestname)
- strunzone(race_previousbestname);
string pbestname = ReadString();
if(autocvar_cl_race_cptimes_onlyself)
{
race_previousbesttime = race_mypreviousbesttime;
race_mypreviousbesttime = 0;
- race_previousbestname = strzone("");
+ strcpy(race_previousbestname, "");
}
else
- race_previousbestname = strzone(pbestname);
+ strcpy(race_previousbestname, pbestname);
race_checkpointtime = time;
race_nextbesttime = ReadInt24_t();
if(b != RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING) // not while spectating (matches server)
race_mybesttime = ReadInt24_t();
- if(race_nextbestname)
- strunzone(race_nextbestname);
string newname = ReadString();
if(autocvar_cl_race_cptimes_onlyself && b != RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING)
{
race_nextbesttime = race_mybesttime;
race_mybesttime = 0;
- race_nextbestname = strzone("");
+ strcpy(race_nextbestname, "");
}
else
- race_nextbestname = strzone(newname);
+ strcpy(race_nextbestname, newname);
break;
case RACE_NET_CHECKPOINT_HIT_RACE:
race_mycheckpointlapsdelta = ReadByte();
if(race_mycheckpointlapsdelta >= 128)
race_mycheckpointlapsdelta -= 256;
- if(race_mycheckpointenemy)
- strunzone(race_mycheckpointenemy);
int who = ReadByte();
if(who)
- race_mycheckpointenemy = strzone(entcs_GetName(who - 1));
+ strcpy(race_mycheckpointenemy, entcs_GetName(who - 1));
else
- race_mycheckpointenemy = strzone(""); // TODO: maybe string_null works fine here?
+ strcpy(race_mycheckpointenemy, ""); // TODO: maybe string_null works fine here?
break;
case RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT:
race_othercheckpointlapsdelta = ReadByte();
if(race_othercheckpointlapsdelta >= 128)
race_othercheckpointlapsdelta -= 256;
- if(race_othercheckpointenemy)
- strunzone(race_othercheckpointenemy);
int what = ReadByte();
if(what)
- race_othercheckpointenemy = strzone(entcs_GetName(what - 1));
+ strcpy(race_othercheckpointenemy, entcs_GetName(what - 1));
else
- race_othercheckpointenemy = strzone(""); // TODO: maybe string_null works fine here?
+ strcpy(race_othercheckpointenemy, ""); // TODO: maybe string_null works fine here?
break;
case RACE_NET_PENALTY_RACE:
race_penaltyeventtime = time;
race_penaltytime = ReadShort();
//race_penaltyaccumulator += race_penaltytime;
- if(race_penaltyreason)
- strunzone(race_penaltyreason);
- race_penaltyreason = strzone(ReadString());
+ strcpy(race_penaltyreason, ReadString());
break;
case RACE_NET_PENALTY_QUALIFYING:
race_penaltyeventtime = time;
race_penaltytime = ReadShort();
race_penaltyaccumulator += race_penaltytime;
- if(race_penaltyreason)
- strunzone(race_penaltyreason);
- race_penaltyreason = strzone(ReadString());
+ strcpy(race_penaltyreason, ReadString());
break;
case RACE_NET_SERVER_RECORD:
break;
case RACE_NET_SPEED_AWARD:
race_speedaward = ReadInt24_t() * GetSpeedUnitFactor(autocvar_hud_panel_physics_speed_unit);
- if(race_speedaward_holder)
- strunzone(race_speedaward_holder);
- race_speedaward_holder = strzone(ReadString());
- if(race_speedaward_unit)
- strunzone(race_speedaward_unit);
- race_speedaward_unit = strzone(GetSpeedUnit(autocvar_hud_panel_physics_speed_unit));
+ strcpy(race_speedaward_holder, ReadString());
+ strcpy(race_speedaward_unit, GetSpeedUnit(autocvar_hud_panel_physics_speed_unit));
break;
case RACE_NET_SPEED_AWARD_BEST:
race_speedaward_alltimebest = ReadInt24_t() * GetSpeedUnitFactor(autocvar_hud_panel_physics_speed_unit);
- if(race_speedaward_alltimebest_holder)
- strunzone(race_speedaward_alltimebest_holder);
- race_speedaward_alltimebest_holder = strzone(ReadString());
- if(race_speedaward_alltimebest_unit)
- strunzone(race_speedaward_alltimebest_unit);
- race_speedaward_alltimebest_unit = strzone(GetSpeedUnit(autocvar_hud_panel_physics_speed_unit));
+ strcpy(race_speedaward_alltimebest_holder, ReadString());
+ strcpy(race_speedaward_alltimebest_unit, GetSpeedUnit(autocvar_hud_panel_physics_speed_unit));
break;
case RACE_NET_SERVER_RANKINGS:
float prevpos, del;
if (prevpos) {
for (i=prevpos-1;i>pos-1;--i) {
grecordtime[i] = grecordtime[i-1];
- if(grecordholder[i])
- strunzone(grecordholder[i]);
- grecordholder[i] = strzone(grecordholder[i-1]);
+ strcpy(grecordholder[i], grecordholder[i-1]);
}
} else if (del) { // a record has been deleted by the admin
for (i=pos-1; i<= RANKINGS_CNT-1; ++i) {
}
else {
grecordtime[i] = grecordtime[i+1];
- if (grecordholder[i])
- strunzone(grecordholder[i]);
- grecordholder[i] = strzone(grecordholder[i+1]);
+ strcpy(grecordholder[i], grecordholder[i+1]);
}
}
} else { // player has no ranked record yet
for (i=RANKINGS_CNT-1;i>pos-1;--i) {
grecordtime[i] = grecordtime[i-1];
- if(grecordholder[i])
- strunzone(grecordholder[i]);
- grecordholder[i] = strzone(grecordholder[i-1]);
+ strcpy(grecordholder[i], grecordholder[i-1]);
}
}
break;
case RACE_NET_SERVER_STATUS:
race_status = ReadShort();
- if(race_status_name)
- strunzone(race_status_name);
- race_status_name = strzone(ReadString());
+ strcpy(race_status_name, ReadString());
}
return true;
}
{
if(autocvar_accuracy_color_levels != acc_color_levels)
{
- if(acc_color_levels)
- strunzone(acc_color_levels);
- acc_color_levels = strzone(autocvar_accuracy_color_levels);
+ strcpy(acc_color_levels, autocvar_accuracy_color_levels);
acc_levels = tokenize_console(acc_color_levels);
if(acc_levels > MAX_ACCURACY_LEVELS)
acc_levels = MAX_ACCURACY_LEVELS;
#include <common/mutators/base.qh>
// register all possible hooks here
-
+
// to use a hook, first register your mutator using REGISTER_MUTATOR
// then create your function using MUTATOR_HOOKFUNCTION
this.mins = this.maxs = '0 0 0';
setsize(this, this.mins, this.maxs);
- if(this.bgmscript)
- strunzone(this.bgmscript);
- this.bgmscript = ReadString();
- if(substring(this.bgmscript, 0, 1) == "<")
+ string s = ReadString();
+ if(substring(s, 0, 1) == "<")
{
- this.bgmscript = strzone(substring(this.bgmscript, 1, -1));
+ strcpy(this.bgmscript, substring(s, 1, -1));
this.bgmscriptangular = 1;
}
else
{
- this.bgmscript = strzone(this.bgmscript);
+ strcpy(this.bgmscript, s);
this.bgmscriptangular = 0;
}
if(this.bgmscript != "")
}
string file = argv(1);
string variants = argv(2);
- if (this.(field)) strunzone(this.(field));
- this.(field) = strzone(strcat(file, " ", variants));
+ strcpy(this.(field), strcat(file, " ", variants));
}
fclose(fh);
return true;
void UpdatePlayerSounds(entity this)
{
if (this.model == this.model_for_playersound && this.skin == this.skin_for_playersound) return;
- if (this.model_for_playersound) strunzone(this.model_for_playersound);
- this.model_for_playersound = strzone(this.model);
+ strcpy(this.model_for_playersound, this.model);
this.skin_for_playersound = this.skin;
ClearPlayerSounds(this);
LoadPlayerSounds(this, "sound/player/default.sounds", true);
/** the engine player name strings are mutable! */
#define ENTCS_SET_MUTABLE_STRING(var, x) MACRO_BEGIN \
- if (var) strunzone(var); \
- var = strzone(x); \
+ strcpy(var, x); \
MACRO_END
ENTCS_PROP(ENTNUM, false, sv_entnum, ENTCS_SET_NORMAL, {}, {}) /* sentinel */
ENTCS_PROP(NAME, true, netname, ENTCS_SET_MUTABLE_STRING,
{ WriteString(chan, ent.netname); },
- { if (ent.netname) strunzone(ent.netname); ent.netname = strzone(ReadString()); })
+ { strcpy(ent.netname, ReadString()); })
ENTCS_PROP(MODEL, true, model, ENTCS_SET_NORMAL,
{ WriteString(chan, ent.model); },
- { if (ent.model) strunzone(ent.model); ent.model = strzone(ReadString()); })
+ { strcpy(ent.model, ReadString()); })
ENTCS_PROP(SKIN, true, skin, ENTCS_SET_NORMAL,
{ WriteByte(chan, ent.skin); },
// `cl_forceplayermodels 1` sounds will be wrong until the player has been in the PVS, but so be it
if (this.model != e.model)
{
- if (this.model) strunzone(this.model);
- this.model = strzone(e.model);
+ strcpy(this.model, e.model);
}
}
case BD_TILE_BRICK1: return false;
}
- if(hit.netname) { strunzone(hit.netname); }
- hit.netname = strzone(testpos);
+ strcpy(hit.netname, testpos);
minigame_server_sendflags(hit,MINIG_SF_UPDATE);
break;
}
case BD_TILE_BRICK1: return false;
}
- if(dozer.netname) { strunzone(dozer.netname); }
- dozer.netname = strzone(newpos);
+ strcpy(dozer.netname, newpos);
return true;
}
if(minigame.bd_nextlevel && minigame.bd_nextlevel != "")
{
- if(minigame.bd_levelname) { strunzone(minigame.bd_levelname); }
- minigame.bd_levelname = strzone(minigame.bd_nextlevel);
+ strcpy(minigame.bd_levelname, minigame.bd_nextlevel);
}
bd_setup_pieces(minigame);
void bd_set_next_match(entity minigame, string next)
{
- if(minigame.bd_nextlevel) { strunzone(minigame.bd_nextlevel); }
- minigame.bd_nextlevel = strzone(next);
+ strcpy(minigame.bd_nextlevel, next);
}
void bd_next_match(entity minigame, entity player, string next)
{
tokenize_console(s);
- if(minigame.bd_nextlevel) { strunzone(minigame.bd_nextlevel); }
- minigame.bd_nextlevel = strzone(argv(2));
+ strcpy(minigame.bd_nextlevel, argv(2));
}
int bd_fix_dir(vector dir)
{
case "start":
{
- if(minigame.bd_levelname) { strunzone(minigame.bd_levelname); }
- minigame.bd_levelname = strzone(autocvar_sv_minigames_bulldozer_startlevel);
+ strcpy(minigame.bd_levelname, autocvar_sv_minigames_bulldozer_startlevel);
bd_setup_pieces(minigame);
minigame.minigame_flags = BD_TURN_MOVE;
{
int letter = ReadByte();
int number = ReadByte();
- if(sent.netname) { strunzone(sent.netname); }
- sent.netname = strzone(minigame_tile_buildname(letter, number));
+ strcpy(sent.netname, minigame_tile_buildname(letter, number));
sent.bd_tiletype = ReadByte();
if(middle.netname) { strunzone(middle.netname); }
delete(middle);
- if(piece.netname) { strunzone(piece.netname); }
- piece.netname = strzone(pos);
+ strcpy(piece.netname, pos);
minigame_server_sendflags(piece,MINIG_SF_ALL);
field = Monster_Sound_SampleField(argv(0));
if(GetMonsterSoundSampleField_notFound)
continue;
- if (this.(field))
- strunzone(this.(field));
- this.(field) = strzone(strcat(argv(1), " ", argv(2)));
+ strcpy(this.(field), strcat(argv(1), " ", argv(2)));
}
fclose(fh);
return true;
);
}
- if (this.text) strunzone(this.text);
- this.text = strzone(s);
+ strcpy(this.text, s);
this.m_size = map_bound_ranges(potential,
autocvar_cl_damagetext_size_min_damage, autocvar_cl_damagetext_size_max_damage,
}
// update last editing time
- if(e.message2) strunzone(e.message2);
- e.message2 = strzone(strftime(true, "%d-%m-%Y %H:%M:%S"));
+ strcpy(e.message2, strftime(true, "%d-%m-%Y %H:%M:%S"));
if(autocvar_g_sandbox_info > 1)
LOG_INFO("^3SANDBOX - SERVER: ^7", player.netname, " edited property ^3", argv(2), " ^7of an object at origin ^3", vtos(e.origin));
// also update the player's nickname if he changed it (but has the same player UID)
if(e.netname != player.netname)
{
- if(e.netname) strunzone(e.netname);
- e.netname = strzone(player.netname);
+ strcpy(e.netname, player.netname);
print_to(player, "^2SANDBOX - INFO: ^7Object owner name updated");
}
return true;
}
- if(e.crypto_idfp) strunzone(e.crypto_idfp);
- e.crypto_idfp = strzone(player.crypto_idfp);
+ strcpy(e.crypto_idfp, player.crypto_idfp);
print_to(player, "^2SANDBOX - INFO: ^7Object claimed successfully");
}
if (sendflags & 2)
{
- if (this.netname)
- strunzone(this.netname);
- this.netname = strzone(ReadString());
+ strcpy(this.netname, ReadString());
}
if (sendflags & 4)
{
- if (this.netname2)
- strunzone(this.netname2);
- this.netname2 = strzone(ReadString());
+ strcpy(this.netname2, ReadString());
}
if (sendflags & 8)
{
- if (this.netname3)
- strunzone(this.netname3);
- this.netname3 = strzone(ReadString());
+ strcpy(this.netname3, ReadString());
}
if (sendflags & 16)
_sound(NULL, soundchannel, AnnouncerFilename(soundfile), soundvolume, soundposition);
- if (prev_soundfile) strunzone(prev_soundfile);
- prev_soundfile = strzone(soundfile);
+ strcpy(prev_soundfile, soundfile);
prev_soundtime = time;
}
else
this.waterlevel = 0;
this.count = 1;
}
- if(this.noise)
- strunzone(this.noise);
- if(this.bgmscript)
- strunzone(this.bgmscript);
- this.noise = strzone(ReadString());
+ strcpy(this.noise, ReadString());
if(this.noise != "")
{
this.atten = ReadByte() / 64.0;
this.volume = ReadByte() / 255.0;
}
- this.bgmscript = strzone(ReadString());
+ strcpy(this.bgmscript, ReadString());
if(this.bgmscript != "")
{
this.bgmscriptattack = ReadByte() / 64.0;
}
if(e.noise != noi)
{
- if(e.noise)
- strunzone(e.noise);
- e.noise = strzone(noi);
+ strcpy(e.noise, noi);
precache_sound(e.noise);
_sound(e, CH_BGM_SINGLE, e.noise, 0, ATTEN_NONE);
if(getsoundtime(e, CH_BGM_SINGLE) < 0)
this.fade_time = ReadByte() / 16.0;
this.fade_rate = ReadByte() / 16.0;
string s = this.noise;
- if(this.noise)
- strunzone(this.noise);
- this.noise = strzone(ReadString());
+ strcpy(this.noise, ReadString());
if(this.noise != s)
{
precache_sound(this.noise);
{
vector mi, ma;
- if(mi_shortname)
- strunzone(mi_shortname);
- mi_shortname = mapname;
- if(!strcasecmp(substring(mi_shortname, 0, 5), "maps/"))
- mi_shortname = substring(mi_shortname, 5, strlen(mi_shortname) - 5);
- if(!strcasecmp(substring(mi_shortname, strlen(mi_shortname) - 4, 4), ".bsp"))
- mi_shortname = substring(mi_shortname, 0, strlen(mi_shortname) - 4);
- mi_shortname = strzone(mi_shortname);
+ string s = mapname;
+ if(!strcasecmp(substring(s, 0, 5), "maps/"))
+ s = substring(s, 5, strlen(s) - 5);
+ if(!strcasecmp(substring(s, strlen(s) - 4, 4), ".bsp"))
+ s = substring(s, 0, strlen(s) - 4);
+ strcpy(mi_shortname, s);
#ifdef CSQC
mi = world.mins;
if(to_execute_next_frame)
{
s = strcat(s, "\n", to_execute_next_frame);
- strunzone(to_execute_next_frame);
}
- to_execute_next_frame = strzone(s);
+ strcpy(to_execute_next_frame, s);
}
.float FindConnectedComponent_processing;
GENERIC_COMMAND(mx, "Send a matrix command") {
switch (argv(1)) {
case "user":
- if (matrix_user) strunzone(matrix_user);
- matrix_user = strzone(substring(command, argv_start_index(2), -1));
+ strcpy(matrix_user, substring(command, argv_start_index(2), -1));
break;
case "token":
- if (matrix_access_token) strunzone(matrix_access_token);
- matrix_access_token = strzone(substring(command, argv_start_index(2), -1));
+ strcpy(matrix_access_token, substring(command, argv_start_index(2), -1));
break;
case "messages":
MX_Messages(string_null);
class(cname).type name; \
INIT(cname) \
{ \
- if (this.name) \
- strunzone(this.name); \
- this.name = strzone(val); \
+ strcpy(this.name, val); \
}
#define STATIC_ATTRIB_STRZONE(cname, name, type, val) \
type cname##_##name; \
_INIT_STATIC(cname) \
{ \
- if (cname##_##name) \
- strunzone(cname##_##name); \
- cname##_##name = val; \
+ strcpy(cname##_##name, val); \
}
#define ATTRIBARRAY(cname, name, type, cnt) \
#define REPLICATE_4(fld, type, var, func) REPLICATE_##type(fld, var, func)
#define REPLICATE_string(fld, var, func) \
REPLICATE_7(fld, string, var, , \
- { if (field) strunzone(field); field = strzone(it); }, \
+ { strcpy(field, it); }, \
{ if (field) strunzone(field); field = string_null; }, \
{ \
/* also initialize to the default value of func when requesting cvars */ \
}
#endif
+#define strcpy(this, s) MACRO_BEGIN \
+ if (this) { \
+ strunzone(this); \
+ } \
+ this = strzone(s); \
+MACRO_END
+
ERASEABLE
string seconds_tostring(float sec)
{
me.text = txt;
if (txt != me.currentText)
{
- if (me.currentText) strunzone(me.currentText);
- me.currentText = strzone(txt);
+ strcpy(me.currentText, txt);
me.recalcPos = 1;
}
}
t = me.textEntity.toString(me.textEntity);
if (t != me.currentText)
{
- if (me.currentText) strunzone(me.currentText);
- me.currentText = strzone(t);
+ strcpy(me.currentText, t);
me.recalcPos = 1;
}
}
{
// fade out if tooltip of a certain item has changed
menuTooltipState = 3;
- if (prev_tooltip) strunzone(prev_tooltip);
- prev_tooltip = strzone(it.tooltip);
+ strcpy(prev_tooltip, it.tooltip);
}
else if (menuTooltipItem && !m_testmousetooltipbox(pos))
{
menuTooltipOrigin.x = -1; // unallocated
- if (menuTooltipText) strunzone(menuTooltipText);
- menuTooltipText = strzone(gettooltip());
+ strcpy(menuTooltipText, gettooltip());
int i = 0;
float w = 0;
{
if (!menuInitialized)
{
- if (m_goto_buffer) strunzone(m_goto_buffer);
- m_goto_buffer = strzone(itemname);
+ strcpy(m_goto_buffer, itemname);
return;
}
if (itemname == "") // this can be called by GameCommand
#include <common/mutators/base.qh>
// register all possible hooks here
-
+
// to use a hook, first register your mutator using REGISTER_MUTATOR
// then create your function using MUTATOR_HOOKFUNCTION
void XonoticCampaignList_loadCvars(entity me)
{
// read campaign cvars
- if(campaign_name)
- strunzone(campaign_name);
- if(me.cvarName)
- strunzone(me.cvarName);
- campaign_name = strzone(cvar_string("g_campaign_name"));
- me.cvarName = strzone(strcat("g_campaign", campaign_name, "_index"));
+ strcpy(campaign_name, cvar_string("g_campaign_name"));
+ strcpy(me.cvarName, strcat("g_campaign", campaign_name, "_index"));
registercvar(me.cvarName, "", 0); // saved by server QC anyway
CampaignFile_Unload();
CampaignFile_Load(0, CAMPAIGN_MAX_ENTRIES);
float a;
rgb = stov(cvar_string("crosshair_color"));
a = cvar("crosshair_alpha");
- if(me.src)
- strunzone(me.src);
- me.src = strzone(strcat("/gfx/crosshair", cvar_string("crosshair")));
+ strcpy(me.src, strcat("/gfx/crosshair", cvar_string("crosshair")));
sz = draw_PictureSize(me.src);
sz = globalToBoxSize(sz, me.size);
if(me.nItems == 0)
return;
- if(me.cvarName)
- strunzone(me.cvarName);
- if(me.cvarDescription)
- strunzone(me.cvarDescription);
if(me.cvarType)
strunzone(me.cvarType);
- if(me.cvarDefault)
- strunzone(me.cvarDefault);
- me.cvarName = strzone(bufstr_get(me.handle, me.selectedItem));
- me.cvarDescription = strzone(cvar_description(me.cvarName));
- me.cvarDefault = strzone(cvar_defstring(me.cvarName));
+ strcpy(me.cvarName, bufstr_get(me.handle, me.selectedItem));
+ strcpy(me.cvarDescription, cvar_description(me.cvarName));
+ strcpy(me.cvarDefault, cvar_defstring(me.cvarName));
me.cvarNameBox.setText(me.cvarNameBox, me.cvarName);
me.cvarDescriptionBox.setText(me.cvarDescriptionBox, me.cvarDescription);
float needsForcing = me.updateCvarType(me);
me.startButton.onClickEntity = mlb;
MapInfo_Get_ByID(i);
- if(me.currentMapBSPName)
- {
- strunzone(me.currentMapBSPName);
- strunzone(me.currentMapTitle);
- strunzone(me.currentMapAuthor);
- strunzone(me.currentMapDescription);
- strunzone(me.currentMapPreviewImage);
- }
- me.currentMapBSPName = strzone(MapInfo_Map_bspname);
- me.currentMapTitle = strzone(strdecolorize(MapInfo_Map_title));
- me.currentMapAuthor = strzone(strdecolorize(MapInfo_Map_author));
- me.currentMapDescription = strzone(MapInfo_Map_description);
- me.currentMapPreviewImage = strzone(strcat("/maps/", MapInfo_Map_bspname));
+ strcpy(me.currentMapBSPName, MapInfo_Map_bspname);
+ strcpy(me.currentMapTitle, strdecolorize(MapInfo_Map_title));
+ strcpy(me.currentMapAuthor, strdecolorize(MapInfo_Map_author));
+ strcpy(me.currentMapDescription, MapInfo_Map_description);
+ strcpy(me.currentMapPreviewImage, strcat("/maps/", MapInfo_Map_bspname));
me.frame.setText(me.frame, me.currentMapBSPName);
me.titleLabel.setText(me.titleLabel, me.currentMapTitle);
return _("Most Weapons Arena");
if(s == weaponarenastring_cvar)
return weaponarenastring;
- if(weaponarenastring)
- strunzone(weaponarenastring);
- if(weaponarenastring_cvar)
- strunzone(weaponarenastring_cvar);
- weaponarenastring_cvar = strzone(s);
+ strcpy(weaponarenastring_cvar, s);
n = tokenize_console(s);
s = "";
}
s = sprintf(_("%s Arena"), s);
- weaponarenastring = strzone(s);
+ strcpy(weaponarenastring, s);
return weaponarenastring;
}
{
if (me.currentScrPath == scrImage)
return;
- if (me.currentScrPath)
- strunzone(me.currentScrPath);
- me.currentScrPath = strzone(scrImage);
+ strcpy(me.currentScrPath, scrImage);
me.screenshotImage.load(me.screenshotImage, me.currentScrPath);
}
void XonoticScreenshotBrowserTab_fill(entity me)
if (me.currentScrPath == scrImage)
return;
- if (me.currentScrPath)
- strunzone(me.currentScrPath);
- me.currentScrPath = strzone(scrImage);
+ strcpy(me.currentScrPath, scrImage);
me.screenshotImage.load(me.screenshotImage, me.currentScrPath);
me.frame.setText(me.frame, me.screenshotImage.screenshotTitle);
}
for(i = 0; i < MapInfo_count; ++i)
draw_PreloadPicture(strcat("/maps/", MapInfo_BSPName_ByID(i)));
- if(me.g_maplistCache)
- strunzone(me.g_maplistCache);
s = "0";
for(i = 1; i < MapInfo_count; i *= 2)
s = strcat(s, s);
);
}
}
- me.g_maplistCache = strzone(s);
+ strcpy(me.g_maplistCache, s);
if(gt != me.lastGametype || f != me.lastFeatures)
{
me.lastGametype = gt;
if(time < me.typeToSearchTime)
{
save = substring(me.typeToSearchString, 0, strlen(me.typeToSearchString) - 1);
- if(me.typeToSearchString)
- strunzone(me.typeToSearchString);
- me.typeToSearchString = strzone(save);
+ strcpy(me.typeToSearchString, save);
me.typeToSearchTime = time + 0.5;
if(strlen(me.typeToSearchString))
{
save = ch;
else
save = strcat(me.typeToSearchString, ch);
- if(me.typeToSearchString)
- strunzone(me.typeToSearchString);
- me.typeToSearchString = strzone(save);
+ strcpy(me.typeToSearchString, save);
me.typeToSearchTime = time + 0.5;
MapInfo_FindName(me.typeToSearchString);
if(MapInfo_FindName_firstResult >= 0)
{
me.idxModels = mod(me.idxModels + d + me.numModels, me.numModels);
- if(me.currentModel)
- strunzone(me.currentModel);
- if(me.currentModelTitle)
- strunzone(me.currentModelTitle);
- if(me.currentModelImage)
- strunzone(me.currentModelImage);
- if(me.currentModelDescription)
- strunzone(me.currentModelDescription);
-
// select model #i!
- me.currentModelTitle = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_TITLE));
- me.currentModelImage = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_IMAGE));
+ strcpy(me.currentModelTitle, bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_TITLE));
+ strcpy(me.currentModelImage, bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_IMAGE));
me.currentSkin = stof(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_SKIN));
- me.currentModel = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_MODEL));
- me.currentModelDescription = strzone(bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_DESC));
+ strcpy(me.currentModel, bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_MODEL));
+ strcpy(me.currentModelDescription, bufstr_get(me.bufModels, BUFMODELS_COUNT*me.idxModels+BUFMODELS_DESC));
// fix the image
if(draw_PictureSize(me.currentModelImage) == '0 0 0')
{
me.screenshotTime = time;
me.src = theImage;
- if (me.screenshotTitle)
- strunzone(me.screenshotTitle);
- me.screenshotTitle = strzone(substring(me.src, 13, strlen(theImage) - 13)); //strip "/screenshots/"
+ strcpy(me.screenshotTitle, substring(me.src, 13, strlen(theImage) - 13)); //strip "/screenshots/"
me.initZoom(me); // this image may have a different size
me.setZoom(me, 0, 0);
if(gethostcachevalue(SLIST_HOSTCACHEVIEWCOUNT) != me.nItems)
return; // sorry, it would be wrong
- if(me.selectedServer)
- strunzone(me.selectedServer);
- me.selectedServer = strzone(gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
+ strcpy(me.selectedServer, gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
me.ipAddressBox.setText(me.ipAddressBox, me.selectedServer);
me.ipAddressBox.cursorPos = strlen(me.selectedServer);
{
if(gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem) != me.selectedServer)
{
- if(me.selectedServer)
- strunzone(me.selectedServer);
- me.selectedServer = strzone(gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
+ strcpy(me.selectedServer, gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
}
found = true;
}
// selected server disappeared, select the last server (scrolling to it)
if(me.selectedItem >= me.nItems)
SUPER(XonoticServerList).setSelected(me, me.nItems - 1);
- if(me.selectedServer)
- strunzone(me.selectedServer);
- me.selectedServer = strzone(gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
+ strcpy(me.selectedServer, gethostcachestring(SLIST_FIELD_CNAME, me.selectedItem));
}
}
}
else
{
- strunzone(campaign_name_previous);
- campaign_name_previous = strzone(campaign_name);
+ strcpy(campaign_name_previous, campaign_name);
campaign_won_previous = cvar(strcat("g_campaign", campaign_name, "_won"));
}
}
bot_cmd.bot_cmd_parm_float = stof(parm);
break;
case BOT_CMD_PARAMETER_STRING:
- if(bot_cmd.bot_cmd_parm_string)
- strunzone(bot_cmd.bot_cmd_parm_string);
- bot_cmd.bot_cmd_parm_string = strzone(parm);
+ strcpy(bot_cmd.bot_cmd_parm_string, parm);
break;
case BOT_CMD_PARAMETER_VECTOR:
if(substring(parm, 0, 1) != "\'")
{
if(cvar_string_campaignwrapper(theCvar) == theValue)
return;
- string s;
- s = cvar_campaignwrapper_list;
+ string s = cvar_campaignwrapper_list;
cvar_campaignwrapper_list = strzone(strcat("; ", theCvar, " ", theValue, s));
strunzone(s);
//print(cvar_campaignwrapper_list, "\n");
}
if (!assume_unchanged && autocvar_sv_eventlog)
GameLogEcho(strcat(":name:", ftos(this.playerid), ":", playername(this, false)));
- if (CS(this).netname_previous) strunzone(CS(this).netname_previous);
- CS(this).netname_previous = strzone(this.netname);
+ strcpy(CS(this).netname_previous, this.netname);
}
// version nagging
error("empty maplist, cannot select a new map");
Map_Current = bound(0, GetMaplistPosition(), Map_Count - 1);
- if(Map_Current_Name)
- strunzone(Map_Current_Name);
- Map_Current_Name = strzone(argv(Map_Current)); // will be automatically freed on exit thanks to DP
+ strcpy(Map_Current_Name, argv(Map_Current)); // will be automatically freed on exit thanks to DP
// this may or may not be correct, but who cares, in the worst case a map
// isn't chosen in the first pass that should have been
}
{
if (thisname == name)
{
- if (store.(field))
- strunzone(store.(field));
- store.(field) = strzone(argv(f + 1));
+ strcpy(store.(field), argv(f + 1));
}
}
else
string s = func(this, strcat1(store.(field)));
if (s != store.(field))
{
- strunzone(store.(field));
- store.(field) = strzone(s);
+ strcpy(store.(field), s);
}
}
}
#include <common/mutators/base.qh>
// register all possible hooks here
-
+
// to use a hook, first register your mutator using REGISTER_MUTATOR
// then create your function using MUTATOR_HOOKFUNCTION
}
race_SendRankings(newpos, player_prevpos, 0, MSG_ALL);
- if(rankings_reply)
- strunzone(rankings_reply);
- rankings_reply = strzone(getrankings());
+ strcpy(rankings_reply, getrankings());
if(newpos == player_prevpos)
{
if(pos == 1)
race_send_recordtime(MSG_ALL);
- if(rankings_reply)
- strunzone(rankings_reply);
- rankings_reply = strzone(getrankings());
+ strcpy(rankings_reply, getrankings());
}
void race_SendTime(entity e, float cp, float t, float tvalid)
if(t < recordtime || recordtime == 0)
{
race_checkpoint_records[cp] = t;
- if(race_checkpoint_recordholders[cp])
- strunzone(race_checkpoint_recordholders[cp]);
- race_checkpoint_recordholders[cp] = strzone(e.netname);
+ strcpy(race_checkpoint_recordholders[cp], e.netname);
if(g_race_qualifying)
FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.race_checkpoint == cp, { race_SendNextCheckpoint(it, 0); });
}
}
}
- if(worldstatus)
- strunzone(worldstatus);
- worldstatus = strzone(s);
+ strcpy(worldstatus, s);
FOREACH_CLIENT(true, {
string s = "";
s = "-666";
}
- if(it.clientstatus)
- strunzone(it.clientstatus);
- it.clientstatus = strzone(s);
+ strcpy(it.clientstatus, s);
});
}
if(cache_lastmutatormsg != autocvar_g_mutatormsg)
{
- if(cache_lastmutatormsg)
- strunzone(cache_lastmutatormsg);
- if(cache_mutatormsg)
- strunzone(cache_mutatormsg);
- cache_lastmutatormsg = strzone(autocvar_g_mutatormsg);
- cache_mutatormsg = strzone(cache_lastmutatormsg);
+ strcpy(cache_lastmutatormsg, autocvar_g_mutatormsg);
+ strcpy(cache_mutatormsg, cache_lastmutatormsg);
}
if (cache_mutatormsg != "") {
this.reload_ammo_min = sent_ammo_min;
this.reload_ammo_amount = e.reloading_ammo;
this.reload_time = e.reloading_time;
- if (actor.reload_sound) strunzone(actor.reload_sound);
- actor.reload_sound = strzone(Sound_fixpath(sent_sound));
+ strcpy(actor.reload_sound, Sound_fixpath(sent_sound));
// don't reload weapons that don't have the RELOADABLE flag
if (!(e.spawnflags & WEP_FLAG_RELOADABLE))