Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OOEntityFilterPredicate.h
Go to the documentation of this file.
1/*
2
3OOEntityFilterPredicate.h
4
5Filters used to select entities in various contexts. Callers are required to
6ensure that the "entity" argument is non-nil and the "parameter" argument is
7valid and relevant.
8
9To reduce header spaghetti, the EntityFilterPredicate type is declared in
10Universe.h, which is included just about everywhere anyway. This file just
11declares a set of widely-useful predicates.
12
13
14Oolite
15Copyright (C) 2004-2013 Giles C Williams and contributors
16
17This program is free software; you can redistribute it and/or
18modify it under the terms of the GNU General Public License
19as published by the Free Software Foundation; either version 2
20of the License, or (at your option) any later version.
21
22This program is distributed in the hope that it will be useful,
23but WITHOUT ANY WARRANTY; without even the implied warranty of
24MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25GNU General Public License for more details.
26
27You should have received a copy of the GNU General Public License
28along with this program; if not, write to the Free Software
29Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
30MA 02110-1301, USA.
31
32*/
33
34
35#import "Universe.h"
36
37
43
51
52
53BOOL YESPredicate(Entity *entity, void *parameter); // Parameter: ignored. Always returns YES.
54BOOL NOPredicate(Entity *entity, void *parameter); // Parameter: ignored. Always returns NO.
55
56BOOL NOTPredicate(Entity *entity, void *parameter); // Parameter: ChainedEntityPredicateParameter. Reverses effect of chained predicate.
57
58BOOL ANDPredicate(Entity *entity, void *parameter); // Parameter: BinaryOperationPredicateParameter. Short-circuiting AND operator.
59BOOL ORPredicate(Entity *entity, void *parameter); // Parameter: BinaryOperationPredicateParameter. Short-circuiting OR operator.
60BOOL NORPredicate(Entity *entity, void *parameter); // Parameter: BinaryOperationPredicateParameter. Short-circuiting NOR operator.
61BOOL XORPredicate(Entity *entity, void *parameter); // Parameter: BinaryOperationPredicateParameter. XOR operator.
62BOOL NANDPredicate(Entity *entity, void *parameter); // Parameter: BinaryOperationPredicateParameter. NAND operator.
63
64BOOL HasScanClassPredicate(Entity *entity, void *parameter); // Parameter: NSNumber (int)
65BOOL HasClassPredicate(Entity *entity, void *parameter); // Parameter: Class
66BOOL IsShipPredicate(Entity *entity, void *parameter); // Parameter: ignored. Tests isShip and !isSubentity.
67BOOL IsStationPredicate(Entity *entity, void *parameter); // Parameter: ignored. Tests isStation.
68BOOL IsPlanetPredicate(Entity *entity, void *parameter); // Parameter: ignored. Tests isPlanet and planetType == STELLAR_TYPE_NORMAL_PLANET.
69BOOL IsSunPredicate(Entity *entity, void *parameter); // Parameter: ignored. Tests isSun.
70BOOL IsVisualEffectPredicate(Entity *entity, void *parameter); // Parameter: ignored. Tests isVisualEffect and !isSubentity.
71
72// These predicates assume their parameter is a ShipEntity.
73BOOL HasRolePredicate(Entity *ship, void *parameter); // Parameter: NSString
74BOOL HasPrimaryRolePredicate(Entity *ship, void *parameter); // Parameter: NSString
75BOOL HasRoleInSetPredicate(Entity *ship, void *parameter); // Parameter: NSSet
76BOOL HasPrimaryRoleInSetPredicate(Entity *ship, void *parameter); // Parameter: NSSet
77BOOL IsHostileAgainstTargetPredicate(Entity *ship, void *parameter); // Parameter: ShipEntity
BOOL IsStationPredicate(Entity *entity, void *parameter)
BOOL NOPredicate(Entity *entity, void *parameter)
BOOL NANDPredicate(Entity *entity, void *parameter)
BOOL XORPredicate(Entity *entity, void *parameter)
BOOL ANDPredicate(Entity *entity, void *parameter)
BOOL NOTPredicate(Entity *entity, void *parameter)
BOOL IsSunPredicate(Entity *entity, void *parameter)
BOOL HasScanClassPredicate(Entity *entity, void *parameter)
BOOL IsHostileAgainstTargetPredicate(Entity *ship, void *parameter)
BOOL HasPrimaryRolePredicate(Entity *ship, void *parameter)
BOOL IsShipPredicate(Entity *entity, void *parameter)
BOOL IsPlanetPredicate(Entity *entity, void *parameter)
BOOL HasRolePredicate(Entity *ship, void *parameter)
BOOL IsVisualEffectPredicate(Entity *entity, void *parameter)
BOOL ORPredicate(Entity *entity, void *parameter)
BOOL NORPredicate(Entity *entity, void *parameter)
BOOL HasClassPredicate(Entity *entity, void *parameter)
BOOL HasRoleInSetPredicate(Entity *ship, void *parameter)
BOOL YESPredicate(Entity *entity, void *parameter)
BOOL HasPrimaryRoleInSetPredicate(Entity *ship, void *parameter)
BOOL(* EntityFilterPredicate)(Entity *entity, void *parameter)
Definition Universe.h:52