//--------- Begin of function Info::detect_military ---------// // void Info::detect_military() { //------- detect the troop report -------// if( browse_troop.detect() ) { browse_troop_recno = browse_troop.recno(); if( browse_troop.double_click ) { Unit* unitPtr = unit_array[ troop_filter(browse_troop_recno) ]; short xLoc, yLoc; if( unitPtr->get_cur_loc(xLoc, yLoc) ) { world.go_loc(xLoc, yLoc, 1); } } } //------- detect the unit report -------// if( browse_unit.detect() ) { browse_unit_recno = browse_unit.recno(); } }
//--------- Begin of function Info::detect_ai_action ---------// // void Info::detect_ai_action() { if( browse_action.detect() ) browse_ai_action_recno = browse_action.recno(); if( browse_attack.detect() ) browse_ai_attack_recno = browse_attack.recno(); }
//--------- Begin of function Info::detect_economy ---------// // void Info::detect_economy() { if( browse_income.detect() ) browse_income_recno = browse_income.recno(); if( browse_expense.detect() ) browse_expense_recno = browse_expense.recno(); }
//--------- Begin of function Info::detect_trade ---------// // void Info::detect_trade() { //-------- detect the caravan browser ---------// if( browse_caravan.detect() ) { browse_caravan_recno = browse_caravan.recno(); if( browse_caravan.double_click ) { Unit* unitPtr = unit_array[ get_report_data(browse_caravan_recno) ]; world.go_loc(unitPtr->next_x_loc(), unitPtr->next_y_loc(), 1); } } //-------- detect the ship browser ---------// /* if( browse_ship.detect() ) { browse_ship_recno = browse_ship.recno(); if( browse_ship.double_click ) { Unit* unitPtr = unit_array[ get_report_data2(browse_ship_recno) ]; world.go_loc(unitPtr->next_x_loc(), unitPtr->next_y_loc(), 1); } } */ }
//--------- Begin of static function disp_detail ---------// // static void disp_detail(int refreshFlag) { if( browse_nation.recno()==0 ) // no records in the list return; switch( info.nation_report_mode ) { case NATION_REPORT_INFO: disp_nation_info(); break; case NATION_REPORT_TALK: disp_nation_talk(); break; case NATION_REPORT_CHAT: disp_nation_chat(refreshFlag); break; case NATION_REPORT_TALK_LOG: disp_talk_msg_sent(refreshFlag); break; case NATION_REPORT_DEBUG: disp_debug_info(); break; } }
//--------- Begin of static function disp_debug_info ---------// // static void disp_debug_info() { vga_util.d3_panel_down( REPORT_DET_X1, REPORT_DET_Y1, REPORT_DET_X2, REPORT_DET_Y2 ); //----------- display info ------------// int nationRecno = info.nation_filter(browse_nation.recno()); Nation* nationPtr = nation_array[nationRecno]; int x1=REPORT_DET_X1+6, x2=REPORT_DET_X1+160; int y=REPORT_DET_Y1+6; int refreshFlag = INFO_REPAINT; //------------ display AI info ----------// font_bld.put_field( x1, y , "Food ", x2, nationPtr->food_str() ); font_bld.put_field( x1, y+=16, "Treasure", x2, nationPtr->cash_str() ); font_bld.put_field( x1, y+=16, "Life points", x2, (int) nationPtr->live_points, 1 ); font_bld.put_field( x1, y+=16, "ai_capture_enemy_town_recno", x2, nationPtr->ai_capture_enemy_town_recno, 1 ); font_bld.put_field( x1, y+=16, "Surplus supply rating", x2, nationPtr->surplus_supply_rating() ); y+=48; //--------- display AI preference ----------// x2 += 60; font_bld.put_field( x1, y+=16, "Unit Chase Distance" , x2, nationPtr->pref_unit_chase_distance , 1 ); font_bld.put_field( x1, y+=16, "Military Development" , x2, nationPtr->pref_military_development , 1 ); font_bld.put_field( x1, y+=16, "Economic Development" , x2, nationPtr->pref_economic_development , 1 ); font_bld.put_field( x1, y+=16, "Increase Pop by Capture" , x2, nationPtr->pref_inc_pop_by_capture , 1 ); font_bld.put_field( x1, y+=16, "Increase Pop by Growth" , x2, nationPtr->pref_inc_pop_by_growth , 1 ); font_bld.put_field( x1, y+=16, "Peacefulness" , x2, nationPtr->pref_peacefulness , 1 ); font_bld.put_field( x1, y+=16, "Military Courage" , x2, nationPtr->pref_military_courage , 1 ); font_bld.put_field( x1, y+=16, "Territorial Cohesiveness", x2, nationPtr->pref_territorial_cohesiveness, 1 ); font_bld.put_field( x1, y+=16, "Trading Tendency" , x2, nationPtr->pref_trading_tendency , 1 ); x1 += (REPORT_DET_X2-REPORT_DET_X1)/2; x2 += (REPORT_DET_X2-REPORT_DET_X1)/2; y=REPORT_DET_Y1+6; font_bld.put_field( x1, y , "Allying Tendency" , x2, nationPtr->pref_allying_tendency , 1 ); font_bld.put_field( x1, y+=16, "Honesty" , x2, nationPtr->pref_honesty , 1 ); font_bld.put_field( x1, y+=16, "Town Defense" , x2, nationPtr->pref_town_defense , 1 ); font_bld.put_field( x1, y+=16, "Citizen Loyalty Concern" , x2, nationPtr->pref_loyalty_concern , 1 ); font_bld.put_field( x1, y+=16, "Forgiveness" , x2, nationPtr->pref_forgiveness , 1 ); font_bld.put_field( x1, y+=16, "Collect Tax Tendency" , x2, nationPtr->pref_collect_tax , 1 ); font_bld.put_field( x1, y+=16, "Build Inn Tendency" , x2, nationPtr->pref_hire_unit , 1 ); font_bld.put_field( x1, y+=16, "Use Weapon Tendency" , x2, nationPtr->pref_use_weapon , 1 ); font_bld.put_field( x1, y+=16, "Keep Generals Tendency" , x2, nationPtr->pref_keep_general , 1 ); font_bld.put_field( x1, y+=16, "Keep Skilled Units Tendency", x2, nationPtr->pref_keep_skilled_unit , 1 ); font_bld.put_field( x1, y+=16, "Attack Monster" , x2, nationPtr->pref_attack_monster , 1 ); font_bld.put_field( x1, y+=16, "Use Spies" , x2, nationPtr->pref_spy , 1 ); font_bld.put_field( x1, y+=16, "Use Counter Spies" , x2, nationPtr->pref_counter_spy , 1 ); font_bld.put_field( x1, y+=16, "Food Reserve" , x2, nationPtr->pref_food_reserve , 1 ); font_bld.put_field( x1, y+=16, "Cash Reserve" , x2, nationPtr->pref_cash_reserve , 1 ); font_bld.put_field( x1, y+=16, "Use Marine" , x2, nationPtr->pref_use_marine , 1 ); }
//--------- Begin of function FirmHarbor::detect_main_menu ---------// // void FirmHarbor::detect_main_menu() { firm_harbor_ptr = this; if( detect_basic_info() ) return; if( !own_firm() ) return; if( browse_ship.detect() ) put_det(INFO_UPDATE); if( detect_det() ) return; //------- detect the build button ---------// if( button_build.detect() ) { harbor_menu_mode = HARBOR_MENU_BUILD; disable_refresh = 1; // static var for disp_info() only info.disp(); disable_refresh = 0; } //-------- detect the sail button ---------// if( button_sail.detect() && browse_ship.recno() > 0 ) sail_ship( ship_recno_array[browse_ship.recno()-1], COMMAND_PLAYER ); //---------- detect cancel build button -----------// if(build_unit_id) { if(button_cancel_build.detect()) { if( !remote.is_enable() ) cancel_build_unit(); else { short *shortPtr = (short *)remote.new_send_queue_msg(MSG_F_HARBOR_SKIP_SHIP, sizeof(short)); shortPtr[0] = firm_recno; } } } }
//--------- 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 FirmInn::update_del_hire_list --------// // void FirmInn::update_del_hire_list() { //------- existing units leave -------// for( int i=inn_unit_count ; i>0 && inn_unit_count>0 ; i-- ) { if( !inn_unit_array[i-1].spy_recno && --inn_unit_array[i-1].stay_count==0 ) { del_inn_unit(i); if( firm_recno == firm_array.selected_recno ) { if( browse_hire.recno() > i && browse_hire.recno() > 1 ) browse_hire.refresh( browse_hire.recno()-1, inn_unit_count ); } } } }
//--------- Begin of function FirmInn::detect_info ---------// // void FirmInn::detect_info() { firm_inn_ptr = this; if( detect_basic_info() ) return; //-------- detect spy button ----------// if( !own_firm() ) { detect_spy_button(); return; } //-------------------------------------// if( browse_hire.detect() ) { put_det(INFO_UPDATE); } if( button_hire.detect('R') && inn_unit_count > 0 ) { // ###### begin Gilbert 31/7 #######// se_res.far_sound(center_x, center_y, 1, 'S', unit_res[inn_unit_array[browse_hire.recno()-1].unit_id]->sprite_id, "RDY" ); // ###### end Gilbert 31/7 #######// if(remote.is_enable()) { // packet structure : <firm recno>, <hire Id> <nation no> short *shortPtr=(short *)remote.new_send_queue_msg(MSG_F_INN_HIRE, 3*sizeof(short)); shortPtr[0] = firm_recno; shortPtr[1] = browse_hire.recno(); shortPtr[2] = nation_recno; } else { hire(browse_hire.recno()); } } }
// ----- 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 Info::detect_news_log ---------// // void Info::detect_news_log() { if( browse_news.detect() ) browse_news_recno = browse_news.recno(); //--------- detect button --------// if( mouse.single_click( ZOOM_X2-27, ZOOM_Y2-23, ZOOM_X2-27+14, ZOOM_Y2-23+14 ) ) sys.set_view_mode(MODE_NORMAL); }
//--------- Begin of function Info::detect_rank ---------// // void Info::detect_rank() { //------- detect nation browser ------// if( browse_nation.detect() ) { browse_nation_recno = browse_nation.recno(); return; } }
//--------- Begin of function Info::detect_town ---------// // void Info::detect_town() { //------- detect the town browser -------// if( browse_town.detect() ) { browse_town_recno = browse_town.recno(); if( browse_town.double_click ) { Town* townPtr = town_array[ town_filter(browse_town_recno) ]; world.go_loc(townPtr->center_x, townPtr->center_y, 1); } } //------- detect the firm browser -------// if( browse_firm.detect() ) browse_firm_recno = browse_firm.recno(); }
//--------- Begin of function FirmInn::put_det ---------// // void FirmInn::put_det(int refreshFlag) { if( browse_hire.none_record ) { button_hire.reset(); return; } //--------- display details ----------// InnUnit* innUnit = inn_unit_array+browse_hire.recno()-1; disp_unit_info(HIRE_DET_Y1, innUnit, refreshFlag ); //------- paint buttons --------// if( own_firm() ) { if( refreshFlag == INFO_REPAINT ) { button_hire.paint( HIRE_DET_X1, HIRE_DET_Y2+4, 'A', "HIREUNIT" ); } else { if( inn_unit_count > 0 && (~nation_array)->cash >= inn_unit_array[browse_hire.recno()-1].hire_cost ) { button_hire.enable(); } else { button_hire.disable(); } } } }
//--------- Begin of function Info::detect_spy ---------// // void Info::detect_spy() { //------- detect the spy browser -------// if( browse_spy.detect() ) { browse_spy_recno = browse_spy.recno(); if( browse_spy.double_click ) { Spy* spyPtr = spy_array[ spy_filter(browse_spy_recno) ]; int xLoc, yLoc; if( spyPtr->get_loc(xLoc, yLoc) ) world.go_loc( xLoc, yLoc, 1 ); } } }
//--------- Begin of function Info::detect_nation ---------// // void Info::detect_nation() { //------- detect nation browser ------// if( browse_nation.detect() ) { browse_nation_recno = browse_nation.recno(); return; } //------- detect report buttons --------// if( detect_button() ) return; //--------- detect detail info -------// detect_detail(); }
//--------- Begin of function FirmHarbor::put_det ---------// // void FirmHarbor::put_det(int refreshFlag) { if( refreshFlag == INFO_REPAINT ) vga_util.d3_panel_up( SHIP_DET_X1, SHIP_DET_Y1, SHIP_DET_X2, SHIP_DET_Y2 ); else vga_util.blt_buf( SHIP_DET_X1, SHIP_DET_Y1, SHIP_DET_X2, SHIP_DET_Y2, 0 ); if( browse_ship.none_record ) return; refreshFlag = INFO_REPAINT; // for calling disp_ship_units() and disp_ship_goods() //------- display info of the ship --------// UnitMarine* shipUnitPtr = (UnitMarine*) unit_array[ ship_recno_array[browse_ship.recno()-1] ]; UnitInfo* shipUnitInfo = unit_res[shipUnitPtr->unit_id]; //----- if the ship can carry both goods and units, display mode selection button ---// if( shipUnitInfo->carry_goods_capacity > 0 && shipUnitInfo->carry_unit_capacity > 0 ) { button_mode[0].create_text( SHIP_DET_X1+10, SHIP_DET_Y1+3, SHIP_DET_X1+80, SHIP_DET_Y1+19, "Units" ); button_mode[1].create_text( SHIP_DET_X1+90, SHIP_DET_Y1+3, SHIP_DET_X2-10, SHIP_DET_Y1+19, "Goods" ); button_mode.paint(ship_disp_mode); if( ship_disp_mode == SHIP_MENU_UNIT ) disp_ship_units(shipUnitPtr, SHIP_DET_Y1+22, refreshFlag); else disp_ship_goods(shipUnitPtr, SHIP_DET_Y1+22, refreshFlag); } else if( shipUnitInfo->carry_goods_capacity > 0 ) { disp_ship_goods(shipUnitPtr, SHIP_DET_Y1+22, refreshFlag); } else if( shipUnitInfo->carry_unit_capacity > 0 ) { disp_ship_units(shipUnitPtr, SHIP_DET_Y1+22, refreshFlag); } }
//--------- Begin of function Firm::can_player_spy_capture ---------// // // return: <int> 0 - if the player can't capture this firm // >0 - the recno of the player's spy who can capture this // firm. // int Firm::can_player_spy_capture() { if( nation_recno == nation_array.player_recno ) // this is the player's own firm. return 0; firm_ptr = this; if( spy_filter()==0 ) return 0; //---- if the overseer is one of the player's spies -----// if( firm_res[firm_id]->need_overseer ) { if( overseer_recno ) { int spyRecno = unit_array[overseer_recno]->spy_recno; if( spyRecno ) { if( spy_array[spyRecno]->true_nation_recno == nation_array.player_recno ) { return spyRecno; } } } } //-- if there are no other units in the firm beside the player's spy unit --// else { if( worker_count == player_spy_count ) { return spy_filter( browse_spy.recno() ); } } return 0; }
//--------- 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 Info::detect_nation ---------// // void Info::detect_nation() { int hideNationBrowse = nation_report_mode == NATION_REPORT_CHAT && hide_nation_browse; //------- detect nation browser ------// if( !hideNationBrowse && browse_nation.detect() ) { browse_nation_recno = browse_nation.recno(); return; } //------- detect report buttons --------// if( detect_button() ) return; //--------- detect detail info -------// detect_detail(); }
//--------- Begin of static function detect_detail ---------// // static void detect_detail() { switch( info.nation_report_mode ) { case NATION_REPORT_INFO: detect_nation_info(); break; case NATION_REPORT_TALK: detect_nation_talk(); break; case NATION_REPORT_CHAT: detect_nation_chat(); break; case NATION_REPORT_TALK_LOG: if( browse_talk_msg.detect() ) info.browse_talk_msg_recno = browse_talk_msg.recno(); break; } }
//--------- Begin of static function disp_detail ---------// // static void disp_detail(int refreshFlag) { if( browse_nation.recno()==0 ) // no records in the list return; // ##### patch begin Gilbert 26/8 ########// if( refreshFlag == INFO_REPAINT || info.nation_report_mode != last_nation_report_mode ) { refreshFlag = INFO_REPAINT; last_nation_report_mode = info.nation_report_mode; } // ##### end begin Gilbert 26/8 ########// switch( info.nation_report_mode ) { case NATION_REPORT_INFO: disp_nation_info(); break; case NATION_REPORT_TALK: disp_nation_talk(); break; case NATION_REPORT_CHAT: disp_nation_chat(refreshFlag); break; case NATION_REPORT_TALK_LOG: disp_talk_msg_sent(refreshFlag); break; case NATION_REPORT_DEBUG: disp_debug_info(); break; } }
//--------- Begin of static function disp_nation_info ---------// // static void disp_nation_info() { vga_util.d3_panel_down( REPORT_DET_X1, REPORT_DET_Y1, REPORT_DET_X2, REPORT_DET_Y2 ); //----------- display info ------------// int nationRecno = info.nation_filter(browse_nation.recno()); Nation* nationPtr = nation_array[nationRecno]; Nation* viewingNation = nation_array[info.viewing_nation_recno]; NationRelation* nationRelation = viewingNation->get_relation(nationRecno); int x1=REPORT_DET_X1+6, x2=REPORT_DET_X1+380, x3=REPORT_DET_X2-10; int y=REPORT_DET_Y1+6; const int lineSpacing = 19; //---- display the nationality of the king ----// if( nationPtr->is_human() ) font_bld.put_field( x1, y, text_reports.str_king_race(nationPtr->race_id), x2, nationPtr->is_human() ? race_res[nationPtr->race_id]->name : monster_res[nationPtr->monster_id()]->name ); y += lineSpacing; //-------- display economic data ----------// String str; if( nationRecno == info.viewing_nation_recno ) { // font_bld.put_field( x1, y, "Your Food", x2, nationPtr->food_str() ); font_bld.put_field( x1, y, text_reports.str_your_food(), x2, nationPtr->food_str() ); str = "$"; str += nationPtr->cash_str(); font_bld.put_field( x1, y+=lineSpacing, text_reports.str_your_treasure(), x2, str ); if( nationPtr->is_monster() ) font_bld.put_field( x1, y+=lineSpacing, text_reports.str_your_live_points(), x2, (int) nationPtr->live_points ); font_bld.field( x1, y+=lineSpacing, text_reports.str_your_peace_time(), x2, nationPtr->peace_duration_str(), x3, INFO_REPAINT, "PEACE" ); } else { //str = translate.process("Your Yearly Import from "); //str += nationPtr->nation_name(); // font_bld.field( x1, y , str, x2, (int) viewingNation->get_relation(nationRecno)->import_365days(IMPORT_TOTAL), 2, x3, INFO_REPAINT, "IMPORT" ); font_bld.field( x1, y , text_reports.str_enemy_import_from(nationPtr->nation_name()), x2, (int) viewingNation->get_relation(nationRecno)->import_365days(IMPORT_TOTAL), 2, x3, INFO_REPAINT, "IMPORT" ); // str = translate.process("Your Yearly Export to "); // str += nationPtr->nation_name(); // font_bld.field( x1, y+=lineSpacing, str, x2, (int) nationPtr->get_relation(info.viewing_nation_recno)->import_365days(IMPORT_TOTAL), 2, x3, INFO_REPAINT, "EXPORT" ); font_bld.field( x1, y+=lineSpacing, text_reports.str_enemy_export_to(nationPtr->nation_name()), x2, (int) nationPtr->get_relation(info.viewing_nation_recno)->import_365days(IMPORT_TOTAL), 2, x3, INFO_REPAINT, "EXPORT" ); // str = translate.process("Continuous Peace Time of "); // str += nationPtr->nation_name(); // font_bld.field( x1, y+=lineSpacing, str, x2, nationPtr->peace_duration_str(), x3, INFO_REPAINT, "PEACE" ); font_bld.field( x1, y+=lineSpacing, text_reports.str_enemy_peace_time(nationPtr->nation_name()), x2, nationPtr->peace_duration_str(), x3, INFO_REPAINT, "PEACE" ); //--------- duration of current status ----------// // str = translate.process("Duration of "); // str += translate.process(nationRelation->status_str()); // str += " Status"; // font_bld.field( x1, y+=lineSpacing, str, x2, nationRelation->status_duration_str(), x3, INFO_REPAINT, "STATTIME" ); font_bld.field( x1, y+=lineSpacing, text_reports.str_enemy_status_duration(nationRelation->status_str()), x2, nationRelation->status_duration_str(), x3, INFO_REPAINT, "STATTIME" ); //------- display the allow_attack field --------// // str = "Allow Your Units to Attack "; // str += nationPtr->nation_name(); // font_bld.field( x1, y+=lineSpacing, str, x2, "", x3, INFO_REPAINT, "ALLOWATK" ); font_bld.field( x1, y+=lineSpacing, text_reports.str_enemy_allow_attack(nationPtr->nation_name()), x2, "", x3, INFO_REPAINT, "ALLOWATK" ); // button_allow_attack[0].set_font( &font_bld ); // button_allow_attack[1].set_font( &font_bld ); button_allow_attack[1].create_text( x2+6 , y, x2+50 , y+lineSpacing-1, text_reports.str_no_yes(1)); // "Yes" ); button_allow_attack[0].create_text( x2+54, y, x2+100, y+lineSpacing-1, text_reports.str_no_yes(0)); // "No" ); button_allow_attack.paint( viewingNation->get_relation(nationRecno)->should_attack ); //---- if this nation is our ally, display its cash and food ----// if( viewingNation->get_relation(nationRecno)->status == RELATION_ALLIANCE ) { // str = nationPtr->nation_name(); // str += " 's Treasure"; // font_bld.field( x1, y+=lineSpacing, str, x2, nationPtr->cash, 2, x3, INFO_REPAINT ); font_bld.field( x1, y+=lineSpacing, text_reports.str_ally_cash(nationPtr->nation_name()), x2, nationPtr->cash, 2, x3, INFO_REPAINT ); // str = nationPtr->nation_name(); // str += " 's Food"; // font_bld.field( x1, y+=lineSpacing, str, x2, nationPtr->food, 1, x3, INFO_REPAINT ); font_bld.field( x1, y+=lineSpacing, text_reports.str_ally_food(nationPtr->nation_name()), x2, nationPtr->food, 1, x3, INFO_REPAINT ); } } y+=lineSpacing+10; //----- display its relation status with other nations -----// if( info.viewing_nation_recno != nationRecno ) { // String str; nationPtr->disp_nation_color(x1, y+1); font_bld.put(x1+20, y, text_reports.str_enemy_relation(nationPtr->nation_name())); y+=20; for( int i=1 ; i<=nation_array.size() ; i++ ) { if( nation_array.is_deleted(i) || i == nationRecno || i == info.viewing_nation_recno ) { continue; } nation_array[i]->disp_nation_color(x1, y+1); font_bld.put( x1+20, y, nation_array[i]->nation_name() ); font_bld.put( x1+240, y, nationPtr->get_relation(i)->status_str() ); if( nationPtr->get_relation(i)->trade_treaty ) { int x2 = font_bld.put( x1+330, y, text_talk.str_trade_treaty()); // "Trade Treaty" ); // font_bld.put( x1+450, y, misc.format((int)nationPtr->total_year_trade(i),2) ); font_bld.put( x2+10, y, misc.format((int)nationPtr->total_year_trade(i),2) ); } if( config.show_debug_info ) { font_bld.put( x1+500, y, nationPtr->get_relation(i)->ai_relation_level ); font_bld.put( x1+530, y, (int) nationPtr->get_relation(i)->good_relation_duration_rating ); } y+=16; } } }
//--------- Begin of function Info::disp_nation ---------// // // <int> refreshFlag - INFO_REPAINT - the user has just switched // to this report. // INFO_UPDATE - the report is already in this mode, // just keep displaying and updating. // void Info::disp_nation(int refreshFlag) { //--------- Create nation income and expenses browsers -------// int x=REPORT_BROWSE_X1+9, y=REPORT_BROWSE_Y1+4; vga_back.d3_panel_up(REPORT_BROWSE_X1, REPORT_BROWSE_Y1, REPORT_BROWSE_X2, REPORT_BROWSE_Y1+33 ); font_san.put( x , y+7, "Kingdom" ); font_san.put( x+185, y+7, "Reputation" ); font_san.put( x+275, y+7, "Status" ); #if(defined(SPANISH)) font_san.put( x+335, y , "Allow" ); font_san.put( x+335, y+13, "Attack" ); font_san.put( x+395, y, "Acuerdo" ); font_san.put( x+395, y+13, "Comerc." ); font_san.put( x+468, y , "Cantidad" ); font_san.put( x+468, y+13, "Comerciada" ); #elif(defined(FRENCH)) font_san.put( x+335, y , "Allow" ); font_san.put( x+335, y+13, "Attack" ); font_san.put( x+395, y, "Accord" ); font_san.put( x+395, y+13, "Commercial" ); font_san.put( x+473, y , "Montant" ); font_san.put( x+473, y+13, "Commercial" ); #elif(defined(GERMAN)) font_san.put( x+345, y , "Allow" ); font_san.put( x+343, y+13, "Attack" ); font_san.put( x+405, y , "Handels-" ); font_san.put( x+405, y+13, "Vertrag" ); font_san.put( x+465, y , "Handels-" ); font_san.put( x+465, y+13, "Betrag" ); #else font_san.put( x+345, y , "Allow" ); font_san.put( x+343, y+13, "Attack" ); font_san.put( x+405, y , "Trade" ); font_san.put( x+405, y+13, "Treaty" ); font_san.put( x+465, y , "Trade" ); font_san.put( x+465, y+13, "Amount" ); #endif if( refreshFlag == INFO_REPAINT ) { browse_nation.init( REPORT_BROWSE_X1, REPORT_BROWSE_Y1+35, REPORT_BROWSE_X2, REPORT_BROWSE_Y2, 0, 20, nation_filter(), put_nation_rec, 1 ); browse_nation.open(browse_nation_recno); } else { browse_nation.paint(); browse_nation.open(browse_nation_recno, nation_filter()); } browse_nation_recno = browse_nation.recno(); //------- disp report buttons --------// disp_button(); //--------- display detail info --------// if( refreshFlag==INFO_REPAINT ) { info.last_talk_nation_recno = 0; browse_talk_msg_recno = 1; } disp_detail(refreshFlag); }
//--------- Begin of function Info::disp_nation ---------// // // <int> refreshFlag - INFO_REPAINT - the user has just switched // to this report. // INFO_UPDATE - the report is already in this mode, // just keep displaying and updating. // void Info::disp_nation(int refreshFlag) { int hideNationBrowse = nation_report_mode == NATION_REPORT_CHAT && hide_nation_browse; //--------- Create nation income and expenses browsers -------// if( !hideNationBrowse ) { int x=REPORT_BROWSE_X1+9, y=REPORT_BROWSE_Y1+4; vga_back.d3_panel_up(REPORT_BROWSE_X1, REPORT_BROWSE_Y1, REPORT_BROWSE_X2, REPORT_BROWSE_Y1+33 ); font_bld.put( x , y+7, text_reports.str_nat_kingdom()); // "Kingdom" ); #if(defined(CHINESE)) font_bld.right_put( x+235 +3, y+7, text_reports.str_nat_reputation()); // "Reputation" ); font_bld.put( x+265 -6, y+7, text_reports.str_nat_status()); // "Status" ); #else font_bld.right_put( x+235, y+7, text_reports.str_nat_reputation()); font_bld.put( x+265, y+7, text_reports.str_nat_status()); // "Status" ); #endif #if(defined(CHINESE)) font_bld.put_paragraph( x+343-8, y+7, x+405, y+28+7, text_reports.str_nat_allow_attack(), 0 ); #else #if(defined(GERMAN)) #define X_SHIFT -5 #else #define X_SHIFT 0 #endif font_bld.put_paragraph( x+343+X_SHIFT, y, x+405+X_SHIFT, y+28, text_reports.str_nat_allow_attack(), 0 ); #undef X_SHIFT #endif //SXM #if(defined(CHINESE)) font_bld.put_paragraph( x+405 -16, y+7, x+465, y+28+7, text_reports.str_nat_trade_treaty(), 0 ); font_bld.put_paragraph( x+465 -14, y+7, x+525, y+28+7, text_reports.str_nat_trade_amount(), 0 ); #else // font_bld.put( x+405, y , "Trade" ); // font_bld.put( x+405, y+13, "Treaty" ); font_bld.put_paragraph( x+405, y, x+465, y+28, text_reports.str_nat_trade_treaty(), 0 ); // font_bld.put( x+465, y , "Trade" ); // font_bld.put( x+465, y+13, "Amount" ); font_bld.put_paragraph( x+465, y, x+525, y+28, text_reports.str_nat_trade_amount(), 0 ); #endif //SXM } if( refreshFlag == INFO_REPAINT ) { browse_nation.init( REPORT_BROWSE_X1, REPORT_BROWSE_Y1+35, REPORT_BROWSE_X2, REPORT_BROWSE_Y2, 0, 20, info.nation_filter(), put_nation_rec, 1 ); if( !hideNationBrowse ) browse_nation.open(browse_nation_recno); } else { if( !hideNationBrowse ) { browse_nation.paint(); browse_nation.open(browse_nation_recno, nation_filter()); } } if( !hideNationBrowse ) browse_nation_recno = browse_nation.recno(); else { int nCount; if( browse_nation_recno > (nCount = nation_filter()) ) browse_nation_recno = nCount; // avoid browse_nation_recno too large } //------- disp report buttons --------// disp_button(); //--------- display detail info --------// if( refreshFlag==INFO_REPAINT ) { info.last_talk_nation_recno = 0; browse_talk_msg_recno = 1; } disp_detail(refreshFlag); }
//--------- Begin of function Firm::disp_spy_menu ---------// // void Firm::disp_spy_menu(int refreshFlag) { static int lastSpyCount; firm_ptr = this; disp_basic_info(INFO_Y1, refreshFlag); //---------- paint controls -----------// if( refreshFlag == INFO_REPAINT ) { //------ display browser field description -------// int x=SPY_BROWSE_X1+2; int y=SPY_BROWSE_Y1-23; vga.d3_panel_up( SPY_BROWSE_X1, y, SPY_BROWSE_X2, SPY_BROWSE_Y1-3 ); font_san.put( x+4 , y+4, "Spy Skill" ); font_san.put( x+70 , y+4, "Loyalty" ); font_san.put( x+130, y+4, "Action" ); //------------ create browser ------------// browse_spy.init( SPY_BROWSE_X1, SPY_BROWSE_Y1, SPY_BROWSE_X2, SPY_BROWSE_Y2, 0, 25, player_spy_count, put_spy_rec ); browse_spy.open(1); lastSpyCount = player_spy_count; err_when( player_spy_count != spy_filter() ); } else { //---------- update controls -----------// if( player_spy_count != lastSpyCount ) { lastSpyCount = player_spy_count; info.disp(); return; } else browse_spy.update(); } if( spy_filter()==0 ) return; //----------- create the paint button ----------// if( refreshFlag == INFO_REPAINT ) { int x=BUTTON_X1; int y=SPY_BROWSE_Y2+5; //--------- spy menu mode -----------// if( firm_menu_mode == FIRM_MENU_SPY ) { //--------- mobilize spy button --------// button_spy_mobilize.paint( x, y, 'A', "MOBILSPY" ); x+=BUTTON_ACTION_WIDTH; //--------- reward spy button --------// button_spy_reward.paint( x, y, 'A', "REWARD" ); x+=BUTTON_ACTION_WIDTH; //------ change spy action button ------// if( firm_id != FIRM_INN && nation_recno != nation_array.player_recno ) // cannot change action in inns { button_spy_action.paint( x, y, 'A', "SPYCHACT" ); x+=BUTTON_ACTION_WIDTH; } else button_spy_action.reset(); //---------- capture button -----------// if( can_player_spy_capture() ) { button_capture.paint( x, y, 'A', "SPYCAPT" ); x+=BUTTON_ACTION_WIDTH; if( x+BUTTON_ACTION_WIDTH-5 > INFO_X2 ) { x = BUTTON_X1; y += BUTTON_ACTION_HEIGHT; } } else button_capture.reset(); //---------- view secret button -----------// if( nation_recno && nation_recno != nation_array.player_recno ) { button_view_secret.paint( x, y, 'A', "VSECRET" ); x+=BUTTON_ACTION_WIDTH; if( x+BUTTON_ACTION_WIDTH-5 > INFO_X2 ) { x = BUTTON_X1; y += BUTTON_ACTION_HEIGHT; } } else button_view_secret.reset(); //---------- assassination button -----------// if( nation_recno && nation_recno != nation_array.player_recno && firm_res[firm_id]->need_overseer ) { button_assassinate.paint( x, y, 'A', "ASSASSIN" ); x+=BUTTON_ACTION_WIDTH; if( x+BUTTON_ACTION_WIDTH-5 > INFO_X2 ) { x = BUTTON_X1; y += BUTTON_ACTION_HEIGHT; } } else button_assassinate.reset(); } //--------- select briber mode --------// else if( firm_menu_mode == FIRM_MENU_SELECT_BRIBER ) { button_bribe.paint( x, y, 'A', "BRIBE" ); x+=BUTTON_ACTION_WIDTH; } else err_here(); //----------- cancel button -----------// button_cancel.paint( x, y, 'A', "PREVMENU" ); } //---- enable/disable view secret button ----// //### begin alex 20/3 ###// if( button_view_secret.init_flag && firm_menu_mode==FIRM_MENU_SPY) //#### end alex 20/3 ####// { Spy* spyPtr = spy_array[ spy_filter( browse_spy.recno() ) ]; if( spyPtr->spy_skill >= MIN_VIEW_SECRET_SPYING_SKILL ) button_view_secret.enable(); else button_view_secret.disable(); } //---- enable/disable assassinate button ----// if( button_assassinate.init_flag ) { if( overseer_recno && unit_array[overseer_recno]->true_nation_recno() != nation_array.player_recno ) // don't assassinate your own spy { button_assassinate.enable(); } else { button_assassinate.disable(); } } }
//--------- Begin of function Firm::detect_spy_menu ---------// // void Firm::detect_spy_menu() { firm_ptr = this; if( spy_filter()==0 ) return; browse_spy.detect(); Spy* spyPtr = spy_array[ spy_filter( browse_spy.recno() ) ]; //--------- detect buttons --------// //--------- spy menu mode -----------// if( firm_menu_mode == FIRM_MENU_SPY ) { //------ mobilize spy ---------// if( button_spy_mobilize.detect() ) { if( !remote.is_enable() ) { if( spyPtr->mobilize_firm_spy() ) { spyPtr->notify_cloaked_nation_flag = 0; // reset it so the player can control it info.disp(); return; } } else { // packet structure <spy recno> short *shortPtr = (short *)remote.new_send_queue_msg(MSG_SPY_LEAVE_FIRM, sizeof(short) ); *shortPtr = spyPtr->spy_recno; } } //------ reward spy ---------// else if( button_spy_reward.detect() ) { spyPtr->reward(COMMAND_PLAYER); } //------- change spy action ---------// else if( button_spy_action.detect() ) // set action mode { if( !remote.is_enable() ) { spyPtr->set_next_action_mode(); disp_spy_menu( INFO_UPDATE ); } else { // packet structure <spy recno> short *shortPtr = (short *)remote.new_send_queue_msg(MSG_SPY_CYCLE_ACTION, sizeof(short) ); *shortPtr = spyPtr->spy_recno; } } //------ capture firm ---------// else if( button_capture.detect() ) { int spyRecno = can_player_spy_capture(); if( spyRecno ) { Spy* capturerSpy = spy_array[spyRecno]; if( !remote.is_enable() ) { capturerSpy->capture_firm(); } else { // packet structure <spy recno> short *shortPtr = (short *)remote.new_send_queue_msg(MSG_SPY_CAPTURE_FIRM, sizeof(short) ); *shortPtr = capturerSpy->spy_recno; } } } //------ view secret ---------// else if( button_view_secret.detect() ) { action_spy_recno = spyPtr->spy_recno; firm_menu_mode = FIRM_MENU_VIEW_SECRET; info.disp(); } //-------- assassinate ------// else if( button_assassinate.detect() ) { spyPtr->assassinate( overseer_recno, COMMAND_PLAYER ); } } //--------- select briber mode --------// else if( firm_menu_mode == FIRM_MENU_SELECT_BRIBER ) { if( button_bribe.detect() ) { action_spy_recno = spyPtr->spy_recno; firm_menu_mode = FIRM_MENU_SET_BRIBE_AMOUNT; info.disp(); } } else { err_here(); } //--------- detect cancel button --------// if( button_cancel.detect() ) { firm_menu_mode = FIRM_MENU_MAIN; info.disp(); } }
//--------- Begin of static function disp_talk_msg_sent ---------// // static void disp_talk_msg_sent(int refreshFlag) { //--- filter out talk messages sent by this nation and sort them by date ---// TalkMsg* talkMsg; TalkMsgDisp talkMsgDisp; static short lastNationRecno=0; int nationRecno = nation_filter(info.browse_nation_recno); if( lastNationRecno != nationRecno ) { info.browse_talk_msg_recno = 1; // reset the browser recno of the viewing nation has been changed lastNationRecno = nationRecno; } //--------------------------------------------// info.talk_msg_disp_array.zap(); for( short i=1 ; i<=talk_res.talk_msg_count() ; i++ ) { if( talk_res.is_talk_msg_deleted(i) ) continue; talkMsg = talk_res.get_talk_msg(i); if( !talkMsg->is_valid_to_disp() ) // don't link it out, otherwise it may cause multiplayer sync problem. continue; if( talkMsg->from_nation_recno == nationRecno || talkMsg->to_nation_recno == nationRecno ) { if( talkMsg->from_nation_recno == info.viewing_nation_recno || talkMsg->to_nation_recno == info.viewing_nation_recno ) { if( !nation_array.is_deleted(talkMsg->from_nation_recno) && !nation_array.is_deleted(talkMsg->to_nation_recno) ) { talkMsgDisp.recno = i; talkMsgDisp.date = talkMsg->date; talkMsgDisp.is_reply = 0; info.talk_msg_disp_array.linkin(&talkMsgDisp); if( talkMsg->reply_date ) { talkMsgDisp.recno = i; talkMsgDisp.date = talkMsg->reply_date; talkMsgDisp.is_reply = 1; info.talk_msg_disp_array.linkin(&talkMsgDisp); } } } } } if( info.talk_msg_disp_array.size() > 0 ) info.talk_msg_disp_array.quick_sort(sort_talk_msg); //----- display a browser of the talk msg sent -----// if( refreshFlag == INFO_REPAINT || !browse_talk_msg.init_flag ) { browse_talk_msg.init( REPORT_DET_X1, REPORT_DET_Y1, REPORT_DET_X2, REPORT_DET_Y2, 0, 30, info.talk_msg_disp_array.size(), put_talk_msg_rec, 1 ); browse_talk_msg.open(info.browse_talk_msg_recno); } else { browse_talk_msg.paint(); browse_talk_msg.open(info.browse_talk_msg_recno, info.talk_msg_disp_array.size()); } info.browse_talk_msg_recno = browse_talk_msg.recno(); }
//--------- Begin of static function disp_nation_info ---------// // static void disp_nation_info() { vga.d3_panel_down( REPORT_DET_X1, REPORT_DET_Y1, REPORT_DET_X2, REPORT_DET_Y2 ); //----------- display info ------------// int nationRecno = nation_filter(browse_nation.recno()); Nation* nationPtr = nation_array[nationRecno]; Nation* viewingNation = nation_array[info.viewing_nation_recno]; NationRelation* nationRelation = viewingNation->get_relation(nationRecno); int x1=REPORT_DET_X1+6, x2=REPORT_DET_X1+340, x3=REPORT_DET_X2-10; int y=REPORT_DET_Y1+6; //-------- display economic data ----------// String str; if( nationRecno == info.viewing_nation_recno ) { font_san.put_field( x1, y, "Your Food", x2, nationPtr->food_str() ); str = "$"; str += nationPtr->cash_str(); font_san.put_field( x1, y+=16, "Your Treasure", x2, str ); font_san.field( x1, y+=16, "Your Continuous Peace Time", x2, nationPtr->peace_duration_str(), x3, INFO_REPAINT, "PEACE" ); } else { str = translate.process("Your Yearly Import from "); str += nationPtr->nation_name(); font_san.field( x1, y , str, x2, (int) viewingNation->get_relation(nationRecno)->import_365days(IMPORT_TOTAL), 2, x3, INFO_REPAINT, "IMPORT" ); str = translate.process("Your Yearly Export to "); str += nationPtr->nation_name(); font_san.field( x1, y+=16, str, x2, (int) nationPtr->get_relation(info.viewing_nation_recno)->import_365days(IMPORT_TOTAL), 2, x3, INFO_REPAINT, "EXPORT" ); str = translate.process("Continuous Peace Time of "); str += nationPtr->nation_name(); font_san.field( x1, y+=16, str, x2, nationPtr->peace_duration_str(), x3, INFO_REPAINT, "PEACE" ); //--------- duration of current status ----------// #if(defined(SPANISH)) str = "Duración del estado de "; str += translate.process(nationRelation->status_str()); #elif(defined(FRENCH)) str = "Duration of "; str += nationRelation->status_str(); str += " Status"; str = translate.process(str); #else // GERMAN and US str = translate.process("Duration of "); str += translate.process(nationRelation->status_str()); str += " Status"; #endif font_san.field( x1, y+=16, str, x2, nationRelation->status_duration_str(), x3, INFO_REPAINT, "STATTIME" ); //------- display the allow_attack field --------// #if(defined(SPANISH)) // str = "Permitir que tus Unidades ataquen al "; str = "Permitir atacar al "; str += nationPtr->nation_name(); #elif(defined(FRENCH)) str = "Autoriser attaque contre le "; str += nationPtr->nation_name(); #elif(defined(GERMAN)) str = "Angriffe auf "; str += nationPtr->nation_name(); str += " erlauben"; #else str = "Allow Your Units to Attack "; str += nationPtr->nation_name(); #endif font_san.field( x1, y+=16, str, x2, "", x3, INFO_REPAINT, "ALLOWATK" ); button_allow_attack[1].create_text( x2+6 , y, x2+50 , y+15, "Yes" ); button_allow_attack[0].create_text( x2+54, y, x2+100, y+15, "No" ); button_allow_attack.paint( viewingNation->get_relation(nationRecno)->should_attack ); //---- if this nation is our ally, display its cash and food ----// if( viewingNation->get_relation(nationRecno)->status == NATION_ALLIANCE ) { #if(defined(SPANISH)) str = "Tesoro del "; str += nationPtr->nation_name(); #elif(defined(FRENCH)) str = "Trésor du "; str += nationPtr->nation_name(); #else // GERMAN and US str = nationPtr->nation_name(); str += " 's Treasure"; #endif font_san.field( x1, y+=16, str, x2, nationPtr->cash, 2, x3, INFO_REPAINT ); #if(defined(SPANISH)) str = "Alimentos del "; str += nationPtr->nation_name(); #elif(defined(FRENCH)) str = "Réserves de nourriture du "; str += nationPtr->nation_name(); #else // GERMAN and US str = nationPtr->nation_name(); str += " 's Food"; #endif font_san.field( x1, y+=16, str, x2, nationPtr->food, 2, x3, INFO_REPAINT ); } } y+=26; //----- display its relation status with other nations -----// if( info.viewing_nation_recno != nationRecno ) { String str; #if(defined(SPANISH)) str = "Estado Diplomático del "; str += nationPtr->nation_name(); str += " con otros Reinos:"; #elif(defined(FRENCH)) str = "Relations diplomatiques de "; str += nationPtr->nation_name(); str += " avec les autres royaumes:"; #else // GERMAN and US str = nationPtr->nation_name(); str += "'s "; str += translate.process( "Diplomatic Status with Other Kingdoms:" ); #endif nationPtr->disp_nation_color(x1, y+1); font_san.put(x1+20, y, str); y+=20; for( int i=1 ; i<=nation_array.size() ; i++ ) { if( nation_array.is_deleted(i) || i == nationRecno || i == info.viewing_nation_recno ) { continue; } nation_array[i]->disp_nation_color(x1, y+1); font_san.put( x1+20, y, nation_array[i]->nation_name() ); font_san.put( x1+240, y, nationPtr->get_relation(i)->status_str() ); if( nationPtr->get_relation(i)->trade_treaty ) { font_san.put( x1+330, y, "Trade Treaty" ); #if(defined(FRENCH)) font_san.put( x1+460, y, m.format((int)nationPtr->total_year_trade(i),2) ); #else // German and US font_san.put( x1+450, y, m.format((int)nationPtr->total_year_trade(i),2) ); #endif } if( config.show_ai_info ) { font_san.put( x1+500, y, nationPtr->get_relation(i)->ai_relation_level ); font_san.put( x1+530, y, (int) nationPtr->get_relation(i)->good_relation_duration_rating ); } y+=16; } } }