aboutsummaryrefslogtreecommitdiff
path: root/plugins/dfnet/cfg.c
blob: a63b074b803809fd7658c21924fcf5199d08d2ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// DF Netplay Plugin
//
// Based on netSock 0.2 by linuzappz.
// The Plugin is free source code.
//

#include <stdio.h>
#include <stdlib.h>

#include "dfnet.h"

#define CFG_FILENAME "dfnet.cfg"

void SaveConf() {
	FILE *f;

	f = fopen(CFG_FILENAME, "w");
	if (f == NULL) return;
	fwrite(&conf, 1, sizeof(conf), f);
	fclose(f);
}

void LoadConf() {
	FILE *f;

	f = fopen(CFG_FILENAME, "r");
	if (f == NULL) {
		conf.PlayerNum = 1;
		conf.PortNum = 33306;
		strcpy(conf.ipAddress, "127.0.0.1");
		return;
	}

	fread(&conf, 1, sizeof(conf), f);
	fclose(f);
}