style: brackets

This commit is contained in:
2020-11-28 23:04:55 +03:00
parent 63b031b111
commit ee260f7a10
211 changed files with 3797 additions and 3797 deletions

View File

@ -13,42 +13,42 @@ var const int StartIndex[5],EndIndex[5];
var const array<string> CN;
var const array<FCountryTagEntry> CT;
static final function string GetClientCountryStr( string IP )
static final function string GetClientCountryStr(string IP)
{
local int i;
local array<string> SA;
// Convert dotted IP-address into integer.
ParseStringIntoArray(IP,SA,".",false);
if( SA.Length<=1 )
if(SA.Length<=1)
return "???";
i = int(SA[0])<<16 | int(SA[1])<<8 | int(SA[2]);
return GetClientCountryTag(i);
}
static final function string GetClientCountryTag( int IP )
static final function string GetClientCountryTag(int IP)
{
local byte V;
local int End,i;
V = IP>>16; // Grab last IP value for lookup table.
if( V<=50 )
if(V<=50)
V = 0;
else if( V<=100 )
else if(V<=100)
V = 1;
else if( V<=150 )
else if(V<=150)
V = 2;
else if( V<=200 )
else if(V<=200)
V = 3;
else V = 4;
// Speed up using lookup table.
End = Default.EndIndex[V];
for( i=Default.StartIndex[V]; i<End; ++i )
for(i=Default.StartIndex[V]; i<End; ++i)
{
if( IP>=Default.CT[i].S && IP<=Default.CT[i].E ) // See if entered range.
if(IP>=Default.CT[i].S && IP<=Default.CT[i].E) // See if entered range.
return Default.CN[Default.CT[i].C];
}
return "???";

View File

@ -8,13 +8,13 @@ var array<byte> Buffer;
var array<string> StrMap;
const CurrentSaveVer=1;
final function bool LoadStatFile( PlayerController Other )
final function bool LoadStatFile(PlayerController Other)
{
local string S;
FlushData();
S = class'ServerExtMut'.Static.GetStatFile(Other.PlayerReplicationInfo.UniqueId);
if( Class'Engine'.Static.BasicLoadObject(Self,S,false,CurrentSaveVer) )
if(Class'Engine'.Static.BasicLoadObject(Self,S,false,CurrentSaveVer))
{
BufferSize = Buffer.Length;
return true;
@ -23,7 +23,7 @@ final function bool LoadStatFile( PlayerController Other )
Buffer.Length = 0;
return false;
}
final function SaveStatFile( PlayerController Other )
final function SaveStatFile(PlayerController Other)
{
local string S;
@ -31,59 +31,59 @@ final function SaveStatFile( PlayerController Other )
Class'Engine'.Static.BasicSaveObject(Self,S,false,CurrentSaveVer);
}
function SaveInt( int Value, optional byte MaxVal )
function SaveInt(int Value, optional byte MaxVal)
{
++MaxVal;
if( (BufferOffset+MaxVal)>Buffer.Length )
if((BufferOffset+MaxVal)>Buffer.Length)
{
Buffer.Length = (BufferOffset+MaxVal);
BufferSize = Buffer.Length;
}
Buffer[BufferOffset++] = Value & 255;
if( MaxVal>1 )
if(MaxVal>1)
{
Buffer[BufferOffset++] = (Value >> 8) & 255;
if( MaxVal>2 )
if(MaxVal>2)
{
Buffer[BufferOffset++] = (Value >> 16) & 255;
if( MaxVal>3 )
if(MaxVal>3)
Buffer[BufferOffset++] = (Value >> 24) & 255;
}
}
}
function int ReadInt( optional byte MaxVal )
function int ReadInt(optional byte MaxVal)
{
local int Res;
++MaxVal;
if( (BufferOffset+MaxVal)>BufferSize )
if((BufferOffset+MaxVal)>BufferSize)
return 0;
Res = Buffer[BufferOffset++];
if( MaxVal>1 )
if(MaxVal>1)
{
Res = Res | (Buffer[BufferOffset++] << 8);
if( MaxVal>2 )
if(MaxVal>2)
{
Res = Res | (Buffer[BufferOffset++] << 16);
if( MaxVal>3 )
if(MaxVal>3)
Res = Res | (Buffer[BufferOffset++] << 24);
}
}
return Res;
}
function SaveStr( string S )
function SaveStr(string S)
{
local int i;
if( S=="" )
if(S=="")
{
SaveInt(0,1);
return;
}
S = Left(S,255);
i = StrMap.Find(S);
if( i==-1 )
if(i==-1)
{
i = StrMap.Length;
StrMap[StrMap.Length] = S;
@ -95,7 +95,7 @@ function string ReadStr()
local int i;
i = ReadInt(1);
if( i==0 || i>StrMap.Length )
if(i==0 || i>StrMap.Length)
return "";
return StrMap[i-1];
}
@ -104,7 +104,7 @@ function int TellOffset()
{
return BufferOffset;
}
function SeekOffset( int Offset )
function SeekOffset(int Offset)
{
BufferOffset = Clamp(Offset,0,BufferSize);
}
@ -124,7 +124,7 @@ function bool AtEnd()
{
return (BufferOffset>=BufferSize);
}
function SkipBytes( int Count )
function SkipBytes(int Count)
{
BufferOffset = Clamp(BufferOffset+Count,0,BufferSize);
}
@ -148,7 +148,7 @@ final function DebugData()
GetData(B);
`Log("DEBUG DATA: Data size: "$B.Length);
for( i=0; i<B.Length; ++i )
for(i=0; i<B.Length; ++i)
{
S $= Chr(Max(B[i],1));
SS $= "."$B[i];
@ -157,7 +157,7 @@ final function DebugData()
`Log("DEBUG DATA: "$SS);
}
function GetData( out array<byte> Res )
function GetData(out array<byte> Res)
{
local int i,l,o,j;
@ -174,16 +174,16 @@ function GetData( out array<byte> Res )
o = 3;
// write each entry.
for( i=0; i<StrMap.Length; ++i )
for(i=0; i<StrMap.Length; ++i)
{
l = Len(StrMap[i]);
Res.Insert(o,l+1);
Res[o++] = l;
for( j=0; j<l; ++j )
for(j=0; j<l; ++j)
Res[o++] = Asc(Mid(StrMap[i],j,1));
}
}
function SetData( out array<byte> S )
function SetData(out array<byte> S)
{
local int i,o,l,j;
@ -195,11 +195,11 @@ function SetData( out array<byte> S )
o = 3;
// read each string map entry.
for( i=0; i<StrMap.Length; ++i )
for(i=0; i<StrMap.Length; ++i)
{
l = Buffer[o++];
StrMap[i] = "";
for( j=0; j<l; ++j )
for(j=0; j<l; ++j)
StrMap[i] $= Chr(Buffer[o++]);
}
Buffer.Remove(0,o);
@ -211,19 +211,19 @@ function int GetArVer()
{
return ArVersion;
}
function SetArVer( int Ver )
function SetArVer(int Ver)
{
ArVersion = Ver;
}
function PushEOFLimit( int EndOffset )
function PushEOFLimit(int EndOffset)
{
EOFStack.AddItem(BufferSize);
BufferSize = EndOffset;
}
function PopEOFLimit()
{
if( EOFStack.Length==0 )
if(EOFStack.Length==0)
{
`Log(Self@"WARNING: Tried to pop one EoF stack down too far!!!");
return; // Whoops, error.
@ -236,7 +236,7 @@ function int GetSaveVersion()
{
return SaveNum;
}
function SetSaveVersion( int Num )
function SetSaveVersion(int Num)
{
SaveNum = Num;
}

View File

@ -9,7 +9,7 @@ struct FTopPlayers
};
var config array<FTopPlayers> TopPlaytimes,TopKills,TopExp;
static final function SetTopPlayers( ExtPlayerController Other )
static final function SetTopPlayers(ExtPlayerController Other)
{
local ExtPerkManager PM;
local bool bDirty;
@ -19,10 +19,10 @@ static final function SetTopPlayers( ExtPlayerController Other )
bDirty = CheckBestTrack(Other.PlayerReplicationInfo,PM.TotalPlayTime,Default.TopPlaytimes);
bDirty = CheckBestTrack(Other.PlayerReplicationInfo,PM.TotalKills,Default.TopKills) || bDirty;
bDirty = CheckBestTrack(Other.PlayerReplicationInfo,PM.TotalEXP,Default.TopExp) || bDirty;
if( bDirty )
if(bDirty)
StaticSaveConfig();
}
static final function bool CheckBestTrack( PlayerReplicationInfo PRI, int Value, out array<FTopPlayers> V )
static final function bool CheckBestTrack(PlayerReplicationInfo PRI, int Value, out array<FTopPlayers> V)
{
local string S;
local int i,l;
@ -30,15 +30,15 @@ static final function bool CheckBestTrack( PlayerReplicationInfo PRI, int Value,
S = class'OnlineSubsystem'.Static.UniqueNetIdToString(PRI.UniqueId);
l = class'ServerExtMut'.Default.MaxTopPlayers;
if( V.Length>l ) // See if list has overflown incase an admin has changed the max stats value.
if(V.Length>l) // See if list has overflown incase an admin has changed the max stats value.
V.Length = l;
i = V.Find('ID',S); // First see if we have an entry from before.
if( i>=0 )
if(i>=0)
{
if( V[i].V==Value ) // Stat unchanged.
if(V[i].V==Value) // Stat unchanged.
{
if( V[i].N!=PRI.PlayerName ) // Name has changed, update that.
if(V[i].N!=PRI.PlayerName) // Name has changed, update that.
{
V[i].N = PRI.PlayerName;
return true;
@ -47,11 +47,11 @@ static final function bool CheckBestTrack( PlayerReplicationInfo PRI, int Value,
}
// Remove entry and insert it back in list only if rank changed.
if( (i>0 && V[i-1].V<Value) || (i<(V.Length-1) && V[i+1].V>Value) )
if((i>0 && V[i-1].V<Value) || (i<(V.Length-1) && V[i+1].V>Value))
V.Remove(i,1);
else // No change in rank.
{
if( V[i].N!=PRI.PlayerName ) // Name has changed, update that.
if(V[i].N!=PRI.PlayerName) // Name has changed, update that.
{
V[i].N = PRI.PlayerName;
return true;
@ -60,15 +60,15 @@ static final function bool CheckBestTrack( PlayerReplicationInfo PRI, int Value,
}
}
for( i=0; i<l; ++i )
for(i=0; i<l; ++i)
{
if( i==V.Length || V[i].V<Value ) // At final entry, or has higher value then this ranked player.
if(i==V.Length || V[i].V<Value) // At final entry, or has higher value then this ranked player.
{
V.Insert(i,1);
V[i].N = PRI.PlayerName;
V[i].V = Value;
V[i].ID = S;
if( V.Length>l ) // See if list has overflown.
if(V.Length>l) // See if list has overflown.
V.Length = l;
return true;
}
@ -76,26 +76,26 @@ static final function bool CheckBestTrack( PlayerReplicationInfo PRI, int Value,
return false;
}
static final function bool GetStat( ExtPlayerController PC, byte ListNum, int StatIndex )
static final function bool GetStat(ExtPlayerController PC, byte ListNum, int StatIndex)
{
local UniqueNetId ID;
switch( ListNum )
switch(ListNum)
{
case 0:
if( StatIndex>=Default.TopPlaytimes.Length )
if(StatIndex>=Default.TopPlaytimes.Length)
return false;
class'OnlineSubsystem'.Static.StringToUniqueNetId(Default.TopPlaytimes[StatIndex].ID,ID);
PC.ClientGetStat(ListNum,false,Default.TopPlaytimes[StatIndex].N,ID,Default.TopPlaytimes[StatIndex].V);
return true;
case 1:
if( StatIndex>=Default.TopKills.Length )
if(StatIndex>=Default.TopKills.Length)
return false;
class'OnlineSubsystem'.Static.StringToUniqueNetId(Default.TopKills[StatIndex].ID,ID);
PC.ClientGetStat(ListNum,false,Default.TopKills[StatIndex].N,ID,Default.TopKills[StatIndex].V);
return true;
case 2:
if( StatIndex>=Default.TopExp.Length )
if(StatIndex>=Default.TopExp.Length)
return false;
class'OnlineSubsystem'.Static.StringToUniqueNetId(Default.TopExp[StatIndex].ID,ID);
PC.ClientGetStat(ListNum,false,Default.TopExp[StatIndex].N,ID,Default.TopExp[StatIndex].V);

View File

@ -10,7 +10,7 @@ function cleanup()
{
webadmin = None;
MyMutator = None;
if( ExtAdminUI!=None )
if(ExtAdminUI!=None)
{
ExtAdminUI.Cleanup();
ExtAdminUI = None;
@ -35,14 +35,14 @@ function bool handleQuery(WebAdminQuery q)
return false;
}
final function IncludeFile( WebAdminQuery q, string file )
final function IncludeFile(WebAdminQuery q, string file)
{
local string S;
if( webadmin.HTMLSubDirectory!="" )
if(webadmin.HTMLSubDirectory!="")
{
S = webadmin.Path $ "/" $ webadmin.HTMLSubDirectory $ "/" $ file;
if ( q.response.FileExists(S) )
if (q.response.FileExists(S))
{
q.response.IncludeUHTM(S);
return;
@ -50,7 +50,7 @@ final function IncludeFile( WebAdminQuery q, string file )
}
q.response.IncludeUHTM(webadmin.Path $ "/" $ file);
}
final function SendHeader( WebAdminQuery q, string Title )
final function SendHeader(WebAdminQuery q, string Title)
{
local IQueryHandler handler;
@ -68,23 +68,23 @@ final function SendHeader( WebAdminQuery q, string Title )
IncludeFile(q,"header.inc");
q.response.SendText("<div id=\"content\"><h2>"$Title$"</h2></div><div class=\"section\">");
}
final function SendFooter( WebAdminQuery q )
final function SendFooter(WebAdminQuery q)
{
IncludeFile(q,"navigation.inc");
IncludeFile(q,"footer.inc");
q.response.ClearSubst();
}
final function AddConfigEditbox( WebAdminQuery q, string InfoStr, string CurVal, int MaxLen, string ResponseVar, string Tooltip, optional bool bSkipTrail )
final function AddConfigEditbox(WebAdminQuery q, string InfoStr, string CurVal, int MaxLen, string ResponseVar, string Tooltip, optional bool bSkipTrail)
{
local string S;
S = "<TR><TD><abbr title=\""$Tooltip$"\">"$InfoStr$":</abbr></TD><TD><input class=\"textbox\" class=\"text\" name=\""$ResponseVar$"\" value=\""$CurVal$"\"></TD>";
if( !bSkipTrail )
if(!bSkipTrail)
S $= "</TR>";
q.response.SendText(S);
}
final function AddConfigCheckbox( WebAdminQuery q, string InfoStr, bool bCur, string ResponseVar, string Tooltip )
final function AddConfigCheckbox(WebAdminQuery q, string InfoStr, bool bCur, string ResponseVar, string Tooltip)
{
local string S;
@ -92,7 +92,7 @@ final function AddConfigCheckbox( WebAdminQuery q, string InfoStr, bool bCur, st
S = "<TR><TD><abbr title=\""$Tooltip$"\">"$InfoStr$":</abbr></TD><TD><input type=\"checkbox\" name=\""$ResponseVar$"\" value=\"1\" "$S$"></TD></TR>";
q.response.SendText(S);
}
final function AddConfigTextbox( WebAdminQuery q, string InfoStr, string CurVal, int Rows, string ResponseVar, string Tooltip )
final function AddConfigTextbox(WebAdminQuery q, string InfoStr, string CurVal, int Rows, string ResponseVar, string Tooltip)
{
local string S;
@ -109,7 +109,7 @@ function handleExtMod(WebAdminQuery q)
local delegate<ExtWebAdmin_UI.OnSetValue> SetV;
local bool bEditArray;
if( ExtAdminUI==None )
if(ExtAdminUI==None)
{
ExtAdminUI = new (None) class'ExtWebAdmin_UI';
MyMutator.InitWebAdmin(ExtAdminUI);
@ -117,19 +117,19 @@ function handleExtMod(WebAdminQuery q)
// First check if user is trying to get to another page.
S = q.request.getVariable("GoToPage");
if( S!="" )
if(S!="")
{
if( S=="Main Menu" )
if(S=="Main Menu")
EditPageIndex = -1;
else EditPageIndex = ExtAdminUI.ConfigList.Find('PageName',S);
}
if( EditPageIndex<0 || EditPageIndex>=ExtAdminUI.ConfigList.Length )
if(EditPageIndex<0 || EditPageIndex>=ExtAdminUI.ConfigList.Length)
{
// Show main links page.
SendHeader(q,"Ext Server Links page");
q.response.SendText("<table id=\"settings\" class=\"grid\"><thead><tr><th>Links</th></tr></thead><tbody>");
for( i=0; i<ExtAdminUI.ConfigList.Length; ++i )
for(i=0; i<ExtAdminUI.ConfigList.Length; ++i)
q.response.SendText("<tr><td><form action=\""$webadmin.Path$ExtWebURL$"\"><input class=\"button\" name=\"GoToPage\" type=\"submit\" value=\""$ExtAdminUI.ConfigList[i].PageName$"\"></form></td></tr>");
q.response.SendText("</tbody></table></div></div></body></html>");
}
@ -137,51 +137,51 @@ function handleExtMod(WebAdminQuery q)
{
S = q.request.getVariable("edit"$EditPageIndex);
bEditArray = false;
if( S=="Submit" )
if(S=="Submit")
{
// Read setting values.
for( i=0; i<ExtAdminUI.ConfigList[EditPageIndex].Configs.Length; ++i )
for(i=0; i<ExtAdminUI.ConfigList[EditPageIndex].Configs.Length; ++i)
{
S = q.request.getVariable("PR"$i,"#NULL");
if( S!="#NULL" )
if(S!="#NULL")
{
SetV = ExtAdminUI.ConfigList[EditPageIndex].SetValue;
SetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,0,S);
}
else if( ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropType==1 ) // Checkboxes return nothing if unchecked.
else if(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropType==1) // Checkboxes return nothing if unchecked.
{
SetV = ExtAdminUI.ConfigList[EditPageIndex].SetValue;
SetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,0,"0");
}
}
}
else if( Left(S,5)=="Edit " )
else if(Left(S,5)=="Edit ")
{
i = ExtAdminUI.ConfigList[EditPageIndex].Configs.Find('UIName',Mid(S,5));
if( i!=-1 && ExtAdminUI.ConfigList[EditPageIndex].Configs[i].NumElements==-1 ) // Check if valid.
if(i!=-1 && ExtAdminUI.ConfigList[EditPageIndex].Configs[i].NumElements==-1) // Check if valid.
{
// Edit dynamic array.
bEditArray = true;
}
}
else if( Left(S,7)=="Submit " )
else if(Left(S,7)=="Submit ")
{
i = ExtAdminUI.ConfigList[EditPageIndex].Configs.Find('UIName',Mid(S,7));
if( i!=-1 && ExtAdminUI.ConfigList[EditPageIndex].Configs[i].NumElements==-1 ) // Check if valid.
if(i!=-1 && ExtAdminUI.ConfigList[EditPageIndex].Configs[i].NumElements==-1) // Check if valid.
{
// Submitted dynamic array values.
GetV = ExtAdminUI.ConfigList[EditPageIndex].GetValue;
SetV = ExtAdminUI.ConfigList[EditPageIndex].SetValue;
z = int(GetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,-1));
for( j=z; j>=0; --j )
for(j=z; j>=0; --j)
{
if( q.request.getVariable("DEL"$j)=="1" )
if(q.request.getVariable("DEL"$j)=="1")
SetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,j,"#DELETE");
else
{
S = q.request.getVariable("PR"$j,"New Line");
if( S!="New Line" )
if(S!="New Line")
SetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,j,S);
}
}
@ -192,29 +192,29 @@ function handleExtMod(WebAdminQuery q)
SendHeader(q,ExtAdminUI.ConfigList[EditPageIndex].PageName$" ("$PathName(ExtAdminUI.ConfigList[EditPageIndex].ObjClass)$")");
q.response.SendText("<form method=\"post\" action=\""$webadmin.Path$ExtWebURL$"\"><table id=\"settings\" class=\"grid\">");
if( bEditArray )
if(bEditArray)
{
q.response.SendText("<table id=\"settings\" class=\"grid\"><thead><tr><th><abbr title=\""$ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIDesc$"\">Edit Array "$ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIName$"</abbr></th><th></th><th>Delete Line</th></tr></thead><tbody>");
GetV = ExtAdminUI.ConfigList[EditPageIndex].GetValue;
z = int(GetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,-1));
for( j=0; j<=z; ++j )
for(j=0; j<=z; ++j)
{
if( j<z )
if(j<z)
S = GetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,j);
else S = "New Line";
switch( ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropType )
switch(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropType)
{
case 0: // int
AddConfigEditbox(q,"["$j$"]",S,8,"PR"$j,"",true);
if( j<z )
if(j<z)
q.response.SendText("<TD><input type=\"checkbox\" name=\"DEL"$j$"\" value=\"1\" "$S$"></TD></TR>");
else q.response.SendText("<TD></TD></TR>");
break;
case 2: // string
AddConfigEditbox(q,"["$j$"]",S,80,"PR"$j,"",true);
if( j<z )
if(j<z)
q.response.SendText("<TD><input type=\"checkbox\" name=\"DEL"$j$"\" value=\"1\" "$S$"></TD></TR>");
else q.response.SendText("<TD></TD></TR>");
break;
@ -226,9 +226,9 @@ function handleExtMod(WebAdminQuery q)
else
{
q.response.SendText("<table id=\"settings\" class=\"grid\"><thead><tr><th>Settings</th></tr></thead><tbody>");
for( i=0; i<ExtAdminUI.ConfigList[EditPageIndex].Configs.Length; ++i )
for(i=0; i<ExtAdminUI.ConfigList[EditPageIndex].Configs.Length; ++i)
{
if( ExtAdminUI.ConfigList[EditPageIndex].Configs[i].NumElements==-1 ) // Dynamic array.
if(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].NumElements==-1) // Dynamic array.
{
GetV = ExtAdminUI.ConfigList[EditPageIndex].GetValue;
j = int(GetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,-1));
@ -238,7 +238,7 @@ function handleExtMod(WebAdminQuery q)
{
GetV = ExtAdminUI.ConfigList[EditPageIndex].GetValue;
S = GetV(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropName,0);
switch( ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropType )
switch(ExtAdminUI.ConfigList[EditPageIndex].Configs[i].PropType)
{
case 0: // Int
AddConfigEditbox(q,ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIName,S,8,"PR"$i,ExtAdminUI.ConfigList[EditPageIndex].Configs[i].UIDesc);

View File

@ -5,7 +5,7 @@ var transient array<string> StackedSect;
event PreBeginPlay();
final function DumpXML( ExtPerkManager M )
final function DumpXML(ExtPerkManager M)
{
OpenFile(class'OnlineSubsystem'.Static.UniqueNetIdToString(M.PRIOwner.UniqueId),FWFT_Stats,".xml",false);
M.OutputXML(Self);
@ -13,13 +13,13 @@ final function DumpXML( ExtPerkManager M )
ResetFile();
}
function WriteValue( string Key, string Value )
function WriteValue(string Key, string Value)
{
Logf(Intendent$"<"$Key$">"$Value$"</"$Key$">");
}
function StartIntendent( string Section, optional string Key, optional string Value )
function StartIntendent(string Section, optional string Key, optional string Value)
{
if( Key!="" )
if(Key!="")
Logf(Intendent$"-<"$Section$" "$Key$"=\""$Value$"\">");
else Logf(Intendent$"-<"$Section$">");
Intendent $= Chr(9);

File diff suppressed because it is too large Load Diff

View File

@ -9,24 +9,24 @@ struct FMapInfoEntry
};
var config array<FMapInfoEntry> N;
static final function int GetMapHistory( string MapName, string MapTitle )
static final function int GetMapHistory(string MapName, string MapTitle)
{
local int i;
MapName = Caps(MapName);
i = Default.M.Find(MapName);
if( i==-1 )
if(i==-1)
{
i = Default.M.Length;
Default.M.Length = i+1;
Default.M[i] = MapName;
Default.N.Length = i+1;
}
if( !(MapTitle~=MapName) && MapTitle!=Class'WorldInfo'.Default.Title && MapTitle!="" )
if(!(MapTitle~=MapName) && MapTitle!=Class'WorldInfo'.Default.Title && MapTitle!="")
Default.N[i].T = MapTitle;
return i;
}
static final function GetHistory( int i, out int UpVotes, out int DownVotes, out int Seq, out int NumP, out string Title )
static final function GetHistory(int i, out int UpVotes, out int DownVotes, out int Seq, out int NumP, out string Title)
{
UpVotes = Default.N[i].U;
DownVotes = Default.N[i].D;
@ -35,13 +35,13 @@ static final function GetHistory( int i, out int UpVotes, out int DownVotes, out
Title = Default.N[i].T;
}
static final function UpdateMapHistory( int iWon )
static final function UpdateMapHistory(int iWon)
{
local int i;
for( i=(Default.M.Length-1); i>=0; --i )
for(i=(Default.M.Length-1); i>=0; --i)
{
if( i==iWon )
if(i==iWon)
{
++Default.N[i].N;
Default.N[i].S = 0;
@ -49,9 +49,9 @@ static final function UpdateMapHistory( int iWon )
else ++Default.N[i].S;
}
}
static final function AddMapKarma( int i, bool bUp )
static final function AddMapKarma(int i, bool bUp)
{
if( bUp )
if(bUp)
++Default.N[i].U;
else ++Default.N[i].D;
}

View File

@ -8,26 +8,26 @@ function UpdateSentText()
NextBroadcaster.UpdateSentText();
}
function Broadcast( Actor Sender, coerce string Msg, optional name Type )
function Broadcast(Actor Sender, coerce string Msg, optional name Type)
{
if( (Type=='Say' || Type=='TeamSay') && Left(Msg,1)=="!" && PlayerController(Sender)!=None )
if((Type=='Say' || Type=='TeamSay') && Left(Msg,1)=="!" && PlayerController(Sender)!=None)
Handler.ParseCommand(Mid(Msg,1),PlayerController(Sender));
NextBroadcaster.Broadcast(Sender,Msg,Type);
}
function BroadcastTeam( Controller Sender, coerce string Msg, optional name Type )
function BroadcastTeam(Controller Sender, coerce string Msg, optional name Type)
{
if( (Type=='Say' || Type=='TeamSay') && Left(Msg,1)=="!" && PlayerController(Sender)!=None )
if((Type=='Say' || Type=='TeamSay') && Left(Msg,1)=="!" && PlayerController(Sender)!=None)
Handler.ParseCommand(Mid(Msg,1),PlayerController(Sender));
NextBroadcaster.BroadcastTeam(Sender,Msg,Type);
}
function AllowBroadcastLocalized( actor Sender, class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject )
function AllowBroadcastLocalized(actor Sender, class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject)
{
NextBroadcaster.AllowBroadcastLocalized(Sender,Message,Switch,RelatedPRI_1,RelatedPRI_2,OptionalObject);
}
event AllowBroadcastLocalizedTeam( int TeamIndex, actor Sender, class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject )
event AllowBroadcastLocalizedTeam(int TeamIndex, actor Sender, class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject)
{
NextBroadcaster.AllowBroadcastLocalizedTeam(TeamIndex,Sender,Message,Switch,RelatedPRI_1,RelatedPRI_2,OptionalObject);
}

View File

@ -27,14 +27,14 @@ function bool handleQuery(WebAdminQuery q)
return false;
}
final function IncludeFile( WebAdminQuery q, string file )
final function IncludeFile(WebAdminQuery q, string file)
{
local string S;
if( webadmin.HTMLSubDirectory!="" )
if(webadmin.HTMLSubDirectory!="")
{
S = webadmin.Path $ "/" $ webadmin.HTMLSubDirectory $ "/" $ file;
if ( q.response.FileExists(S) )
if (q.response.FileExists(S))
{
q.response.IncludeUHTM(S);
return;
@ -42,7 +42,7 @@ final function IncludeFile( WebAdminQuery q, string file )
}
q.response.IncludeUHTM(webadmin.Path $ "/" $ file);
}
final function SendHeader( WebAdminQuery q, string Title )
final function SendHeader(WebAdminQuery q, string Title)
{
local IQueryHandler handler;
@ -60,23 +60,23 @@ final function SendHeader( WebAdminQuery q, string Title )
IncludeFile(q,"header.inc");
q.response.SendText("<div id=\"content\"><h2>"$Title$"</h2></div><div class=\"section\">");
}
final function SendFooter( WebAdminQuery q )
final function SendFooter(WebAdminQuery q)
{
IncludeFile(q,"navigation.inc");
IncludeFile(q,"footer.inc");
q.response.ClearSubst();
}
final function AddConfigEditbox( WebAdminQuery q, string InfoStr, string CurVal, int MaxLen, string ResponseVar, string Tooltip, optional bool bNoTR )
final function AddConfigEditbox(WebAdminQuery q, string InfoStr, string CurVal, int MaxLen, string ResponseVar, string Tooltip, optional bool bNoTR)
{
local string S;
S = "<abbr title=\""$Tooltip$"\"><TD>"$InfoStr$":</TD><TD><input class=\"textbox\" class=\"text\" name=\""$ResponseVar$"\" size=\""$Min(100,MaxLen)$"\" value=\""$CurVal$"\" maxlength=\""$MaxLen$"\"></TD></abbr>";
if( !bNoTR )
if(!bNoTR)
S = "<TR>"$S$"</TR>";
q.response.SendText(S);
}
final function AddInLineEditbox( WebAdminQuery q, string CurVal, int MaxLen, string ResponseVar, string Tooltip )
final function AddInLineEditbox(WebAdminQuery q, string CurVal, int MaxLen, string ResponseVar, string Tooltip)
{
q.response.SendText("<abbr title=\""$Tooltip$"\"><TD><input class=\"textbox\" class=\"text\" name=\""$ResponseVar$"\" size=\""$Min(100,MaxLen)$"\" value=\""$CurVal$"\" maxlength=\""$MaxLen$"\"></TD></abbr>");
}
@ -86,7 +86,7 @@ function handleMapVotes(WebAdminQuery q)
local string S;
S = q.request.getVariable("edit");
if( S=="Submit" )
if(S=="Submit")
{
class'xVotingHandler'.Default.VoteTime = int(q.request.getVariable("VT",string(class'xVotingHandler'.Default.VoteTime)));
class'xVotingHandler'.Default.MidGameVotePct = float(q.request.getVariable("MV",string(class'xVotingHandler'.Default.MidGameVotePct)));
@ -96,7 +96,7 @@ function handleMapVotes(WebAdminQuery q)
class'xVotingHandler'.Static.StaticSaveConfig();
EditSettingLine = -1;
}
else if( S=="New" )
else if(S=="New")
{
i = class'xVotingHandler'.Default.GameModes.Length;
class'xVotingHandler'.Default.GameModes.Length = i+1;
@ -106,9 +106,9 @@ function handleMapVotes(WebAdminQuery q)
EditSettingLine = i;
class'xVotingHandler'.Static.StaticSaveConfig();
}
else if( S=="Save" )
else if(S=="Save")
{
if( EditSettingLine>=0 && EditSettingLine<class'xVotingHandler'.Default.GameModes.Length )
if(EditSettingLine>=0 && EditSettingLine<class'xVotingHandler'.Default.GameModes.Length)
{
i = EditSettingLine;
class'xVotingHandler'.Default.GameModes[i].GameName = q.request.getVariable("GN",class'xVotingHandler'.Default.GameModes[i].GameName);
@ -123,17 +123,17 @@ function handleMapVotes(WebAdminQuery q)
}
else
{
for( i=0; i<class'xVotingHandler'.Default.GameModes.Length; ++i )
for(i=0; i<class'xVotingHandler'.Default.GameModes.Length; ++i)
{
S = q.request.getVariable("edit"$i);
if( S=="Delete" )
if(S=="Delete")
{
class'xVotingHandler'.Default.GameModes.Remove(i,1);
class'xVotingHandler'.Static.StaticSaveConfig();
EditSettingLine = -1;
break;
}
else if( S=="Edit" )
else if(S=="Edit")
{
EditSettingLine = i;
break;
@ -154,9 +154,9 @@ function handleMapVotes(WebAdminQuery q)
q.response.SendText("<form method=\"post\" action=\""$webadmin.Path$MapVoterURL$"\"><table id=\"settings\" class=\"grid\">");
q.response.SendText("<thead><tr><th colspan=7>Mapvote game modes</th></tr></thead><tbody>");
q.response.SendText("<tr><th>Game Name</th><th>Game Short Name</th><th>Game Class</th><th>Mutators</th><th>Options</th><th>Map Prefix</th><th></th></tr>");
for( i=0; i<class'xVotingHandler'.Default.GameModes.Length; ++i )
for(i=0; i<class'xVotingHandler'.Default.GameModes.Length; ++i)
{
if( EditSettingLine==i )
if(EditSettingLine==i)
{
q.response.SendText("<tr>",false);
AddInLineEditbox(q,class'xVotingHandler'.Default.GameModes[i].GameName,48,"GN","Game type long display name");

View File

@ -26,21 +26,21 @@ function PostBeginPlay()
local int i,j,z,n,UpV,DownV,Seq,NumPl;
local string S,MapFile;
if( WorldInfo.Game.BaseMutator==None )
if(WorldInfo.Game.BaseMutator==None)
WorldInfo.Game.BaseMutator = Self;
else WorldInfo.Game.BaseMutator.AddMutator(Self);
if( bDeleteMe ) // This was a duplicate instance of the mutator.
if(bDeleteMe) // This was a duplicate instance of the mutator.
return;
MapFile = string(WorldInfo.GetPackageName());
iCurrentHistory = class'xMapVoteHistory'.Static.GetMapHistory(MapFile,WorldInfo.Title);
if( LastVotedGameInfo<0 || LastVotedGameInfo>=GameModes.Length )
if(LastVotedGameInfo<0 || LastVotedGameInfo>=GameModes.Length)
LastVotedGameInfo = 0;
if( MapChangeDelay==0 )
if(MapChangeDelay==0)
MapChangeDelay = 3;
if( GameModes.Length==0 ) // None specified, so use current settings.
if(GameModes.Length==0) // None specified, so use current settings.
{
GameModes.Length = 1;
GameModes[0].GameName = "Killing Floor";
@ -56,11 +56,11 @@ function PostBeginPlay()
// Build maplist.
z = 0;
for( i=(Class'KFGameInfo'.Default.GameMapCycles.Length-1); i>=0; --i )
for(i=(Class'KFGameInfo'.Default.GameMapCycles.Length-1); i>=0; --i)
{
for( j=(Class'KFGameInfo'.Default.GameMapCycles[i].Maps.Length-1); j>=0; --j )
for(j=(Class'KFGameInfo'.Default.GameMapCycles[i].Maps.Length-1); j>=0; --j)
{
if( MaxMapsOnList>0 && Class'KFGameInfo'.Default.GameMapCycles[i].Maps[j]~=MapFile ) // If we limit the maps count, remove current map.
if(MaxMapsOnList>0 && Class'KFGameInfo'.Default.GameMapCycles[i].Maps[j]~=MapFile) // If we limit the maps count, remove current map.
continue;
Maps.Length = z+1;
Maps[z].MapName = Class'KFGameInfo'.Default.GameMapCycles[i].Maps[j];
@ -76,10 +76,10 @@ function PostBeginPlay()
}
}
if( MaxMapsOnList>0 )
if(MaxMapsOnList>0)
{
// Remove random maps from list.
while( Maps.Length>MaxMapsOnList )
while(Maps.Length>MaxMapsOnList)
Maps.Remove(Rand(Maps.Length),1);
}
@ -88,9 +88,9 @@ function PostBeginPlay()
}
function AddMutator(Mutator M)
{
if( M!=Self ) // Make sure we don't get added twice.
if(M!=Self) // Make sure we don't get added twice.
{
if( M.Class==Class )
if(M.Class==Class)
M.Destroy();
else Super.AddMutator(M);
}
@ -108,15 +108,15 @@ function SetupBroadcast()
B.Handler = Self;
B.NextBroadcaster = WorldInfo.Game.BroadcastHandler;
WorldInfo.Game.BroadcastHandler = B;
if( !bNoWebAdmin )
if(!bNoWebAdmin)
{
foreach AllActors(class'WebServer',W)
break;
if( W!=None )
if(W!=None)
{
for( i=0; (i<10 && A==None); ++i )
for(i=0; (i<10 && A==None); ++i)
A = WebAdmin(W.ApplicationObjects[i]);
if( A!=None )
if(A!=None)
{
xW = new (None) class'xVoteWebApp';
A.addQueryHandler(xW);
@ -126,54 +126,54 @@ function SetupBroadcast()
else `Log("X-VoteWebAdmin ERROR: No WebServer object found!");
}
}
final function AddVote( int Count, int MapIndex, int GameIndex )
final function AddVote(int Count, int MapIndex, int GameIndex)
{
local int i,j;
if( bMapvoteHasEnded )
if(bMapvoteHasEnded)
return;
for( i=0; i<ActiveVotes.Length; ++i )
if( ActiveVotes[i].GameIndex==GameIndex && ActiveVotes[i].MapIndex==MapIndex )
for(i=0; i<ActiveVotes.Length; ++i)
if(ActiveVotes[i].GameIndex==GameIndex && ActiveVotes[i].MapIndex==MapIndex)
{
ActiveVotes[i].NumVotes += Count;
for( j=(ActiveVoters.Length-1); j>=0; --j )
for(j=(ActiveVoters.Length-1); j>=0; --j)
ActiveVoters[j].ClientReceiveVote(GameIndex,MapIndex,ActiveVotes[i].NumVotes);
if( ActiveVotes[i].NumVotes<=0 )
if(ActiveVotes[i].NumVotes<=0)
{
for( j=(ActiveVoters.Length-1); j>=0; --j )
if( ActiveVoters[j].DownloadStage==2 && ActiveVoters[j].DownloadIndex>=i && ActiveVoters[j].DownloadIndex>0 ) // Make sure client doesn't skip a download at this point.
for(j=(ActiveVoters.Length-1); j>=0; --j)
if(ActiveVoters[j].DownloadStage==2 && ActiveVoters[j].DownloadIndex>=i && ActiveVoters[j].DownloadIndex>0) // Make sure client doesn't skip a download at this point.
--ActiveVoters[j].DownloadIndex;
ActiveVotes.Remove(i,1);
}
return;
}
if( Count<=0 )
if(Count<=0)
return;
ActiveVotes.Length = i+1;
ActiveVotes[i].GameIndex = GameIndex;
ActiveVotes[i].MapIndex = MapIndex;
ActiveVotes[i].NumVotes = Count;
for( j=(ActiveVoters.Length-1); j>=0; --j )
for(j=(ActiveVoters.Length-1); j>=0; --j)
ActiveVoters[j].ClientReceiveVote(GameIndex,MapIndex,Count);
}
final function LogoutPlayer( PlayerController PC )
final function LogoutPlayer(PlayerController PC)
{
local int i;
for( i=(ActiveVoters.Length-1); i>=0; --i )
if( ActiveVoters[i].PlayerOwner==PC )
for(i=(ActiveVoters.Length-1); i>=0; --i)
if(ActiveVoters[i].PlayerOwner==PC)
{
ActiveVoters[i].Destroy();
break;
}
}
final function LoginPlayer( PlayerController PC )
final function LoginPlayer(PlayerController PC)
{
local xVotingReplication R;
local int i;
for( i=(ActiveVoters.Length-1); i>=0; --i )
if( ActiveVoters[i].PlayerOwner==PC )
for(i=(ActiveVoters.Length-1); i>=0; --i)
if(ActiveVoters[i].PlayerOwner==PC)
return;
R = Spawn(class'xVotingReplication',PC);
R.VoteHandler = Self;
@ -182,45 +182,45 @@ final function LoginPlayer( PlayerController PC )
function NotifyLogout(Controller Exiting)
{
if( PlayerController(Exiting)!=None )
if(PlayerController(Exiting)!=None)
LogoutPlayer(PlayerController(Exiting));
if ( NextMutator != None )
if (NextMutator != None)
NextMutator.NotifyLogout(Exiting);
}
function NotifyLogin(Controller NewPlayer)
{
if( PlayerController(NewPlayer)!=None )
if(PlayerController(NewPlayer)!=None)
LoginPlayer(PlayerController(NewPlayer));
if ( NextMutator != None )
if (NextMutator != None)
NextMutator.NotifyLogin(NewPlayer);
}
function ClientDownloadInfo( xVotingReplication V )
function ClientDownloadInfo(xVotingReplication V)
{
if( bMapvoteHasEnded )
if(bMapvoteHasEnded)
{
V.DownloadStage = 255;
return;
}
switch( V.DownloadStage )
switch(V.DownloadStage)
{
case 0: // Game modes.
if( V.DownloadIndex>=GameModes.Length )
if(V.DownloadIndex>=GameModes.Length)
break;
V.ClientReceiveGame(V.DownloadIndex,GameModes[V.DownloadIndex].GameName,GameModes[V.DownloadIndex].GameShortName,GameModes[V.DownloadIndex].Prefix);
++V.DownloadIndex;
return;
case 1: // Maplist.
if( V.DownloadIndex>=Maps.Length )
if(V.DownloadIndex>=Maps.Length)
break;
if( Maps[V.DownloadIndex].MapTitle=="" )
if(Maps[V.DownloadIndex].MapTitle=="")
V.ClientReceiveMap(V.DownloadIndex,Maps[V.DownloadIndex].MapName,Maps[V.DownloadIndex].UpVotes,Maps[V.DownloadIndex].DownVotes,Maps[V.DownloadIndex].Sequence,Maps[V.DownloadIndex].NumPlays);
else V.ClientReceiveMap(V.DownloadIndex,Maps[V.DownloadIndex].MapName,Maps[V.DownloadIndex].UpVotes,Maps[V.DownloadIndex].DownVotes,Maps[V.DownloadIndex].Sequence,Maps[V.DownloadIndex].NumPlays,Maps[V.DownloadIndex].MapTitle);
++V.DownloadIndex;
return;
case 2: // Current votes.
if( V.DownloadIndex>=ActiveVotes.Length )
if(V.DownloadIndex>=ActiveVotes.Length)
break;
V.ClientReceiveVote(ActiveVotes[V.DownloadIndex].GameIndex,ActiveVotes[V.DownloadIndex].MapIndex,ActiveVotes[V.DownloadIndex].NumVotes);
++V.DownloadIndex;
@ -233,81 +233,81 @@ function ClientDownloadInfo( xVotingReplication V )
++V.DownloadStage;
V.DownloadIndex = 0;
}
function ClientCastVote( xVotingReplication V, int GameIndex, int MapIndex, bool bAdminForce )
function ClientCastVote(xVotingReplication V, int GameIndex, int MapIndex, bool bAdminForce)
{
local int i;
if( bMapvoteHasEnded )
if(bMapvoteHasEnded)
return;
if( bAdminForce && V.PlayerOwner.PlayerReplicationInfo.bAdmin )
if(bAdminForce && V.PlayerOwner.PlayerReplicationInfo.bAdmin)
{
SwitchToLevel(GameIndex,MapIndex,true);
return;
}
if( !Class'xUI_MapVote'.Static.BelongsToPrefix(Maps[MapIndex].MapName,GameModes[GameIndex].Prefix) )
if(!Class'xUI_MapVote'.Static.BelongsToPrefix(Maps[MapIndex].MapName,GameModes[GameIndex].Prefix))
{
V.PlayerOwner.ClientMessage("Error: Can't vote that map (wrong Prefix to that game mode)!");
return;
}
if( V.CurrentVote[0]>=0 )
if(V.CurrentVote[0]>=0)
AddVote(-1,V.CurrentVote[1],V.CurrentVote[0]);
V.CurrentVote[0] = GameIndex;
V.CurrentVote[1] = MapIndex;
AddVote(1,MapIndex,GameIndex);
for( i=(ActiveVoters.Length-1); i>=0; --i )
for(i=(ActiveVoters.Length-1); i>=0; --i)
ActiveVoters[i].ClientNotifyVote(V.PlayerOwner.PlayerReplicationInfo,GameIndex,MapIndex);
TallyVotes();
}
function ClientRankMap( xVotingReplication V, bool bUp )
function ClientRankMap(xVotingReplication V, bool bUp)
{
class'xMapVoteHistory'.Static.AddMapKarma(iCurrentHistory,bUp);
}
function ClientDisconnect( xVotingReplication V )
function ClientDisconnect(xVotingReplication V)
{
ActiveVoters.RemoveItem(V);
if( V.CurrentVote[0]>=0 )
if(V.CurrentVote[0]>=0)
AddVote(-1,V.CurrentVote[1],V.CurrentVote[0]);
TallyVotes();
}
final function float GetPctOf( int Nom, int Denom )
final function float GetPctOf(int Nom, int Denom)
{
local float R;
R = float(Nom) / float(Denom);
return R;
}
final function TallyVotes( optional bool bForce )
final function TallyVotes(optional bool bForce)
{
local int i,NumVotees,c,j;
local array<int> Candidates;
if( bMapvoteHasEnded )
if(bMapvoteHasEnded)
return;
NumVotees = ActiveVoters.Length;
c = 0;
if( bForce )
if(bForce)
{
// First check for highest result.
for( i=(ActiveVotes.Length-1); i>=0; --i )
for(i=(ActiveVotes.Length-1); i>=0; --i)
c = Max(c,ActiveVotes[i].NumVotes);
if( c>0 )
if(c>0)
{
// Then check how many votes for the best.
for( i=(ActiveVotes.Length-1); i>=0; --i )
if( ActiveVotes[i].NumVotes==c )
for(i=(ActiveVotes.Length-1); i>=0; --i)
if(ActiveVotes[i].NumVotes==c)
Candidates.AddItem(i);
// Finally pick a random winner from the best.
c = Candidates[Rand(Candidates.Length)];
if( NumVotees>=4 && ActiveVotes.Length==1 ) // If more then 4 voters and everyone voted same map?!!! Give the mapvote some orgy.
if(NumVotees>=4 && ActiveVotes.Length==1) // If more then 4 voters and everyone voted same map?!!! Give the mapvote some orgy.
{
for( j=(ActiveVoters.Length-1); j>=0; --j )
for(j=(ActiveVoters.Length-1); j>=0; --j)
ActiveVoters[j].PlayerOwner.ClientPlaySound(AnnouncerCues[13]);
}
SwitchToLevel(ActiveVotes[c].GameIndex,ActiveVotes[c].MapIndex,false);
@ -318,11 +318,11 @@ final function TallyVotes( optional bool bForce )
c = Rand(Maps.Length);
// Pick a random gametype to win along with it.
for( i=(GameModes.Length-1); i>=0; --i )
if( Class'xUI_MapVote'.Static.BelongsToPrefix(Maps[c].MapName,GameModes[i].Prefix) )
for(i=(GameModes.Length-1); i>=0; --i)
if(Class'xUI_MapVote'.Static.BelongsToPrefix(Maps[c].MapName,GameModes[i].Prefix))
Candidates.AddItem(i);
if( Candidates.Length==0 ) // Odd, a map without gametype...
if(Candidates.Length==0) // Odd, a map without gametype...
i = Rand(GameModes.Length);
else i = Candidates[Rand(Candidates.Length)];
@ -332,14 +332,14 @@ final function TallyVotes( optional bool bForce )
}
// Check for insta-win vote.
for( i=(ActiveVotes.Length-1); i>=0; --i )
for(i=(ActiveVotes.Length-1); i>=0; --i)
{
c+=ActiveVotes[i].NumVotes;
if( GetPctOf(ActiveVotes[i].NumVotes,NumVotees)>=MapWinPct )
if(GetPctOf(ActiveVotes[i].NumVotes,NumVotees)>=MapWinPct)
{
if( NumVotees>=4 && ActiveVotes.Length==1 ) // If more then 4 voters and everyone voted same map?!!! Give the mapvote some orgy.
if(NumVotees>=4 && ActiveVotes.Length==1) // If more then 4 voters and everyone voted same map?!!! Give the mapvote some orgy.
{
for( j=(ActiveVoters.Length-1); j>=0; --j )
for(j=(ActiveVoters.Length-1); j>=0; --j)
ActiveVoters[j].PlayerOwner.ClientPlaySound(AnnouncerCues[13]);
}
SwitchToLevel(ActiveVotes[i].GameIndex,ActiveVotes[i].MapIndex,false);
@ -348,19 +348,19 @@ final function TallyVotes( optional bool bForce )
}
// Check for mid-game voting timer.
if( !bMapVoteTimer && NumVotees>0 && GetPctOf(c,NumVotees)>=MidGameVotePct )
if(!bMapVoteTimer && NumVotees>0 && GetPctOf(c,NumVotees)>=MidGameVotePct)
StartMidGameVote(true);
}
final function StartMidGameVote( bool bMidGame )
final function StartMidGameVote(bool bMidGame)
{
local int i;
if( bMapVoteTimer || bMapvoteHasEnded )
if(bMapVoteTimer || bMapvoteHasEnded)
return;
bMapVoteTimer = true;
if( bMidGame )
if(bMidGame)
{
for( i=(ActiveVoters.Length-1); i>=0; --i )
for(i=(ActiveVoters.Length-1); i>=0; --i)
ActiveVoters[i].ClientNotifyVoteTime(0);
}
ShowMenuDelay = 5;
@ -369,15 +369,15 @@ final function StartMidGameVote( bool bMidGame )
}
function CheckEndGameEnded()
{
if( KF==None )
if(KF==None)
{
KF = KFGameReplicationInfo(WorldInfo.GRI);
if( KF==None )
if(KF==None)
return;
}
if( KF.bMatchIsOver ) // HACK, since KFGameInfo_Survival doesn't properly notify mutators of this!
if(KF.bMatchIsOver) // HACK, since KFGameInfo_Survival doesn't properly notify mutators of this!
{
if( !bMapVoteTimer )
if(!bMapVoteTimer)
StartMidGameVote(false);
ClearTimer('CheckEndGameEnded');
WorldInfo.Game.ClearTimer('ShowPostGameMenu');
@ -385,7 +385,7 @@ function CheckEndGameEnded()
}
function bool HandleRestartGame()
{
if( !bMapVoteTimer )
if(!bMapVoteTimer)
StartMidGameVote(false);
return true;
}
@ -394,9 +394,9 @@ function Timer()
local int i;
local SoundCue FX;
if( bMapvoteHasEnded )
if(bMapvoteHasEnded)
{
if( WorldInfo.NextSwitchCountdown<=0.f ) // Mapswitch failed, force to random other map.
if(WorldInfo.NextSwitchCountdown<=0.f) // Mapswitch failed, force to random other map.
{
ActiveVotes.Length = 0;
bMapvoteHasEnded = false;
@ -404,47 +404,47 @@ function Timer()
}
return;
}
if( ShowMenuDelay>0 && --ShowMenuDelay==0 )
if(ShowMenuDelay>0 && --ShowMenuDelay==0)
{
for( i=(ActiveVoters.Length-1); i>=0; --i )
for(i=(ActiveVoters.Length-1); i>=0; --i)
ActiveVoters[i].ClientOpenMapvote(true);
}
--VoteTimeLeft;
if( VoteTimeLeft==0 )
if(VoteTimeLeft==0)
{
TallyVotes(true);
}
else if( VoteTimeLeft<=10 || VoteTimeLeft==20 || VoteTimeLeft==30 || VoteTimeLeft==60 )
else if(VoteTimeLeft<=10 || VoteTimeLeft==20 || VoteTimeLeft==30 || VoteTimeLeft==60)
{
FX = None;
if( VoteTimeLeft<=10 )
if(VoteTimeLeft<=10)
FX = AnnouncerCues[VoteTimeLeft-1];
else if( VoteTimeLeft==20 )
else if(VoteTimeLeft==20)
FX = AnnouncerCues[10];
else if( VoteTimeLeft==30 )
else if(VoteTimeLeft==30)
FX = AnnouncerCues[11];
else if( VoteTimeLeft==60 )
else if(VoteTimeLeft==60)
FX = AnnouncerCues[12];
for( i=(ActiveVoters.Length-1); i>=0; --i )
for(i=(ActiveVoters.Length-1); i>=0; --i)
{
ActiveVoters[i].ClientNotifyVoteTime(VoteTimeLeft);
if( FX!=None )
if(FX!=None)
ActiveVoters[i].PlayerOwner.ClientPlaySound(FX);
}
}
}
final function SwitchToLevel( int GameIndex, int MapIndex, bool bAdminForce )
final function SwitchToLevel(int GameIndex, int MapIndex, bool bAdminForce)
{
local int i;
local string S;
if( bMapvoteHasEnded )
if(bMapvoteHasEnded)
return;
Default.LastVotedGameInfo = GameIndex;
Class.Static.StaticSaveConfig();
bMapvoteHasEnded = true;
if( !bAdminForce && !bHistorySaved )
if(!bAdminForce && !bHistorySaved)
{
class'xMapVoteHistory'.Static.UpdateMapHistory(Maps[MapIndex].History);
class'xMapVoteHistory'.Static.StaticSaveConfig();
@ -452,16 +452,16 @@ final function SwitchToLevel( int GameIndex, int MapIndex, bool bAdminForce )
}
S = Maps[MapIndex].MapName$" ("$GameModes[GameIndex].GameName$")";
for( i=(ActiveVoters.Length-1); i>=0; --i )
for(i=(ActiveVoters.Length-1); i>=0; --i)
{
KFPlayerController(ActiveVoters[i].PlayerOwner).ShowConnectionProgressPopup(PMT_AdminMessage,"Switching to level:",S);
ActiveVoters[i].ClientNotifyVoteWin(GameIndex,MapIndex,bAdminForce);
}
PendingMapURL = Maps[MapIndex].MapName$"?Game="$GameModes[GameIndex].GameClass$"?Mutator="$PathName(BaseMutator);
if( GameModes[GameIndex].Mutators!="" )
if(GameModes[GameIndex].Mutators!="")
PendingMapURL $= ","$GameModes[GameIndex].Mutators;
if( GameModes[GameIndex].Options!="" )
if(GameModes[GameIndex].Options!="")
PendingMapURL $= "?"$GameModes[GameIndex].Options;
`Log("MapVote: Switch map to "$PendingMapURL);
SetTimer(FMax(MapChangeDelay,0.1),false,'PendingSwitch');
@ -472,62 +472,62 @@ function PendingSwitch()
SetTimer(1,true);
}
final function ParseCommand( string Cmd, PlayerController PC )
final function ParseCommand(string Cmd, PlayerController PC)
{
if( Cmd~="Help" )
if(Cmd~="Help")
{
PC.ClientMessage("MapVote commands:");
PC.ClientMessage("!MapVote - Show mapvote menu");
PC.ClientMessage("!AddMap <Mapname> - Add map to mapvote");
PC.ClientMessage("!RemoveMap <Mapname> - Remove map from mapvote");
}
else if( Cmd~="MapVote" )
else if(Cmd~="MapVote")
ShowMapVote(PC);
else if( !PC.PlayerReplicationInfo.bAdmin && !PC.IsA('MessagingSpectator') )
else if(!PC.PlayerReplicationInfo.bAdmin && !PC.IsA('MessagingSpectator'))
return;
else if( Left(Cmd,7)~="AddMap " )
else if(Left(Cmd,7)~="AddMap ")
{
Cmd = Mid(Cmd,7);
PC.ClientMessage("Added map '"$Cmd$"'!");
AddMap(Cmd);
}
else if( Left(Cmd,10)~="RemoveMap " )
else if(Left(Cmd,10)~="RemoveMap ")
{
Cmd = Mid(Cmd,10);
if( RemoveMap(Cmd) )
if(RemoveMap(Cmd))
PC.ClientMessage("Removed map '"$Cmd$"'!");
else PC.ClientMessage("Map '"$Cmd$"' not found!");
}
}
function ShowMapVote( PlayerController PC )
function ShowMapVote(PlayerController PC)
{
local int i;
if( bMapvoteHasEnded )
if(bMapvoteHasEnded)
return;
for( i=(ActiveVoters.Length-1); i>=0; --i )
if( ActiveVoters[i].PlayerOwner==PC )
for(i=(ActiveVoters.Length-1); i>=0; --i)
if(ActiveVoters[i].PlayerOwner==PC)
{
ActiveVoters[i].ClientOpenMapvote(false);
return;
}
}
final function AddMap( string M )
final function AddMap(string M)
{
if( Class'KFGameInfo'.Default.GameMapCycles.Length==0 )
if(Class'KFGameInfo'.Default.GameMapCycles.Length==0)
Class'KFGameInfo'.Default.GameMapCycles.Length = 1;
Class'KFGameInfo'.Default.GameMapCycles[0].Maps.AddItem(M);
Class'KFGameInfo'.Static.StaticSaveConfig();
}
final function bool RemoveMap( string M )
final function bool RemoveMap(string M)
{
local int i,j;
for( i=(Class'KFGameInfo'.Default.GameMapCycles.Length-1); i>=0; --i )
for(i=(Class'KFGameInfo'.Default.GameMapCycles.Length-1); i>=0; --i)
{
for( j=(Class'KFGameInfo'.Default.GameMapCycles[i].Maps.Length-1); j>=0; --j )
for(j=(Class'KFGameInfo'.Default.GameMapCycles[i].Maps.Length-1); j>=0; --j)
{
if( Class'KFGameInfo'.Default.GameMapCycles[i].Maps[j]~=M )
if(Class'KFGameInfo'.Default.GameMapCycles[i].Maps[j]~=M)
{
Class'KFGameInfo'.Default.GameMapCycles[i].Maps.Remove(j,1);
Class'KFGameInfo'.Static.StaticSaveConfig();