Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

C functions available in sccharts by including readparams.h:

int debugLevel();

Reads debug level from a JSON settings file called settings.json in $XDG_CONFIG_HOME/railway if XDG_CONFIG_HOME is set or from $HOME/.config/railway if it isn't.

void readTrainPositions(int* aiTrainPositions, int num_trains);

Read initial train positions from a local JSON configuration file and inserts it in the int array aiTrainPositions. The JSON file is called config.json and is found in $XDG_CONFIG_HOME/railway if XDG_CONFIG_HOME is set or from $HOME/.config/railway if it isn't.

void getAction(int* aiAction);

Read a new action's data from a JSON file and inserts it into the int array aiAction. aiAction will then contain {id, start, destination, reverse flag}. If one or more fields are set to -1 the action is to be considered invalid and ignored. The JSON file is called input.json and is found in $XDG_CONFIG_HOME/railway if XDG_CONFIG_HOME is set or from $HOME/.config/railway if it isn't.