git repos / blockattack-game

blame: source/code/highscore.h

normal view · raw

89c4a3a6 sago007 2008-08-29 14:32 1
/*
c53e6443 sago007 2012-04-17 11:04 2
===========================================================================
c53e6443 sago007 2012-04-17 11:04 3
blockattack - Block Attack - Rise of the Blocks
c53e6443 sago007 2012-04-17 11:04 4
Copyright (C) 2005-2012 Poul Sander
89c4a3a6 sago007 2008-08-29 14:32 5
c53e6443 sago007 2012-04-17 11:04 6
This program is free software: you can redistribute it and/or modify
c53e6443 sago007 2012-04-17 11:04 7
it under the terms of the GNU General Public License as published by
c53e6443 sago007 2012-04-17 11:04 8
the Free Software Foundation, either version 2 of the License, or
c53e6443 sago007 2012-04-17 11:04 9
(at your option) any later version.
89c4a3a6 sago007 2008-08-29 14:32 10
c53e6443 sago007 2012-04-17 11:04 11
This program is distributed in the hope that it will be useful,
c53e6443 sago007 2012-04-17 11:04 12
but WITHOUT ANY WARRANTY; without even the implied warranty of
c53e6443 sago007 2012-04-17 11:04 13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c53e6443 sago007 2012-04-17 11:04 14
GNU General Public License for more details.
89c4a3a6 sago007 2008-08-29 14:32 15
c53e6443 sago007 2012-04-17 11:04 16
You should have received a copy of the GNU General Public License
c53e6443 sago007 2012-04-17 11:04 17
along with this program.  If not, see http://www.gnu.org/licenses/
89c4a3a6 sago007 2008-08-29 14:32 18
c53e6443 sago007 2012-04-17 11:04 19
Source information and contacts persons can be found at
021de090 sago007 2015-12-30 18:56 20
http://blockattack.net
c53e6443 sago007 2012-04-17 11:04 21
===========================================================================
89c4a3a6 sago007 2008-08-29 14:32 22
*/
89c4a3a6 sago007 2008-08-29 14:32 23
89c4a3a6 sago007 2008-08-29 14:32 24
#include <iostream>
89c4a3a6 sago007 2008-08-29 14:32 25
#include <fstream>
89c4a3a6 sago007 2008-08-29 14:32 26
#include <cstring>
89c4a3a6 sago007 2008-08-29 14:32 27
#include <string>
89c4a3a6 sago007 2008-08-29 14:32 28
#include <stdlib.h>
89c4a3a6 sago007 2008-08-29 14:32 29
89c4a3a6 sago007 2008-08-29 14:32 30
const int top = 10;
89c4a3a6 sago007 2008-08-29 14:32 31
89c4a3a6 sago007 2008-08-29 14:32 32
struct record
89c4a3a6 sago007 2008-08-29 14:32 33
{
c53e6443 sago007 2012-04-17 11:04 34
	char name[30];
c53e6443 sago007 2012-04-17 11:04 35
	int score;
89c4a3a6 sago007 2008-08-29 14:32 36
};
89c4a3a6 sago007 2008-08-29 14:32 37
dfdb7d66 sago007 2015-11-29 19:21 38
89c4a3a6 sago007 2008-08-29 14:32 39
class Highscore
89c4a3a6 sago007 2008-08-29 14:32 40
{
89c4a3a6 sago007 2008-08-29 14:32 41
private:
c53e6443 sago007 2012-04-17 11:04 42
	record tabel[top];
90e6c797 sago007 2015-11-22 21:46 43
	std::string filename;
c53e6443 sago007 2012-04-17 11:04 44
	int ourType;     //This is ugly, remove me, plz!
c53e6443 sago007 2012-04-17 11:04 45
	void writeFile();
89c4a3a6 sago007 2008-08-29 14:32 46
public:
89c4a3a6 sago007 2008-08-29 14:32 47
c53e6443 sago007 2012-04-17 11:04 48
	Highscore()
c53e6443 sago007 2012-04-17 11:04 49
	{
c53e6443 sago007 2012-04-17 11:04 50
	}
89c4a3a6 sago007 2008-08-29 14:32 51
c53e6443 sago007 2012-04-17 11:04 52
	Highscore(int type);
89c4a3a6 sago007 2008-08-29 14:32 53
c53e6443 sago007 2012-04-17 11:04 54
	bool isHighScore(int);
8f632c05 sago007 2015-08-22 16:21 55
	void addScore(const std::string& newName, int);
c53e6443 sago007 2012-04-17 11:04 56
	int getScoreNumber(int);
c53e6443 sago007 2012-04-17 11:04 57
	char* getScoreName(int);
89c4a3a6 sago007 2008-08-29 14:32 58
};
1970-01-01 00:00 59