Re: Learn me good! [message #411258 is a reply to message #411245] |
Wed, 18 November 2009 05:26 |
|
Assuming you've got a large (preferably alphabetical) list of every preset:
Psuedocode:
CODE
Function BinarySearch(AString : String; Data: array of string) : integer; // -1 if not found, else the index in "Data" for which AString = Data[Index].
(I'll assume you can either code a binary search, or use another option if a binary search isn't possible for whatever reason)
For I := 0 to (InputFile.LineCount - 1) do
begin
Index := BinarySearch(LeftStr(InputFile.Lines[I], Pos(',', InputFile.Lines[I], My_List_Of_Every_Preset)));
If Index != -1 then begin
SetPresetDamagePointsForPrefixByName(My_List_Of_Every_Preset[Index], StrToFloat(RightStr(InputFile.Lines[Index], Length(InputFiles.Lines) - Pos(',', InputFile.Lines[Index]))); // I think I got the brackets right
end
end else Continue;
Where the input file must look like this:
*PRESET_NAME*[U],[/U] DAMAGE_VALUE
In short, a simple text file and then check every line for whether the first part (before the comma) is a valid preset name (by binary searching an alphabetical list of every preset name) then setting the damage points for that preset (I don't know how that's achieved, so I made a up a routine for it. )
Renguard is a wonderful initiative
Toggle Spoiler
BBC news, quoting... |
Supporters of Proposition 8 will argue California does not discriminate against gays, as the current law allows them to get married - as long as they wed a partner of the opposite sex.
|
halokid wrote on Mon, 11 October 2010 08:46 |
R315r4z0r wrote on Mon, 11 October 2010 15:35 |
|
the hell is that?
|
[Updated on: Wed, 18 November 2009 05:26] Report message to a moderator
|
|
|