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 config
players: players:
width: 1000 width: 200
startXPosition: 50 startXPosition: 50
fireCooldown: 10 fireCooldown: 40
speed: 20 speed: 6
lives: 3 lives: 3
user1: user1:
color: red color: red
@ -25,9 +25,9 @@ players:
# Enemies config # Enemies config
invaders: invaders:
fireCooldown: 20 fireCooldown: 20
size: 40 size: 30
speed: 5 speed: 2
distance: 40 # distance in pixels between invaders distance: 15 # distance in pixels between invaders
typeA: typeA:
points: 100 points: 100
@ -44,16 +44,18 @@ invaders:
projectiles: projectiles:
missiles: missiles:
color: yellow color: yellow
speed: 10 speed: 5
width: 10 width: 10
torpedos: torpedos:
color: green color: green
speed: 10 speed: 5
width: 10 width: 10
# God is not in configuration because you can't control a god
# Grid definition # Grid definition
# You can add more rows, make rows longer and add spaces # You can add more rows, make rows longer and add spaces
grid: grid:
- "AAAAAAAAAA" - "CA AAAAAA AC"
- "BBBBBBBBBB" - "CBBB BBBC"
- "CCCCCCCCCC" - "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 { int ConfigBuilder::getInt(const configKey& key, int def, int min, int max) const {
try{ try{
int val = getInt(key); 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 : " + throw config_error("Value for key " + key + " do not follow preconditions : " +
to_string(min) + "<=" + to_string(val) + "<=" + to_string(max)); to_string(min) + "<=" + to_string(val) + "<=" + to_string(max));
} }