aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorXaviDCR92 <xavi.dcr@gmail.com>2017-06-06 07:13:16 +0200
committerXaviDCR92 <xavi.dcr@gmail.com>2017-06-06 07:13:16 +0200
commitfaf31975556ceb5be674eb89b0ec5b2d2836e42a (patch)
treed904b589e2e967fae4ec29456c51300b58cad49d /Source
parent1244505327009142c80140e44c86138f4fd6ae07 (diff)
downloadairport-faf31975556ceb5be674eb89b0ec5b2d2836e42a.tar.gz
* Some more work on Plt file generator.
Diffstat (limited to 'Source')
-rw-r--r--Source/MapEditor/MapEditor.pro.user4
-rw-r--r--Source/PltParser.c38
2 files changed, 39 insertions, 3 deletions
diff --git a/Source/MapEditor/MapEditor.pro.user b/Source/MapEditor/MapEditor.pro.user
index c6dedd7..fff8c7f 100644
--- a/Source/MapEditor/MapEditor.pro.user
+++ b/Source/MapEditor/MapEditor.pro.user
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.0.3, 2017-06-06T05:55:51. -->
+<!-- Written by QtCreator 4.0.3, 2017-06-06T07:08:57. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@@ -292,7 +292,7 @@
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">MapEditor.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
- <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default"></value>
+ <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">C:/cygwin/home/Xavier/Airport/Source/MapEditor</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
diff --git a/Source/PltParser.c b/Source/PltParser.c
index 61f066d..41e2da0 100644
--- a/Source/PltParser.c
+++ b/Source/PltParser.c
@@ -297,9 +297,10 @@ uint8_t* PltParserGenerateFile(TYPE_PLT_CONFIG* ptrPltConfig)
uint8_t maxAircraftTime;
uint8_t nAircraft;
uint8_t i;
+ uint8_t j;
TYPE_HOUR InitialHour;
TYPE_MINUTE InitialMinutes;
- char auxBuffer[32] = {0};
+ char auxBuffer[32] = {'\0'};
switch(ptrPltConfig->Level)
{
@@ -320,6 +321,10 @@ uint8_t* PltParserGenerateFile(TYPE_PLT_CONFIG* ptrPltConfig)
maxAircraftTime = MIN_AIRCRAFT_TIMELAPSE_MAX_SECONDS_HARD;
nAircraft = SystemRand(MIN_AIRCRAFT_HARD, MAX_AIRCRAFT_HARD);
break;
+
+ default:
+ dprintf("PltParserGenerateFile(): Undefined level!\n");
+ return NULL;
}
SystemClearBuffer();
@@ -332,5 +337,36 @@ uint8_t* PltParserGenerateFile(TYPE_PLT_CONFIG* ptrPltConfig)
snprintf(auxBuffer, 32, "%d:%d\n", InitialHour, InitialMinutes);
+ for(i = 0; auxBuffer[i] != '\0'; i++)
+ {
+ // Transfer contents generated from snprintf to main buffer.
+ PltBuffer[i] = auxBuffer[i];
+ }
+
+ dprintf("%s\n", PltBuffer);
+ DEBUG_PRINT_VAR(ptrPltConfig->Level);
+ DEBUG_PRINT_VAR(nAircraft);
+ DEBUG_PRINT_VAR(minAircraftTime);
+ DEBUG_PRINT_VAR(maxAircraftTime);
+
+ for(j = 0; j < nAircraft; j++)
+ {
+ uint8_t dep_arr_rand = SystemRand(0,100);
+
+ if(dep_arr_rand < 50)
+ {
+ // Set departure flight
+
+ memcpy(&PltBuffer[i], "DEPARTURE", sizeof("DEPARTURE") * sizeof(uint8_t) );
+ i += strlen("DEPARTURE");
+ }
+ else
+ {
+ // Set arrival flight
+ memcpy(&PltBuffer[i], "ARRIVAL", sizeof("ARRIVAL") * sizeof(uint8_t) );
+ i += strlen("ARRIVAL");
+ }
+ }
+
return PltBuffer;
}