From f3515c8e07d47f75f9f42ae9ca92961868b4e46f Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 7 Oct 2017 18:03:22 +0200 Subject: [PATCH] move read_orders to its own module --- src/CMakeLists.txt | 1 + src/orderfile.c | 30 ++++++++++++++++++++++++++++++ src/orderfile.h | 18 ++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 src/orderfile.c create mode 100644 src/orderfile.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c4c306118..2af57d6b7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -116,6 +116,7 @@ set (ERESSEA_SRC magic.c market.c morale.c + orderfile.c randenc.c renumber.c volcano.c diff --git a/src/orderfile.c b/src/orderfile.c new file mode 100644 index 000000000..9f044ddbe --- /dev/null +++ b/src/orderfile.c @@ -0,0 +1,30 @@ +#include "orderfile.h" + +#include +#include + +#include +#include + +#include +void read_orders(stream *strm) +{ + faction *f = NULL; + unit *u = NULL; + char line[1024]; + + line = strm->api->readln(strm->handle, line, sizeof(line)); +} + +void read_orderfile(const char *filename) +{ + stream strm; + FILE * F = fopen(filename, "r"); + if (!F) { + return; + } + fstream_init(&strm, F); + read_orders(&strm); + fstream_done(&strm); + fclose(F); +} diff --git a/src/orderfile.h b/src/orderfile.h new file mode 100644 index 000000000..11364d361 --- /dev/null +++ b/src/orderfile.h @@ -0,0 +1,18 @@ +#ifndef H_ORDERFILE +#define H_ORDERFILE + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + struct stream; + + void read_orderfile(const char *filename); + void read_orders(struct stream *strm); + +#ifdef __cplusplus +} +#endif +#endif