Freeciv-3.3
Loading...
Searching...
No Matches
common
workertask.c
Go to the documentation of this file.
1
/****************************************************************************
2
Freeciv - Copyright (C) 2004 - The Freeciv Team
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
/* utility */
19
#include "
log.h
"
20
21
/* common */
22
#include "
city.h
"
23
#include "
extras.h
"
24
#include "
unit.h
"
25
26
#include "
workertask.h
"
27
28
/************************************************************************/
31
void
worker_task_init
(
struct
worker_task
*
ptask
)
32
{
33
ptask
->ptile =
NULL
;
34
ptask
->want = 0;
35
}
36
37
/************************************************************************/
40
bool
worker_task_is_sane
(
struct
worker_task
*
ptask
)
41
{
42
if
(
ptask
==
NULL
) {
43
return
FALSE
;
44
}
45
46
if
(
ptask
->ptile ==
NULL
) {
47
return
FALSE
;
48
}
49
50
if
(
ptask
->act >=
ACTIVITY_LAST
) {
51
return
FALSE
;
52
}
53
54
if
(
activity_requires_target
(
ptask
->act)) {
55
if
(
ptask
->tgt ==
NULL
) {
56
return
FALSE
;
57
}
58
if
(!
is_extra_caused_by
(
ptask
->tgt,
59
activity_to_extra_cause
(
ptask
->act))
60
&& !
is_extra_removed_by
(
ptask
->tgt,
61
activity_to_extra_rmcause
(
ptask
->act))) {
62
return
FALSE
;
63
}
64
}
65
66
return
TRUE
;
67
}
city.h
incite_cost
char * incite_cost
Definition
comments.c:76
activity_to_extra_cause
enum extra_cause activity_to_extra_cause(enum unit_activity act)
Definition
extras.c:1090
is_extra_removed_by
bool is_extra_removed_by(const struct extra_type *pextra, enum extra_rmcause rmcause)
Definition
extras.c:353
activity_to_extra_rmcause
enum extra_rmcause activity_to_extra_rmcause(enum unit_activity act)
Definition
extras.c:1111
extras.h
is_extra_caused_by
#define is_extra_caused_by(e, c)
Definition
extras.h:203
log.h
worker_task
Definition
workertask.h:21
TRUE
#define TRUE
Definition
support.h:46
FALSE
#define FALSE
Definition
support.h:47
activity_requires_target
bool activity_requires_target(enum unit_activity activity)
Definition
unit.c:590
unit.h
worker_task_is_sane
bool worker_task_is_sane(struct worker_task *ptask)
Definition
workertask.c:40
worker_task_init
void worker_task_init(struct worker_task *ptask)
Definition
workertask.c:31
workertask.h
Generated on Sun Dec 22 2024 22:30:37 for Freeciv-3.3 by
1.9.8