Mercurial > hg > forks > yadex
annotate src/t_flags.cc @ 109:f05330267c66
Use stdint types.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 06 Oct 2014 12:59:23 +0300 |
parents | a68786b9c74b |
children |
rev | line source |
---|---|
0 | 1 /* |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
2 * t_flags.cc |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
3 * AYM 1998-12-21 |
0 | 4 */ |
5 | |
6 | |
7 /* | |
8 This file is part of Yadex. | |
9 | |
10 Yadex incorporates code from DEU 5.21 that was put in the public domain in | |
11 1994 by Raphaël Quinet and Brendon Wyber. | |
12 | |
13 The rest of Yadex is Copyright © 1997-2003 André Majorel and others. | |
14 | |
15 This program is free software; you can redistribute it and/or modify it under | |
16 the terms of the GNU General Public License as published by the Free Software | |
17 Foundation; either version 2 of the License, or (at your option) any later | |
18 version. | |
19 | |
20 This program is distributed in the hope that it will be useful, but WITHOUT | |
21 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
22 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |
23 | |
24 You should have received a copy of the GNU General Public License along with | |
25 this program; if not, write to the Free Software Foundation, Inc., 59 Temple | |
26 Place, Suite 330, Boston, MA 02111-1307, USA. | |
27 */ | |
28 | |
29 | |
30 #include "yadex.h" | |
31 #include "levels.h" | |
32 #include "selectn.h" | |
33 #include "wstructs.h" | |
34 | |
35 | |
36 /* | |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
37 * frob_things_flags - set/reset/toggle things flags |
0 | 38 * |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
39 * For all the things in <list>, apply the operator <op> |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
40 * with the operand <operand> on the flags field. |
0 | 41 */ |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
42 void frob_things_flags(SelPtr list, int op, int operand) |
0 | 43 { |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
44 SelPtr cur; |
109 | 45 int16_t mask; |
0 | 46 |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
47 if (op == YO_CLEAR || op == YO_SET || op == YO_TOGGLE) |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
48 mask = 1 << operand; |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
49 else |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
50 mask = operand; |
0 | 51 |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
52 for (cur = list; cur; cur = cur->next) |
0 | 53 { |
33
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
54 if (op == YO_CLEAR) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
55 Things[cur->objnum].when &= ~mask; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
56 else if (op == YO_SET) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
57 Things[cur->objnum].when |= mask; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
58 else if (op == YO_TOGGLE) |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
59 Things[cur->objnum].when ^= mask; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
60 else |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
61 { |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
62 nf_bug("frob_things_flags: op=%02X", op); |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
63 return; |
a68786b9c74b
Oops, used indent with tabs enabled. Remove tabs.
Matti Hamalainen <ccr@tnsp.org>
parents:
25
diff
changeset
|
64 } |
0 | 65 } |
25
8eaf72e2041b
Reindent the source using GNU indent and "indent -i4 -bli0 -npcs -nprs -npsl".
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
66 MadeChanges = 1; |
0 | 67 } |