Commit f9f5a254 authored by Nicolas LIENART's avatar Nicolas LIENART

Money dans mapdata

parent 83862685
......@@ -10,6 +10,8 @@ in 0 255 0
out 0 0 255
construct 0 0 0
inconstructible 255 0 234
# Player info
argent 2000
# Construction Data
laser 1 1 2 2 0 200 100
missile 2 1 1 1 0 300 150
......
......@@ -10,6 +10,8 @@ in 0 255 0
out 0 0 255
construct 0 0 0
inconstructible 255 0 234
# Player info
argent 2120
# Construction Data (DEGAT ALIM CAD PORTEE RANGE VAL VAL)
laser 1 1 5 2 0 200 100
missile 2 1 2 1 0 300 150
......
......@@ -10,6 +10,8 @@ in 0 255 0
out 0 0 255
construct 0 0 0
inconstructible 255 0 234
# Player info
argent 3000
# Construction Data (DEGAT ALIM CAD PORTEE RANGE VAL VAL)
laser 1 1 5 2 0 200 100
missile 2 1 2 1 0 300 150
......
......@@ -62,13 +62,11 @@ void case_initPlateau()
exit(EXIT_FAILURE);
}
int argent = 2000;
plateau->idListInfos = GL_INVALID_VALUE;
plateau->idListIcon = GL_INVALID_VALUE;
plateau->idListMoney = GL_INVALID_VALUE;
plateau->joueur = player_init(argent);
plateau->joueur = player_init(mapData->argent);
plateau->listMonsters = monster_initListMonster();
plateau->listTours = tour_initListTours();
plateau->listProjectiles = projectile_initListProjectiles();
......
......@@ -376,6 +376,17 @@ int itd_getImageFilePath(FILE* file)
return CHK_SUCCESS;
}
}
int itd_getMoney(FILE* file)
{
int money;
if(fscanf(file, "%d", &money)) {
mapData->argent = money;
return CHK_SUCCESS;
}
else {
return CHK_ERROR_FILE;
}
}
int itd_getEnergyValue(FILE* file)
{
......@@ -511,6 +522,16 @@ int itd_checkForMapData(FILE* file)
}
}
if (strcmp("argent", label) == 0) {
if (itd_getMoney(file) == CHK_SUCCESS) {
return CHK_SUCCESS;
}
else {
fseek(file, originalPosition, SEEK_SET);
return CHK_ERROR_FILE;
}
}
if (strcmp("laser", label) == 0) {
if (itd_getConstructionData(file, LASER) == CHK_SUCCESS) {
return CHK_SUCCESS;
......
......@@ -150,6 +150,7 @@ typedef struct MapData {
int Ysplit;
char* mapFile;
int energy;
int argent;
RGBcolor pathCol;
RGBcolor nodeCol;
RGBcolor buildingCol;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment