From e96c90c48d947d1d284d4c9037413b4eb61b5445 Mon Sep 17 00:00:00 2001 From: wdbee Date: Sun, 22 Feb 2009 16:23:10 +0000 Subject: [PATCH] Global team manager for use with teams of different robots git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@773 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 9e0c1fb0d1a3a0626401944f3ad5b06c1398ce2a Former-commit-id: a1f936b430c6d3734076c96c8fbdd5ad4d0f90ba --- src/drivers/simplix/simplix.vcproj | 5 +- src/drivers/simplix/src/unitcommondata.cpp | 3 + src/drivers/simplix/src/unitcommondata.h | 8 + src/drivers/simplix/src/unitdriver.cpp | 14 +- src/drivers/simplix/src/unitdriver.h | 12 ++ src/drivers/simplix/src/unitglobal.h | 4 + src/drivers/simplix/src/unitopponent.cpp | 10 + src/drivers/simplix/src/unitopponent.h | 9 + src/drivers/simplix/src/unitstrategy.cpp | 39 +++- src/libs/robottools/robotools.def | 55 +++-- src/libs/robottools/robottools.vcproj | 9 + src/libs/robottools/rtteammanager.cpp | 240 +++++++++++++++++++++ src/libs/robottools/teammanager.h | 104 +++++++++ 13 files changed, 481 insertions(+), 31 deletions(-) create mode 100644 src/libs/robottools/rtteammanager.cpp create mode 100644 src/libs/robottools/teammanager.h diff --git a/src/drivers/simplix/simplix.vcproj b/src/drivers/simplix/simplix.vcproj index f269af2bd..83ca83a5b 100644 --- a/src/drivers/simplix/simplix.vcproj +++ b/src/drivers/simplix/simplix.vcproj @@ -49,7 +49,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="../../../export/include;../../../../3rdParty/include;../../windows/include;../../.." - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;DEBUG;DEBUG_OUT" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;DEBUG;DEBUG_OUT;_USE_RTTEAMMANAGER_" BasicRuntimeChecks="3" RuntimeLibrary="1" PrecompiledHeaderFile=".\Debug/simplix.pch" @@ -152,7 +152,7 @@ Optimization="2" InlineFunctionExpansion="2" AdditionalIncludeDirectories="../../../export/include;../../../../3rdParty\include;../../windows/include;../../.." - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_USE_RTTEAMMANAGER_" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -890,4 +890,3 @@ - diff --git a/src/drivers/simplix/src/unitcommondata.cpp b/src/drivers/simplix/src/unitcommondata.cpp index 8efc150ed..89ae092c0 100644 --- a/src/drivers/simplix/src/unitcommondata.cpp +++ b/src/drivers/simplix/src/unitcommondata.cpp @@ -66,6 +66,9 @@ TCommonData::TCommonData(): Track(NULL) { +#ifdef _USE_RTTEAMMANAGER_ + TeamManager = RtGetGlobalTeamManager(); +#endif } //==========================================================================* diff --git a/src/drivers/simplix/src/unitcommondata.h b/src/drivers/simplix/src/unitcommondata.h index 8174a3bdb..36839f44f 100644 --- a/src/drivers/simplix/src/unitcommondata.h +++ b/src/drivers/simplix/src/unitcommondata.h @@ -60,7 +60,11 @@ #include #include "unitglobal.h" +#ifdef _USE_RTTEAMMANAGER_ +#include +#else #include "unitteammanager.h" +#endif #include "unitclothoid.h" //==========================================================================* @@ -73,7 +77,11 @@ class TCommonData ~TCommonData(); // Destructor public: +#ifdef _USE_RTTEAMMANAGER_ + tTeamManager* TeamManager; // Team manager +#else TTeamManager TeamManager; // Team manager +#endif PTrack Track; // TORCS Track data }; //==========================================================================* diff --git a/src/drivers/simplix/src/unitdriver.cpp b/src/drivers/simplix/src/unitdriver.cpp index 31d07216b..4da0e29ee 100644 --- a/src/drivers/simplix/src/unitdriver.cpp +++ b/src/drivers/simplix/src/unitdriver.cpp @@ -10,7 +10,7 @@ // File : unitdriver.cpp // Created : 2007.11.25 // Last changed : 2009.02.14 -// Copyright : © 2007-2009 Wolf-Dieter Beelitzf +// Copyright : © 2007-2009 Wolf-Dieter Beelitz // eMail : wdb@wdbee.de // Version : 2.00.000 //--------------------------------------------------------------------------* @@ -1052,6 +1052,7 @@ void TDriver::EndRace() //--------------------------------------------------------------------------* void TDriver::Shutdown() { + RtFreeGlobalTeamManager(); } //==========================================================================* @@ -1111,7 +1112,11 @@ void TDriver::FindRacinglines() if(oCommonData->Track != oTrackDesc.Track()) // New track? { oCommonData->Track = oTrackDesc.Track(); // Save pointer +#ifdef _USE_RTTEAMMANAGER_ +// oCommonData->TeamManager->Clear(); // release old informations +#else oCommonData->TeamManager.Clear(); // release old informations +#endif } GfOut("# ... load smooth path ...\n"); @@ -1232,7 +1237,11 @@ void TDriver::FindRacinglines() //--------------------------------------------------------------------------* void TDriver::TeamInfo() { +#ifdef _USE_RTTEAMMANAGER_ + oTeam = RtTeamManagerAdd(oCommonData->TeamManager,oCar); +#else oTeam = oCommonData->TeamManager.Add(oCar); +#endif //GfOut("#\n\n# Team: %s\n\n\n",oTeam->TeamName); } //==========================================================================* @@ -1312,7 +1321,10 @@ void TDriver::Update(tCarElt* Car, tSituation* S) for (int I = 0; I < oNbrCars; I++) { oOpponents[I].Update(oCar, +#ifdef _USE_RTTEAMMANAGER_ +#else &oCommonData->TeamManager, +#endif MyDomX, MyDomY, MinDistBack, MinTimeSlot); } diff --git a/src/drivers/simplix/src/unitdriver.h b/src/drivers/simplix/src/unitdriver.h index bda26528b..85fe8e8ab 100644 --- a/src/drivers/simplix/src/unitdriver.h +++ b/src/drivers/simplix/src/unitdriver.h @@ -155,7 +155,11 @@ class TDriver (void* RobotSettings, char* Value); inline void SetCommonData // Set pointer to common data (TCommonData* CommonData); +#ifdef _USE_RTTEAMMANAGER_ + inline tTeam* GetTeam(); +#else inline TTeamManager::TTeam* GetTeam(); +#endif inline char* GetBotName(); inline float CurrSpeed(); @@ -216,7 +220,11 @@ private: double oAvoidScale; // scale avoiding double oAvoidWidth; // In m. bool oGoToPit; // Enter pit flag +#ifdef _USE_RTTEAMMANAGER_ + tTeam* oTeam; +#else TTeamManager::TTeam* oTeam; // Team +#endif int oDriveTrainType; // Drive train type TPidController oPIDCLine; // Controller for line error. @@ -387,7 +395,11 @@ void TDriver::SetCommonData //==========================================================================* // Get Team //--------------------------------------------------------------------------* +#ifdef _USE_RTTEAMMANAGER_ +tTeam* TDriver::GetTeam() +#else TTeamManager::TTeam* TDriver::GetTeam() +#endif { return oTeam; } diff --git a/src/drivers/simplix/src/unitglobal.h b/src/drivers/simplix/src/unitglobal.h index e5a8dc2d5..0f4f0d57f 100644 --- a/src/drivers/simplix/src/unitglobal.h +++ b/src/drivers/simplix/src/unitglobal.h @@ -238,7 +238,11 @@ enum // ... my own planet // pit states ... +#ifdef _USE_RTTEAMMANAGER_ +#define PIT_IS_FREE NULL +#else #define PIT_IS_FREE (-1) +#endif // ... pit states // Shortcuts for TORCS commands ... diff --git a/src/drivers/simplix/src/unitopponent.cpp b/src/drivers/simplix/src/unitopponent.cpp index 0fe099a67..763eb1cf2 100644 --- a/src/drivers/simplix/src/unitopponent.cpp +++ b/src/drivers/simplix/src/unitopponent.cpp @@ -132,13 +132,19 @@ TOpponent::TInfo& TOpponent::Info() //--------------------------------------------------------------------------* void TOpponent::Update( const PCarElt MyCar, +#ifdef _USE_RTTEAMMANAGER_ +#else PTeamManager TeamManager, +#endif double MyDirX, double MyDirY, float &MinDistBack, double &MinTimeSlot) { +#ifdef _USE_RTTEAMMANAGER_ +#else oTeamManager = TeamManager; // Save Pointer +#endif if((CarState & RM_CAR_STATE_NO_SIMU) && // omit cars out of race (CarState & RM_CAR_STATE_PIT) == 0 ) // if not in pit @@ -317,7 +323,11 @@ bool TOpponent::Classify( DistAhead = MIN(MAX(50, DistAhead), 100); // view to min 50 max 100 m // Teammate? +#ifdef _USE_RTTEAMMANAGER_ + if (RtIsTeamMate(MyCar,oCar)) // If Opp. is teammate +#else if (oTeamManager->IsTeamMate(MyCar,oCar)) // If Opp. is teammate +#endif { oInfo.Flags |= F_TEAMMATE; // Set teammate flag oInfo.TeamMateDamage = oCar->_dammage; // Save his damages diff --git a/src/drivers/simplix/src/unitopponent.h b/src/drivers/simplix/src/unitopponent.h index 8dfbd7737..5266d7d77 100644 --- a/src/drivers/simplix/src/unitopponent.h +++ b/src/drivers/simplix/src/unitopponent.h @@ -61,7 +61,10 @@ #include "unitglobal.h" #include "unitcommon.h" +#ifdef _USE_RTTEAMMANAGER_ +#else #include "unitteammanager.h" +#endif //==========================================================================* // Class TOpponent @@ -134,7 +137,10 @@ class TOpponent void Update // Update (const PCarElt MyCar, +#ifdef _USE_RTTEAMMANAGER_ +#else PTeamManager TeamManager, +#endif double MyDirX, double MyDirY, float &MinDistBack, double &MinTimeSlot); @@ -151,7 +157,10 @@ class TOpponent double oDeltaTime; // Simulation delta time int oIndex; // Opponents cars index TInfo oInfo; // info of this opponent +#ifdef _USE_RTTEAMMANAGER_ +#else PTeamManager oTeamManager; // Teammanager +#endif double LapBackTimer; }; diff --git a/src/drivers/simplix/src/unitstrategy.cpp b/src/drivers/simplix/src/unitstrategy.cpp index fc28fc2f3..7cce7cf42 100644 --- a/src/drivers/simplix/src/unitstrategy.cpp +++ b/src/drivers/simplix/src/unitstrategy.cpp @@ -106,9 +106,15 @@ bool TSimpleStrategy::IsPitFree() { if (CarPit != NULL) { +#ifdef _USE_RTTEAMMANAGER_ + tTeam* Team = oDriver->GetTeam(); + if ((CarPit->pitCarIndex == TR_PIT_STATE_FREE) + && ((Team->PitState == oCar) || (Team->PitState == PIT_IS_FREE))) +#else TTeamManager::TTeam* Team = oDriver->GetTeam(); if ((CarPit->pitCarIndex == TR_PIT_STATE_FREE) && ((Team->PitState == CarDriverIndex) || (Team->PitState == PIT_IS_FREE))) +#endif return true; } return false; @@ -161,14 +167,25 @@ bool TSimpleStrategy::NeedPitStop() } else // Ansonsten prüfen, für { // welche Anzahl von Runden - TTeamManager::TTeam* Team = // alle Teammitglieder - oDriver->GetTeam(); // noch Treibstoff haben - + // alle Teammitglieder + // noch Treibstoff haben +#ifdef _USE_RTTEAMMANAGER_ + tTeam* Team = oDriver->GetTeam(); +#else + TTeamManager::TTeam* Team = oDriver->GetTeam(); +#endif FuelNeeded = FuelConsum * oTrackLength; // Treibstoff für eine Runde +#ifdef _USE_RTTEAMMANAGER_ + int FuelForLaps = // Eigene Reichweite + (int) (CarFuel / FuelNeeded - 1); + RtTeamSetMinLaps(Team,oCar,FuelForLaps); // Eigene Reichweite melden + int MinLaps = RtTeamGetMinLaps(Team,oCar); // Mindestreichweite der anderen +#else int FuelForLaps = // Eigene Reichweite Team->FuelForLaps[CarDriverIndex] = (int) (CarFuel / FuelNeeded - 1); int MinLaps = Team->GetMinLaps(oCar); // Mindestreichweite der anderen +#endif // Wenn Tanken, dann der, der weniger Runden weit kommen würde if (FuelForLaps < MinLaps) @@ -194,8 +211,13 @@ bool TSimpleStrategy::NeedPitStop() if (Result) { +#ifdef _USE_RTTEAMMANAGER_ + tTeam* Team = oDriver->GetTeam(); + Team->PitState = oCar; // Box reserviert +#else TTeamManager::TTeam* Team = oDriver->GetTeam(); Team->PitState = CarDriverIndex; // Box reserviert +#endif } return Result; }; @@ -206,8 +228,13 @@ bool TSimpleStrategy::NeedPitStop() //--------------------------------------------------------------------------* void TAbstractStrategy::PitRelease() { +#ifdef _USE_RTTEAMMANAGER_ + tTeam* Team = oDriver->GetTeam(); + if (Team->PitState == oCar) // Box für mich reserviert? +#else TTeamManager::TTeam* Team = oDriver->GetTeam(); if (Team->PitState == CarDriverIndex) // Box für mich reserviert? +#endif { Team->PitState = PIT_IS_FREE; oCar->ctrl.raceCmd = 0; @@ -447,11 +474,11 @@ void TSimpleStrategy::Update(PtCarElt Car, oLastPitFuel = 0.0; // Refueled oFuelChecked = true; // We did the estimation in this lap - if (!oGoToPit) // If decision isn'd made - oGoToPit = NeedPitStop(); // Check if we sholud have a pitstop + if (!oGoToPit) // If decision isn't made + oGoToPit = NeedPitStop(); // Check if we should have a pitstop } else if (DL < 50) // I we are out of the window - { // to estimate + { // to estimate fuel consumption oFuelChecked = false; // reset flag }; }; diff --git a/src/libs/robottools/robotools.def b/src/libs/robottools/robotools.def index c9191ada8..02b96e164 100644 --- a/src/libs/robottools/robotools.def +++ b/src/libs/robottools/robotools.def @@ -1,21 +1,34 @@ -; -; robottools.def -; - -LIBRARY - -SECTIONS .data READ WRITE - -EXPORTS - RtTrackGetWidth - RtTrackHeightL - RtTrackLocal2Global - RtTrackHeightG - RtTrackSideTgAngleL - RtTrackSideNormalG - RtTrackGlobal2Local - RtTrackSurfaceNormalL - RtGetDistFromStart - RtGetDistFromStart2 - RtDistToPit - RtTrackGetSeg +; +; robottools.def +; + +LIBRARY + +SECTIONS .data READ WRITE + +EXPORTS + RtTrackGetWidth + RtTrackHeightL + RtTrackLocal2Global + RtTrackHeightG + RtTrackSideTgAngleL + RtTrackSideNormalG + RtTrackGlobal2Local + RtTrackSurfaceNormalL + RtGetDistFromStart + RtGetDistFromStart2 + RtDistToPit + RtTrackGetSeg + RtIsTeamMate + RtTeamManager + RtTeamManagerFree + RtTeamManagerAdd + RtGetGlobalTeamManager + RtFreeGlobalTeamManager + RtTeam + RtTeamFree + RtTeamGetMinLaps + RtTeamSetMinLaps + RtTeamAdd + RtTeammate + RtTeammateFree diff --git a/src/libs/robottools/robottools.vcproj b/src/libs/robottools/robottools.vcproj index 67f86a72b..45f59d8cf 100644 --- a/src/libs/robottools/robottools.vcproj +++ b/src/libs/robottools/robottools.vcproj @@ -4,6 +4,7 @@ Version="8,00" Name="robottools" ProjectGUID="{65130FEC-5171-4924-B6AE-0456FB4029A1}" + RootNamespace="robottools" > + + @@ -287,6 +292,10 @@ RelativePath="robottools.h" > + + Wolf-Dieter Beelitz + @version + @ingroup robottools +*/ + +/** @defgroup teammanager Teammanager for robots. + @ingroup robottools +*/ + +#include +#include +#include +#ifdef WIN32 +#include +#endif +#include +#include "robottools.h" +#include "teammanager.h" + +static tTeamManager* GlobalTeamManager; + +// +// Check if Car0 is teammate of Car1 +// +bool RtIsTeamMate(const CarElt* Car0, const CarElt* Car1) +{ + return strcmp(Car0->_teamname, Car1->_teamname) == 0; +} + +// +// Create a team manager +// +tTeamManager* RtTeamManager() // Default constructor +{ + tTeamManager* TeamManager = (tTeamManager*) // get memory + malloc(sizeof(tTeamManager)); + TeamManager->Count = 0; // Nbr of Teams + TeamManager->Teams = NULL; // The next team member + + return TeamManager; +} + +// +// Destroy a team manager +// +void RtTeamManagerFree(tTeamManager *TeamManager)// Destructor +{ + tTeam* Team = TeamManager->Teams; + while (Team != NULL) + { + tTeam* NextTeam = Team->Teams; + tTeammate* Teammate = Team->Teammates; + while (Teammate != NULL) + { + tTeammate* NextTeammate = Teammate->Next; + RtTeammateFree(Teammate); + Teammate = NextTeammate; + } + RtTeamFree(Team); + Team = NextTeam; + } + free(TeamManager); // Release memory +} + +// +// Add a car to his team +// +tTeam* RtTeamManagerAdd(tTeamManager *TeamManager, CarElt* Car) +{ + tTeammate* NewTeammate = RtTeammate(); // Add car: new teammate + NewTeammate->Car = Car ; // Set car pointer + NewTeammate->Next = NULL; // Empty list + + tTeam* Team = TeamManager->Teams; // Get first Team; + while (Team != NULL) // Loop over all teams + { + if (strcmp(Car->_teamname,Team->TeamName) == 0) + { // If Team is cars team add car to team + RtTeamAdd(Team, NewTeammate); + return Team; + } + else + Team = Team->Teams; + } + + // If the team doesn't exists yet + tTeam* NewTeam = RtTeam(); // Create a new team + NewTeam->TeamName = Car->_teamname; // Set its teamname + RtTeamAdd(NewTeam, NewTeammate); // Add new teammate + + if (TeamManager->Teams == NULL) // Add new team to + TeamManager->Teams = NewTeam; // linked list of + else // teams + { + Team = TeamManager->Teams; + while (Team->Teams != NULL) + Team = Team->Teams; + Team->Teams = NewTeam; + } + return NewTeam; +} + +// +// Get a pointer to the global teammanager +// +tTeamManager* RtGetGlobalTeamManager() +{ + if (GlobalTeamManager == NULL) + GlobalTeamManager = RtTeamManager(); + return GlobalTeamManager; +} + +// +// Release the global teammanager +// +void RtFreeGlobalTeamManager() +{ + if (GlobalTeamManager != NULL) + RtTeamManagerFree(GlobalTeamManager); + + GlobalTeamManager = NULL; +} + +// +// Create a team +// +tTeam* RtTeam() // Default constructor +{ + tTeam* Team = (tTeam*) malloc(sizeof(tTeam));// get memory + Team->Count = 0; // Nbr of Teammates + Team->PitState = PIT_IS_FREE; // Request for shared pit + Team->TeamName = NULL; // Name of team + Team->Teams = NULL; // Empty list + Team->Teammates = NULL; // Empty list + for (int I = 0; I < TR_PIT_MAXCARPERPIT; I++)// Loop over all + { // possible members + Team->Cars[I] = NULL; // No Cars + Team->FuelForLaps[I] = 99; // Fuel still unlimited + } + + return Team; +} + +// +// Destroy a team +// +void RtTeamFree(tTeam *Team) // Destructor +{ + free(Team); // Release memory +} + +// +// Get nbr of laps all other teammates can race with current fuel +// +int RtTeamGetMinLaps(tTeam *Team, CarElt* Car) // Get Nbr of laps, all +{ // teammates has fuel for + int MinL = 99; // Assume unlimited + for (int I = 0; I < TR_PIT_MAXCARPERPIT; I++)// Loop over all possible + if (Team->Cars[I] != Car) // entries! + MinL = MIN(MinL,Team->FuelForLaps[I]); // If not self, calculate + + return MinL; // Nbr of laps all can race +} + +// +// Set nbr of laps this teammate can race with current fuel +// +void RtTeamSetMinLaps(tTeam *Team, CarElt* Car, int FuelForLaps) +{ + for (int I = 0; I < TR_PIT_MAXCARPERPIT; I++)// Loop over all teammates + { + if (Team->Cars[I] == Car) // If self, set value + { + Team->FuelForLaps[I] = FuelForLaps; + break; + } + } +} + +// +// Add a teammate to the team +// +void RtTeamAdd(tTeam *Team, tTeammate* NewTeammate) +{ + tTeammate* Teammate = Team->Teammates; + if (Teammate == NULL) + Team->Teammates = NewTeammate; + else + { + while (Teammate->Next) + Teammate = Teammate->Next; + Teammate->Next = NewTeammate; + } + Team->Cars[Team->Count++] = NewTeammate->Car; +} + +// +// Create a teammate +// +tTeammate* RtTeammate() // Default constructor +{ + tTeammate* Teammate = (tTeammate*) malloc(sizeof(tTeammate)); + Teammate->Car = NULL; // Teammates car + Teammate->Next = NULL; // Empty list + + return Teammate; +} + +// +// Destroy a teammate +// +void RtTeammateFree(tTeammate* Teammate) +{ + free(Teammate); // Release memory +} diff --git a/src/libs/robottools/teammanager.h b/src/libs/robottools/teammanager.h new file mode 100644 index 000000000..d54de3620 --- /dev/null +++ b/src/libs/robottools/teammanager.h @@ -0,0 +1,104 @@ +/*************************************************************************** + + file : teammanager.h + created : Sun Feb 22 28:43:00 CET 2009 + copyright : (C) 2009 by Wolf-Dieter Beelitz + email : wdb@wdbee.de + version : + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +/** @file + Teammanager + @author Wolf-Dieter Beelitz + @version +*/ + +#ifndef _TEAMMANAGER_H_ +#define _TEAMMANAGER_H_ + +#include +#include // TR_PIT_MAXCARPERPIT = 4 + +// Teammanager defines + +#define PIT_IS_FREE NULL + +// Teammanager Utilities + +// +// Data of a teammate +// +typedef struct tTeammate +{ + CarElt* Car; // The car of this team member + tTeammate* Next; // The next team member +} tTeammate; + +// +// Data of a team +// +typedef struct tTeam +{ + int Count; // Nbr of Teammates + CarElt* PitState; // Request for shared pit + char* TeamName; // Name of team + tTeam* Teams; // Linked list of teams + tTeammate* Teammates; // Linked list of teammates + CarElt* Cars[TR_PIT_MAXCARPERPIT]; // Cars + int FuelForLaps[TR_PIT_MAXCARPERPIT]; // Fuel for laps +} tTeam; + +// +// Data of a team manager +// +typedef struct +{ + int Count; // Nbr of Teammates + tTeam* Teams; // Linked list of teams +} tTeamManager; + +// +// Utility functions +// +bool RtIsTeamMate(const CarElt* Car0, const CarElt* Car1); + +// +// Teammanager related functions +// +extern tTeamManager* RtTeamManager(); +extern void RtTeamManagerFree(tTeamManager* Teammanager); +extern tTeam* RtTeamManagerAdd(tTeamManager *TeamManager, CarElt* Car); +extern tTeamManager* RtGetGlobalTeamManager(); +extern void RtFreeGlobalTeamManager(); + + +// +// Team related functions +// +extern tTeam* RtTeam(); +extern void RtTeamFree(tTeam* Team); +extern int RtTeamGetMinLaps(tTeam* Team, CarElt* Car); +extern void RtTeamSetMinLaps(tTeam *Team, CarElt* Car, int FuelForLaps); +extern void RtTeamAdd(tTeam *Team, tTeammate* Teammate); + +// +// Teammate related functions +// +extern tTeammate* RtTeammate(); +extern void RtTeammateFree(tTeammate* Teammate); + + +#endif /* _TEAMMANAGER_H_ */ + + +