Wiki source code of C
Last modified by GiorgioGhisotti on 2025/01/30 12:19
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | C functions available in sccharts by including readparams.h: | ||
| 2 | |||
| 3 | == int debugLevel(); == | ||
| 4 | |||
| 5 | 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. | ||
| 6 | |||
| 7 | == void readTrainPositions(int* aiTrainPositions, int num_trains, int debug_level); == | ||
| 8 | |||
| 9 | Read initial train positions from a JSON 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. debug_level should be obtained through debugLevel(). | ||
| 10 | |||
| 11 | == void getAction(int* aiAction, int debug_level); == | ||
| 12 | |||
| 13 | 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. debug_level should be obtained through debugLevel(). |