2 // nazghul - an old-school RPG engine
3 // Copyright (C) 2002, 2003 Gordon McNutt
5 // This program is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free
7 // Software Foundation; either version 2 of the License, or (at your option)
10 // This program is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 // You should have received a copy of the GNU General Public License along with
16 // this program; if not, write to the Free Foundation, Inc., 59 Temple Place,
17 // Suite 330, Boston, MA 02111-1307 USA
20 // gmcnutt@users.sourceforge.net
30 #define INVALID_HANDLE -1
31 #define INVALID_FACTION -1
33 #define PLAYER_PARTY_FACTION 1
35 static inline int are_hostile(Being *a, Being *b)
37 return dtable_are_hostile(session_dtable(),
38 a->getCurrentFaction(),
39 b->getCurrentFaction());
42 static inline int are_natively_hostile(Being *a, Being *b)
44 return dtable_are_hostile(session_dtable(),
49 static inline int are_allies(Being *a, Being *b)
51 return dtable_are_allies(session_dtable(),
52 a->getCurrentFaction(),
53 b->getCurrentFaction());
56 static inline void make_hostile(Being *a, Being *b)
58 dtable_set(session_dtable(),
59 a->getCurrentFaction(),
60 b->getCurrentFaction(),
61 dtable_hostile(session_dtable()));
64 static inline void make_allies(Being *a, Being *b)
66 dtable_set(session_dtable(),
67 a->getCurrentFaction(),
68 b->getCurrentFaction(),
69 dtable_allies(session_dtable()));
72 static inline void improve_relations(Being *a, Being *b)
74 dtable_inc(session_dtable(),
75 a->getCurrentFaction(),
76 b->getCurrentFaction());
79 static inline void harm_relations(Being *a, Being *b)
81 if (a->getCurrentFaction() != b->getCurrentFaction())
83 dtable_dec(session_dtable(),
84 a->getCurrentFaction(),
85 b->getCurrentFaction());
89 static inline const char * diplomacy_string(Being *a, Being *b)
91 return dtable_describe(session_dtable(),
92 a->getCurrentFaction(),
93 b->getCurrentFaction());