new config + patch

This commit is contained in:
Thomas 2022-01-10 09:49:18 +01:00
parent 9dc5a03427
commit 3dcdcadff3
No known key found for this signature in database
GPG Key ID: E538821A6CDFDAD7
2 changed files with 14 additions and 12 deletions

View File

@ -4,10 +4,10 @@ general:
# Players config
players:
width: 1000
width: 200
startXPosition: 50
fireCooldown: 10
speed: 20
fireCooldown: 40
speed: 6
lives: 3
user1:
color: red
@ -25,9 +25,9 @@ players:
# Enemies config
invaders:
fireCooldown: 20
size: 40
speed: 5
distance: 40 # distance in pixels between invaders
size: 30
speed: 2
distance: 15 # distance in pixels between invaders
typeA:
points: 100
@ -44,16 +44,18 @@ invaders:
projectiles:
missiles:
color: yellow
speed: 10
speed: 5
width: 10
torpedos:
color: green
speed: 10
speed: 5
width: 10
# God is not in configuration because you can't control a god
# Grid definition
# You can add more rows, make rows longer and add spaces
grid:
- "AAAAAAAAAA"
- "BBBBBBBBBB"
- "CCCCCCCCCC"
- "CA AAAAAA AC"
- "CBBB BBBC"
- "CCCCCCCCCCCC"

View File

@ -215,7 +215,7 @@ const string& ConfigBuilder::getString(const configKey& key) const {
int ConfigBuilder::getInt(const configKey& key, int def, int min, int max) const {
try{
int val = getInt(key);
if(val > min || val < max){
if(val < min || val > max){
throw config_error("Value for key " + key + " do not follow preconditions : " +
to_string(min) + "<=" + to_string(val) + "<=" + to_string(max));
}