if(i >= bgmscriptbufsize)
{
LOG_INFOF("ERROR: bgmscript does not define %s", e.bgmscript);
- strunzone(e.bgmscript);
- e.bgmscript = string_null;
+ strfree(e.bgmscript);
}
}
}
if (argv(1))
{
// W_FixWeaponOrder will trash argv, so save what we need.
- string thiscvar = strzone(argv(1));
+ string thiscvar = string_null; strcpy(thiscvar, argv(1));
string s = cvar_string(thiscvar);
if (thiscvar == "cl_weaponpriority")
s = W_FixWeaponOrder(W_NumberWeaponOrder(s), 0);
localcmd("cmd sentcvar ", thiscvar, " \"", s, "\"\n");
- strunzone(thiscvar);
+ strfree(thiscvar);
return;
}
}
centerprint_expire_time[i] = 0;
centerprint_time[i] = 1;
centerprint_msgID[i] = 0;
- if(centerprint_messages[i])
- strunzone(centerprint_messages[i]);
- centerprint_messages[i] = string_null;
+ strfree(centerprint_messages[i]);
}
}
float hud_configure_cp_generation_time;
if (race_status_time - time <= 0) {
race_status_prev = -1;
race_status = -1;
- if(race_status_name)
- strunzone(race_status_name);
- race_status_name = string_null;
- if(race_status_name_prev)
- strunzone(race_status_name_prev);
- race_status_name_prev = string_null;
+ strfree(race_status_name);
+ strfree(race_status_name_prev);
}
}
void QuickMenu_Page_ClearEntry(int i)
{
TC(int, i);
- if (QuickMenu_Page_Description[i])
- strunzone(QuickMenu_Page_Description[i]);
- QuickMenu_Page_Description[i] = string_null;
- if (QuickMenu_Page_Command[i])
- strunzone(QuickMenu_Page_Command[i]);
- QuickMenu_Page_Command[i] = string_null;
+ strfree(QuickMenu_Page_Description[i]);
+ strfree(QuickMenu_Page_Command[i]);
QuickMenu_Page_Command_Type[i] = 0;
}
void QuickMenu_Close()
{
- if (QuickMenu_CurrentSubMenu)
- strunzone(QuickMenu_CurrentSubMenu);
- QuickMenu_CurrentSubMenu = string_null;
+ strfree(QuickMenu_CurrentSubMenu);
int i;
for (i = 0; i < QUICKMENU_MAXLINES; ++i)
QuickMenu_Page_ClearEntry(i);
// It assumes submenu open tag is already detected
void QuickMenu_skip_submenu(string submenu)
{
- string s, z_submenu;
- z_submenu = strzone(submenu);
+ string z_submenu = string_null; strcpy(z_submenu, submenu);
for(++QuickMenu_Buffer_Index ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
{
- s = QuickMenu_Buffer_Get();
+ string s = QuickMenu_Buffer_Get();
if(substring(s, 0, 1) != QM_TAG_SUBMENU)
continue;
if(substring(s, 1, -1) == z_submenu) // submenu end
break;
QuickMenu_skip_submenu(substring(s, 1, -1));
}
- strunzone(z_submenu);
+ strfree(z_submenu);
}
bool QuickMenu_IsOpened()
if(!(nags & BIT(2)))
{
- if(vote_called_vote)
- strunzone(vote_called_vote);
- vote_called_vote = string_null;
+ strfree(vote_called_vote);
vote_active = 0;
}
else
for (i=pos-1; i<= RANKINGS_CNT-1; ++i) {
if (i == RANKINGS_CNT-1) { // clear out last record
grecordtime[i] = 0;
- if (grecordholder[i])
- strunzone(grecordholder[i]);
- grecordholder[i] = string_null;
+ strfree(grecordholder[i]);
}
else {
grecordtime[i] = grecordtime[i+1];
}
// store new ranking
- if(grecordholder[pos-1] != "")
- strunzone(grecordholder[pos-1]);
- grecordholder[pos-1] = strzone(ReadString());
+ strcpy(grecordholder[pos-1], ReadString());
grecordtime[pos-1] = ReadInt24_t();
if(strdecolorize(grecordholder[pos-1]) == strdecolorize(entcs_GetName(player_localnum)))
race_myrank = pos;
wcross_scale_goal_prev = 0;
wcross_alpha_goal_prev = 0;
wcross_changedonetime = 0;
- if(wcross_name_goal_prev)
- strunzone(wcross_name_goal_prev);
- wcross_name_goal_prev = string_null;
- if(wcross_name_goal_prev_prev)
- strunzone(wcross_name_goal_prev_prev);
- wcross_name_goal_prev_prev = string_null;
+ strfree(wcross_name_goal_prev);
+ strfree(wcross_name_goal_prev_prev);
wcross_name_changestarttime = 0;
wcross_name_changedonetime = 0;
wcross_name_alpha_goal_prev = 0;
void Ent_Wall_Remove(entity this)
{
- if(this.bgmscript)
- strunzone(this.bgmscript);
- this.bgmscript = string_null;
+ strfree(this.bgmscript);
}
NET_HANDLE(ENT_CLIENT_WALL, bool isnew)
{
if(campaign_title)
{
- strunzone(campaign_title);
+ strfree(campaign_title);
for(int i = 0; i < campaign_entries; ++i)
{
- strunzone(campaign_gametype[i]);
- strunzone(campaign_mapname[i]);
- strunzone(campaign_mutators[i]);
- strunzone(campaign_shortdesc[i]);
- strunzone(campaign_longdesc[i]);
+ strfree(campaign_gametype[i]);
+ strfree(campaign_mapname[i]);
+ strfree(campaign_mutators[i]);
+ strfree(campaign_shortdesc[i]);
+ strfree(campaign_longdesc[i]);
}
campaign_entries = 0;
- campaign_title = string_null;
}
}
}
DESTRUCTOR(DebugText3d) {
- strunzone(this.message);
+ strfree(this.message);
}
void DebugText3d_draw2d(DebugText3d this) {
.string fld = it.m_playersoundfld;
if (this.(fld))
{
- strunzone(this.(fld));
- this.(fld) = string_null;
+ strfree(this.(fld));
}
});
}
int n = this.sv_entnum;
entity e = entcs_receiver(n);
entcs_receiver(n, NULL);
- if (e.netname) strunzone(e.netname);
- e.netname = string_null;
- if (e.model) strunzone(e.model);
- e.model = string_null;
+ strfree(e.netname);
+ strfree(e.model);
if (e != this) delete(e);
}
if(!piece)
return; // how?!
- if(piece.netname) { strunzone(piece.netname); }
+ strfree(piece.netname);
delete(piece);
minigame_server_sendflags(minigame,MINIG_SF_UPDATE);
return;
if(targ && thetype == targ.bd_tiletype)
{
- if(targ.netname) { strunzone(targ.netname); }
+ strfree(targ.netname);
delete(targ);
}
else if(piece && thetype == piece.bd_tiletype)
{
- if(piece.netname) { strunzone(piece.netname); }
+ strfree(piece.netname);
delete(piece);
}
else return;
while( (e = findentity(e, owner, minigame)) )
if(e.classname == "minigame_board_piece")
{
- if(e.netname) { strunzone(e.netname); }
+ strfree(e.netname);
delete(e);
}
e = NULL;
while( (e = findentity(e, owner, minigame)) )
if(e.classname == "minigame_board_piece")
{
- if(e.netname) { strunzone(e.netname); }
+ strfree(e.netname);
delete(e);
}
e = NULL;
delete(e);
}
- if(minigame.bd_nextlevel) { strunzone(minigame.bd_nextlevel); }
- if(minigame.bd_levelname) { strunzone(minigame.bd_levelname); }
+ strfree(minigame.bd_nextlevel);
+ strfree(minigame.bd_levelname);
return false;
}
case "join":
void bd_set_curr_pos(string s)
{
- if ( bd_curr_pos )
- strunzone(bd_curr_pos);
+ strfree(bd_curr_pos);
if ( s )
s = strzone(s);
bd_curr_pos = s;
while( (e = findentity(e, owner, minigame)) )
if(e.classname == "minigame_board_piece")
{
- if(e.netname) { strunzone(e.netname); }
+ strfree(e.netname);
delete(e);
}
return false;
void c4_set_curr_pos(string s)
{
- if ( c4_curr_pos )
- strunzone(c4_curr_pos);
+ strfree(c4_curr_pos);
if ( s )
s = strzone(s);
c4_curr_pos = s;
while ( ( e = findentity(e,owner,minig) ) )
if ( e.classname == "minigame_nmm_tile" )
{
- strunzone(e.netname);
- strunzone(e.nmm_tile_hmill);
- strunzone(e.nmm_tile_vmill);
+ strfree(e.netname);
+ strfree(e.nmm_tile_hmill);
+ strfree(e.nmm_tile_vmill);
delete(e);
}
}
if(existing)
{
- if(existing.netname) { strunzone(existing.netname); }
+ strfree(existing.netname);
delete(existing);
}
while( (e = findentity(e, owner, minigame)) )
if(e.classname == "minigame_board_piece")
{
- if(e.netname) { strunzone(e.netname); }
+ strfree(e.netname);
delete(e);
}
return false;
void pp_set_curr_pos(string s)
{
- if ( pp_curr_pos )
- strunzone(pp_curr_pos);
+ strfree(pp_curr_pos);
if ( s )
s = strzone(s);
pp_curr_pos = s;
if(!middle)
return false;
- if(middle.netname) { strunzone(middle.netname); }
+ strfree(middle.netname);
delete(middle);
strcpy(piece.netname, pos);
while( (e = findentity(e, owner, minigame)) )
if(e.classname == "minigame_board_piece")
{
- if(e.netname) { strunzone(e.netname); }
+ strfree(e.netname);
delete(e);
}
return false;
void ps_set_curr_pos(string s)
{
- if ( ps_curr_pos )
- strunzone(ps_curr_pos);
+ strfree(ps_curr_pos);
if ( s )
s = strzone(s);
ps_curr_pos = s;
while( (e = findentity(e, owner, minigame)) )
if(e.classname == "minigame_board_piece")
{
- if(e.netname) { strunzone(e.netname); }
+ strfree(e.netname);
delete(e);
}
return false;
void ttt_set_curr_pos(string s)
{
- if ( ttt_curr_pos )
- strunzone(ttt_curr_pos);
+ strfree(ttt_curr_pos);
if ( s )
s = strzone(s);
ttt_curr_pos = s;
delete(e);
}
- strunzone(minigame_session.netname);
+ strfree(minigame_session.netname);
delete(minigame_session);
}
void Monster_Sounds_Clear(entity this)
{
-#define _MSOUND(m) if(this.monstersound_##m) { strunzone(this.monstersound_##m); this.monstersound_##m = string_null; }
+#define _MSOUND(m) strfree(this.monstersound_##m);
ALLMONSTERSOUNDS
#undef _MSOUND
}
}
DESTRUCTOR(DamageText) {
- if (this.text) strunzone(this.text);
+ strfree(this.text);
if (this == DamageText_screen_first) {
// start from 0 offset again, hopefully, others (if any) will have faded away by now
DamageText_screen_first = NULL;
// if the object being removed has been selected for attachment by a player, unset it
FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.object_attach == e, { it.object_attach = NULL; });
- if(e.material) { strunzone(e.material); e.material = string_null; }
- if(e.crypto_idfp) { strunzone(e.crypto_idfp); e.crypto_idfp = string_null; }
- if(e.netname) { strunzone(e.netname); e.netname = string_null; }
- if(e.message) { strunzone(e.message); e.message = string_null; }
- if(e.message2) { strunzone(e.message2); e.message2 = string_null; }
+ strfree(e.material);
+ strfree(e.crypto_idfp);
+ strfree(e.netname);
+ strfree(e.message);
+ strfree(e.message2);
delete(e);
e = NULL;
e.old_movetype = stof(argv(argv_num)); ++argv_num;
set_movetype(e, e.old_movetype);
e.damageforcescale = stof(argv(argv_num)); ++argv_num;
- if(e.material) strunzone(e.material); if(argv(argv_num) != "") e.material = strzone(argv(argv_num)); else e.material = string_null; ++argv_num;
+ strfree(e.material); if(argv(argv_num) != "") e.material = strzone(argv(argv_num)); else e.material = string_null; ++argv_num;
if(database)
{
// properties stored only for the database
- if(e.crypto_idfp) strunzone(e.crypto_idfp); if(argv(argv_num) != "") e.crypto_idfp = strzone(argv(argv_num)); else e.crypto_idfp = string_null; ++argv_num;
- if(e.netname) strunzone(e.netname); e.netname = strzone(argv(argv_num)); ++argv_num;
- if(e.message) strunzone(e.message); e.message = strzone(argv(argv_num)); ++argv_num;
- if(e.message2) strunzone(e.message2); e.message2 = strzone(argv(argv_num)); ++argv_num;
+ strfree(e.crypto_idfp); if(argv(argv_num) != "") e.crypto_idfp = strzone(argv(argv_num)); else e.crypto_idfp = string_null; ++argv_num;
+ strcpy(e.netname, argv(argv_num)); ++argv_num;
+ strcpy(e.message, argv(argv_num)); ++argv_num;
+ strcpy(e.message2, argv(argv_num)); ++argv_num;
}
// attach last
e.damageforcescale = stof(argv(3));
break;
case "material":
- if(e.material) strunzone(e.material);
+ strfree(e.material);
if(argv(3))
{
for (j = 1; j <= 5; j++) // precache material sounds, 5 in total
void Ent_RemoveWaypointSprite(entity this)
{
- if (this.netname) strunzone(this.netname);
- if (this.netname2) strunzone(this.netname2);
- if (this.netname3) strunzone(this.netname3);
+ strfree(this.netname);
+ strfree(this.netname2);
+ strfree(this.netname3);
}
/** flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable] */
this.owner.nent_name
));
#endif
- for (int i = 0; i < this.nent_stringcount; ++i) { if (this.nent_strings[i]) strunzone(this.nent_strings[i]); }
+ for (int i = 0; i < this.nent_stringcount; ++i) { strfree(this.nent_strings[i]); }
delete(this);
}
}
}
- strunzone(p.playerstats_id);
- p.playerstats_id = string_null;
+ strfree(p.playerstats_id);
}
void PlayerStats_GameReport(float finished)
void ItemRemove(entity this)
{
- if(this.mdl)
- strunzone(this.mdl);
+ strfree(this.mdl);
}
NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
if(!warpzone_warpzones_exist && this.fade_start && !autocvar_cl_items_nofade)
setpredraw(this, Item_PreDraw);
- if(this.mdl)
- strunzone(this.mdl);
+ strfree(this.mdl);
this.mdl = "";
string _fn = ReadString();
void func_ladder_remove(entity this)
{
- if(this.classname) { strunzone(this.classname); }
- this.classname = string_null;
+ strfree(this.classname);
}
NET_HANDLE(ENT_CLIENT_LADDER, bool isnew)
void Ent_PointParticles_Remove(entity this)
{
- if(this.noise)
- strunzone(this.noise);
- this.noise = string_null;
- if(this.bgmscript)
- strunzone(this.bgmscript);
- this.bgmscript = string_null;
- if(this.mdl)
- strunzone(this.mdl);
- this.mdl = string_null;
+ strfree(this.noise);
+ strfree(this.bgmscript);
+ strfree(this.mdl);
}
NET_HANDLE(ENT_CLIENT_POINTPARTICLES, bool isnew)
void corner_remove(entity this)
{
- if(this.target) { strunzone(this.target); }
- this.target = string_null;
-
- if(this.target2) { strunzone(this.target2); }
- this.target2 = string_null;
-
- if(this.target3) { strunzone(this.target3); }
- this.target3 = string_null;
-
- if(this.target4) { strunzone(this.target4); }
- this.target4 = string_null;
-
- if(this.targetname) { strunzone(this.targetname); }
- this.targetname = string_null;
-
- if(this.platmovetype) { strunzone(this.platmovetype); }
- this.platmovetype = string_null;
+ strfree(this.target);
+ strfree(this.target2);
+ strfree(this.target3);
+ strfree(this.target4);
+ strfree(this.targetname);
+ strfree(this.platmovetype);
}
NET_HANDLE(ENT_CLIENT_CORNER, bool isnew)
void teleport_dest_remove(entity this)
{
- //if(this.classname)
- //strunzone(this.classname);
- //this.classname = string_null;
-
- if(this.targetname)
- strunzone(this.targetname);
- this.targetname = string_null;
+ // strfree(this.classname);
+ strfree(this.targetname);
}
NET_HANDLE(ENT_CLIENT_TELEPORT_DEST, bool isnew)
if(getsoundtime(e, CH_BGM_SINGLE) < 0)
{
LOG_TRACEF("Cannot initialize sound %s", e.noise);
- strunzone(e.noise);
- e.noise = string_null;
+ strfree(e.noise);
}
}
e.volume = vol;
void Ent_TriggerMusic_Remove(entity this)
{
- if(this.noise)
- strunzone(this.noise);
- this.noise = string_null;
+ strfree(this.noise);
}
NET_HANDLE(ENT_CLIENT_TRIGGER_MUSIC, bool isnew)
if(getsoundtime(this, CH_BGM_SINGLE) < 0)
{
LOG_TRACEF("Cannot initialize sound %s", this.noise);
- strunzone(this.noise);
- this.noise = string_null;
+ strfree(this.noise);
}
}
}
void target_push_remove(entity this)
{
- //if(this.classname)
- //strunzone(this.classname);
- //this.classname = string_null;
-
- if(this.targetname)
- strunzone(this.targetname);
- this.targetname = string_null;
+ // strfree(this.classname);
+ strfree(this.targetname);
}
NET_HANDLE(ENT_CLIENT_TARGET_PUSH, bool isnew)
#elif defined(CSQC)
void keylock_remove(entity this)
{
- if(this.target) { strunzone(this.target); }
- this.target = string_null;
-
- if(this.target2) { strunzone(this.target2); }
- this.target2 = string_null;
-
- if(this.target3) { strunzone(this.target3); }
- this.target3 = string_null;
-
- if(this.target4) { strunzone(this.target4); }
- this.target4 = string_null;
-
- if(this.killtarget) { strunzone(this.killtarget); }
- this.killtarget = string_null;
-
- if(this.targetname) { strunzone(this.targetname); }
- this.targetname = string_null;
+ strfree(this.target);
+ strfree(this.target2);
+ strfree(this.target3);
+ strfree(this.target4);
+ strfree(this.killtarget);
+ strfree(this.targetname);
}
NET_HANDLE(ENT_CLIENT_KEYLOCK, bool isnew)
if(withtarget)
{
- if(this.target) { strunzone(this.target); }
- if(this.target2) { strunzone(this.target2); }
- if(this.target3) { strunzone(this.target3); }
- if(this.target4) { strunzone(this.target4); }
- if(this.targetname) { strunzone(this.targetname); }
- if(this.killtarget) { strunzone(this.killtarget); }
+ strfree(this.target);
+ strfree(this.target2);
+ strfree(this.target3);
+ strfree(this.target4);
+ strfree(this.targetname);
+ strfree(this.killtarget);
int targbits = ReadByte();
void trigger_remove_generic(entity this)
{
- if(this.target) { strunzone(this.target); }
- this.target = string_null;
-
- if(this.target2) { strunzone(this.target2); }
- this.target2 = string_null;
-
- if(this.target3) { strunzone(this.target3); }
- this.target3 = string_null;
-
- if(this.target4) { strunzone(this.target4); }
- this.target4 = string_null;
-
- if(this.targetname) { strunzone(this.targetname); }
- this.target = string_null;
-
- if(this.killtarget) { strunzone(this.killtarget); }
- this.killtarget = string_null;
+ strfree(this.target);
+ strfree(this.target2);
+ strfree(this.target3);
+ strfree(this.target4);
+ strfree(this.targetname);
+ strfree(this.killtarget);
}
#endif
if(to_execute_next_frame)
{
localcmd("\n", to_execute_next_frame, "\n");
- strunzone(to_execute_next_frame);
- to_execute_next_frame = string_null;
+ strfree(to_execute_next_frame);
}
}
void queue_to_execute_next_frame(string s)
fh.url_verb = "PUT";
fh.url_content_type = "application/json";
url_fputs(fh, sprintf("{\"msgtype\": \"m.text\", \"body\": \"%s\"}", pass.message));
- strunzone(pass.message); delete(pass);
+ strfree(pass.message);
+ delete(pass);
url_fclose(fh);
break;
}
{
if (g_buf == "") return;
localcmd("\ncmd c2s \"", strreplace("$", "$$", g_buf), "\"\n");
- strunzone(g_buf);
- g_buf = string_null;
+ strfree(g_buf);
}
#endif
string s = string_null;
yenc_single(b, s);
string tmp = strcat(g_buf, s);
- if (g_buf) strunzone(g_buf);
- g_buf = strzone(tmp);
+ strcpy(g_buf, tmp);
}
void WriteShort(int to, int b)
{
#define REPLICATE_string(fld, var, func) \
REPLICATE_7(fld, string, var, , \
{ strcpy(field, it); }, \
- { if (field) strunzone(field); field = string_null; }, \
+ { strfree(field); }, \
{ \
/* also initialize to the default value of func when requesting cvars */ \
string s = func(field); \
if (s != field) \
{ \
- strunzone(field); \
- field = strzone(s); \
+ strcpy(field, s); \
} \
})
#define REPLICATE_float(fld, var, func) REPLICATE_7(fld, float, var, func, { field = stof(it); }, , )
this = strzone(s); \
MACRO_END
+#define strfree(this) MACRO_BEGIN \
+ if (this) { \
+ strunzone(this); \
+ } \
+ this = string_null; \
+MACRO_END
+
ERASEABLE
string seconds_tostring(float sec)
{
{
LOG_INFO("url_URI_Get_Callback: out of memory in buf_create");
e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
- strunzone(e.url_url);
+ strfree(e.url_url);
delete(e);
return 1;
}
{
LOG_INFO("url_URI_Get_Callback: out of memory in buf_create");
e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
- strunzone(e.url_url);
+ strfree(e.url_url);
delete(e);
return 1;
}
{
// an ERROR
e.url_ready(e, e.url_ready_pass, -fabs(status));
- strunzone(e.url_url);
+ strfree(e.url_url);
delete(e);
return 1;
}
{
LOG_INFO("url_single_fopen: out of memory in buf_create");
rdy(e, pass, URL_READY_ERROR);
- strunzone(e.url_url);
+ strfree(e.url_url);
delete(e);
return;
}
LOG_INFO("url_fclose: too many concurrent requests");
e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
buf_del(e.url_wbuf);
- strunzone(e.url_url);
+ strfree(e.url_url);
delete(e);
return;
}
LOG_INFO("url_fclose: failure in crypto_uri_postbuf");
e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
buf_del(e.url_wbuf);
- strunzone(e.url_url);
+ strfree(e.url_url);
delete(e);
return;
}
// we have READ all data, just close
e.url_ready(e, e.url_ready_pass, URL_READY_CLOSED);
buf_del(e.url_rbuf);
- strunzone(e.url_url);
+ strfree(e.url_url);
delete(e);
}
}
{
LOG_INFO("uri_multi_ready: got HTTP error 422, data is in unusable format - not continuing");
me.url_ready(fh, me.url_ready_pass, status);
- strunzone(me.url_url);
+ strfree(me.url_url);
delete(me);
return;
}
if (n <= me.url_attempt)
{
me.url_ready(fh, me.url_ready_pass, status);
- strunzone(me.url_url);
+ strfree(me.url_url);
delete(me);
return;
}
void InputBox_setText(entity me, string txt)
{
- if (me.text) strunzone(me.text);
+ strfree(me.text);
SUPER(InputBox).setText(me, strzone(txt));
}
if (m_goto_buffer)
{
m_goto(m_goto_buffer);
- strunzone(m_goto_buffer);
- m_goto_buffer = string_null;
+ strfree(m_goto_buffer);
}
if (Menu_Active) m_display(); // delayed menu display
if (menuTooltipItem == NULL)
{
- if (menuTooltipText)
- {
- strunzone(menuTooltipText);
- menuTooltipText = string_null;
- }
+ strfree(menuTooltipText);
return;
}
else
for(i = 0; i < campaign_entries; ++i)
{
l = l0;
- if(campaign_longdesc_wrapped[i])
- strunzone(campaign_longdesc_wrapped[i]);
+ strfree(campaign_longdesc_wrapped[i]);
n = tokenizebyseparator(campaign_longdesc[i], "\n");
r = "";
for(j = 0; j < n; ++j)
if(me.nItems == 0)
return;
- if(me.cvarType)
- strunzone(me.cvarType);
+ strfree(me.cvarType);
strcpy(me.cvarName, bufstr_get(me.handle, me.selectedItem));
strcpy(me.cvarDescription, cvar_description(me.cvarName));
strcpy(me.cvarDefault, cvar_defstring(me.cvarName));
void DemoList_Filter_Change(entity box, entity me)
{
- if(me.filterString)
- strunzone(me.filterString);
+ strfree(me.filterString);
if(box.text != "")
{
// clear old values
for(i = 0; i < e.nValues; ++i);
{
- if(e.(valueStrings[i]))
- {
- strunzone(e.(valueStrings[i]));
- e.(valueStrings[i]) = string_null;
- }
- if(e.(valueIdentifiers[i]))
- {
- strunzone(e.(valueIdentifiers[i]));
- e.(valueIdentifiers[i]) = string_null;
- }
+ strfree(e.(valueStrings[i]));
+ strfree(e.(valueIdentifiers[i]));
}
e.clearValues(e);
// ====================================
// First clear and unzone the strings
// ====================================
- if(me.currentServerName)
- strunzone(me.currentServerName);
- me.currentServerName = string_null;
-
- if(me.currentServerCName)
- strunzone(me.currentServerCName);
- me.currentServerCName = string_null;
-
- if(me.currentServerType)
- strunzone(me.currentServerType);
- me.currentServerType = string_null;
-
- if(me.currentServerMap)
- strunzone(me.currentServerMap);
- me.currentServerMap = string_null;
-
- if(me.currentServerPlayers)
- strunzone(me.currentServerPlayers);
- me.currentServerPlayers = string_null;
-
- if(me.currentServerNumPlayers)
- strunzone(me.currentServerNumPlayers);
- me.currentServerNumPlayers = string_null;
-
- if(me.currentServerNumBots)
- strunzone(me.currentServerNumBots);
- me.currentServerNumBots = string_null;
-
- if(me.currentServerNumFreeSlots)
- strunzone(me.currentServerNumFreeSlots);
- me.currentServerNumFreeSlots = string_null;
-
- if(me.currentServerMod)
- strunzone(me.currentServerMod);
- me.currentServerMod = string_null;
-
- if(me.currentServerVersion)
- strunzone(me.currentServerVersion);
- me.currentServerVersion = string_null;
-
+ strfree(me.currentServerName);
+ strfree(me.currentServerCName);
+ strfree(me.currentServerType);
+ strfree(me.currentServerMap);
+ strfree(me.currentServerPlayers);
+ strfree(me.currentServerNumPlayers);
+ strfree(me.currentServerNumBots);
+ strfree(me.currentServerNumFreeSlots);
+ strfree(me.currentServerMod);
+ strfree(me.currentServerVersion);
// not zoned!
- //if(me.currentServerEncrypt)
- // strunzone(me.currentServerEncrypt);
- //me.currentServerEncrypt = string_null;
- if(me.currentServerPure)
- strunzone(me.currentServerPure);
- me.currentServerPure = string_null;
-
- if(me.currentServerKey)
- strunzone(me.currentServerKey);
- me.currentServerKey = string_null;
-
- if(me.currentServerID)
- strunzone(me.currentServerID);
- me.currentServerID = string_null;
+ // strfree(me.currentServerEncrypt);
+ strfree(me.currentServerPure);
+ strfree(me.currentServerKey);
+ strfree(me.currentServerID);
// ==========================
// Now, fill in the strings
void HUDSkinList_SavedName_Change(entity box, entity me)
{
- if(me.savedName)
- strunzone(me.savedName);
+ strfree(me.savedName);
if(box.text != "")
me.savedName = strzone(box.text);
- else
- me.savedName = string_null;
}
void HUDSkinList_Filter_Change(entity box, entity me)
{
- if(me.filterString)
- strunzone(me.filterString);
+ strfree(me.filterString);
if(box.text != "")
{
else
me.filterString = strzone(strcat("*", box.text, "*"));
}
- else
- me.filterString = string_null;
me.getHUDSkins(me);
}
for(int i = 0; i < MAX_KEYBINDS; ++i)
{
- if(Xonotic_KeyBinds_Functions[i])
- strunzone(Xonotic_KeyBinds_Functions[i]);
- Xonotic_KeyBinds_Functions[i] = string_null;
- if(Xonotic_KeyBinds_Descriptions[i])
- strunzone(Xonotic_KeyBinds_Descriptions[i]);
- Xonotic_KeyBinds_Descriptions[i] = string_null;
+ strfree(Xonotic_KeyBinds_Functions[i]);
+ strfree(Xonotic_KeyBinds_Descriptions[i]);
}
Xonotic_KeyBinds_Count = 0;
}
void MapList_StringFilterBox_Change(entity box, entity me)
{
- if(me.stringFilter)
- strunzone(me.stringFilter);
+ strfree(me.stringFilter);
if(box.text != "")
me.stringFilter = strzone(box.text);
- else
- me.stringFilter = string_null;
me.refilter(me);
}
void ScreenshotList_Filter_Change(entity box, entity me)
{
- if(me.filterString)
- strunzone(me.filterString);
+ strfree(me.filterString);
if(box.text != "")
{
else
me.filterString = strzone(strcat("*", box.text, "*"));
}
- else
- me.filterString = string_null;
ScreenshotList_Refresh_Click(NULL, me);
}
} } \
if(catnum) \
{ \
- strunzone(categories[i].override_string); \
- categories[i].override_string = string_null; \
+ strfree(categories[i].override_string); \
categories[i].override_field = catnum; \
continue; \
} \
); \
} \
} \
- strunzone(categories[i].override_string); \
- categories[i].override_string = string_null; \
+ strfree(categories[i].override_string); \
categories[i].override_field = 0; \
}
PROCESS_OVERRIDE(cat_enoverride_string, cat_enoverride)
}
void ServerList_Filter_Change(entity box, entity me)
{
- if(me.filterString)
- strunzone(me.filterString);
+ strfree(me.filterString);
if(box.text != "")
me.filterString = strzone(box.text);
- else
- me.filterString = string_null;
me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
me.ipAddressBox.setText(me.ipAddressBox, "");
me.sortButton4.forcePressed = 0;
me.sortButton5.forcePressed = (fld == SLIST_FIELD_NUMHUMANS);
me.selectedItem = 0;
- if(me.selectedServer)
- strunzone(me.selectedServer);
- me.selectedServer = string_null;
+ strfree(me.selectedServer);
me.refreshServerList(me, REFRESHSERVERLIST_REFILTER);
}
void XonoticServerList_positionSortButton(entity me, entity btn, float theOrigin, float theSize, string theTitle, void(entity, entity) theFunc)
void SoundList_Filter_Change(entity box, entity me)
{
- if(me.filterString)
- strunzone(me.filterString);
+ strfree(me.filterString);
if(box.text != "")
me.filterString = strzone(box.text);
- else
- me.filterString = string_null;
me.getSounds(me);
}
theTooltip = string_null;
}
- if(e.tooltip)
- strunzone(e.tooltip);
+ strfree(e.tooltip);
e.tooltip = (theTooltip != "") ? strzone(theTooltip) : string_null;
}
if (!IS_BOT_CLIENT(this))
return;
bot_clearqueue(this);
- if(this.cleanname)
- strunzone(this.cleanname);
- if(this.netname_freeme)
- strunzone(this.netname_freeme);
- if(this.playermodel_freeme)
- strunzone(this.playermodel_freeme);
- if(this.playerskin_freeme)
- strunzone(this.playerskin_freeme);
- this.cleanname = string_null;
- this.netname_freeme = string_null;
- this.playermodel_freeme = string_null;
- this.playerskin_freeme = string_null;
+ strfree(this.cleanname);
+ strfree(this.netname_freeme);
+ strfree(this.playermodel_freeme);
+ strfree(this.playerskin_freeme);
if(this.bot_cmd_current)
delete(this.bot_cmd_current);
if(bot_waypoint_queue_owner == this)
it.bot_barrier = 0;
for(int i = 0; i < it.bot_places_count; ++i)
{
- strunzone(it.(bot_placenames[i]));
- it.(bot_placenames[i]) = string_null;
+ strfree(it.(bot_placenames[i]));
}
it.bot_places_count = 0;
});
MUTATOR_CALLHOOK(ClientDisconnect, this);
- if (CS(this).netname_previous) strunzone(CS(this).netname_previous); // needs to be before the CS entity is removed!
- if (CS(this).weaponorder_byimpulse) strunzone(CS(this).weaponorder_byimpulse);
+ strfree(CS(this).netname_previous); // needs to be before the CS entity is removed!
+ strfree(CS(this).weaponorder_byimpulse);
ClientState_detach(this);
Portal_ClearAll(this);
bot_relinkplayerlist();
- if (this.clientstatus) strunzone(this.clientstatus);
+ strfree(this.clientstatus);
if (this.personal) delete(this.personal);
this.playerid = 0;
if (vote_called)
{
- strunzone(vote_called_command);
- strunzone(vote_called_display);
- strunzone(vote_caller_name);
+ strfree(vote_called_command);
+ strfree(vote_called_display);
+ strfree(vote_caller_name);
}
vote_called = VOTE_NULL;
vote_caller = NULL;
- vote_caller_name = string_null;
vote_endtime = 0;
- vote_called_command = string_null;
- vote_called_display = string_null;
-
vote_parsed_command = string_null;
vote_parsed_display = string_null;
string k, v, d;
float n, i, adding, pureadding;
- if(cvar_changes)
- strunzone(cvar_changes);
- cvar_changes = string_null;
- if(cvar_purechanges)
- strunzone(cvar_purechanges);
- cvar_purechanges = string_null;
+ strfree(cvar_changes);
+ strfree(cvar_purechanges);
cvar_purechanges_count = 0;
h = buf_create();
if(argc == 0)
goto killme;
- if(OnlineBanList_Servers)
- strunzone(OnlineBanList_Servers);
- OnlineBanList_Servers = argv(0);
- for(i = 1; i < argc; ++i)
- OnlineBanList_Servers = strcat(OnlineBanList_Servers, ";", argv(i));
- OnlineBanList_Servers = strzone(OnlineBanList_Servers);
+ string s = argv(0); for(i = 1; i < argc; ++i) s = strcat(s, ";", argv(i));
+ strcpy(OnlineBanList_Servers, s);
uri = strcat( "action=list&hostname=", uri_escape(autocvar_hostname));
uri = strcat(uri, "&servers=", uri_escape(OnlineBanList_Servers));
{
for(int j = 0; j < mapvote_count; ++j)
{
- if ( mapvote_maps[j] )
- {
- strunzone(mapvote_maps[j]);
- mapvote_maps[j] = string_null;
- }
- if ( mapvote_maps_pakfile[j] )
- {
- strunzone(mapvote_maps_pakfile[j]);
- mapvote_maps_pakfile[j] = string_null;
- }
+ strfree(mapvote_maps[j]);
+ strfree(mapvote_maps_pakfile[j]);
}
}
{
if (f < 0)
{
- if (store.(field))
- strunzone(store.(field));
- store.(field) = string_null;
+ strfree(store.(field));
}
else if (f > 0)
{
}
string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(entity this, string wo)
{
- string o;
- o = W_FixWeaponOrder_ForceComplete(wo);
- if(CS(this).weaponorder_byimpulse)
- {
- strunzone(CS(this).weaponorder_byimpulse);
- CS(this).weaponorder_byimpulse = string_null;
- }
- CS(this).weaponorder_byimpulse = strzone(W_FixWeaponOrder_BuildImpulseList(o));
+ string o = W_FixWeaponOrder_ForceComplete(wo);
+ strcpy(CS(this).weaponorder_byimpulse, W_FixWeaponOrder_BuildImpulseList(o));
return o;
}
if(player.stored_netname != player.netname)
{
db_put(ServerProgsDB, strcat("/uid2name/", player.crypto_idfp), player.netname);
- strunzone(player.stored_netname);
- player.stored_netname = strzone(player.netname);
+ strcpy(player.stored_netname, player.netname);
}
}
}
if(player.stored_netname != player.netname)
{
db_put(ServerProgsDB, strcat("/uid2name/", player.crypto_idfp), player.netname);
- strunzone(player.stored_netname);
- player.stored_netname = strzone(player.netname);
+ strcpy(player.stored_netname, player.netname);
}
}
if(player.stored_netname != player.netname)
{
db_put(ServerProgsDB, strcat("/uid2name/", player.crypto_idfp), player.netname);
- strunzone(player.stored_netname);
- player.stored_netname = strzone(player.netname);
+ strcpy(player.stored_netname, player.netname);
}
}
for(int j = 0; j < MAX_CHECKPOINTS; ++j)
{
race_checkpoint_records[j] = 0;
- if(race_checkpoint_recordholders[j])
- strunzone(race_checkpoint_recordholders[j]);
- race_checkpoint_recordholders[j] = string_null;
+ strfree(race_checkpoint_recordholders[j]);
}
FOREACH_CLIENT(true, {