Update to work around MPL bug with 0 based arrays

This commit is contained in:
mysticbbs 2012-09-20 13:50:17 -04:00
parent ad87c0f37c
commit 360e43d724
1 changed files with 13 additions and 13 deletions

View File

@ -47,7 +47,7 @@ Type
SMTP : Word; SMTP : Word;
NNTP : Word; NNTP : Word;
HTTP : Word; HTTP : Word;
Hourly : Array[0..23] of Byte; Hourly : Array[1..24] of Byte;
Reserved : Array[1..2] of Byte; Reserved : Array[1..2] of Byte;
End; End;
@ -55,8 +55,8 @@ Var
Days : LongInt; Days : LongInt;
Calls : LongInt; Calls : LongInt;
Month : Array[1..12] of Cardinal; Month : Array[1..12] of Cardinal;
Week : Array[0..6] of Cardinal; Week : Array[1..7] of Cardinal;
Hour : Array[0..23] of Cardinal; Hour : Array[1..24] of Cardinal;
Procedure DrawBar (XPos, bSize, Value: Byte); Procedure DrawBar (XPos, bSize, Value: Byte);
Var Var
@ -112,8 +112,8 @@ Begin
Write (strRep(#250, 8)); Write (strRep(#250, 8));
End; End;
For Count := 0 to 6 Do For Count := 1 to 7 Do
DrawBar (4 + (Count * 11), 8, Week[Count]); DrawBar (4 + ((Count - 1) * 11), 8, Week[Count]);
End; End;
Procedure DisplayHourly; Procedure DisplayHourly;
@ -139,8 +139,8 @@ Begin
Write ('|08' + #250 + #250); Write ('|08' + #250 + #250);
End; End;
For Count := 0 to 23 Do For Count := 1 to 24 Do
DrawBar (5 + (Count * 3), 2, Hour[Count]); DrawBar (5 + ((Count - 1) * 3), 2, Hour[Count]);
End; End;
Procedure CalculateHistory; Procedure CalculateHistory;
@ -175,10 +175,10 @@ Begin
Calls := Calls + OneDay.Calls; Calls := Calls + OneDay.Calls;
TempLong := Str2Int(Copy(DateStr(OneDay.Date, 1), 1, 2)); TempLong := Str2Int(Copy(DateStr(OneDay.Date, 1), 1, 2));
Month[TempLong] := Month[TempLong] + OneDay.Calls; Month[TempLong] := Month[TempLong] + OneDay.Calls;
TempLong := DayOfWeek(OneDay.Date); TempLong := DayOfWeek(OneDay.Date) + 1;
Week[TempLong] := Week[TempLong] + OneDay.Calls; Week[TempLong] := Week[TempLong] + OneDay.Calls;
For Count := 0 to 23 Do For Count := 1 to 24 Do
Hour[Count] := Hour[Count] + OneDay.Hourly[Count]; Hour[Count] := Hour[Count] + OneDay.Hourly[Count];
End; End;
@ -198,11 +198,11 @@ Begin
Highest := 0; Highest := 0;
For Count := 0 to 6 Do For Count := 1 to 7 Do
If Week[Count] > Highest Then If Week[Count] > Highest Then
Highest := Week[Count]; Highest := Week[Count];
For Count := 0 to 6 Do For Count := 1 to 7 Do
If Week[Count] > 0 Then Begin If Week[Count] > 0 Then Begin
TempReal := (Week[Count] / Highest * 100); TempReal := (Week[Count] / Highest * 100);
Week[Count] := TempReal / 7 + 1; Week[Count] := TempReal / 7 + 1;
@ -210,11 +210,11 @@ Begin
Highest := 0; Highest := 0;
For Count := 0 to 23 Do For Count := 1 to 24 Do
If Hour[Count] > Highest Then If Hour[Count] > Highest Then
Highest := Hour[Count]; Highest := Hour[Count];
For Count := 0 to 23 Do For Count := 1 to 24 Do
If Hour[Count] > 0 Then Begin If Hour[Count] > 0 Then Begin
TempReal := (Hour[Count] / Highest * 100); TempReal := (Hour[Count] / Highest * 100);
Hour[Count] := TempReal / 7 + 1; Hour[Count] := TempReal / 7 + 1;