git repos / blockattack-game

commit c0e47392

Poul Sander · 2018-12-23 16:39
c0e47392f6ee0b96114876ce464e793ac838ebaa patch · browse files
parent 66e1a55c0872233a5d7a4f0ffa30c26c57cdadb0

Use initializer lists for some contructors

Changed files

M README.md before
M source/code/ReadKeyboard.cpp before
M source/code/highscore.cpp before
diff --git a/README.md b/README.md index 301fadc..7d5227c 100644 --- a/README.md +++ b/README.md
@@ -5,7 +5,7 @@ A Tetris Attack Clone under the GPL.
Homepage: <https://blockattack.net><br/>
Source: <https://github.com/blockattack/blockattack-game>
-##Screen shot
+## Screen shot
![Block Attack - Rise of the Blocks 2.0.0 snapshot](/source/misc/screenshots/screen_shot_2016_01_19.png?raw=true "Screen shot from 2016-01-19")
## Dependencies
@@ -65,7 +65,6 @@ and
docker build -f source/misc/docker/Dockerfile.WindoesBuild . -t blockattack_test
```
-
## Source Structure
This project is a bit unconversionel because I didn't know any better at the time.
diff --git a/source/code/ReadKeyboard.cpp b/source/code/ReadKeyboard.cpp index 736093a..ee806f5 100644 --- a/source/code/ReadKeyboard.cpp +++ b/source/code/ReadKeyboard.cpp
@@ -37,9 +37,7 @@ int ReadKeyboard::CharsBeforeCursor() {
return std::distance(text_string.begin(), position);
}
-ReadKeyboard::ReadKeyboard(const char* oldName) {
- maxLength = 16;
- text_string = oldName;
+ReadKeyboard::ReadKeyboard(const char* oldName) : maxLength(16), text_string(oldName) {
position = text_string.end();
}
diff --git a/source/code/highscore.cpp b/source/code/highscore.cpp index 5a346f3..d12e685 100644 --- a/source/code/highscore.cpp +++ b/source/code/highscore.cpp
@@ -50,9 +50,7 @@ bool record_sorter (const record& i,const record& j) {
return (i.score > j.score);
}
-Highscore::Highscore(const std::string& type) {
- this->type = type;
- filename = type+".json.dat";
+Highscore::Highscore(const std::string& type) : filename(type+".json.dat"), type(type) {
std::string readFileContent = sago::GetFileContent(filename.c_str());
if (readFileContent.length() > 0) {
try {