move read_orders to its own module

This commit is contained in:
Enno Rehling 2017-10-07 18:03:22 +02:00
parent b676bb0968
commit f3515c8e07
3 changed files with 49 additions and 0 deletions

View File

@ -116,6 +116,7 @@ set (ERESSEA_SRC
magic.c magic.c
market.c market.c
morale.c morale.c
orderfile.c
randenc.c randenc.c
renumber.c renumber.c
volcano.c volcano.c

30
src/orderfile.c Normal file
View File

@ -0,0 +1,30 @@
#include "orderfile.h"
#include <kernel/faction.h>
#include <kernel/unit.h>
#include <stream.h>
#include <filestream.h>
#include <stdio.h>
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);
}

18
src/orderfile.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef H_ORDERFILE
#define H_ORDERFILE
#include <skill.h>
#ifdef __cplusplus
extern "C" {
#endif
struct stream;
void read_orderfile(const char *filename);
void read_orders(struct stream *strm);
#ifdef __cplusplus
}
#endif
#endif