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