int fuelcen_delete_from_curseg() { fuelcen_delete( Cursegp ); return 1; }
void do_centers_window() { int i; // int robot_flags; int redraw_window; if ( MainWindow == NULL ) return; //------------------------------------------------------------ // Call the ui code.. //------------------------------------------------------------ ui_button_any_drawn = 0; ui_window_do_gadgets(MainWindow); //------------------------------------------------------------ // If we change walls, we need to reset the ui code for all // of the checkboxes that control the wall flags. //------------------------------------------------------------ if (old_seg_num != Cursegp-Segments) { for ( i=0; i < MAX_CENTER_TYPES; i++ ) { CenterFlag[i]->flag = 0; // Tells ui that this button isn't checked CenterFlag[i]->status = 1; // Tells ui to redraw button } Assert(Cursegp->special < MAX_CENTER_TYPES); CenterFlag[Cursegp->special]->flag = 1; mprintf((0, "Cursegp->matcen_num = %i\n", Cursegp->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[Cursegp->matcen_num].robot_flags & (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 } } //------------------------------------------------------------ // If any of the radio buttons that control the mode are set, then // update the corresponding center. //------------------------------------------------------------ redraw_window=0; for ( i=0; i < MAX_CENTER_TYPES; i++ ) { if ( CenterFlag[i]->flag == 1 ) if ( i == 0) fuelcen_delete(Cursegp); else if ( Cursegp->special != i ) { fuelcen_delete(Cursegp); redraw_window = 1; fuelcen_activate( Cursegp, i ); } } for ( i=0; i < N_robot_types; i++ ) { if ( RobotMatFlag[i]->flag == 1 ) { if (!(RobotCenters[Cursegp->matcen_num].robot_flags & (1<<i) )) { RobotCenters[Cursegp->matcen_num].robot_flags |= (1<<i); mprintf((0,"Segment %i, matcen = %i, Robot_flags %d\n", Cursegp-Segments, Cursegp->matcen_num, RobotCenters[Cursegp->matcen_num].robot_flags)); } } else if (RobotCenters[Cursegp->matcen_num].robot_flags & 1<<i) { RobotCenters[Cursegp->matcen_num].robot_flags &= ~(1<<i); mprintf((0,"Segment %i, matcen = %i, Robot_flags %d\n", Cursegp-Segments, Cursegp->matcen_num, RobotCenters[Cursegp->matcen_num].robot_flags)); } } //------------------------------------------------------------ // If anything changes in the ui system, redraw all the text that // identifies this wall. //------------------------------------------------------------ if (redraw_window || (old_seg_num != Cursegp-Segments ) ) { // int i; // char temp_text[CENTER_STRING_LENGTH]; ui_wprintf_at( MainWindow, 12, 6, "Seg: %3d", Cursegp-Segments ); // for (i=0; i<CENTER_STRING_LENGTH; i++) // temp_text[i] = ' '; // temp_text[i] = 0; // Assert(Cursegp->special < MAX_CENTER_TYPES); // strncpy(temp_text, Center_names[Cursegp->special], strlen(Center_names[Cursegp->special])); // ui_wprintf_at( MainWindow, 12, 23, " Type: %s", temp_text ); Update_flags |= UF_WORLD_CHANGED; } if ( QuitButton->pressed || (last_keypress==KEY_ESC) ) { close_centers_window(); return; } old_seg_num = Cursegp-Segments; }