1 /*
2  *	l_flags.cc
3  *	AYM 1998-12-21
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 /*
37  *	frob_linedefs_flags
38  *	For all the linedefs in <list>, apply the operator <op>
39  *	with the operand <operand> on the flags field.
40  */
frob_linedefs_flags(SelPtr list,int op,int operand)41 void frob_linedefs_flags (SelPtr list, int op, int operand)
42 {
43   SelPtr cur;
44   i16 mask;
45 
46   if (op == YO_CLEAR || op == YO_SET || op == YO_TOGGLE)
47     mask = 1 << operand;
48   else
49     mask = operand;
50 
51   for (cur = list; cur; cur = cur->next)
52   {
53     if (op == YO_CLEAR)
54       LineDefs[cur->objnum].flags &= ~mask;
55     else if (op == YO_SET)
56       LineDefs[cur->objnum].flags |= mask;
57     else if (op == YO_TOGGLE)
58       LineDefs[cur->objnum].flags ^= mask;
59     else
60     {
61       nf_bug ("frob_linedef_flags: op=%02X", op);
62       return;
63     }
64   }
65   MadeChanges = 1;
66 }
67 
68 
69