Add defaultMap config option
This commit is contained in:
parent
72ca020f27
commit
f5a7a90168
@ -21,6 +21,7 @@ typedef struct config_t
|
|||||||
int difficulty; // 0-3 //Schwierigkeitsgrad
|
int difficulty; // 0-3 //Schwierigkeitsgrad
|
||||||
int snakeDefaultLength; // = 2 //Länge der Schlange
|
int snakeDefaultLength; // = 2 //Länge der Schlange
|
||||||
const char *leaderboardFilename; // Dateiname des Leaderboards
|
const char *leaderboardFilename; // Dateiname des Leaderboards
|
||||||
|
const char *defaultMapName; // Name der map die initial geladen wird
|
||||||
} config_t;
|
} config_t;
|
||||||
|
|
||||||
// global config struct defined in config.c
|
// global config struct defined in config.c
|
||||||
|
@ -8,5 +8,8 @@ config_t config = {
|
|||||||
.cycleDurationMs = 400,
|
.cycleDurationMs = 400,
|
||||||
.difficulty = 1,
|
.difficulty = 1,
|
||||||
.snakeDefaultLength = 2,
|
.snakeDefaultLength = 2,
|
||||||
.leaderboardFilename = ""
|
.leaderboardFilename = "",
|
||||||
|
//.defaultMapName = "default" //10x10
|
||||||
|
.defaultMapName = "intermediate" //15x15
|
||||||
|
//.defaultMapName = "empty" //20x10
|
||||||
};
|
};
|
@ -37,9 +37,8 @@ void gameInit()
|
|||||||
//----- load map -----
|
//----- load map -----
|
||||||
//load default map if no map loaded yet
|
//load default map if no map loaded yet
|
||||||
if (!game.mapIsLoaded){
|
if (!game.mapIsLoaded){
|
||||||
loadMapByName("default");
|
//loadMapByName("default");
|
||||||
//loadMapByName("empty");
|
loadMapByName(config.defaultMapName);
|
||||||
//loadMapByName("intermediate");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--- place initial food ---
|
//--- place initial food ---
|
||||||
|
10
src/map.c
10
src/map.c
@ -230,13 +230,13 @@ static const map_t map_intermediate = {
|
|||||||
.portals = {
|
.portals = {
|
||||||
{.posX = 5,
|
{.posX = 5,
|
||||||
.posY = 8,
|
.posY = 8,
|
||||||
.targetX = 7,
|
.targetX = 13,
|
||||||
.targetY = 1,
|
.targetY = 2,
|
||||||
.color = "blue"},
|
.color = "blue"},
|
||||||
{.posX = 1,
|
{.posX = 2,
|
||||||
.posY = 2,
|
.posY = 2,
|
||||||
.targetX = 2,
|
.targetX = 3,
|
||||||
.targetY = 8,
|
.targetY = 12,
|
||||||
.color = "red"}},
|
.color = "red"}},
|
||||||
.portalCount = 2};
|
.portalCount = 2};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user