Freeciv-3.3: /fast/freeciv/nightly/main/common/oblig_reqs.h Source File

Freeciv-3.3

Loading...
Searching...
No Matches
oblig_reqs.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__OBLIG_REQS_H
14#define FC__OBLIG_REQS_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* Custom data types for obligatory hard action requirements. */
21
22/* A contradiction to an obligatory hard requirement. */
23 struct action_enabler_contradiction {
24 /* A requirement that contradicts the obligatory hard requirement. */
25 struct requirement req;
26
27 /* Is the obligatory hard requirement in the action enabler's target
28 * requirement vector? If FALSE it is in its actor requirement vector. */
29 bool is_target;
30};
31
32/* An obligatory hard action requirement */
33 struct obligatory_req {
34 /* The requirement is fulfilled if the action enabler doesn't contradict
35 * one of the contradictions listed here. */
36 struct ae_contra_or *contras;
37
38 /* The error message to show when the hard obligatory requirement is
39 * missing. Must be there. */
40 const char *error_msg;
41};
42
43#define SPECVEC_TAG obligatory_req
44#define SPECVEC_TYPE struct obligatory_req
45#include "specvec.h"
46#define obligatory_req_vector_iterate(obreq_vec, pobreq) \
47 TYPED_VECTOR_ITERATE(struct obligatory_req, obreq_vec, pobreq)
48#define obligatory_req_vector_iterate_end VECTOR_ITERATE_END
49
50/* One or more alternative obligatory hard requirement contradictions. */
51 struct ae_contra_or {
52 int alternatives;
53 /* The obligatory hard requirement is fulfilled if a contradiction exists
54 * that doesn't contradict the action enabler. */
55 struct action_enabler_contradiction *alternative;
56
57 /* How many obligatory reqs use this */
58 int users;
59};
60
61void oblig_hard_reqs_init(void);
62void oblig_hard_reqs_free(void);
63
64void hard_code_oblig_hard_reqs(void);
65void hard_code_oblig_hard_reqs_ruleset(void);
66
67struct obligatory_req_vector *oblig_hard_reqs_get(enum action_result res);
68struct obligatory_req_vector *oblig_hard_reqs_get_sub(enum action_sub_result res);
69
70#ifdef __cplusplus
71}
72#endif /* __cplusplus */
73
74#endif /* OBLIG_REQS_H */
incite_cost
char * incite_cost
Definition comments.c:74
oblig_hard_reqs_init
void oblig_hard_reqs_init(void)
Definition oblig_reqs.c:807
oblig_hard_reqs_free
void oblig_hard_reqs_free(void)
Definition oblig_reqs.c:827
hard_code_oblig_hard_reqs_ruleset
void hard_code_oblig_hard_reqs_ruleset(void)
Definition oblig_reqs.c:770
hard_code_oblig_hard_reqs
void hard_code_oblig_hard_reqs(void)
Definition oblig_reqs.c:250
oblig_hard_reqs_get
struct obligatory_req_vector * oblig_hard_reqs_get(enum action_result res)
Definition oblig_reqs.c:852
oblig_hard_reqs_get_sub
struct obligatory_req_vector * oblig_hard_reqs_get_sub(enum action_sub_result res)
Definition oblig_reqs.c:863
specvec.h
action_enabler_contradiction
Definition oblig_reqs.h:23
action_enabler_contradiction::is_target
bool is_target
Definition oblig_reqs.h:29
action_enabler_contradiction::req
struct requirement req
Definition oblig_reqs.h:25
ae_contra_or
Definition oblig_reqs.h:51
ae_contra_or::alternative
struct action_enabler_contradiction * alternative
Definition oblig_reqs.h:55
ae_contra_or::alternatives
int alternatives
Definition oblig_reqs.h:52
ae_contra_or::users
int users
Definition oblig_reqs.h:58
obligatory_req
Definition oblig_reqs.h:33
obligatory_req::contras
struct ae_contra_or * contras
Definition oblig_reqs.h:36
obligatory_req::error_msg
const char * error_msg
Definition oblig_reqs.h:40
requirement
Definition requirements.h:81