From 64dbf5cdd5c16ab6ccdadcfd66949aba5b8fa1e2 Mon Sep 17 00:00:00 2001 From: Xavier ASUS Date: Sun, 25 Nov 2018 18:02:18 +0100 Subject: Bugfix: minutes were not being retrieved from PLT files. Game.c: parking slots cannot be selected if an aircraft in STATE_PARKED state is on it. Other fixes and improvements. Added some tiles from TILESET2.TIM --- Source/PltParser.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'Source/PltParser.c') diff --git a/Source/PltParser.c b/Source/PltParser.c index 4d01135..0d97739 100644 --- a/Source/PltParser.c +++ b/Source/PltParser.c @@ -45,8 +45,8 @@ bool PltParserLoadFile(const char* strPath, TYPE_FLIGHT_DATA* const ptrFlightDat char lineBuffer[LINE_MAX_CHARACTERS]; char* lineBufferPtr; char* pltBufferSavePtr; - char strHour[PLT_HOUR_MINUTE_CHARACTERS]; - char strMinutes[PLT_HOUR_MINUTE_CHARACTERS]; + char strHour[PLT_HOUR_MINUTE_CHARACTERS] = {'\0'}; + char strMinutes[PLT_HOUR_MINUTE_CHARACTERS] = {'\0'};; uint8_t* strPltBuffer; if (SystemLoadFile(strPath) == false) @@ -112,7 +112,6 @@ bool PltParserLoadFile(const char* strPath, TYPE_FLIGHT_DATA* const ptrFlightDat if (i == PLT_COLON_POSITION) { j = 0; - buffer = strtok(NULL,"\n"); continue; } else if (i < PLT_COLON_POSITION) @@ -126,17 +125,14 @@ bool PltParserLoadFile(const char* strPath, TYPE_FLIGHT_DATA* const ptrFlightDat } GameSetTime((uint8_t)atoi(strHour),(uint8_t)atoi(strMinutes) ); - Serial_printf("Game time set to %.2d:%.2d.\n",(uint8_t)atoi(strHour),(uint8_t)atoi(strMinutes) ); } else { - typedef enum t_lineType + enum { MESSAGE_INFO, AIRCRAFT_DATA - }TYPE_LINE; - - TYPE_LINE tLine = AIRCRAFT_DATA; // Default value + } tLine = AIRCRAFT_DATA; // Default value TYPE_MESSAGE_DATA tMessage = {0}; // File header (initial game time) has already been read -- cgit v1.2.3