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)) if(gB_Zones && Shavit_ZoneExists(Zone_End))
{ {
Shavit_StopTimer(client); Shavit_StopTimer(client);
Call_StartForward(gH_Forwards_OnEnd); Call_StartForward(gH_Forwards_OnEnd);
Call_PushCell(client); Call_PushCell(client);
Call_Finish(); Call_Finish();
@ -1203,17 +1204,14 @@ void SQL_SetPrefix()
SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it."); SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it.");
} }
else char[] sLine = new char[PLATFORM_MAX_PATH*2];
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)) break;
{
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
break;
}
} }
delete fFile; delete fFile;

View File

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

View File

@ -992,17 +992,14 @@ void SQL_SetPrefix()
SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it."); SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it.");
} }
else char[] sLine = new char[PLATFORM_MAX_PATH*2];
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)) break;
{
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
break;
}
} }
delete fFile; delete fFile;

View File

@ -218,17 +218,14 @@ void SQL_SetPrefix()
SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it."); SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it.");
} }
else char[] sLine = new char[PLATFORM_MAX_PATH*2];
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)) break;
{
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
break;
}
} }
delete fFile; delete fFile;

View File

@ -143,17 +143,14 @@ void SQL_SetPrefix()
SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it."); SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it.");
} }
else char[] sLine = new char[PLATFORM_MAX_PATH*2];
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)) break;
{
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
break;
}
} }
delete fFile; delete fFile;

View File

@ -1328,17 +1328,14 @@ void SQL_SetPrefix()
SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it."); SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it.");
} }
else char[] sLine = new char[PLATFORM_MAX_PATH*2];
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)) break;
{
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
break;
}
} }
delete fFile; delete fFile;

View File

@ -2054,17 +2054,14 @@ void SQL_SetPrefix()
SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it."); SetFailState("Cannot open \"configs/shavit-prefix.txt\". Make sure this file exists and that the server has read permissions to it.");
} }
else char[] sLine = new char[PLATFORM_MAX_PATH*2];
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)) break;
{
TrimString(sLine);
strcopy(gS_MySQLPrefix, 32, sLine);
break;
}
} }
delete fFile; delete fFile;