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 <cstring>
89c4a3a6 sago007 2008-08-29 14:32 26
#include <string>
89c4a3a6 sago007 2008-08-29 14:32 27
#include <stdlib.h>
89c4a3a6 sago007 2008-08-29 14:32 28
c3b697c6 sago007 2016-02-07 17:30 29
#ifndef HIGHSCORE_H
c3b697c6 sago007 2016-02-07 17:30 30
#define HIGHSCORE_H
c3b697c6 sago007 2016-02-07 17:30 31
89c4a3a6 sago007 2008-08-29 14:32 32
const int top = 10;
89c4a3a6 sago007 2008-08-29 14:32 33
89c4a3a6 sago007 2008-08-29 14:32 34
struct record
89c4a3a6 sago007 2008-08-29 14:32 35
{
c53e6443 sago007 2012-04-17 11:04 36
	char name[30];
c53e6443 sago007 2012-04-17 11:04 37
	int score;
89c4a3a6 sago007 2008-08-29 14:32 38
};
89c4a3a6 sago007 2008-08-29 14:32 39
dfdb7d66 sago007 2015-11-29 19:21 40
89c4a3a6 sago007 2008-08-29 14:32 41
class Highscore
89c4a3a6 sago007 2008-08-29 14:32 42
{
89c4a3a6 sago007 2008-08-29 14:32 43
private:
c53e6443 sago007 2012-04-17 11:04 44
	record tabel[top];
90e6c797 sago007 2015-11-22 21:46 45
	std::string filename;
c53e6443 sago007 2012-04-17 11:04 46
	int ourType;     //This is ugly, remove me, plz!
c53e6443 sago007 2012-04-17 11:04 47
	void writeFile();
89c4a3a6 sago007 2008-08-29 14:32 48
public:
89c4a3a6 sago007 2008-08-29 14:32 49
c53e6443 sago007 2012-04-17 11:04 50
	Highscore()
c53e6443 sago007 2012-04-17 11:04 51
	{
c53e6443 sago007 2012-04-17 11:04 52
	}
89c4a3a6 sago007 2008-08-29 14:32 53
c53e6443 sago007 2012-04-17 11:04 54
	Highscore(int type);
89c4a3a6 sago007 2008-08-29 14:32 55
c53e6443 sago007 2012-04-17 11:04 56
	bool isHighScore(int);
8f632c05 sago007 2015-08-22 16:21 57
	void addScore(const std::string& newName, int);
c53e6443 sago007 2012-04-17 11:04 58
	int getScoreNumber(int);
02428d87 sago007 2016-02-02 17:53 59
	const char* getScoreName(int);
89c4a3a6 sago007 2008-08-29 14:32 60
};
c3b697c6 sago007 2016-02-07 17:30 61
c3b697c6 sago007 2016-02-07 17:30 62
#endif