//--------- Begin of static function detect_nation_info ---------// // static void detect_nation_info() { int nationRecno = nation_filter(browse_nation.recno()); Nation* viewingNation = nation_array[info.viewing_nation_recno]; if( button_allow_attack.detect() >= 0 ) viewingNation->set_relation_should_attack(nationRecno, button_allow_attack.button_pressed, COMMAND_PLAYER); }
// ----- begin of function ScenarioEditor::detect_monster_main ------// // void ScenarioEditor::detect_monster_main() { // detect interface area int rc; if (!spinner_race_group.vbrowse_enable_flag) { rc = button_unit_or_struct.detect(); if( rc >= 0 ) unit_or_struct = rc; rc = button_player_recno.detect(); if( rc >= 0 ) brush_player_recno = rc; if( !unit_or_struct ) { rc = vbrowse_unit_id.detect(); // ###### begin gilbert 22/2 ########// //if( rc > 0 ) // monster_unit_id_browse_recno = rc; monster_unit_id_browse_recno = vbrowse_unit_id.recno(); // ###### end gilbert 22/2 ########// } else { rc = vbrowse_firm_build.detect(); // ###### begin Gilbert 22/2 #########// // if( rc > 0 ) // monster_firm_group_browse_recno = rc; monster_firm_group_browse_recno = vbrowse_firm_build.recno(); // ###### end Gilbert 22/2 #########// } } // rc = button_race_group.detect(); rc = spinner_race_group.detect(); if( rc >= 0 ) { monster_race_filter = -rc; return; } }
//--------- Begin of function FirmHarbor::detect_det ---------// // int FirmHarbor::detect_det() { if( browse_ship.none_record ) return 0; UnitMarine* shipUnitPtr = (UnitMarine*) unit_array[ ship_recno_array[browse_ship.recno()-1] ]; UnitInfo* shipUnitInfo = unit_res[shipUnitPtr->unit_id]; if( shipUnitInfo->carry_goods_capacity > 0 && shipUnitInfo->carry_unit_capacity > 0 ) { if( button_mode.detect() >= 0 ) { ship_disp_mode = button_mode.button_pressed; vga_util.blt_buf( SHIP_DET_X1, SHIP_DET_Y1+22, SHIP_DET_X2, SHIP_DET_Y2, 0 ); put_det(INFO_UPDATE); return 1; } } return 0; }
// ----- begin of function ScenarioEditor::detect_players_main ------// // void ScenarioEditor::detect_players_main() { int rc; // ------- detect scroll area ----------// if( (rc = browse_nation.detect()) > 0 ) { // ###### begin Gilbert 22/2 #######// // brush_player_recno = rc; // ###### end Gilbert 22/2 #######// } brush_player_recno = browse_nation.recno(); if( nation_array.is_deleted(brush_player_recno) ) return; Nation *nationPtr = nation_array[brush_player_recno]; int y = INFO_Y1+170; if( mouse.single_click( INFO_X1+5, y, INFO_X2-5, y+8+font_cara_w.max_font_height ) ) { // create geta to edit nation name const int yOffs = 4; const int lrMargin = 5; const unsigned int FIELD_LEN = 30; // paint the background again int y2 = y+8+font_cara_w.max_font_height; vga_buffer.d3_panel_up( INFO_X1+5, y, INFO_X2-5, y2 ); Blob2DW backGroundBuf; backGroundBuf.resize( 0, 0, (INFO_X2-5)-(INFO_X1+5+lrMargin)+1, y2-(y+yOffs)+1 ); vga_buffer.read_bitmapW( INFO_X1+5+lrMargin, y+yOffs, INFO_X2-5, y2, backGroundBuf.bitmap_ptr() ); // get a wider background char nationStr[FIELD_LEN+1]; strncpy( nationStr, nationPtr->nation_name(), FIELD_LEN ); nationStr[FIELD_LEN] = '\0'; GetA nation_name_field; nation_name_field.init( INFO_X1+5+lrMargin, y+yOffs, INFO_X2-5-lrMargin, nationStr, FIELD_LEN, &font_cara_w, 1, 1 ); nation_name_field.set_background( backGroundBuf.ptr ); nation_name_field.paint(); while(1) { sys.yield(); mouse.get_event(); music.yield(); vga.flip(); int rc = nation_name_field.detect(); if( rc == KEY_RETURN ) { nation_array.set_custom_nation_name( brush_player_recno, nationStr ); break; } else if( rc == KEY_ESC ) { break; // cancel } if( rc ) nation_name_field.paint(1); } } int cashAdjustment[3] = { 100, 1000, 10000 }; if( button_cash_up.detect() ) { nationPtr->cash += cashAdjustment[button_adjustment()]; } if( button_cash_down.detect() ) { nationPtr->cash -= cashAdjustment[button_adjustment()]; } int foodAdjustment[3] = { 100, 1000, 10000 }; if( button_food_up.detect() ) { nationPtr->food += foodAdjustment[button_adjustment()]; } if( button_food_down.detect() ) { nationPtr->food -= foodAdjustment[button_adjustment()]; } int reputationAdjustment[3] = { 1, 10, 100 }; if( button_reput_up.detect() ) { nationPtr->reputation += reputationAdjustment[button_adjustment()]; if( nationPtr->reputation > 100 ) nationPtr->reputation = 100; } if( button_reput_down.detect() ) { nationPtr->reputation -= reputationAdjustment[button_adjustment()]; if( nationPtr->reputation < -100 ) nationPtr->reputation = -100; } if( nationPtr->is_monster() ) { int lifeAdjustment[3] = { 100, 1000, 10000 }; if( button_live_up.detect() ) { nationPtr->live_points += lifeAdjustment[button_adjustment()]; } if( button_live_down.detect() ) { nationPtr->live_points -= lifeAdjustment[button_adjustment()]; } } button_adjustment.detect(); // if( (rc = button_player_type.detect()) >= 0 ) // { // nation_array[brush_player_recno]->nation_type = rc ? NATION_AI : NATION_REMOTE; // } }