Proper reset of leaderboards.

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@1512 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 89ed6e25b069e311ff8e0e8f9ef4eff8cb2e8f1d
Former-commit-id: 8cdc8772187c5cb7ebd7b60f66853b618179653f
This commit is contained in:
kmetykog 2009-10-06 11:33:46 +00:00
parent 7c15b90a53
commit a45ecbe6be

View file

@ -49,6 +49,14 @@ static int Winh = 600;
static char path[1024]; static char path[1024];
//Scrolling leaderboard variables
static int iStart = 0;
static double iTimer = 0.0;
static int iStringStart = 0;
static int iRaceLaps = -1;
static string st; //This is the line we will display in the bottom
cGrBoard::cGrBoard (int myid) { cGrBoard::cGrBoard (int myid) {
id = myid; id = myid;
trackMap = NULL; trackMap = NULL;
@ -788,7 +796,14 @@ cGrBoard::shutdown(void)
delete trackMap; delete trackMap;
trackMap = NULL; trackMap = NULL;
} }
//Resetting scrolling leaderboard variables
sShortNames.clear(); sShortNames.clear();
st.clear();
iStart = 0;
iTimer = 0.0;
iStringStart = 0;
iRaceLaps = -1;
} }
void void
@ -1012,7 +1027,6 @@ void grInitBoardCar(tCarElt *car)
void grShutdownBoardCar(void) void grShutdownBoardCar(void)
{ {
sShortNames.clear();
/*int i; /*int i;
for (i = 0; i < nstate; i++) { for (i = 0; i < nstate; i++) {
printf("%d\n", i); printf("%d\n", i);
@ -1025,8 +1039,6 @@ void grShutdownBoardCar(void)
nstate = 0;*/ nstate = 0;*/
} }
static int iStart = 0;
static double iTimer = 0;
#define LEADERBOARD_SCROLL_TIME 2.0 #define LEADERBOARD_SCROLL_TIME 2.0
/** /**
* grDispLeaderBoardScroll * grDispLeaderBoardScroll
@ -1117,8 +1129,6 @@ cGrBoard::grDispLeaderBoardScroll(const tCarElt *car, const tSituation *s) const
}//grDispLeaderBoardScroll }//grDispLeaderBoardScroll
static int iStringStart = 0;
static int iRaceLaps = -1;
#define LEADERBOARD_LINE_SCROLL_TIME 0.1 #define LEADERBOARD_LINE_SCROLL_TIME 0.1
/** /**
* name: grDispLeaderBoardScrollLine * name: grDispLeaderBoardScrollLine
@ -1131,7 +1141,7 @@ void
cGrBoard::grDispLeaderBoardScrollLine(const tCarElt *car, const tSituation *s) cGrBoard::grDispLeaderBoardScrollLine(const tCarElt *car, const tSituation *s)
{ {
//Scrolling //Scrolling
if(iTimer == 0 || iStringStart == 0) grMakeThreeLetterNames(s); if(iTimer == 0 || iStringStart == 0 || sShortNames.size() == 0) grMakeThreeLetterNames(s);
if(iTimer == 0 || s->currentTime < iTimer) iTimer = s->currentTime; if(iTimer == 0 || s->currentTime < iTimer) iTimer = s->currentTime;
if(s->currentTime >= iTimer + LEADERBOARD_LINE_SCROLL_TIME) if(s->currentTime >= iTimer + LEADERBOARD_LINE_SCROLL_TIME)
{ {
@ -1167,8 +1177,6 @@ cGrBoard::grDispLeaderBoardScrollLine(const tCarElt *car, const tSituation *s)
glEnd(); glEnd();
glDisable(GL_BLEND); glDisable(GL_BLEND);
static string st; //This is the line we will display
//Another lap gone by? //Another lap gone by?
if(s->cars[0]->race.laps > iRaceLaps) { if(s->cars[0]->race.laps > iRaceLaps) {
//Let's regenerate the roster. //Let's regenerate the roster.