Freeciv-3.4
Loading...
Searching...
No Matches
daisanity.c
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
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* server */
19#include "sanitycheck.h"
20
21/* ai/default */
22#include "daidata.h"
23#include "daiplayer.h"
24
25#include "daisanity.h"
26
27/**********************************************************************/
30void dai_sanity_check(struct ai_type *ait, struct player *pplayer)
31{
32#ifdef SANITY_CHECKING
33
34#define SANITY_CHECK(check) \
35 fc_assert_full(__FILE__, __FUNCTION__, __FC_LINE__, check, , NOLOGMSG, NOLOGMSG)
36
37 struct player *wt;
38
39 if (!pplayer->is_alive) {
40 return;
41 }
42
44
46 struct ai_dip_intel *adip = dai_diplomacy_get(ait, pplayer, opponent);
47 bool at_war = pplayers_at_war(pplayer, opponent);
48 bool war_target = (wt == opponent);
49
50 /* SANITY_CHECK(adip->countdown < 0 || !at_war); */
51 SANITY_CHECK(adip->countdown >= -1 || at_war || war_target);
53
54#endif /* SANITY_CHECKING */
55}
char * incite_cost
Definition comments.c:77
struct ai_dip_intel * dai_diplomacy_get(struct ai_type *ait, const struct player *plr1, const struct player *plr2)
Definition daidata.c:402
static struct ai_plr * def_ai_player_data(const struct player *pplayer, struct ai_type *deftype)
Definition daiplayer.h:54
void dai_sanity_check(struct ai_type *ait, struct player *pplayer)
Definition daisanity.c:30
bool pplayers_at_war(const struct player *pplayer, const struct player *pplayer2)
Definition player.c:1376
#define players_iterate_alive_end
Definition player.h:562
#define players_iterate_alive(_pplayer)
Definition player.h:557
struct ai_plr::@280 diplomacy
struct player * war_target
Definition daidata.h:97
Definition ai.h:50
bool is_alive
Definition player.h:268