-
Notifications
You must be signed in to change notification settings - Fork 4
/
common.h
134 lines (106 loc) · 2.4 KB
/
common.h
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
Copyright (C) 2000 Jason C. Garcowski(jcg5@po.cwru.edu),
Ryan Glasnapp(rglasnap@nmt.edu)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// New Defines
#ifndef TURNS_PER_DAY
#define TURNS_PER_DAY 100
#endif
#ifndef MAX_WARPS
#define MAX_WARPS 6
#endif
#ifndef START_CREDITS
#define START_CREDITS 2000
#endif
#ifndef START_FIGHTERS
#define START_FIGHTERS 20
#endif
#ifndef START_HOLDS
#define START_HOLDS 20
#endif
#ifndef PROCESS_INTERVAL
#define PROCESS_INTERVAL 2
#endif
#ifndef AUTOSAVE
#define AUTOSAVE 10
#endif
#ifndef MAX_SHIP_NAME
#define MAX_SHIP_NAME 12
#endif
#ifndef SHIP_TYPES
#define SHIP_TYPES 10
#endif
#ifndef DEFAULT_NODES
#define DEFAULT_NODES 0
#endif
// END New
#ifndef MAX_PLAYERS
#define MAX_PLAYERS 200
#endif
#ifndef MAX_SHIPS
#define MAX_SHIPS 1024
#endif
#ifndef MAX_PORTS
#define MAX_PORTS 500
#endif
#ifndef MAX_TOTAL_PLANETS
#define MAX_TOTAL_PLANETS 200
#endif
#ifndef MAX_WARPS_PER_SECTOR
#define MAX_WARPS_PER_SECTOR 6
#endif
#ifndef DEFAULT_PORT
#define DEFAULT_PORT 1234
#endif
#ifndef BUFF_SIZE
#define BUFF_SIZE 5000
#endif
#ifndef MAX_NAME_LENGTH
#define MAX_NAME_LENGTH 25
#endif
#ifndef COMMON_H
#define COMMON_H
#include <netinet/in.h>
#include <string.h>
int init_sockaddr (int, struct sockaddr_in *);
int init_clientnetwork (char *hostname, int port);
int sendinfo (int sockid, char *buffer);
int recvinfo (int sockid, char *buffer);
int acceptnewconnection (int sockid);
int randomnum(int min, int max);
int min(int a, int b);
int max(int a, int b);
enum porttype
{
p_trade,
p_land,
p_upgrade,
p_negotiate,
p_rob,
p_smuggle,
p_attack,
p_quit,
p_buyship,
p_sellship,
p_priceship,
p_listships,
p_deposit,
p_withdraw,
p_balance,
p_buyhardware,
pn_listnodes,
pn_travel
};
int *usedNames;
#endif