GameStatisticsClasses.pas from Sector-37 at Krugle
Show GameStatisticsClasses.pas syntax highlighted
//*******************************//
// //
//Strange Game Statistic Classes //
// //
//******************//*******************************//*********************//
// //
// This unit is the part of a real time 3d space strategy engine //
// (www.federation.netfirms.com) //
// //
//**************************************************************************//
{
Author : Alexander Federyakov aka Da Stranger
Version : 0.001 ;-]
Date : 22 October '2005
License : You can use this unit ONLY for educational purposes. You cannot use
more than 10% of its code in your own personal projects. It cannot
be used for any commercial products.
Comments: This is the core of a 3d realtime space strategy game engine.
Much is still to be done...
Requirements: GLScene
Known Bugs and limitations: none
Contacts:
Web: http://www.sector-37.com
E-mail: datarget@mail.ru
ICQ: 293-963-070
Odigo: 8077227
}
unit GameStatisticsClasses;
interface
uses sysutils;
type
TplayerMillitaryStatistics=record
UnitsKilledNumber:integer;
UnitsKilledRating:integer;
UnitsLostNumber:integer;
UnitsLostRating:integer;
UnitsProducedNumber:integer;
UnitsProducedRating:integer;
PlanetsGainedNumber:integer;
PlanetsGainedRating:integer;
ColonizedPlanetsNumber:integer;
ColonizedPlanetsRating:integer;
PlanetsLostNumber:integer;
PlanetsLostRating:integer;
BuildingsBuiltNumber:integer;
BuildingsLostNumber:integer;
BuildingsDestroyedNumber:integer;
end;
TplayerEconomyStatistics=record
//upgrades
//researches
//resources
end;
TplayerDiplomacyStatistics=record
MadeAlliesNumber:integer;
MadeEnemiesNumber:integer;
HelpedAlliesNumber:integer;
DidntHelpAlliesNumber:integer;
MissionsDoneNumber:integer;
MissionsFailedNumber:integer;
end;
TPlayerStatistics=class
public
// Player:Tplayer;
TimeOfDeath:TDateTime;//hm.........
Millitary:TplayerMillitaryStatistics;
Economy:TplayerEconomyStatistics;
Diplomacy:TplayerDiplomacyStatistics;
MillitaryRatings:array of single;
EconomyRatings: array of single;
DiplomacyRatings:array of single;
OverRollRatings:array of single;
procedure UpdateRatings;
function GetLastMillitaryRating:single;
function GetLastEconomyRating:single;
function GetLastDiplomacyRating:single;
function GetLastOverRollRating:single; //is calculated from the last 3
destructor Destroy;override;
end;
implementation
{ TPlayerStatistics }
destructor TPlayerStatistics.Destroy;
begin
inherited;
end;
function TPlayerStatistics.GetLastDiplomacyRating: single;
begin
Result := DiplomacyRatings[length(DiplomacyRatings)-1];
end;
function TPlayerStatistics.GetLastEconomyRating: single;
begin
Result := EconomyRatings[length(EconomyRatings)-1];
end;
function TPlayerStatistics.GetLastMillitaryRating: single;
begin
Result := MillitaryRatings[length(MillitaryRatings)-1];
end;
function TPlayerStatistics.GetLastOverRollRating: single;
begin
Result := OverRollRatings[length(OverRollRatings)-1];
end;
procedure TPlayerStatistics.UpdateRatings;
var
index:integer;
begin
index := length(OverRollRatings);
Setlength(OverRollRatings,index+1);
Setlength(MillitaryRatings,index+1);
Setlength(EconomyRatings,index+1);
Setlength(DiplomacyRatings,index+1);
{ TODO 3 -oDa Stranger -cExtending Capabilities : now calculate the parameters and add them to the arrays }
end;
end.
See more files for this project here