| Home Page | Recent Changes | Preferences

ProfileConfigSet

UT2003 :: Object >> ProfileConfigSet (Ladder1.46)
00001  //-----------------------------------------------------------
00002  // Ladder.ProfileConfigSet
00003  // Loosely (very loosely) based on GameConfigSet
00004  //
00005  // ProfileConfigSet is, in essence, a primitive database program which
00006  // stores and retrieves not only numerous different "GameConfigSet"
00007  // profiles, but map, mutator, serveractor and accesscontrol information as well.
00008  //-----------------------------------------------------------
00009  class ProfileConfigSet extends Object
00010      Config(System)
00011      PerObjectConfig;
00012  
00013  const LOGNAME = 'ProfileConfigSet';
00014  
00015  // Variables that are used globally
00016  var LevelInfo                           Level;          // Need access to Level object
00017  var protected string                    AllMapsPrefix;  // Which map prefix is currently loaded
00018  var protected array< class<GameInfo> >  AllGameTypes;   // All valid gametypes
00019  var protected config string             DefaultGameType;// The gametype for this profile
00020  var protected class<AccessControl>      ACClass;        // The access control class
00021  var protected GameConfigSet             RealConfigSet;  // Actual gameconfigset used by the game
00022  
00023  var protected class<GameInfo>           GameClass;      // Which game class is used by this profile
00024  var protected PlayInfo                  PInfo;          // PlayInfo for currently active GameType, AccessControl Class, and Active Mutators
00025  var protected MapList                   Maps;           // Maps currently in rotation
00026  
00027  // Regarding ServerActors
00028  struct ProfileSA {
00029                          var string      ActorClass;
00030                          var bool        bRequired; };
00031  var config array<ProfileSA>             AllServerActors;
00032  var config array<string>                ProfileServerActors;
00033  var protected array<string>             GameServerActors;
00034  var protected StringArray               ActiveServerActors;
00035  
00036  // Regarding Maps
00037  struct ProfileMap {
00038                          var string      MapName;
00039                          var int         MapListOrder;
00040                          var bool        bRequired; };
00041  var config int                          MaxMaps;                // Maximum maps allowed in maplist
00042  var protected array<string>             GameMaps;               // List of all maps for this gametype that exist on server
00043  var protected config array<ProfileMap>  AllMaps;                // List of all maps that could be used by this profile
00044  var protected config array<string>      ProfileMaps;            // List of all maps that are included in the maplist for this profile
00045  var protected StringArray               ActiveMaps;             // StringArray of ProfileMaps
00046  
00047  // Regarding Mutators
00048  struct ProfileMutator {
00049                          var string          MutatorName;
00050                          var bool            bRequired; };
00051  var string                                  NextMutators;           // What mutators were set during this session
00052  var protected array<xUtil.MutatorRecord>    GameMutators;           // List of all mutators that exist on server
00053  var protected config array<ProfileMutator>  AllMutators;            // List of all mutators that could be used this profile
00054  var protected config array<string>          ProfileMutators;        // Mutators that will be loaded by this profile
00055  var protected StringArray                   ActiveMutators;         // StringArray of ProfileMutators
00056  
00057  // Regarding PlayInfo
00058  var protected config string                 AccessClass;
00059  struct ProfileSetting { var string          SettingName;
00060                          var string          SettingValue; };
00061  var protected config array<ProfileSetting>  ProfileSettings;    // Stored Profile Settings which include non-active mutators PlayInfo
00062  var protected array<ProfileSetting>         ActiveSettings;     // Representation of stored profile settings including only active mutators
00063  
00064  // Whether we are currently editing something
00065  var protected bool                          bEdit;
00066  
00067  // Localized strings
00068  var localized string    ErrorNoGameType;
00069  var localized string    SavingToFile;
00070  var localized string    DidNotStartEdit;
00071  
00072  function Init(LevelInfo Lv, optional string GameType, optional string AC)
00073  {
00074      if (Lv==None)
00075          return;
00076  
00077      Level = Lv;
00078      if (GameType!="") DefaultGameType = GameType;
00079      if (AC != "") AccessClass = AC;
00080      else AccessClass = Level.Game.AccessControlClass;
00081      AllMapsPrefix = FindGameType(DefaultGameType).default.MapPrefix;
00082  
00083      // Make sure that none of the configured mutators have been removed from this server
00084      ValidateProfile();
00085  }
00086  
00087  function Cleanup()
00088  {
00089      // Destroy any references to actors
00090      if (Level != None)
00091          Level=None;
00092  
00093      if (ActiveMaps != None)
00094          ActiveMaps = None;
00095  
00096      if (Maps != None)
00097          Maps = None;
00098  }
00099  
00100  function ValidateProfile()
00101  {
00102      ValidateAllMutators();
00103      ValidateAllMaps();
00104      ValidateAllServerActors();
00105  }
00106  
00107  function ValidateAllMutators()
00108  {
00109      local class<Mutator>    TempMutClass;
00110      local int i;
00111  
00112      for (i = 0;i < AllMutators.Length; i++)
00113      {
00114          TempMutClass = class<Mutator>(DynamicLoadObject(AllMutators[i].MutatorName, Class'class'));
00115          if (TempMutClass == None)
00116          {
00117              log("Mutator class '"$AllMutators[i].MutatorName$"' has been removed from this server.  Removing mutator from current profile.",LOGNAME);
00118              AllMutators.Remove(i--,1);
00119              SaveConfig();
00120          }
00121      }
00122  }
00123  
00124  function ValidateAllMaps()
00125  {
00126      local int i, j;
00127  
00128      LoadAllMaps();
00129      for (i = 0;i < AllMaps.Length;i++)
00130      {
00131          for (j = 0;j < GameMaps.Length;j++)
00132              if (GameMaps[j] ~= AllMaps[i].MapName)
00133                  break;
00134  
00135          if (j == GameMaps.Length)
00136          {
00137              log("Map '"$AllMaps[i].MapName$"' has been removed from this server. Removing map from profile.",LOGNAME);
00138              AllMaps.Remove(i--,1);
00139              SaveConfig();
00140          }
00141      }
00142  }
00143  
00144  function ValidateAllServerActors()
00145  {
00146      local int i;
00147      local class<Info> TempSA;
00148  
00149      for (i=0;i<AllServerActors.Length;i++)
00150      {
00151          TempSA = class<Info>(DynamicLoadObject(AllServerActors[i].ActorClass,Class'Class'));
00152          if (TempSA == None)
00153          {
00154              log("ServerActor '"$AllServerActors[i].ActorClass$"' does not exist on this server.  Removing ServerActor from profile.",LOGNAME);
00155              AllServerActors.Remove(i--,1);
00156              SaveConfig();
00157          }
00158      }
00159  }
00160  
00161  function bool StartEdit()
00162  {
00163      if (Level == None || bEdit)
00164          return false;
00165  
00166      bEdit = true;
00167  
00168      if (PInfo == None)
00169          PInfo = New(None) class'PlayInfo';
00170  
00171      if (AllGameTypes.Length == 0)
00172          LoadGameTypes();
00173      GameClass = FindGameType(DefaultGameType);
00174      if (GameClass == None)
00175      {
00176          log(ErrorNoGameType$DefaultGameType);
00177          return false;
00178      }
00179  
00180      if (AccessClass != "")
00181          ACClass = class<AccessControl>(DynamicLoadObject(AccessClass, class'class'));
00182  
00183      if (Level != None && Level.Game != None && Level.Game.AccessControl != None && AccessControlIni(Level.Game.AccessControl) != None && AccessControlIni(Level.Game.AccessControl).ConfigSet != None)
00184          RealConfigSet = AccessControlIni(Level.Game.AccessControl).ConfigSet;
00185  
00186      if (ActiveMutators == None)
00187          ActiveMutators = new(None) class'SortedStringArray';
00188      if (ActiveMaps == None)
00189          ActiveMaps = new(None) class'StringArray';
00190      if (ActiveServerActors == None)
00191          ActiveServerActors = new(None) class'SortedStringArray';
00192  
00193      NextMutators = "";
00194      LoadAllMaps();
00195  
00196      if (GameMutators.Length == 0)
00197          LoadAllMutators();
00198      LoadAllServerActors();
00199  
00200      SetUsedMaps();
00201      SetUsedMutators();
00202      SetUsedServerActors();
00203  
00204      // Load Game Setting
00205      LoadSettings(GameClass);
00206      AllMapsPrefix = GameClass.default.MapPrefix;
00207      return true;
00208  }
00209  
00210  function bool EndEdit(bool bSave, optional bool bQuiet)
00211  {
00212      if (Level == None || !bEdit)
00213          return false;
00214  
00215      // Save all data where it belongs
00216      if (bSave)
00217      {
00218          if (!bQuiet) Log(Name@SavingToFile);
00219  
00220          SaveUsedMaps();
00221          SaveUsedMutators();
00222          SaveUsedServerActors();
00223          SaveConfig();
00224      }
00225  
00226      bEdit = false;
00227      return true;
00228  }
00229  
00230  function ReplaceWith(ProfileConfigSet SourcePCS)
00231  {
00232      local int i;
00233  
00234      if (!bEdit)
00235      {
00236          log("ReplaceWith()"@DidNotStartEdit);
00237          return;
00238      }
00239  
00240      if (SourcePCS.GetGameClass() != None)
00241      {
00242          Wipe();
00243          DefaultGameType = string(SourcePCS.GetGameClass());
00244          GameClass = FindGameType(DefaultGameType);
00245          AccessClass = SourcePCS.GetAccessControl();
00246          ACClass = SourcePCS.GetAccessClass();
00247          AllMapsPrefix = GameClass.default.MapPrefix;
00248          MaxMaps = SourcePCS.MaxMaps;
00249  
00250          AllMaps = SourcePCS.GetProfileMaps();
00251          AllMutators = SourcePCS.GetProfileMutators();
00252          AllServerActors = SourcePCS.GetProfileServerActors();
00253          ProfileMaps = SourcePCS.GetUsedMaps();
00254          ProfileMutators = SourcePCS.GetUsedMutators();
00255          ProfileServerActors = SourcePCS.GetUsedServerActors();
00256          ProfileSettings.Length = SourcePCS.Count();
00257          for (i = 0; i < SourcePCS.Count(); i++)
00258              SetProfileParam(i, SourcePCS.GetProfileParamName(i), SourcePCS.GetProfileParam(i));
00259  
00260          LoadSettings(GameClass);
00261      }
00262  }
00263  
00264  function bool CanEdit()
00265  {
00266      return !bEdit;
00267  }
00268  
00269  // This profile was deleted, but PerObjectConfig config values cannot be completely removed from .ini (that I know of)
00270  // We can, however, make the ini entry for this object as small as possible until it is reused.
00271  final function Wipe()
00272  {
00273  //log("Wiping Profile"@Name);
00274      ActiveMaps.Reset();
00275      ActiveMutators.Reset();
00276  
00277      MaxMaps = 0;
00278  
00279      ProfileMaps.Length = 0;
00280      AllMaps.Length = 0;
00281      ProfileMutators.Length = 0;
00282      AllMutators.Length = 0;
00283      ProfileServerActors.Length = 0;
00284      AllServerActors.Length = 0;
00285      ProfileSettings.Length = 0;
00286      ActiveSettings.Length = 0;
00287  
00288      DefaultGameType = "";
00289      AccessClass = "";
00290      AllMapsPrefix = "";
00291      NextMutators = "";
00292  
00293      GameClass = None;
00294      ACClass = None;
00295      Maps = None;
00296  
00297  }
00298  
00299  ///////////////////////////////////////////////////////////////////
00300  // Public GameType Information
00301  ///////////////////////////////////////////////////////////////////
00302  
00303  function bool SetGameType(optional string NewGameType)
00304  {
00305      local string OldGameType;
00306  
00307      if (!bEdit)
00308      {
00309          log("SetGameType()"@DidNotStartEdit);
00310          return false;
00311      }
00312  
00313      OldGameType = DefaultGameType;
00314      if (NewGameType=="")
00315          NewGameType=DefaultGameType;
00316      else DefaultGameType = NewGameType;
00317  
00318      if (AllGameTypes.Length==0)
00319          LoadGameTypes();
00320  
00321      GameClass = FindGameType(NewGameType);
00322  
00323      if (GameClass != None && (NewGameType != OldGameType))
00324      {
00325          AllMapsPrefix = GameClass.default.MapPrefix;
00326          ClearUsedMaps();
00327          ClearAllMaps();
00328          ClearProfile(ProfileSettings);
00329          LoadSettings(GameClass);
00330          return true;
00331      }
00332      return false;
00333  }
00334  
00335  function class<GameInfo> GetGameClass()
00336  {
00337      if (GameClass != None)
00338          return GameClass;
00339  
00340      return None;
00341  }
00342  
00343  function string GetGameAcronym()
00344  {
00345      if (GameClass != None)
00346          return GameClass.default.Acronym;
00347  
00348      return "";
00349  }
00350  
00351  function string GetAccessControl()
00352  {
00353      return AccessClass;
00354  }
00355  
00356  function class<AccessControl> GetAccessClass()
00357  {
00358      if (ACClass != None)
00359          return ACClass;
00360      return None;
00361  }
00362  
00363  /////////////////////////////////////////////////////////////
00364  // Public MapList Functions
00365  /////////////////////////////////////////////////////////////
00366  function bool AddProfileMap(string MapMask, bool bRequired)
00367  {
00368      local int i;
00369      local ProfileMap tmp;
00370  
00371      if (!bEdit)
00372      {
00373          log("AddProfileMap()"@DidNotStartEdit);
00374          return false;
00375      }
00376  
00377      for (i=0;i<AllMaps.Length;i++)
00378      {
00379          if (AllMaps[i].MapName ~= MapMask)
00380          {
00381              AllMaps[i].bRequired = bRequired;
00382              return true;
00383          }
00384      }
00385  
00386      for (i=0;i<GameMaps.Length;i++)
00387      {
00388          if (MapMask ~= GameMaps[i])
00389          {
00390              tmp.MapName = GameMaps[i];
00391              tmp.bRequired = bRequired;
00392              AllMaps[AllMaps.Length] = tmp;
00393              return true;
00394          }
00395      }
00396  
00397      return false;
00398  }
00399  
00400  function bool DelProfileMap(string MapName)
00401  {
00402      local int i;
00403      local string Str;
00404  
00405      if (!bEdit)
00406      {
00407          log("DelProfileMap()"@DidNotStartEdit);
00408          return false;
00409      }
00410  
00411      for (i=0;i<AllMaps.Length;i++)
00412      {
00413          Str = AllMaps[i].MapName;
00414          if (Str ~= MapName)
00415          {
00416              AllMaps.Remove(i, 1);
00417              SetUsedMaps();
00418              return true;
00419          }
00420      }
00421  
00422      return false;
00423  }
00424  
00425  function string AddMap(string MapMask, int Order)
00426  {
00427      local int i, j, k;
00428      local bool bFound;
00429  
00430      if (!bEdit)
00431      {
00432          log("AddMaps()"@DidNotStartEdit);
00433          return "";
00434      }
00435  
00436      k = ActiveMaps.Count();
00437      for (i = 0; i<AllMaps.Length; i++)
00438      {
00439          if (AllMaps[i].MapName ~= MapMask)
00440          {
00441              // Found a matching map, see if its already in the Used Maps list
00442              bFound = false;
00443              for (j = 0; j < k; j++)
00444              {
00445                  if (ActiveMaps.GetTag(j) ~= AllMaps[i].MapName)
00446                  {
00447                      bFound = true;
00448                      AllMaps[i].MapListOrder = Order;
00449                      break;
00450                  }
00451              }
00452  
00453              if (!bFound && ((MaxMaps == 0) || (k < MaxMaps)))
00454              {
00455                  AllMaps[i].MapListOrder = ActiveMaps.Count();
00456                  ActiveMaps.Add(string(i), AllMaps[i].MapName);
00457                  return AllMaps[i].MapName;
00458              }
00459          }
00460      }
00461      return "";
00462  }
00463  
00464  function string RemoveMap(string MapName)
00465  {
00466      local int i;
00467      local string TempStr;
00468      if (!bEdit)
00469      {
00470          log("RemoveMaps()"@DidNotStartEdit);
00471          return "";
00472      }
00473  
00474      for (i=0; i<ActiveMaps.Count(); i++)
00475      {
00476          TempStr = ActiveMaps.GetTag(i);
00477          if (TempStr ~= MapName)
00478          {
00479              ActiveMaps.Remove(i);
00480              return TempStr;
00481          }
00482      }
00483      return "";
00484  }
00485  
00486  function array<string> FindMaps(string MapMask)
00487  {
00488      local array<string> FoundMasks, FoundMaps;
00489      local int i, j, k;
00490      local bool bFound;
00491  
00492      class'wUtils103.wString'.static.Split2(MapMask, " ", FoundMasks);
00493      if (FoundMasks.Length > 0)
00494      {
00495          for (i = 0; i<AllMaps.Length; i++)
00496          {
00497              for (j = 0; j<FoundMasks.Length; j++)
00498              {
00499                  if (class'wUtils103.wString'.static.MaskedCompare(AllMaps[i].MapName, FoundMasks[j]))
00500                  {
00501                      // Found a matching map, see if its already in the Used Maps list
00502                      bFound = false;
00503                      for (k = 0; k<ActiveMaps.Count(); k++)
00504                      {
00505                          if (ActiveMaps.GetTag(k) ~= AllMaps[i].MapName)
00506                          {
00507                              bFound = true;
00508                              break;
00509                          }
00510                      }
00511  
00512                      if (bFound)
00513                          FoundMaps[FoundMaps.Length] = "+"$AllMaps[i].MapName;
00514                      else
00515                          FoundMaps[FoundMaps.Length] = AllMaps[i].MapName;
00516  
00517                      break;
00518                  }
00519              }
00520          }
00521      }
00522      return FoundMaps;
00523  }
00524  
00525  function MapList GetMaps()
00526  {
00527      if (Maps==None)
00528      {
00529          if (GameClass==None)
00530              GameClass=class<GameInfo>(DynamicLoadObject(DefaultGameType, class'Class'));
00531  
00532          Maps = Level.Game.GetMapList(AllMapsPrefix);
00533      }
00534  
00535      return Maps;
00536  }
00537  
00538  function array<string> GetUsedMaps()
00539  {
00540      local array<string> Strings;
00541      local int i;
00542  
00543      if (ActiveMaps == None)
00544          ActiveMaps = new(None) class'StringArray';
00545  
00546      for (i = 0; i<ActiveMaps.Count(); i++)
00547          Strings[Strings.Length] = ActiveMaps.GetTag(i);
00548  
00549      return Strings;
00550  }
00551  
00552  function array<string> GetUnusedMaps()
00553  {
00554      local array<string> Strings;
00555      local int i;
00556  
00557      if (ActiveMaps == None)
00558          ActiveMaps = new(None) class'StringArray';
00559  
00560      Strings.Length = AllMaps.Length;
00561      for (i = 0; i<AllMaps.Length; i++)
00562          Strings[i] = AllMaps[i].MapName;
00563  
00564      // Tag all used mutators
00565      for (i = 0; i<ActiveMaps.Count(); i++)
00566          Strings[int(ActiveMaps.GetItem(i))] = "";
00567  
00568      for (i = 0; i<Strings.Length; i++)
00569      {
00570          if (Strings[i] == "")
00571          {
00572              Strings.Remove(i, 1);
00573              i--;
00574          }
00575      }
00576      return Strings;
00577  }
00578  
00579  function bool MapIsRequired(string MapName)
00580  {
00581      local int i;
00582      for (i=0;i<AllMaps.Length;i++)
00583          if (MapName ~= AllMaps[i].MapName && AllMaps[i].bRequired)
00584              return true;
00585      return false;
00586  }
00587  
00588  function array<ProfileMap> GetProfileMaps()
00589  {
00590      return AllMaps;
00591  }
00592  
00593  function int GetMaxMaps()
00594  {
00595      return MaxMaps;
00596  }
00597  
00598  /////////////////////////////////////////////////////////////////////
00599  // Public Mutator list functions
00600  /////////////////////////////////////////////////////////////////////
00601  
00602  function array<ProfileMutator> GetProfileMutators()
00603  {
00604      return AllMutators;
00605  }
00606  
00607  function array<string> GetUsedMutators()
00608  {
00609      local array<string> Strings;
00610      local int i;
00611  
00612      if (ActiveMutators == None)
00613          ActiveMutators = new(None) class'SortedStringArray';
00614  
00615      for (i = 0; i<ActiveMutators.Count(); i++)
00616          Strings[Strings.Length] = ActiveMutators.GetTag(i);
00617  
00618      return Strings;
00619  }
00620  
00621  function array<string> GetUnusedMutators()
00622  {
00623      local array<string> Strings;
00624      local int i;
00625  
00626      if (ActiveMutators == None)
00627          ActiveMutators = new(None) class'SortedStringArray';
00628  
00629      Strings.Length = AllMutators.Length;
00630      for (i = 0; i<AllMutators.Length; i++)
00631          Strings[i] = AllMutators[i].MutatorName;
00632  
00633      // Tag all used mutators
00634      for (i = 0; i<ActiveMutators.Count(); i++)
00635          Strings[int(ActiveMutators.GetItem(i))] = "";
00636  
00637      for (i = 0; i<Strings.Length; i++)
00638      {
00639          if (Strings[i] == "")
00640          {
00641              Strings.Remove(i, 1);
00642              i--;
00643          }
00644      }
00645      return Strings;
00646  }
00647  
00648  function bool AddMutator(string MutatorName)
00649  {
00650      local int i;
00651      local string Str;
00652  
00653      if (!bEdit)
00654      {
00655          log("AddMutator()"@DidNotStartEdit);
00656          return false;
00657      }
00658  
00659      if (ActiveMutators.Count() == 0)
00660          SetUsedMutators();
00661  
00662      // First make sure it isnt in the list
00663      for (i = 0; i<ActiveMutators.Count(); i++)
00664      {
00665          Str = ActiveMutators.GetTag(i);
00666          if (Str ~= MutatorName || Right(Str, Len(MutatorName) + 1) ~= ("."$MutatorName))
00667              return false;
00668      }
00669  
00670      for (i=0;i<AllMutators.Length;i++)
00671      {
00672          Str = AllMutators[i].MutatorName;
00673          if (Str ~= MutatorName || Right(Str, Len(MutatorName) + 1) ~= ("."$MutatorName))
00674          {
00675              ActiveMutators.Add(string(i), Str);
00676              return true;
00677          }
00678      }
00679      return false;
00680  }
00681  
00682  function bool DelMutator(string MutatorName)
00683  {
00684      local int i;
00685      local string Str;
00686  
00687      if (!bEdit)
00688      {
00689          log("DelMutator()"@DidNotStartEdit);
00690          return false;
00691      }
00692  
00693      if (MutIsRequired(MutatorName))
00694          return false;
00695  
00696      // First make sure it is in the list
00697      for (i = 0; i<ActiveMutators.Count(); i++)
00698      {
00699          Str = ActiveMutators.GetTag(i);
00700          if (Str ~= MutatorName || Right(Str, Len(MutatorName) + 1) ~= ("."$MutatorName))
00701          {
00702              ActiveMutators.Remove(i);
00703              return true;
00704          }
00705      }
00706      return false;
00707  }
00708  
00709  // Add mutator to list of possible mutators
00710  function bool AddProfileMutator(string MutatorName, bool bRequired)
00711  {
00712      local int i,j;
00713      local string Str;
00714      local ProfileMutator tmp;
00715  
00716      if (!bEdit)
00717      {
00718          log("AddProfileMutator()"@DidNotStartEdit);
00719          return false;
00720      }
00721  
00722      for (i=0;i<AllMutators.Length;i++)
00723      {
00724          Str = AllMutators[i].MutatorName;
00725          if (Str ~= MutatorName || Right(Str, Len(MutatorName) + 1) ~= ("."$MutatorName))
00726          {
00727              AllMutators[i].bRequired = bRequired;
00728              return false;
00729          }
00730      }
00731  
00732      for (j=0;j<GameMutators.Length;j++)
00733      {
00734          Str = GameMutators[j].ClassName;
00735          if (Str ~= MutatorName || Right(Str, Len(MutatorName) + 1) ~= ("."$MutatorName))
00736          {
00737              tmp.MutatorName = Str;
00738              tmp.bRequired = bRequired;
00739              AllMutators[AllMutators.Length] = tmp;
00740              return true;
00741          }
00742      }
00743  
00744      return false;
00745  }
00746  
00747  function bool DelProfileMutator(string MutatorName)
00748  {
00749      local int i;
00750      local string Str;
00751  
00752      if (!bEdit)
00753      {
00754          log("DelProfileMutator()"@DidNotStartEdit);
00755          return false;
00756      }
00757  
00758      for (i=0;i<AllMutators.Length;i++)
00759      {
00760          Str = AllMutators[i].MutatorName;
00761          if (Str ~= MutatorName || Right(Str, Len(MutatorName)+1) ~= ("."$MutatorName))
00762          {
00763              AllMutators.Remove(i, 1);
00764              SetUsedMutators();
00765              return true;
00766          }
00767      }
00768  
00769      return false;
00770  }
00771  
00772  function bool MutIsRequired(string MutatorName)
00773  {
00774      local int i;
00775      for (i=0;i<AllMutators.Length;i++)
00776          if (MutatorName ~= AllMutators[i].MutatorName && AllMutators[i].bRequired)
00777              return true;
00778      return false;
00779  }
00780  
00781  //////////////////////////////////
00782  // Public ServerActor Functions
00783  //////////////////////////////////
00784  
00785  function array<ProfileSA> GetProfileServerActors()
00786  {
00787      return AllServerActors;
00788  }
00789  
00790  function array<string> GetUsedServerActors()
00791  {
00792      local array<string> Strings;
00793      local int i;
00794  
00795      if (ActiveServerActors == None)
00796          ActiveServerActors = new(None) class'SortedStringArray';
00797  
00798      for (i = 0; i<ActiveServerActors.Count(); i++)
00799          Strings[Strings.Length] = ActiveServerActors.GetTag(i);
00800  
00801      return Strings;
00802  }
00803  
00804  function bool AddProfileServerActor(string ActorName, bool bRequired)
00805  {
00806      local int i;
00807      local ProfileSA tmp;
00808  
00809      if (!bEdit)
00810      {
00811          log("AddProfileServerActor()"@DidNotStartEdit);
00812          return false;
00813      }
00814  
00815      for (i=0;i<AllServerActors.Length;i++)
00816      {
00817          if (AllServerActors[i].ActorClass ~= ActorName)
00818          {
00819              AllServerActors[i].bRequired = bRequired;
00820              return false;
00821          }
00822      }
00823  
00824      tmp.ActorClass = ActorName;
00825      tmp.bRequired = bRequired;
00826      AllServerActors[AllServerActors.Length] = tmp;
00827      SetUsedServerActors();
00828      return true;
00829  }
00830  
00831  function bool AddServerActor(string ActorName)
00832  {
00833      local int i;
00834  
00835      if (!bEdit)
00836      {
00837          log("AddServerActor()"@DidNotStartEdit);
00838          return false;
00839      }
00840  
00841      // Check for already exists
00842      for (i=0;i<ProfileServerActors.Length;i++)
00843      {
00844          if (ProfileServerActors[i] ~= ActorName)
00845              return false;
00846      }
00847  
00848      for (i=0;i<AllServerActors.Length;i++)
00849      {
00850          if (AllServerActors[i].ActorClass ~= ActorName)
00851          {
00852              ProfileServerActors[ProfileServerActors.Length] = ActorName;
00853              SetUsedServerActors();
00854              return true;
00855          }
00856      }
00857      return false;
00858  }
00859  
00860  function bool DelProfileServerActor(string ActorName)
00861  {
00862      local int i;
00863  
00864      if (!bEdit)
00865      {
00866          log("DelProfileServerActor()"@DidNotStartEdit);
00867          return false;
00868      }
00869  
00870      for (i=0;i<AllServerActors.Length;i++)
00871      {
00872          if (AllServerActors[i].ActorClass ~= ActorName)
00873          {
00874              AllServerActors.Remove(i,1);
00875              SetUsedServerActors();
00876              return true;
00877          }
00878      }
00879  
00880      return false;
00881  }
00882  
00883  function bool DelServerActor(string ActorName)
00884  {
00885      local int i;
00886  
00887      if (!bEdit)
00888      {
00889          log("DelServerActor()"@DidNotStartEdit);
00890          return false;
00891      }
00892  
00893      i = ActiveServerActors.FindTagId(ActorName);
00894      if (i >= 0)
00895      {
00896          ActiveServerActors.Remove(i);
00897          return true;
00898      }
00899  
00900      return false;
00901  }
00902  
00903  function bool ServerActorIsRequired(string ActorName)
00904  {
00905      local int i;
00906      for (i=0;i<AllServerActors.Length;i++)
00907          if (ActorName ~= AllServerActors[i].ActorClass)
00908              return AllServerActors[i].bRequired;
00909  
00910      return false;
00911  }
00912  
00913  
00914  ////////////////////////////////
00915  // Protected Helping functions
00916  ////////////////////////////////
00917  
00918  // Always reload settings at StartEdit()
00919  protected function string LoadSettings(class<GameInfo> GameClass)
00920  {
00921      local class<Mutator> MutClass;
00922      local class<Info>   SAClass;
00923      local int i,j;
00924  
00925      if (!bEdit)
00926      {
00927          log("LoadSettings()"@DidNotStartEdit);
00928          return "";
00929      }
00930  
00931      if (PInfo == None)
00932          PInfo = new(None) class'PlayInfo';
00933  
00934      PInfo.Clear();
00935  
00936      // Unhook GameInfo.FillPlayInfo()'s hook to BaseMutator.FillPlayInfo()
00937      // Otherwise, we end up with mutator playinfo that we may not want
00938      GameClass.static.FillPlayInfo(PInfo);
00939      PInfo.PopClass();
00940  
00941      if (ACClass == None && AccessClass != "")
00942          ACClass = class<AccessControl>(DynamicLoadObject(AccessClass,class'Class'));
00943  
00944      if (ACClass!=None)
00945      {
00946          ACClass.static.FillPlayInfo(PInfo);
00947          PInfo.PopClass();
00948      }
00949  
00950      if (GameClass.default.MutatorClass != "")
00951      {
00952          MutClass = class<Mutator>(DynamicLoadObject(GameClass.default.MutatorClass,class'Class'));
00953          if (MutClass != None)
00954          {
00955              MutClass.static.FillPlayInfo(PInfo);
00956              PInfo.PopClass();
00957          }
00958      }
00959  
00960      if (ActiveMutators.Count() == 0)
00961          SetUsedMutators();
00962  
00963      if (ActiveServerActors.Count() == 0)
00964          SetUsedServerActors();
00965  
00966      for (i=0;i<ActiveMutators.Count();i++)
00967      {
00968          MutClass=class<Mutator>(DynamicLoadObject(AllMutators[int(ActiveMutators.GetItem(i))].MutatorName,class'class'));
00969          if (MutClass!=None)
00970          {
00971              MutClass.static.FillPlayInfo(PInfo);
00972              PInfo.PopClass();
00973          }
00974      }
00975  
00976      for (i=0;i<ActiveServerActors.Count();i++)
00977      {
00978          j = int(ActiveServerActors.GetItem(i));
00979          SAClass = class<Info>(DynamicLoadObject(AllServerActors[j].ActorClass,class'Class'));
00980          if (SAClass != None)
00981          {
00982              SAClass.static.FillPlayInfo(PInfo);
00983              PInfo.PopClass();
00984          }
00985      }
00986  
00987      // Create active profile array
00988      InitializeProfile(ActiveSettings);
00989      if (ProfileSettings.Length > 0)
00990      {
00991          ActiveSettings.Length = ProfileSettings.Length;
00992          // Then retrieve all stored values from saved profile
00993          for (i=0;i<ProfileSettings.Length;i++)
00994              ActiveSettings[i] = ProfileSettings[i];
00995      }
00996      else // Copy active profile to saved profile.
00997      {
00998          ProfileSettings.Length = ActiveSettings.Length;
00999          for (i=0;i<ActiveSettings.Length;i++)
01000              SetProfileParam(i,ActiveSettings[i].SettingName,ActiveSettings[i].SettingValue);
01001      }
01002  
01003      return string(GameClass);
01004  }
01005  
01006  protected function LoadGameTypes()
01007  {
01008      local class<GameInfo>   TempClass;
01009      local String            NextGame;
01010      local int               i;
01011  
01012      // Compile a list of all gametypes.
01013      i = 0;
01014      NextGame = Level.GetNextInt("Engine.GameInfo", 0);
01015      AllGameTypes.Length = 0;
01016      while (NextGame != "")
01017      {
01018          TempClass = class<GameInfo>(DynamicLoadObject(NextGame, class'Class'));
01019          if (TempClass != None)
01020              AllGameTypes[AllGameTypes.Length] = TempClass;
01021  
01022          NextGame = Level.GetNextInt("Engine.GameInfo", ++i);
01023      }
01024  }
01025  
01026  protected function class<GameInfo> FindGameType(string GameType)
01027  {
01028      local class<GameInfo> TempClass;
01029      local int i;
01030  
01031      if (AllGameTypes.Length == 0)
01032          LoadGameTypes();
01033      TempClass = None;
01034      for (i=0; i<AllGameTypes.Length; i++)
01035      {
01036          TempClass = AllGameTypes[i];
01037          if (GameType ~= string(TempClass))              break;
01038          if (GameType ~= TempClass.default.Acronym)      break;
01039          if (GameType ~= TempClass.default.DecoTextName) break;
01040          if (Right(string(TempClass), Len(GameType)+1) ~= ("."$GameType))            break;
01041          if (Right(TempClass.default.DecoTextName, Len(GameType)+1) ~= ("."$GameType))   break;
01042      }
01043      return TempClass;
01044  }
01045  
01046  protected function LoadAllMaps()
01047  {
01048      if (GameClass==None)
01049          GameClass = FindGameType(DefaultGameType);
01050  
01051      if (GameClass == None)
01052          return;
01053  
01054      GameMaps.Length = 0;
01055      GameClass.static.LoadMapList(GameClass.default.MapPrefix, GameMaps);
01056  }
01057  
01058  protected function LoadAllMutators()
01059  {
01060      class'xUtil'.static.GetMutatorList(GameMutators);
01061  }
01062  
01063  protected function LoadAllServerActors()
01064  {
01065      local int i;
01066      local ConfigMaster ConfigM;
01067  
01068      if (Level != None && Level.Game != None && Level.Game.BaseMutator != None && ConfigMaster(Level.Game.BaseMutator.NextMutator) != None)
01069          ConfigM = ConfigMaster(Level.Game.BaseMutator.NextMutator);
01070      else return;
01071  
01072      for (i=0;i<ConfigM.ManagedActors.Length;i++)
01073          GameServerActors[GameServerActors.Length] = string(ConfigM.ManagedActors[i].SAClass);
01074  }
01075  
01076  protected function bool MapIsValid(string MapName)
01077  {
01078      local string Prefix, ShortName;
01079  
01080      Divide(MapName,"-",Prefix,ShortName);
01081      if (Prefix ~= AllMapsPrefix)
01082          return true;
01083      return false;
01084  }
01085  
01086  protected function string GetMutatorGroup(string MutName)
01087  {
01088      local int i;
01089  
01090      if (GameMutators.Length == 0)
01091          LoadAllMutators();
01092  
01093      for (i=0;i<GameMutators.Length;i++)
01094          if (GameMutators[i].ClassName ~= MutName)
01095              return GameMutators[i].GroupName;
01096  
01097      return "";
01098  }
01099  
01100  protected function SetUsedMaps()
01101  {
01102      local int i,j;
01103  
01104      if (!bEdit)
01105      {
01106          log("SetUsedMaps()"@DidNotStartEdit);
01107          return;
01108      }
01109  
01110      if (AllMaps.Length == 0)
01111          return;
01112  
01113      ActiveMaps.Reset();
01114  
01115      // Add required maps first, up to MaxMaps count
01116      for (i=0;i<AllMaps.Length;i++)
01117      {
01118          if (MaxMaps > 0 && ActiveMaps.Count() >= MaxMaps)
01119              break;
01120          if (AllMaps[i].bRequired)
01121              ActiveMaps.Add(string(i),AllMaps[i].MapName);
01122      }
01123  
01124      if ((((MaxMaps > 0) && (ActiveMaps.Count() < MaxMaps)) || (MaxMaps == 0))&&(ProfileMaps.Length>0))
01125      {
01126          for (i=0;i<ProfileMaps.Length;i++)
01127          {
01128              if (!MapIsValid(ProfileMaps[i]))
01129              {
01130                  ProfileMaps.Remove(i,1);
01131                  i--;
01132                  continue;
01133              }
01134  
01135              if (MaxMaps > 0 && ActiveMaps.Count() >= MaxMaps)
01136                  break;
01137              for (j=0;j<AllMaps.Length;j++)
01138                  if ((ProfileMaps[i]~=AllMaps[j].MapName) && (ActiveMaps.FindTagId(AllMaps[j].MapName)<0))
01139                      ActiveMaps.Add(string(j), AllMaps[j].MapName);
01140          }
01141      }
01142  }
01143  
01144  // Loads used mutators from ini into ActiveMutators StringArray
01145  protected function SetUsedMutators()
01146  {
01147      local int i,j;
01148      local string MutatorGroups, tmp;
01149      if (!bEdit)
01150      {
01151          log("SetUsedMutators()"@DidNotStartEdit);
01152          return;
01153      }
01154  
01155      if (AllMutators.Length == 0)
01156          return;
01157  
01158      ActiveMutators.Reset();
01159      // Add required mutators first
01160      for (i=0;i<AllMutators.Length;i++)
01161      {
01162          if (AllMutators[i].bRequired)
01163          {
01164              tmp = GetMutatorGroup(AllMutators[i].MutatorName);
01165              if (InStr(MutatorGroups, tmp) == -1)
01166              {
01167                  if (MutatorGroups != "") MutatorGroups = MutatorGroups $ ",";
01168                  MutatorGroups = MutatorGroups $ tmp;
01169                  ActiveMutators.Add(string(i), AllMutators[i].MutatorName);
01170              }
01171          }
01172      }
01173  
01174      for (i=0;i<ProfileMutators.Length;i++)
01175      {
01176          for (j=0;j<AllMutators.Length;j++)
01177          {
01178              if ((AllMutators[j].MutatorName ~= ProfileMutators[i])&&(ActiveMutators.FindTagId(AllMutators[j].MutatorName)<0))
01179              {
01180                  tmp = GetMutatorGroup(AllMutators[j].MutatorName);
01181                  if (InStr(MutatorGroups, tmp) == -1)
01182                  {
01183                      if (MutatorGroups != "") MutatorGroups = MutatorGroups $ ",";
01184                      MutatorGroups = MutatorGroups $ tmp;
01185                      ActiveMutators.Add(string(j), AllMutators[j].MutatorName);
01186                  }
01187              }
01188          }
01189      }
01190  }
01191  
01192  protected function SetUsedServerActors()
01193  {
01194      local int i,j;
01195      if (!bEdit)
01196      {
01197          log("SetUsedServerActors()"@DidNotStartEdit);
01198          return;
01199      }
01200  
01201      if (AllServerActors.Length == 0)
01202          return;
01203  
01204      ActiveServerActors.Reset();
01205      // Add required server actors first
01206      for (i=0;i<AllServerActors.Length;i++)
01207          if (AllServerActors[i].bRequired)
01208              ActiveServerActors.Add(string(i), AllServerActors[i].ActorClass,True);
01209  
01210      for (i=0;i<ProfileServerActors.Length;i++)
01211          for (j=0;j<AllServerActors.Length;j++)
01212              if (AllServerActors[j].ActorClass ~= ProfileServerActors[i])
01213                  ActiveServerActors.Add(string(j),AllServerActors[j].ActorClass,True);
01214  }
01215  
01216  protected function ClearUsedMaps()
01217  {
01218      ProfileMaps.Length = 0;
01219      SaveConfig();
01220  }
01221  
01222  protected function ClearUsedMutators()
01223  {
01224      ProfileMutators.Length = 0;
01225      SaveConfig();
01226  }
01227  
01228  protected function ClearUsedServerActors()
01229  {
01230      ProfileServerActors.Length = 0;
01231      SaveConfig();
01232  }
01233  
01234  protected function ClearAllMaps()
01235  {
01236      AllMaps.Length=0;
01237      SaveConfig();
01238  }
01239  
01240  protected function ClearAllMutators()
01241  {
01242      AllMutators.Length = 0;
01243      SaveConfig();
01244  }
01245  
01246  protected function ClearAllServerActors()
01247  {
01248      AllServerActors.Length = 0;
01249      SaveConfig();
01250  }
01251  
01252  // Saves active maps for this profile to ini
01253  protected function SaveUsedMaps()
01254  {
01255      local int i;
01256      if (!bEdit)
01257      {
01258          log("SaveUsedMaps()"@DidNotStartEdit);
01259          return;
01260      }
01261  
01262      ClearUsedMaps();
01263      for (i=0;i<ActiveMaps.Count();i++)
01264          ProfileMaps[ProfileMaps.Length] = ActiveMaps.GetTag(i);
01265  }
01266  
01267  // Saves ActiveMutators to ini
01268  protected function SaveUsedMutators()
01269  {
01270      local int i;
01271  
01272      if (!bEdit)
01273      {
01274          log("SaveUsedMutators()"@DidNotStartEdit);
01275          return;
01276      }
01277  
01278      ClearUsedMutators();
01279      for (i=0;i<ActiveMutators.Count();i++)
01280          ProfileMutators[ProfileMutators.Length] = ActiveMutators.GetTag(i);
01281  }
01282  
01283  protected function SaveUsedServerActors()
01284  {
01285      local int i;
01286  
01287      if (!bEdit)
01288      {
01289          log("SaveUsedServerActors()"@DidNotStartEdit);
01290          return;
01291      }
01292      ClearUsedServerActors();
01293      for (i=0;i<ActiveServerActors.Count();i++)
01294          ProfileServerActors[ProfileServerActors.Length] = ActiveServerActors.GetTag(i);
01295  }
01296  
01297  // Applies the active maps to the actual Game maplist
01298  protected function ApplyMapList(array<string> NewMapList)
01299  {
01300      local int i;
01301  
01302      if (GameClass == None)
01303          GameClass = class<GameInfo>(DynamicLoadObject(DefaultGameType,class'Class'));
01304  
01305      if (Maps == None)
01306          GetMaps();
01307  
01308      if (Maps == None)
01309          return;
01310  
01311      Maps.Maps.Length = 0;
01312      for (i=0;i<NewMapList.Length;i++)
01313          Maps.Maps[i] = NewMapList[i];
01314  
01315      Maps.SaveConfig();
01316  }
01317  
01318  // Applies ActiveMutators to actual Game mutator list
01319  protected function ApplyMutators()
01320  {
01321      local int i;
01322      local array<string> TempMut;
01323  
01324      if (!bEdit)
01325      {
01326          log("ApplyMutators()"@DidNotStartEdit);
01327          return;
01328      }
01329  
01330      for (i=0;i<ActiveMutators.Count();i++)
01331          TempMut[TempMut.Length] = ActiveMutators.GetTag(i);
01332  
01333      if (TempMut.Length == 0)
01334          NextMutators = "";
01335  
01336      else NextMutators = class'wUtils103.wArray'.static.Join(TempMut,",");
01337  }
01338  
01339  protected function ClearProfile(out array<ProfileSetting> OldProfile)
01340  {
01341      if (!bEdit)
01342      {
01343          log("ClearProfile()"@DidNotStartEdit);
01344          return;
01345      }
01346  
01347      OldProfile.Length = 0;
01348  }
01349  
01350  protected function bool InitializeProfile(out array<ProfileSetting> NewProfile)
01351  {
01352      local int i;
01353      local ProfileSetting NewSetting;
01354  
01355      if (!bEdit)
01356      {
01357          log("InitializeProfile()"@DidNotStartEdit);
01358          return false;
01359      }
01360  
01361      if (PInfo==None)
01362          return false;
01363  
01364      if (NewProfile.Length>0)
01365          ClearProfile(NewProfile);
01366  
01367      for (i = 0; i < PInfo.Settings.Length; i++)
01368      {
01369          if (InStr(PInfo.Settings[i].SettingName,"AdminName") != -1 || InStr(PInfo.Settings[i].SettingName,"AdminEmail") != -1)
01370              continue;
01371  
01372          NewSetting.SettingName = PInfo.Settings[i].SettingName;
01373          NewSetting.SettingValue = PInfo.Settings[i].Value;
01374  
01375          NewProfile[NewProfile.Length] = NewSetting;
01376      }
01377  
01378      return true;
01379  }
01380  
01381  ////////////////////////////////////////////////////////////////////////////
01382  // PlayInfo Query Functions
01383  ////////////////////////////////////////////////////////////////////////////
01384  
01385  function string GetParamName(int idx)
01386  {
01387      if (idx < 0 || idx >= PInfo.Settings.Length)
01388          return "";
01389  
01390      return PInfo.Settings[idx].SettingName;
01391  }
01392  
01393  function int GetParamIndex(string SettingName)
01394  {
01395      local int i;
01396  
01397      for (i = 0; i < PInfo.Settings.Length; i++)
01398          if (PInfo.Settings[i].SettingName ~= SettingName)
01399              break;
01400  
01401      if (i==PInfo.Settings.Length)
01402          return -1;
01403  
01404      return i;
01405  }
01406  
01407  function string GetParam(int idx)
01408  {
01409      if (idx < 0 || idx >= PInfo.Settings.Length)
01410          return "";
01411  
01412      return PInfo.Settings[idx].Value;
01413  }
01414  
01415  function string GetNamedParam(string Parameter)
01416  {
01417      local int i;
01418      local string SettingName;
01419  
01420      for (i = 0; i < PInfo.Settings.Length; i++)
01421      {
01422          SettingName = PInfo.Settings[i].SettingName;
01423          if (SettingName ~= Parameter || Right(SettingName, Len(Parameter) + 1) ~= ("."$Parameter))
01424              return PInfo.Settings[i].Value;
01425      }
01426      return "";
01427  }
01428  
01429  function array<string> GetMaskedParams(string ParamMask)
01430  {
01431      local array<string> FoundParams;
01432      local array<string> FoundMasks;
01433      local string SettingName, ShortName;
01434      local int i, j, p;
01435  
01436      class'wUtils103.wString'.static.Split2(ParamMask, " ", FoundMasks);
01437      if (FoundMasks.Length > 0)
01438      {
01439          for (i = 0; i<PInfo.Settings.Length; i++)
01440          {
01441              SettingName = PInfo.Settings[i].SettingName;
01442  
01443              ShortName = SettingName;
01444              j = Instr(ShortName, ".");
01445              while (j != -1)
01446              {
01447                  ShortName = Mid(ShortName, p+1);
01448                  j = Instr(ShortName, ".");
01449              }
01450  
01451              for (j = 0; j<FoundMasks.Length; j++)
01452              {
01453                  if (class'wUtils103.wString'.static.MaskedCompare(ShortName, FoundMasks[j]) || class'wUtils103.wString'.static.MaskedCompare(SettingName, FoundMasks[j]))
01454                  {
01455                      FoundParams[FoundParams.Length] = SettingName;
01456                      FoundParams[FoundParams.Length] = PInfo.Settings[i].Value;
01457                      break;
01458                  }
01459              }
01460          }
01461      }
01462      return FoundParams;
01463  }
01464  
01465  /////////////////////////////////////////////////////////////////////
01466  // Profile Query Functions
01467  ////////////////////////////////////////////////////////////////////
01468  
01469  function int GetProfileParamIndex(string SettingName)
01470  {
01471      local int i;
01472  
01473      for (i=0;i<ProfileSettings.Length;i++)
01474          if (ProfileSettings[i].SettingName ~= SettingName)
01475              break;
01476  
01477      if (i==ProfileSettings.Length)
01478          return -1;
01479  
01480      return i;
01481  }
01482  
01483  function string GetProfileParamName(int idx)
01484  {
01485      if (idx < 0 || idx >= ProfileSettings.Length)
01486          return "";
01487  
01488      return ProfileSettings[idx].SettingName;
01489  }
01490  
01491  function string GetProfileParam(int idx)
01492  {
01493      if (idx < 0 || idx >= ProfileSettings.Length)
01494          return "";
01495  
01496      return ProfileSettings[idx].SettingValue;
01497  }
01498  
01499  function string GetProfileNamedParam(string Parameter)
01500  {
01501      local int i;
01502      local string SettingName;
01503  
01504      for (i = 0; i < ProfileSettings.Length; i++)
01505      {
01506          SettingName = ProfileSettings[i].SettingName;
01507          if (SettingName ~= Parameter || Right(SettingName, Len(Parameter)+1) ~= ("."$Parameter))
01508              return ProfileSettings[i].SettingValue;
01509      }
01510  
01511      return "";
01512  }
01513  
01514  /////////////////////////////////////////////////////////////////////
01515  // PlayInfo Manipulation Functions
01516  /////////////////////////////////////////////////////////////////////
01517  
01518  function SavePI()
01519  {
01520      if (!bEdit)
01521      {
01522          log("SavePI()"@DidNotStartEdit);
01523          return;
01524      }
01525  
01526      if (PInfo == None)
01527          return;
01528  
01529      PInfo.SaveSettings();
01530  }
01531  
01532  function bool SetParam(int idx, string Value)
01533  {
01534      if (PInfo == None || idx < 0 || idx >= PInfo.Settings.Length)
01535          return false;
01536  
01537      if (InStr(PInfo.Settings[idx].SettingName,"AdminName") != -1 || InStr(PInfo.Settings[idx].SettingName,"AdminEmail") != -1)
01538          return false;
01539  
01540      return PInfo.StoreSetting(idx, Value);
01541  }
01542  
01543  function bool SetNamedParam(string Parameter, string Value)
01544  {
01545      local int i;
01546      local string SettingName;
01547  
01548      if (PInfo == None) return false;
01549  
01550      for (i = 0; i < PInfo.Settings.Length; i++)
01551      {
01552          SettingName = PInfo.Settings[i].SettingName;
01553          if (SettingName ~= Parameter || Right(SettingName, Len(Parameter) + 1) ~= ("."$Parameter))
01554          {
01555              if (InStr(PInfo.Settings[i].SettingName,"AdminName") != -1 || InStr(PInfo.Settings[i].SettingName,"AdminEmail") != -1)
01556                  return false;
01557  
01558              return PInfo.StoreSetting(i, Value);
01559          }
01560      }
01561      // Parameter not found
01562      return false;
01563  }
01564  
01565  ///////////////////////////////////////////////////////////////////////////
01566  // Profile Manipulation Functions
01567  ///////////////////////////////////////////////////////////////////////////
01568  
01569  function int Count()
01570  {
01571      return ProfileSettings.Length;
01572  }
01573  
01574  function bool SetProfileParam(int idx, string SettingName, coerce string SettingValue)
01575  {
01576      if (idx < 0 || idx > ProfileSettings.Length)
01577          return false;
01578  
01579      if (ProfileSettings.Length == idx)
01580          ProfileSettings.Length = ProfileSettings.Length+1;
01581  
01582      ProfileSettings[idx].SettingName = SettingName;
01583      ProfileSettings[idx].SettingValue = SettingValue;
01584  
01585      return true;
01586  }
01587  
01588  function bool SetProfileNamedParam(string Parameter, string Value)
01589  {
01590      local int i;
01591      local string SettingName;
01592  
01593      for (i = 0;i < ProfileSettings.Length; i++)
01594      {
01595          SettingName = ProfileSettings[i].SettingName;
01596          if (SettingName ~= Parameter || Right(SettingName, Len(Parameter) + 1) ~= ("."$Parameter))
01597          {
01598              ProfileSettings[i].SettingValue = Value;
01599              return true;
01600          }
01601      }
01602  
01603      return false;
01604  }

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In