#include #include #include #include #include "typedef.h" #include "wfc.h" void manage_arguments(int argc, char **argv) { int opt; while((opt = getopt(argc, argv, "hd:s:m:")) != -1) { switch(opt) { case 'd': width = atoll(strtok(optarg, "x")); height = atoll(strtok(NULL, "x")); break; case 's': SEED = atoll(optarg); break; case 'm': SCALE = atoll(optarg); break; case 'h': default: puts("Usage: wfc [OPTION] [VALUE(S)]...\n"); puts("The options are the following: (No option is mandatory)"); puts("-h Get help"); puts("-d Change width and height of the tilemap, defaut is 30x30"); puts(" args: 2 numbers; width and height seperated by an 'x'"); puts("-s Change the seed, default is time(0)"); puts(" args: 1 number; the seed"); puts("-m Change the number, that the tilemap is scaled by"); puts(" args: 1 number; scaler"); exit(EXIT_SUCCESS); break; } } } int main(int argc, char **argv) { default_values(); manage_arguments(argc, argv); srand(SEED); info("Starting With:\n\tWidth: %ld\n\tHeight: %ld\n\tSeed: %ld\n\tScale: %ld", width, height, SEED, SCALE); init_wfc(); info("WFC Initialized"); wfc(); info("Tilemap Successfully Generated"); save_wfc(); deinit_wfc(); info("WFC Deinitialized"); return 0; }