Minor optimizations.

This commit is contained in:
shavitush 2016-11-04 09:50:16 +02:00
parent 9e91f9373e
commit 82829e8b16
No known key found for this signature in database
GPG Key ID: 0A298F154527B9A4
7 changed files with 45 additions and 63 deletions

View File

@ -427,6 +427,7 @@ public Action Command_TeleportEnd(int client, int args)
if(gB_Zones && Shavit_ZoneExists(Zone_End))
{
Shavit_StopTimer(client);
Call_StartForward(gH_Forwards_OnEnd);
Call_PushCell(client);
Call_Finish();
@ -1202,18 +1203,15 @@ void SQL_SetPrefix()
{
SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it.");
}
char[] sLine = new char[PLATFORM_MAX_PATH*2];
else
while(fFile.ReadLine(sLine, PLATFORM_MAX_PATH*2))
{
char[] sLine = new char[PLATFORM_MAX_PATH*2];
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
while(fFile.ReadLine(sLine, PLATFORM_MAX_PATH*2))
{
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
break;
}
break;
}
delete fFile;

View File

@ -240,7 +240,6 @@ public void OnPluginStart()
// crons
CreateTimer(1.0, Timer_Scoreboard, 0, TIMER_REPEAT);
CreateTimer(gF_AdvertisementInterval, Timer_Advertisement, 0, TIMER_REPEAT);
if(LibraryExists("dhooks"))
{
@ -370,6 +369,8 @@ public void OnMapStart()
Shavit_OnStyleConfigLoaded(-1);
Shavit_OnChatConfigLoaded();
}
CreateTimer(gF_AdvertisementInterval, Timer_Advertisement, 0, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
bool LoadAdvertisementsConfig()
@ -723,12 +724,10 @@ public void OnWeaponDrop(int client, int entity)
// hide
public Action OnSetTransmit(int entity, int client)
{
if(client != entity && gB_Hide[client])
if(gB_Hide[client] && client != entity && (!IsClientObserver(client) || (GetEntProp(client, Prop_Send, "m_iObserverMode") != 6 &&
GetEntPropEnt(client, Prop_Send, "m_hObserverTarget") != entity)))
{
if(!IsClientObserver(client) || (GetEntProp(client, Prop_Send, "m_iObserverMode") != 6 && GetEntPropEnt(client, Prop_Send, "m_hObserverTarget") != entity))
{
return Plugin_Handled;
}
return Plugin_Handled;
}
return Plugin_Continue;
@ -881,10 +880,10 @@ public int MenuHandler_Teleport(Menu menu, MenuAction action, int param1, int pa
{
if(action == MenuAction_Select)
{
char[] info = new char[16];
menu.GetItem(param2, info, 16);
char[] sInfo = new char[16];
menu.GetItem(param2, sInfo, 16);
if(!Teleport(param1, StringToInt(info)))
if(!Teleport(param1, StringToInt(sInfo)))
{
Command_Teleport(param1, 0);
}

View File

@ -991,18 +991,15 @@ void SQL_SetPrefix()
{
SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it.");
}
char[] sLine = new char[PLATFORM_MAX_PATH*2];
else
while(fFile.ReadLine(sLine, PLATFORM_MAX_PATH*2))
{
char[] sLine = new char[PLATFORM_MAX_PATH*2];
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
while(fFile.ReadLine(sLine, PLATFORM_MAX_PATH*2))
{
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
break;
}
break;
}
delete fFile;

View File

@ -217,18 +217,15 @@ void SQL_SetPrefix()
{
SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it.");
}
char[] sLine = new char[PLATFORM_MAX_PATH*2];
else
while(fFile.ReadLine(sLine, PLATFORM_MAX_PATH*2))
{
char[] sLine = new char[PLATFORM_MAX_PATH*2];
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
while(fFile.ReadLine(sLine, PLATFORM_MAX_PATH*2))
{
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
break;
}
break;
}
delete fFile;

View File

@ -142,18 +142,15 @@ void SQL_SetPrefix()
{
SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it.");
}
char[] sLine = new char[PLATFORM_MAX_PATH*2];
else
while(fFile.ReadLine(sLine, PLATFORM_MAX_PATH*2))
{
char[] sLine = new char[PLATFORM_MAX_PATH*2];
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
while(fFile.ReadLine(sLine, PLATFORM_MAX_PATH*2))
{
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
break;
}
break;
}
delete fFile;

View File

@ -1327,18 +1327,15 @@ void SQL_SetPrefix()
{
SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it.");
}
char[] sLine = new char[PLATFORM_MAX_PATH*2];
else
while(fFile.ReadLine(sLine, PLATFORM_MAX_PATH*2))
{
char[] sLine = new char[PLATFORM_MAX_PATH*2];
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
while(fFile.ReadLine(sLine, PLATFORM_MAX_PATH*2))
{
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
break;
}
break;
}
delete fFile;

View File

@ -2053,18 +2053,15 @@ void SQL_SetPrefix()
{
SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it.");
}
char[] sLine = new char[PLATFORM_MAX_PATH*2];
else
while(fFile.ReadLine(sLine, PLATFORM_MAX_PATH*2))
{
char[] sLine = new char[PLATFORM_MAX_PATH * 2];
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
while(fFile.ReadLine(sLine, PLATFORM_MAX_PATH * 2))
{
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
break;
}
break;
}
delete fFile;