diff options
| author | Tomas Chvatal (scarabeus) <tomas.chvatal@gmail.com> | 2008-10-22 22:51:24 +0200 |
|---|---|---|
| committer | Tomas Chvatal (scarabeus) <tomas.chvatal@gmail.com> | 2008-10-22 22:51:24 +0200 |
| commit | 44daf03024fbf7cbffa10349044786f6ab784821 (patch) | |
| tree | fe311eb22e2d853dfc18fde1a9e55d21815f4f82 /src/server/heightScore.c~ | |
| parent | e12753d2ec9db83ec08bb9db63902a82fb245cdd (diff) | |
Revert "X"
This reverts commit e12753d2ec9db83ec08bb9db63902a82fb245cdd.
Diffstat (limited to 'src/server/heightScore.c~')
| -rw-r--r-- | src/server/heightScore.c~ | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/src/server/heightScore.c~ b/src/server/heightScore.c~ deleted file mode 100644 index 5c42ad6..0000000 --- a/src/server/heightScore.c~ +++ /dev/null @@ -1,102 +0,0 @@ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> - -#include "main.h" -#include "list.h" -#include "textFile.h" -#include "heightScore.h" - -static textFile_t *textFile; - -void initHeightScore(char *file) -{ - int i; - - textFile = loadTextFile(file); - - if( textFile == NULL ) - { - fprintf(stderr, _("I am unable to load: \"%s\" !\n"), file); - fprintf(stderr, _("Creating: \"%s\"\n"), file); - textFile = newTextFile(file); - } - else - { -#ifdef DEBUG - printf(_("Scorefile: \"%s\"\n"), file); -#endif - return; - } - - if( textFile == NULL ) - { - fprintf(stderr, _("I was unable to create: \"%s\" !\n"), file); - return; - } - - for( i = 0 ; i < HEIGHTSCORE_MAX_PLAYERS ; i++ ) - { - addList(textFile->text, strdup("no_name 0") ); - } - - saveTextFile(textFile); -} - -int addPlayerInHighScore(char *name, int score) -{ - int i; - - if( score <= 0 ) - { - return -1; // Ha ha ha - } - - for( i = 0 ; i < HEIGHTSCORE_MAX_PLAYERS ; i++ ) - { - char *line; - char thisName[STR_NAME_SIZE]; - int thisCore; - - line = (char *) textFile->text->list[i]; - sscanf(line, "%s %d", thisName, &thisCore); - - if( score >= thisCore ) - { - char new[STR_SIZE]; - - sprintf(new, "%s %d", name, score); - insList(textFile->text, i, strdup(new) ); - delListItem(textFile->text, HEIGHTSCORE_MAX_PLAYERS, free); - //printTextFile(textFile); - saveTextFile(textFile); - - return 0; - } - } - - return -1; -} - -char* getTableItem(int index) -{ - if( textFile != NULL && - index >= 0 && - index < textFile->text->count ) - { - return (char *)textFile->text->list[index]; - } - - return NULL; -} - -void quitHeightScore() -{ - if( textFile != NULL ) - { - saveTextFile(textFile); - destroyTextFile(textFile); - } -} |