From 0b015142d2d1c5b3aa0b6ecbec4131489219de78 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Fri, 24 Dec 2004 05:55:56 +0000 Subject: [PATCH] Use both ints with the robot producer flags. --- ChangeLog | 7 ++++- main/editor/centers.c | 64 +++++++++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4559d697..9e5031fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,13 @@ +2004-12-23 Chris Taylor + + * main/editor/centers.c: Use both ints with the robot producer + flags. + 2004-12-23 Bradley Bell * main/editor/centers.c, main/editor/editor.h, main/editor/eswitch.c, main/editor/group.c, main/editor/med.c, - main/editor/meddraw.h, main/editor/medwall.c, main/editor/mine.c, + main/editor/meddraw.c, main/editor/medwall.c, main/editor/mine.c, main/editor/seguvs.c, main/segment.h: Use macros to use Segment2s when necessary. diff --git a/main/editor/centers.c b/main/editor/centers.c index 602b7037..60bfff1a 100644 --- a/main/editor/centers.c +++ b/main/editor/centers.c @@ -1,4 +1,4 @@ -/* $Id: centers.c,v 1.4 2004-12-24 05:17:09 btb Exp $ */ +/* $Id: centers.c,v 1.5 2004-12-24 05:55:56 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -19,7 +19,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ #ifdef RCS -static char rcsid[] = "$Id: centers.c,v 1.4 2004-12-24 05:17:09 btb Exp $"; +static char rcsid[] = "$Id: centers.c,v 1.5 2004-12-24 05:55:56 btb Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -64,7 +64,7 @@ static char rcsid[] = "$Id: centers.c,v 1.4 2004-12-24 05:17:09 btb Exp $"; static UI_WINDOW *MainWindow = NULL; static UI_GADGET_BUTTON *QuitButton; static UI_GADGET_RADIO *CenterFlag[MAX_CENTER_TYPES]; -static UI_GADGET_CHECKBOX *RobotMatFlag[MAX_ROBOT_TYPES]; +static UI_GADGET_CHECKBOX *RobotMatFlag[64]; // 2 ints = 64 bits static int old_seg_num; @@ -104,8 +104,8 @@ int do_centers_dialog() CenterFlag[3] = ui_add_gadget_radio( MainWindow, 18, i, 16, 16, 0, "ControlCen" ); i += 24; CenterFlag[4] = ui_add_gadget_radio( MainWindow, 18, i, 16, 16, 0, "RobotCen" ); i += 24; - // These are the checkboxes for each door flag. - for (i=0; imatcen_num = %i\n", Curseg2p->matcen_num)); // Read materialization center robot bit flags - for ( i=0; i < N_robot_types; i++ ) { - RobotMatFlag[i]->status = 1; // Tells ui to redraw button - if (RobotCenters[Curseg2p->matcen_num].robot_flags[0] & (1 << i)) - RobotMatFlag[i]->flag = 1; // Tells ui that this button is checked - else - RobotMatFlag[i]->flag = 0; // Tells ui that this button is not checked + for (i = 0; i < 2; i++) + { + robot_index = i * 32; + robot_flags = RobotCenters[Curseg2p->matcen_num].robot_flags[i]; + while (robot_flags) + { + RobotMatFlag[i]->status = 1; // Tells ui to redraw button + if (robot_flags & 1) + RobotMatFlag[i]->flag = 1; // Tells ui that this button is checked + else + RobotMatFlag[i]->flag = 0; // Tells ui that this button is not checked + robot_flags >>= 1; + robot_index++; + } } } @@ -181,19 +190,28 @@ void do_centers_window() } } - for ( i=0; i < N_robot_types; i++ ) { - if ( RobotMatFlag[i]->flag == 1 ) { - if (!(RobotCenters[Curseg2p->matcen_num].robot_flags[0] & (1 << i))) - { - RobotCenters[Curseg2p->matcen_num].robot_flags[0] |= (1 << i); - mprintf((0, "Segment %i, matcen = %i, Robot_flags %d\n", Cursegp - Segments, Curseg2p->matcen_num, RobotCenters[Curseg2p->matcen_num].robot_flags[0])); - } - } - else if (RobotCenters[Curseg2p->matcen_num].robot_flags[0] & 1 << i) + for (i = 0; i < 2; i++) + { + robot_flags = RobotCenters[curseg2p->matcen_num].robot_flags[i]; + + for (robot_index = 0; robot_index < 32; robot_index++) { - RobotCenters[Curseg2p->matcen_num].robot_flags[0] &= ~(1 << i); - mprintf((0, "Segment %i, matcen = %i, Robot_flags %d\n", Cursegp - Segments, Curseg2p->matcen_num, RobotCenters[Curseg2p->matcen_num].robot_flags[0])); + if (RobotMatFlag[robot_index + i * 32]->flag == 1) + { + if (!(robot_flags & (1 << robot_index))) + { + robot_flags |= (1 << robot_index); + mprintf((0, "Segment %i, matcen = %i, robot_flags[%d] = %d\n", Cursegp - Segments, Curseg2p->matcen_num, i, robot_flags)); + } + } + else if (robot_flags & 1 << robot_index) + { + robot_flags &= ~(1 << robot_index); + mprintf((0, "Segment %i, matcen = %i, robot_flags[%d] = %d\n", Cursegp - Segments, Curseg2p->matcen_num, i, robot_flags)); + } } + + RobotCenters[curseg2p->matcen_num].robot_flags[i] = robot_flags; } //------------------------------------------------------------ -- 2.39.2