Commit | Line | Data |
---|---|---|
ef79bbde P |
1 | // |
2 | // DF Netplay Plugin | |
3 | // | |
4 | // Based on netSock 0.2 by linuzappz. | |
5 | // The Plugin is free source code. | |
6 | // | |
7 | ||
8 | #include <stdio.h> | |
9 | #include <stdlib.h> | |
10 | ||
11 | #include "dfnet.h" | |
12 | ||
13 | #define CFG_FILENAME "dfnet.cfg" | |
14 | ||
15 | void SaveConf() { | |
16 | FILE *f; | |
17 | ||
18 | f = fopen(CFG_FILENAME, "w"); | |
19 | if (f == NULL) return; | |
20 | fwrite(&conf, 1, sizeof(conf), f); | |
21 | fclose(f); | |
22 | } | |
23 | ||
24 | void LoadConf() { | |
25 | FILE *f; | |
26 | ||
27 | f = fopen(CFG_FILENAME, "r"); | |
28 | if (f == NULL) { | |
29 | conf.PlayerNum = 1; | |
30 | conf.PortNum = 33306; | |
31 | strcpy(conf.ipAddress, "127.0.0.1"); | |
32 | return; | |
33 | } | |
34 | ||
35 | fread(&conf, 1, sizeof(conf), f); | |
36 | fclose(f); | |
37 | } |