Freeciv-3.2
Loading...
Searching...
No Matches
spaceship.h
Go to the documentation of this file.
1/**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13#ifndef FC__SPACESHIP_H
14#define FC__SPACESHIP_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* utility */
21#include "bitvector.h"
22#include "support.h" /* bool type */
23
24/* common */
25#include "fc_types.h"
26
27/**********************************************************************
28First, some ascii art showing the spaceship and relevant parts,
29including numbering of parts:
30 2 4 6 8 10 12 14 16 18 20 22 24 26 28
31 | | | | | | | | | | | | | |
32 :::-:::-:::-:::-:::-:::-:::-:::-:::-:::-:::-:::-:::-:::- s=structural
33 2_:::-:::-:::-:::-:::-:::-:::-:::-:::-:::-:::-:::-:::-:::- C=component
34 :::-:::-:::-:::-:::-:::-:::-:::-:::-:::-/C12/ C13 \:::- M=module
35 4_!!!-!!!-!!!-!!!-!!!-!!!-!!!-!!!-!!!-!!!-\F6/\ P6 /!!!-
36 :::-:::-\++++++/:::-:::-\++++++/:::-[s ][s ][s ]:::-:::- P=Propulsion
37 6_:::-:::-# M8 #:::-:::-# M2 #:::-[24][26][28]:::-:::- F=Fuel
38 :::-:::-# S2 #:::-:::-# S0 #:::-[s ]/C8>/ C9 \:::-
39 8_!!!-!!!-/++++++\!!!-!!!-/++++++\!!!-[22]\F4/\ P4 /!!!- H=Habitation
40 :::-:::-[s ][s ][s ][s ][s ][s ][s ][s ]/C4>/ C5 \:::- L=Life Support
4110_:::-:::-[30][20][18][16][14][10][ 6][ 4]\F2/\ P2 /:::- S=Solar Panels
42 :::-/======\/======\/======\/======\[s ][s ][s ]:::-:::-
4312_!!!-# M10 ## M6 ## M4 ## M0 #[ 2][ 8][12]!!!-!!!-
44 :::-# L3 ## H2 ## L1 ## H0 #[s ]/C0\/ C1 \:::-
4514_:::-\======/\======/\======/\======/[ 0]\F0/\ P0 /:::-
46 :::-/======\/======\/======\/======\[s ]/C2\/ C3 \:::-
4716_!!!-# M9 ## M7 ## M3 ## M1 #[ 1]\F1/\ P1 /!!!-
48 :::-# H3 ## L2 ## H1 ## L0 #[s ][s ][s ]:::-:::-
4918_:::-\======/\======/\======/\======/[ 3][ 9][13]:::-:::-
50 :::-:::-[s ][s ][s ][s ][s ][s ][s ][s ]/C6\/ C7 \:::-
5120_!!!-!!!-[31][21][19][17][15][11][ 7][ 5]\F3/\ P3 /!!!-
52 :::-:::-\++++++/:::-:::-\++++++/:::-[s ]/C10/ C11 \:::-
5322_:::-:::-# M11 #:::-:::-# M5 #:::-[23]\F5/\ P5 /:::-
54 :::-:::-# S3 #:::-:::-# S1 #:::-[s ][s ][s ]:::-:::-
5524_!!!-!!!-/++++++\!!!-!!!-/++++++\!!!-[25][27][29]!!!-!!!-
56 :::-:::-:::-:::-:::-:::-:::-:::-:::-:::-/C14/ C15 \:::-
5726_:::-:::-:::-:::-:::-:::-:::-:::-:::-:::-\F7/\ P7 /:::-
58 :::-:::-:::-:::-:::-:::-:::-:::-:::-:::-:::-:::-:::-:::-
5928_!!!-!!!-!!!-!!!-!!!-!!!-!!!-!!!-!!!-!!!-!!!-!!!-!!!-!!!-
60
61Now, how things work:
62
63Modules and Components: player (if the client is smart enough)
64can choose which sort of each to build, but not where they are
65built. That is, first module built can be choice of H,L,S,
66but whichever it is, it is H0, L0 or S0. If you build 4 F and
670 P, they will be F0,F1,F2,F3.
68
69Structural are different: the first s must be s0, but after that
70you can in principle build any s which is adjacent (4 ways) to
71another s (but in practice the client may make the choice for you).
72Because you have to start with s0, this means each s actually
73depends on one single other s, so we just note that required s
74below, and don't have to calculate adjacency.
75
76Likewise, whether a component or module is "connected" to the
77structure depends in each case on just a single structural.
78(Actually, F2 and F3 are exceptions, which have a choice
79of two (non-dependent) structs to depend on; we choose just
80the one which must be there for P2 and P3).
81
82**********************************************************************/
83
86
87#define NUM_SS_STRUCTURALS 32 /* Used in the network protocol. */
88#define NUM_SS_COMPONENTS 16
89#define NUM_SS_MODULES 12
90
91/* Used in the network protocol. */
93
95 /* how many of each part built, including any "unplaced": */
99 /* which structurals placed: (array of booleans) */
101 /* which components and modules placed: (may or may not be connected) */
102 int fuel;
107 /* other stuff: */
110 /* derived quantities: */
112 int mass;
117};
118
120 int x, y; /* position of tile centre */
121 int required; /* required for struct connection */
122};
123
126extern const struct sship_part_info modules_info[NUM_SS_MODULES];
127
130
136
137bool next_spaceship_component(struct player *pplayer,
138 struct player_spaceship *ship,
139 struct spaceship_component *fill);
140
141#ifdef __cplusplus
142}
143#endif /* __cplusplus */
144
145#endif /* FC__SPACESHIP_H */
#define BV_DEFINE(name, bits)
Definition bitvector.h:132
char * incite_cost
Definition comments.c:75
spaceship_place_type
Definition fc_types.h:1296
#define NUM_SS_MODULES
Definition spaceship.h:89
int num_spaceship_structurals_placed(const struct player_spaceship *ship)
Definition spaceship.c:113
bool next_spaceship_component(struct player *pplayer, struct player_spaceship *ship, struct spaceship_component *fill)
Definition spaceship.c:130
#define NUM_SS_COMPONENTS
Definition spaceship.h:88
void spaceship_init(struct player_spaceship *ship)
Definition spaceship.c:96
const struct sship_part_info structurals_info[NUM_SS_STRUCTURALS]
Definition spaceship.c:23
const struct sship_part_info modules_info[NUM_SS_MODULES]
Definition spaceship.c:77
const struct sship_part_info components_info[NUM_SS_COMPONENTS]
Definition spaceship.c:58
#define NUM_SS_STRUCTURALS
Definition spaceship.h:87
spaceship_state
Definition spaceship.h:84
@ SSHIP_ARRIVED
Definition spaceship.h:85
@ SSHIP_STARTED
Definition spaceship.h:84
@ SSHIP_LAUNCHED
Definition spaceship.h:85
@ SSHIP_NONE
Definition spaceship.h:84
bv_spaceship_structure structure
Definition spaceship.h:100
double success_rate
Definition spaceship.h:115
double support_rate
Definition spaceship.h:113
enum spaceship_state state
Definition spaceship.h:108
enum spaceship_place_type type
Definition spaceship.h:133