OFIRMIF.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. /*
  2. * Seven Kingdoms: Ancient Adversaries
  3. *
  4. * Copyright 1997,1998 Enlight Software Ltd.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. //Filename : OFIRMIF.CPP
  21. //Description : Firm interface routines
  22. #include <OSTR.h>
  23. #include <KEY.h>
  24. #include <OVGA.h>
  25. #include <OHELP.h>
  26. #include <OMOUSE.h>
  27. #include <OFONT.h>
  28. #include <OBUTT3D.h>
  29. #include <OBUTTON.h>
  30. #include <OSLIDER.h>
  31. #include <ONATION.h>
  32. #include <OINFO.h>
  33. #include <ORACERES.h>
  34. #include <OUNIT.h>
  35. #include <OSPY.h>
  36. #include <OTOWN.h>
  37. #include <OWORLD.h>
  38. #include <OFIRM.h>
  39. #include <OREMOTE.h>
  40. #include <OIMGRES.h>
  41. #include <OGAME.h>
  42. #include <OSYS.h>
  43. //---------- Define static variables ------------//
  44. static Button3D button_sell, button_destruct, button_builder;
  45. static short pop_disp_y1;
  46. //---------- Declare static function ------------//
  47. static void disp_worker_hit_points(int x1, int y1, int x2, int hitPoints, int maxHitPoints);
  48. //--------- Begin of function Firm::disp_info_both ---------//
  49. //
  50. void Firm::disp_info_both(int refreshFlag)
  51. {
  52. static char lastUnderConstruction;
  53. static short lastFirmRecno;
  54. static char lastShouldShowInfo;
  55. static short lastPlayerSpyCount;
  56. //------ check if under_construction has been changed -----//
  57. if( lastUnderConstruction != under_construction )
  58. {
  59. lastUnderConstruction = under_construction;
  60. if( refreshFlag == INFO_UPDATE )
  61. info.disp(); // refresh the display
  62. }
  63. //--------------------------------------------//
  64. if( under_construction )
  65. {
  66. disp_basic_info(INFO_Y1, refreshFlag);
  67. if( refreshFlag == INFO_REPAINT )
  68. font_san.d3_put( INFO_X1, INFO_Y1+54, INFO_X2, INFO_Y1+74, "Under Construction" );
  69. }
  70. else
  71. {
  72. //------ check if should_show_info() has been changed -----//
  73. int shouldShowInfo = should_show_info();
  74. if( shouldShowInfo != lastShouldShowInfo ||
  75. player_spy_count != lastPlayerSpyCount )
  76. {
  77. lastShouldShowInfo = shouldShowInfo;
  78. lastPlayerSpyCount = player_spy_count;
  79. if( refreshFlag == INFO_UPDATE )
  80. {
  81. info.disp();
  82. return;
  83. }
  84. }
  85. //----------------------------------------//
  86. if( lastFirmRecno != firm_recno ||
  87. (firm_menu_mode != FIRM_MENU_ASSASSINATE_RESULT &&
  88. player_spy_count==0 && bribe_result==BRIBE_NONE) ) // don't refresh mode if the player spy in the firm has just failed the bribing and executed, and we now need to display the failure message
  89. {
  90. firm_menu_mode = FIRM_MENU_MAIN;
  91. lastFirmRecno = firm_recno;
  92. bribe_result = BRIBE_NONE;
  93. }
  94. switch( firm_menu_mode )
  95. {
  96. case FIRM_MENU_MAIN:
  97. put_info(refreshFlag);
  98. break;
  99. case FIRM_MENU_SPY:
  100. case FIRM_MENU_SELECT_BRIBER:
  101. disp_spy_menu(refreshFlag);
  102. break;
  103. case FIRM_MENU_SET_BRIBE_AMOUNT:
  104. disp_bribe_menu(refreshFlag);
  105. break;
  106. case FIRM_MENU_VIEW_SECRET:
  107. spy_array.disp_view_secret_menu(action_spy_recno, refreshFlag);
  108. break;
  109. case FIRM_MENU_ASSASSINATE_RESULT:
  110. disp_assassinate_result(refreshFlag);
  111. break;
  112. }
  113. #ifdef DEBUG
  114. if(debug2_enable_flag)
  115. {
  116. font_san.d3_put( INFO_X1, INFO_Y2-30, INFO_X2, INFO_Y2, "" );
  117. font_san.field( INFO_X1+10, INFO_Y2-20, " ", INFO_X1+20, firm_recno, 1, INFO_X2-10, refreshFlag);
  118. font_san.field( INFO_X1+40, INFO_Y2-20, " ", INFO_X1+50, loc_x1, 1, INFO_X2-10, refreshFlag);
  119. font_san.field( INFO_X1+70, INFO_Y2-20, " ", INFO_X1+80, loc_y1, 1, INFO_X2-10, refreshFlag);
  120. font_san.field( INFO_X1+100, INFO_Y2-20, " ", INFO_X1+110, ai_link_checked, 1, INFO_X2-10, refreshFlag);
  121. }
  122. #endif
  123. }
  124. }
  125. //----------- End of function Firm::disp_info_both -----------//
  126. //--------- Begin of function Firm::detect_info_both ---------//
  127. //
  128. // Called by Info::detect(). Detect both cases when the firm is
  129. // under construction and is normal.
  130. //
  131. void Firm::detect_info_both()
  132. {
  133. if( under_construction )
  134. detect_basic_info();
  135. else
  136. {
  137. switch( firm_menu_mode )
  138. {
  139. case FIRM_MENU_MAIN:
  140. detect_info();
  141. break;
  142. case FIRM_MENU_SPY:
  143. case FIRM_MENU_SELECT_BRIBER:
  144. detect_spy_menu();
  145. break;
  146. case FIRM_MENU_SET_BRIBE_AMOUNT:
  147. detect_bribe_menu();
  148. break;
  149. case FIRM_MENU_VIEW_SECRET:
  150. if( spy_array.detect_view_secret_menu(action_spy_recno, nation_recno) )
  151. {
  152. firm_menu_mode = FIRM_MENU_MAIN;
  153. info.disp();
  154. }
  155. break;
  156. case FIRM_MENU_ASSASSINATE_RESULT:
  157. detect_assassinate_result();
  158. break;
  159. }
  160. }
  161. }
  162. //----------- End of function Firm::detect_info_both -----------//
  163. //--------- Begin of function Firm::disp_basic_info ---------//
  164. //
  165. void Firm::disp_basic_info(int dispY1, int refreshFlag)
  166. {
  167. //------- display the name of the firm --------//
  168. if( refreshFlag == INFO_REPAINT )
  169. {
  170. vga.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+21 );
  171. if( nation_recno )
  172. {
  173. font_san.center_put( INFO_X1+21, dispY1, INFO_X2-2, dispY1+21, firm_name() );
  174. char *nationPict = image_button.get_ptr("V_COLCOD");
  175. vga_front.put_bitmap_remap(INFO_X1+3, dispY1+2, nationPict, game.get_color_remap_table(nation_recno, 0) );
  176. }
  177. else
  178. {
  179. font_san.center_put( INFO_X1, dispY1, INFO_X2-2, dispY1+21, firm_name() );
  180. }
  181. }
  182. dispY1+=23;
  183. //------- display hit points and buttons -------//
  184. int sliderX1, sliderX2;
  185. if( under_construction )
  186. sliderX1 = INFO_X1+34; // there is only one button in the contruction mode, so the slider is longer
  187. else
  188. sliderX1 = INFO_X1+64;
  189. sliderX2 = INFO_X2-64;
  190. int showRepairIcon = builder_recno && !under_construction && should_show_info();
  191. if( refreshFlag == INFO_REPAINT )
  192. {
  193. button_sell.reset();
  194. button_destruct.reset();
  195. vga.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+26 );
  196. if( nation_array.player_recno &&
  197. nation_recno == nation_array.player_recno )
  198. {
  199. if( under_construction || !can_sell() )
  200. {
  201. button_destruct.paint( INFO_X1+4, dispY1+1, "V_DEM-U", "V_DEM-D" ); // Destruct
  202. if( under_construction )
  203. button_destruct.set_help_code( "CANCELBLD" );
  204. else
  205. button_destruct.set_help_code( "DESTFIRM" );
  206. }
  207. if( !under_construction && can_sell() )
  208. {
  209. button_sell.paint( INFO_X1+4, dispY1+1, "V_SEL-U", "V_SEL-D" ); // Sell
  210. button_sell.set_help_code( "SELLFIRM" );
  211. }
  212. }
  213. if( showRepairIcon )
  214. {
  215. button_builder.paint( INFO_X1+30, dispY1+1, "REPAIRU", "REPAIRD" ); // Builder
  216. button_builder.set_help_code( "REPAIR" );
  217. }
  218. }
  219. else //--------- INFO_UPDATE --------//
  220. {
  221. if( showRepairIcon != button_builder.enable_flag )
  222. {
  223. if( showRepairIcon )
  224. {
  225. button_builder.paint( INFO_X1+30, dispY1+1, "REPAIRU", "REPAIRD" ); // Builder
  226. button_builder.set_help_code( "REPAIR" );
  227. }
  228. else
  229. button_builder.hide();
  230. }
  231. }
  232. disp_hit_point(dispY1);
  233. }
  234. //----------- End of function Firm::disp_basic_info -----------//
  235. //--------- Begin of function Firm::detect_basic_info ---------//
  236. //
  237. int Firm::detect_basic_info()
  238. {
  239. //--- click on the name area to center the map on it ---//
  240. if( mouse.single_click(INFO_X1, INFO_Y1, INFO_X2, INFO_Y1+21) )
  241. {
  242. world.go_loc( center_x, center_y );
  243. return 1;
  244. }
  245. //----------- Mobilize the builder ---------//
  246. int detectBuilder = builder_recno && !under_construction &&
  247. unit_array[builder_recno]->is_own(); // this is your unit in your firm or it is a spy of yours in an enemy firm
  248. if( detectBuilder && button_builder.detect(0, 0, 1) ) // 1-detect right button also
  249. {
  250. if( !remote.is_enable() )
  251. set_builder(0);
  252. else
  253. {
  254. // packet structure : <firm recno>
  255. short *shortPtr = (short *)remote.new_send_queue_msg(MSG_FIRM_MOBL_BUILDER, sizeof(short));
  256. *shortPtr = firm_recno;
  257. }
  258. return 1;
  259. }
  260. //---------------------------------------//
  261. if( !own_firm() )
  262. return 0;
  263. //---------- "Destruct" button -----------//
  264. if( button_destruct.detect(KEY_DEL) )
  265. {
  266. if( under_construction )
  267. cancel_construction(COMMAND_PLAYER);
  268. else
  269. destruct_firm(COMMAND_PLAYER);
  270. return 1;
  271. }
  272. //------------ "Sell" button -------------//
  273. if( button_sell.detect(KEY_DEL) )
  274. {
  275. sell_firm(COMMAND_PLAYER);
  276. return 1;
  277. }
  278. return 0;
  279. }
  280. //----------- End of function Firm::detect_basic_info -----------//
  281. //--------- Begin of function Firm::disp_worker_list ---------//
  282. //
  283. void Firm::disp_worker_list(int dispY1, int refreshFlag)
  284. {
  285. pop_disp_y1 = dispY1;
  286. //---------------- paint the panel --------------//
  287. if( refreshFlag == INFO_REPAINT )
  288. vga.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+60 );
  289. //----------- display populatin distribution ---------//
  290. int overseerRaceId=0;
  291. if( overseer_recno )
  292. overseerRaceId = unit_array[overseer_recno]->race_id;
  293. if( selected_worker_id > worker_count )
  294. selected_worker_id = worker_count;
  295. //------ display population composition -------//
  296. int x, y;
  297. Worker* workerPtr = worker_array;
  298. static char last_race_id_array[MAX_WORKER];
  299. static char last_unit_id_array[MAX_WORKER];
  300. dispY1+=1;
  301. for( int i=0 ; i<MAX_WORKER ; i++, workerPtr++ )
  302. {
  303. x = INFO_X1+4+i%4*50;
  304. y = dispY1+i/4*29;
  305. if( i<worker_count )
  306. {
  307. if( refreshFlag==INFO_REPAINT ||
  308. last_race_id_array[i] != workerPtr->race_id ||
  309. last_unit_id_array[i] != workerPtr->unit_id )
  310. {
  311. vga_front.put_bitmap(x+2, y+2, workerPtr->small_icon_ptr());
  312. }
  313. //----- highlight the selected worker -------//
  314. if( selected_worker_id == i+1 )
  315. vga_front.rect( x, y, x+27, y+23, 2, V_YELLOW );
  316. else
  317. vga_front.rect( x, y, x+27, y+23, 2, vga_front.color_up );
  318. //------ display hit points bar --------//
  319. disp_worker_hit_points( x+2, y+24, x+25, workerPtr->hit_points, workerPtr->max_hit_points() );
  320. //----- display combat or skill level ------//
  321. char* spyIconName=NULL;
  322. if( workerPtr->spy_recno )
  323. {
  324. Spy* spyPtr = spy_array[workerPtr->spy_recno];
  325. //------ if this is the player's spy -------//
  326. if( nation_array.player_recno &&
  327. spyPtr->true_nation_recno == nation_array.player_recno )
  328. {
  329. spyIconName = "U_SPY";
  330. }
  331. //--------------------------------------------//
  332. //
  333. // If this is an enemy spy and this firm belongs
  334. // to the player and there is a player's phoenix
  335. // over this firm and the spying skill of the spy
  336. // is low (below 40)
  337. //
  338. //--------------------------------------------//
  339. /*
  340. else if( spyPtr->spy_skill < 40 &&
  341. nation_recno == nation_array.player_recno &&
  342. nation_array.player_recno &&
  343. (~nation_array)->revealed_by_phoenix(loc_x1, loc_y1) )
  344. {
  345. spyIconName = "ENEMYSPY";
  346. }
  347. */
  348. }
  349. //--------------------------------------//
  350. if( spyIconName )
  351. {
  352. vga_front.put_bitmap( x+30, y+6, image_icon.get_ptr(spyIconName) );
  353. vga.blt_buf( x+40, y+6, x+49, y+15, 0 );
  354. vga.blt_buf( x+30, y+16, x+49, y+26, 0 );
  355. }
  356. else
  357. {
  358. if( firm_id == FIRM_CAMP )
  359. font_san.disp(x+30, y+6, workerPtr->combat_level, 1, x+49);
  360. else
  361. font_san.disp(x+30, y+6, workerPtr->skill_level, 1, x+49);
  362. }
  363. last_race_id_array[i] = workerPtr->race_id;
  364. last_unit_id_array[i] = workerPtr->unit_id;
  365. //------- set help parameters ---------//
  366. if( mouse.in_area(x, y, x+27, y+23) )
  367. help.set_unit_help( workerPtr->unit_id, 0, x, y, x+27, y+23 );
  368. }
  369. else
  370. {
  371. if( last_race_id_array[i] != 0 || last_unit_id_array[i] != 0 )
  372. {
  373. vga.blt_buf( x, y, x+49, y+27, 0 );
  374. last_race_id_array[i] = 0;
  375. last_unit_id_array[i] = 0;
  376. }
  377. }
  378. }
  379. }
  380. //----------- End of function Firm::disp_worker_list -----------//
  381. //--------- Begin of function Firm::detect_worker_list ---------//
  382. //
  383. int Firm::detect_worker_list()
  384. {
  385. if( !should_show_info() )
  386. return 0;
  387. //------- detect buttons on hiring firm workers -------//
  388. int i, x, y;
  389. int liveInTown = firm_res[firm_id]->live_in_town;
  390. for( i=0 ; i<worker_count ; i++ )
  391. {
  392. x = INFO_X1+6+i%4*50;
  393. y = pop_disp_y1+1+i/4*29;
  394. switch( mouse.single_click(x, y, x+27, y+23, 2) )
  395. {
  396. case 1: // left button to select worker
  397. selected_worker_id = i+1;
  398. return 1;
  399. case 2:
  400. if( own_firm() ) // only if this is our own firm
  401. {
  402. //--- if the town where the unit lives belongs to the nation of this firm ---//
  403. mobilize_worker(i+1, COMMAND_PLAYER);
  404. return 1;
  405. }
  406. break;
  407. }
  408. }
  409. return 0;
  410. }
  411. //----------- End of function Firm::detect_worker_list -----------//
  412. //--------- Begin of function disp_worker_hit_points ---------//
  413. //
  414. static void disp_worker_hit_points(int x1, int y1, int x2, int hitPoints, int maxHitPoints)
  415. {
  416. //------- determine the hit bar type -------//
  417. #define HIT_BAR_TYPE_COUNT 3
  418. int hit_bar_color_array[HIT_BAR_TYPE_COUNT] = { 0xA8, 0xB4, 0xAC };
  419. int hit_bar_max_array[HIT_BAR_TYPE_COUNT] = { 50, 100, 200 };
  420. char hitBarColor;
  421. for( int i=0 ; i<HIT_BAR_TYPE_COUNT ; i++ )
  422. {
  423. if( maxHitPoints <= hit_bar_max_array[i] || i==HIT_BAR_TYPE_COUNT-1 )
  424. {
  425. hitBarColor = hit_bar_color_array[i];
  426. break;
  427. }
  428. }
  429. //------- draw the hit points bar -------//
  430. enum { HIT_BAR_DARK_BORDER = 3,
  431. HIT_BAR_BODY = 1 };
  432. int barWidth = (x2-x1+1) * hitPoints / max(hitPoints, maxHitPoints);
  433. vga_front.bar( x1, y1, x1+barWidth-1, y1+1, hitBarColor + HIT_BAR_BODY );
  434. if( x1+barWidth <= x2 )
  435. vga.blt_buf( x1+barWidth, y1, x2, y1+1, 0 );
  436. y1+=2;
  437. vga_front.bar( x1, y1, x1+barWidth-1, y1, hitBarColor + HIT_BAR_DARK_BORDER );
  438. vga_front.bar( x1+barWidth, y1, x1+barWidth, y1, V_BLACK );
  439. if( x1+barWidth+1 <= x2 )
  440. vga.blt_buf( x1+barWidth+1, y1, x2, y1, 0 );
  441. y1++;
  442. vga_front.bar( x1+1, y1, x1+barWidth, y1, V_BLACK );
  443. if( x1+barWidth+1 <= x2 )
  444. vga.blt_buf( x1+barWidth+1, y1, x2, y1, 0 );
  445. }
  446. //----------- End of function disp_worker_hit_points -----------//
  447. //--------- Begin of function Firm::disp_worker_info ---------//
  448. //
  449. void Firm::disp_worker_info(int dispY1, int refreshFlag)
  450. {
  451. static int lastSelected;
  452. if( selected_worker_id > worker_count )
  453. selected_worker_id = worker_count;
  454. if( lastSelected != selected_worker_id > 0 )
  455. {
  456. lastSelected = selected_worker_id > 0;
  457. info.disp(); // redisplay the interface
  458. return;
  459. }
  460. //------ if selected_worker_id==0, display overseer info -----//
  461. if( selected_worker_id==0 ) // display overseer info
  462. {
  463. disp_overseer_info(dispY1, refreshFlag);
  464. return;
  465. }
  466. //---------------- paint the panel --------------//
  467. if( refreshFlag == INFO_REPAINT )
  468. {
  469. if( firm_id == FIRM_CAMP ) // the command base has one more field
  470. vga.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+71 );
  471. else
  472. vga.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+55 );
  473. }
  474. if( selected_worker_id > 0 )
  475. {
  476. int x=INFO_X1+4, y=dispY1+4;
  477. Worker* workerPtr = worker_array + selected_worker_id - 1;
  478. if( workerPtr->town_recno ) // FirmInfo::live_in_town is 1
  479. {
  480. Town* townPtr = town_array[workerPtr->town_recno];
  481. font_san.field( x, y, "Residence", x+100, townPtr->town_name(), INFO_X2-2, refreshFlag);
  482. y+=16;
  483. if( town_array[workerPtr->town_recno]->nation_recno == nation_recno &&
  484. workerPtr->race_id )
  485. {
  486. info.disp_loyalty( x, y, x+100, workerPtr->loyalty(), workerPtr->target_loyalty(firm_recno), nation_recno, refreshFlag );
  487. }
  488. else
  489. font_san.field( x, y, "Loyalty", x+100, "N/A", INFO_X2-2, refreshFlag ); // no loyalty because it does not belong to your empire
  490. }
  491. else // FirmInfo::live_in_town is 0
  492. {
  493. if( workerPtr->race_id )
  494. info.disp_loyalty( x, y, x+100, workerPtr->loyalty(), workerPtr->target_loyalty(firm_recno), nation_recno, refreshFlag );
  495. else
  496. font_san.field( x, y, "Loyalty", x+100, "N/A", INFO_X2-2, refreshFlag ); // no loyalty because it does not belong to your empire
  497. }
  498. y+=16;
  499. //----------------------------------------//
  500. String str;
  501. if( workerPtr->race_id )
  502. str = m.format(workerPtr->skill_level, 1);
  503. else
  504. str = "N/A";
  505. font_san.field( x, y, Skill::skill_str_array[workerPtr->skill_id-1],
  506. x+100, str, INFO_X2-2, refreshFlag);
  507. y+=16;
  508. //----------------------------------------//
  509. if( firm_id == FIRM_CAMP )
  510. {
  511. if( workerPtr->race_id )
  512. str = m.format(workerPtr->combat_level, 1);
  513. else
  514. str = "N/A";
  515. font_san.field( x, y, "Combat", x+100, str, INFO_X2-2, refreshFlag);
  516. y+=16;
  517. //---------------------------------------//
  518. str = workerPtr->hit_points;
  519. str += "/";
  520. str += workerPtr->max_hit_points();
  521. font_san.field( x, y, "Hit Points", x+100, str, INFO_X2-2, refreshFlag);
  522. }
  523. }
  524. }
  525. //----------- End of function Firm::disp_worker_info -----------//
  526. //--------- Begin of function Firm::disp_overseer_info ---------//
  527. //
  528. void Firm::disp_overseer_info(int dispY1, int refreshFlag)
  529. {
  530. if( refreshFlag == INFO_REPAINT )
  531. {
  532. if( firm_id == FIRM_CAMP )
  533. vga.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+71 );
  534. else
  535. vga.d3_panel_up( INFO_X1, dispY1, INFO_X2, dispY1+55 );
  536. }
  537. if( !overseer_recno )
  538. return;
  539. int x=INFO_X1+4, y=dispY1+4;
  540. Unit* unitPtr = unit_array[overseer_recno];
  541. if( unitPtr->rank_id != RANK_KING )
  542. {
  543. info.disp_loyalty( x, y, x+100, unitPtr->loyalty, unitPtr->target_loyalty, nation_recno, refreshFlag );
  544. y+=16;
  545. }
  546. font_san.field( x, y, Skill::skill_str_array[unitPtr->skill.skill_id-1],
  547. x+100, unitPtr->skill.skill_level , 1, INFO_X2-2, refreshFlag);
  548. y+=16;
  549. if( firm_id==FIRM_CAMP ) // only display combat level in camps and don't display it in seat of power
  550. {
  551. font_san.field( x, y, "Combat" , x+100, unitPtr->skill.combat_level, 1, INFO_X2-2, refreshFlag);
  552. y+=16;
  553. }
  554. String str;
  555. str = (int) unitPtr->hit_points;
  556. str += "/";
  557. str += unitPtr->max_hit_points;
  558. font_san.field( x, y, "Hit Points", x+100, str, INFO_X2-2, refreshFlag);
  559. }
  560. //----------- End of function Firm::disp_overseer_info -----------//
  561. //----------- Begin of function Firm::disp_hit_point -----------//
  562. void Firm::disp_hit_point(int dispY1)
  563. {
  564. float hitPoints;
  565. if( hit_points > (float)0 && hit_points < (float)1 )
  566. hitPoints = (float) 1; // display 1 for value between 0 and 1
  567. else
  568. hitPoints = hit_points;
  569. Vga::active_buf->indicator(0x0b, INFO_X1+58, dispY1+1, hitPoints, max_hit_points, 0);
  570. }
  571. //----------- End of function Firm::disp_hit_point -----------//