2 * $Logfile: /Freespace2/code/Fred2/WeaponEditorDlg.cpp $
7 * Weapon editor dialog box handling code
10 * Revision 1.2 2002/05/07 03:16:44 theoddone33
11 * The Great Newline Fix
13 * Revision 1.1.1.1 2002/05/03 03:28:09 root
17 * 4 4/28/99 11:13p Dave
18 * Temporary checkin of artillery code.
20 * 3 4/23/99 12:01p Johnson
23 * 2 10/07/98 6:28p Dave
24 * Initial checkin. Renamed all relevant stuff to be Fred2 instead of
25 * Fred. Globalized mission and campaign file extensions. Removed Silent
26 * Threat specific code.
28 * 1 10/07/98 3:02p Dave
30 * 1 10/07/98 3:00p Dave
32 * 17 5/14/98 5:31p Hoffoss
33 * Fixed some stupid behaviour in this editor related to ammo counts being
36 * 16 4/22/98 11:27a Hoffoss
37 * Make big weapons available for capital ships as well as big ships (why
38 * the hell a capital ship isn't a big ship is beyond me, though).
40 * 15 4/14/98 11:46a Johnson
41 * Added window enables for spinners, but it seems to be ignored.
43 * 14 2/26/98 10:44a Johnson
44 * Fixed bug with SetRange() not being called on editor first open.
46 * 13 2/22/98 1:32a Hoffoss
47 * Changed editor to use raw ammo counts isntead of percentages, and make
48 * it select first item in list by default.
50 * 12 2/13/98 3:38p Johnson
51 * Fixed bug where multi ship editing won't update player ships.
53 * 11 12/11/97 5:46p Hoffoss
54 * Changed Fred to not display weapons that are not available to various
57 * 10 9/16/97 9:41p Hoffoss
58 * Changed Fred code around to stop using Parse_player structure for
59 * player information, and use actual ships instead.
61 * 9 5/30/97 4:50p Hoffoss
62 * Added code to allow marked ship editing of data in child dialogs of
65 * 8 4/21/97 5:02p Hoffoss
66 * Player/player status editing supported, and both saved and loaded from
69 * 7 4/16/97 2:02p Hoffoss
70 * Fixed bug Mike created by changing code while I had file checked out
73 * 6 4/16/97 1:59p Hoffoss
74 * Weapon editor now fully functional.
76 * 5 4/10/97 3:20p Mike
77 * Change hull damage to be like shields.
79 * 4 4/09/97 11:48a Hoffoss
80 * Initial work to weapon editor.
82 * 3 3/31/97 6:07p Hoffoss
83 * Fixed several errors, including BG editor not graying fields, BG editor
84 * not updating image when changed, Removed obsolete data from Weapon
85 * editor, priority not being saved when missions saved, priority not
86 * editable in initial orders editor.
88 * 2 2/17/97 5:28p Hoffoss
89 * Checked RCS headers, added them were missing, changing description to
90 * something better, etc where needed.
97 #include "weaponeditordlg.h"
99 #include "management.h"
103 #define BLANK_FIELD -99
106 #define new DEBUG_NEW
108 static char THIS_FILE[] = __FILE__;
111 /////////////////////////////////////////////////////////////////////////////
112 // WeaponEditorDlg dialog
114 WeaponEditorDlg::WeaponEditorDlg(CWnd* pParent /*=NULL*/)
115 : CDialog(WeaponEditorDlg::IDD, pParent)
117 //{{AFX_DATA_INIT(WeaponEditorDlg)
136 int save_number(char *str, int *val)
142 sprintf(buf, "%d", num);
143 if (strncmp(str, buf, strlen(buf)))
150 void WeaponEditorDlg::DoDataExchange(CDataExchange* pDX)
154 CDialog::DoDataExchange(pDX);
155 //{{AFX_DATA_MAP(WeaponEditorDlg)
156 DDX_Control(pDX, IDC_SPIN4, m_spin4);
157 DDX_Control(pDX, IDC_SPIN3, m_spin3);
158 DDX_Control(pDX, IDC_SPIN2, m_spin2);
159 DDX_Control(pDX, IDC_SPIN1, m_spin1);
160 DDX_CBIndex(pDX, IDC_AI_CLASS, m_ai_class);
161 DDX_CBIndex(pDX, IDC_GUN1, m_gun1);
162 DDX_CBIndex(pDX, IDC_GUN2, m_gun2);
163 DDX_CBIndex(pDX, IDC_GUN3, m_gun3);
164 DDX_CBIndex(pDX, IDC_MISSILE1, m_missile1);
165 DDX_CBIndex(pDX, IDC_MISSILE2, m_missile2);
166 DDX_CBIndex(pDX, IDC_MISSILE3, m_missile3);
167 DDX_CBIndex(pDX, IDC_MISSILE4, m_missile4);
168 DDX_LBIndex(pDX, IDC_LIST, m_cur_item);
171 if (pDX->m_bSaveAndValidate) {
172 GetDlgItem(IDC_AMMO1)->GetWindowText(str);
173 if (save_number((char *) (LPCSTR) str, &m_ammo1)) {
174 m_ammo_max1 = (m_missile1 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 + First_secondary_index - 1);
177 if (m_ammo1 > m_ammo_max1)
178 m_ammo1 = m_ammo_max1;
181 GetDlgItem(IDC_AMMO2)->GetWindowText(str);
182 if (save_number((char *) (LPCSTR) str, &m_ammo2)) {
183 m_ammo_max2 = (m_missile2 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 1, m_missile2 + First_secondary_index - 1);
186 if (m_ammo2 > m_ammo_max2)
187 m_ammo2 = m_ammo_max2;
190 GetDlgItem(IDC_AMMO3)->GetWindowText(str);
191 if (save_number((char *) (LPCSTR) str, &m_ammo3)) {
192 m_ammo_max3 = (m_missile3 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 2, m_missile3 + First_secondary_index - 1);
195 if (m_ammo3 > m_ammo_max3)
196 m_ammo3 = m_ammo_max3;
199 GetDlgItem(IDC_AMMO4)->GetWindowText(str);
200 if (save_number((char *) (LPCSTR) str, &m_ammo4)) {
201 m_ammo_max4 = (m_missile4 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 3, m_missile4 + First_secondary_index - 1);
204 if (m_ammo4 > m_ammo_max4)
205 m_ammo4 = m_ammo_max4;
208 m_spin1.SetRange(0, m_ammo_max1);
209 m_spin2.SetRange(0, m_ammo_max2);
210 m_spin3.SetRange(0, m_ammo_max3);
211 m_spin4.SetRange(0, m_ammo_max4);
214 if (m_ammo1 != BLANK_FIELD)
215 DDX_Text(pDX, IDC_AMMO1, m_ammo1);
217 GetDlgItem(IDC_AMMO1)->SetWindowText("");
219 if (m_ammo2 != BLANK_FIELD)
220 DDX_Text(pDX, IDC_AMMO2, m_ammo2);
222 GetDlgItem(IDC_AMMO2)->SetWindowText("");
224 if (m_ammo3 != BLANK_FIELD)
225 DDX_Text(pDX, IDC_AMMO3, m_ammo3);
227 GetDlgItem(IDC_AMMO3)->SetWindowText("");
229 if (m_ammo4 != BLANK_FIELD)
230 DDX_Text(pDX, IDC_AMMO4, m_ammo4);
232 GetDlgItem(IDC_AMMO4)->SetWindowText("");
236 BEGIN_MESSAGE_MAP(WeaponEditorDlg, CDialog)
237 //{{AFX_MSG_MAP(WeaponEditorDlg)
238 ON_LBN_SELCHANGE(IDC_LIST, OnSelchangeList)
240 ON_CBN_SELCHANGE(IDC_MISSILE1, OnSelchangeMissile1)
241 ON_CBN_SELCHANGE(IDC_MISSILE2, OnSelchangeMissile2)
242 ON_CBN_SELCHANGE(IDC_MISSILE3, OnSelchangeMissile3)
243 ON_CBN_SELCHANGE(IDC_MISSILE4, OnSelchangeMissile4)
247 /////////////////////////////////////////////////////////////////////////////
248 // WeaponEditorDlg message handlers
250 BOOL WeaponEditorDlg::OnInitDialog()
252 int i, z, big = 1, end1, end2, inst, flag = 0;
254 model_subsystem *psub;
255 ship_subsys *ssl, *pss;
259 CDialog::OnInitDialog();
262 m_ship = Objects[cur_object_index].instance;
264 end1 = First_secondary_index;
265 end2 = Num_weapon_types;
267 list = (CListBox *) GetDlgItem(IDC_LIST);
269 z = list->AddString("Pilot");
271 list->SetItemDataPtr(z, &pilot);
272 ptr = GET_FIRST(&obj_used_list);
273 while (ptr != END_OF_LIST(&obj_used_list)) {
274 if (((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) && (ptr->flags & OF_MARKED)) {
275 inst = ptr->instance;
276 if (!(ship_get_SIF(inst) & (SIF_BIG_SHIP | SIF_HUGE_SHIP)))
280 pilot = Ships[inst].weapons;
281 m_ship_class = Ships[inst].ship_info_index;
285 Assert(Ships[inst].ship_info_index == m_ship_class);
286 if (pilot.ai_class != Ships[inst].weapons.ai_class)
287 pilot.ai_class = BLANK_FIELD;
289 for (i=0; i<MAX_PRIMARY_BANKS; i++)
290 if (pilot.primary_bank_weapons[i] != Ships[inst].weapons.primary_bank_weapons[i])
291 pilot.primary_bank_weapons[i] = BLANK_FIELD;
293 for (i=0; i<MAX_SECONDARY_BANKS; i++) {
294 if (pilot.secondary_bank_weapons[i] != Ships[inst].weapons.secondary_bank_weapons[i])
295 pilot.secondary_bank_weapons[i] = BLANK_FIELD;
296 if (pilot.secondary_bank_ammo[i] != Ships[inst].weapons.secondary_bank_ammo[i])
297 pilot.secondary_bank_ammo[i] = BLANK_FIELD;
306 if (!(ship_get_SIF(m_ship) & (SIF_BIG_SHIP | SIF_HUGE_SHIP)))
309 m_ship_class = Ships[m_ship].ship_info_index;
310 list->SetItemDataPtr(z, &Ships[m_ship].weapons);
311 ssl = &Ships[m_ship].subsys_list;
312 for (pss = GET_FIRST(ssl); pss != END_OF_LIST(ssl); pss = GET_NEXT(pss)) {
313 psub = pss->system_info;
314 if (psub->type == SUBSYSTEM_TURRET) {
315 z = list->AddString(psub->subobj_name);
316 list->SetItemDataPtr(z, &pss->weapons);
321 box = (CComboBox *) GetDlgItem(IDC_AI_CLASS);
322 for (i=0; i<Num_ai_classes; i++){
323 box->AddString(Ai_class_names[i]);
326 for (i=0; i<end1; i++){
327 if ((Weapon_info[i].wi_flags & WIF_CHILD) || (!big && (Weapon_info[i].wi_flags & WIF_BIG_ONLY))){
332 box = (CComboBox *) GetDlgItem(IDC_GUN1);
333 box->AddString("None");
334 for (i=0; i<end1; i++){
335 box->AddString(Weapon_info[i].name);
338 box = (CComboBox *) GetDlgItem(IDC_GUN2);
339 box->AddString("None");
340 for (i=0; i<end1; i++){
341 box->AddString(Weapon_info[i].name);
344 box = (CComboBox *) GetDlgItem(IDC_GUN3);
345 box->AddString("None");
346 for (i=0; i<end1; i++){
347 box->AddString(Weapon_info[i].name);
350 for (i=First_secondary_index; i<end2; i++){
351 if ((Weapon_info[i].wi_flags & WIF_CHILD) || (!big && (Weapon_info[i].wi_flags & WIF_BIG_ONLY))){
356 box = (CComboBox *) GetDlgItem(IDC_MISSILE1);
357 box->AddString("None");
358 for (i=First_secondary_index; i<end2; i++){
359 box->AddString(Weapon_info[i].name);
362 box = (CComboBox *) GetDlgItem(IDC_MISSILE2);
363 box->AddString("None");
364 for (i=First_secondary_index; i<end2; i++){
365 box->AddString(Weapon_info[i].name);
368 box = (CComboBox *) GetDlgItem(IDC_MISSILE3);
369 box->AddString("None");
370 for (i=First_secondary_index; i<end2; i++){
371 box->AddString(Weapon_info[i].name);
374 box = (CComboBox *) GetDlgItem(IDC_MISSILE4);
375 box->AddString("None");
376 for (i=First_secondary_index; i<end2; i++){
377 box->AddString(Weapon_info[i].name);
387 void WeaponEditorDlg::OnSelchangeList()
394 void WeaponEditorDlg::change_selection()
396 CString a1, a2, a3, a4;
398 GetDlgItem(IDC_AMMO1)->GetWindowText(a1);
399 GetDlgItem(IDC_AMMO2)->GetWindowText(a2);
400 GetDlgItem(IDC_AMMO3)->GetWindowText(a3);
401 GetDlgItem(IDC_AMMO4)->GetWindowText(a4);
403 if (m_last_item >= 0) {
404 cur_weapon->ai_class = m_ai_class;
405 cur_weapon->primary_bank_weapons[0] = m_gun1 - 1;
406 cur_weapon->primary_bank_weapons[1] = m_gun2 - 1;
407 cur_weapon->primary_bank_weapons[2] = m_gun3 - 1;
409 m_missile1 += First_secondary_index;
411 cur_weapon->secondary_bank_weapons[0] = m_missile1 - 1;
413 m_missile2 += First_secondary_index;
415 cur_weapon->secondary_bank_weapons[1] = m_missile2 - 1;
417 m_missile3 += First_secondary_index;
419 cur_weapon->secondary_bank_weapons[2] = m_missile3 - 1;
421 m_missile4 += First_secondary_index;
423 cur_weapon->secondary_bank_weapons[3] = m_missile4 - 1;
424 cur_weapon->secondary_bank_ammo[0] = m_ammo_max1 ? (m_ammo1 * 100 / m_ammo_max1) : 0;
425 cur_weapon->secondary_bank_ammo[1] = m_ammo_max2 ? (m_ammo2 * 100 / m_ammo_max2) : 0;
426 cur_weapon->secondary_bank_ammo[2] = m_ammo_max3 ? (m_ammo3 * 100 / m_ammo_max3) : 0;
427 cur_weapon->secondary_bank_ammo[3] = m_ammo_max4 ? (m_ammo4 * 100 / m_ammo_max4) : 0;
430 cur_weapon->secondary_bank_ammo[0] = BLANK_FIELD;
432 cur_weapon->secondary_bank_ammo[1] = BLANK_FIELD;
434 cur_weapon->secondary_bank_ammo[2] = BLANK_FIELD;
436 cur_weapon->secondary_bank_ammo[3] = BLANK_FIELD;
440 m_gun1 = m_gun2 = m_gun3 = m_missile1 = m_missile2 = m_missile3 = m_missile4 = -1;
441 m_ammo1 = m_ammo2 = m_ammo3 = m_ammo4 = BLANK_FIELD;
442 m_ammo_max1 = m_ammo_max2 = m_ammo_max3 = m_ammo_max4 = 0;
443 if (m_cur_item < 0) {
444 m_last_item = m_cur_item;
445 GetDlgItem(IDC_GUN1)->EnableWindow(FALSE);
446 GetDlgItem(IDC_GUN2)->EnableWindow(FALSE);
447 GetDlgItem(IDC_GUN3)->EnableWindow(FALSE);
448 GetDlgItem(IDC_MISSILE1)->EnableWindow(FALSE);
449 GetDlgItem(IDC_MISSILE2)->EnableWindow(FALSE);
450 GetDlgItem(IDC_MISSILE3)->EnableWindow(FALSE);
451 GetDlgItem(IDC_MISSILE4)->EnableWindow(FALSE);
452 GetDlgItem(IDC_AMMO1)->EnableWindow(FALSE);
453 GetDlgItem(IDC_AMMO2)->EnableWindow(FALSE);
454 GetDlgItem(IDC_AMMO3)->EnableWindow(FALSE);
455 GetDlgItem(IDC_AMMO4)->EnableWindow(FALSE);
456 GetDlgItem(IDC_SPIN1)->EnableWindow(FALSE);
457 GetDlgItem(IDC_SPIN2)->EnableWindow(FALSE);
458 GetDlgItem(IDC_SPIN3)->EnableWindow(FALSE);
459 GetDlgItem(IDC_SPIN4)->EnableWindow(FALSE);
460 GetDlgItem(IDC_AI_CLASS)->EnableWindow(FALSE);
465 cur_weapon = (ship_weapon *) ((CListBox *) GetDlgItem(IDC_LIST))->GetItemDataPtr(m_cur_item);
466 GetDlgItem(IDC_AI_CLASS)->EnableWindow(TRUE);
467 m_ai_class = cur_weapon->ai_class;
469 if (cur_weapon->num_primary_banks > 0) {
470 m_gun1 = cur_weapon->primary_bank_weapons[0] + 1;
471 GetDlgItem(IDC_GUN1)->EnableWindow(TRUE);
473 GetDlgItem(IDC_GUN1)->EnableWindow(FALSE);
475 if (cur_weapon->num_primary_banks > 1) {
476 m_gun2 = cur_weapon->primary_bank_weapons[1] + 1;
477 GetDlgItem(IDC_GUN2)->EnableWindow(TRUE);
479 GetDlgItem(IDC_GUN2)->EnableWindow(FALSE);
481 if (cur_weapon->num_primary_banks > 2) {
482 m_gun3 = cur_weapon->primary_bank_weapons[2] + 1;
483 GetDlgItem(IDC_GUN3)->EnableWindow(TRUE);
485 GetDlgItem(IDC_GUN3)->EnableWindow(FALSE);
487 if (cur_weapon->num_secondary_banks > 0) {
488 m_missile1 = cur_weapon->secondary_bank_weapons[0] + 1;
489 if (m_missile1 > 0) {
490 m_ammo_max1 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 - 1);
491 if (cur_weapon->secondary_bank_ammo[0] != BLANK_FIELD)
492 m_ammo1 = cur_weapon->secondary_bank_ammo[0] * m_ammo_max1 / 100;
493 m_missile1 -= First_secondary_index;
496 GetDlgItem(IDC_MISSILE1)->EnableWindow(TRUE);
497 GetDlgItem(IDC_AMMO1)->EnableWindow(TRUE);
498 GetDlgItem(IDC_SPIN1)->EnableWindow(TRUE);
501 GetDlgItem(IDC_MISSILE1)->EnableWindow(FALSE);
502 GetDlgItem(IDC_AMMO1)->EnableWindow(FALSE);
503 GetDlgItem(IDC_SPIN1)->EnableWindow(FALSE);
506 if (cur_weapon->num_secondary_banks > 1) {
507 m_missile2 = cur_weapon->secondary_bank_weapons[1] + 1;
508 if (m_missile2 > 0) {
509 m_ammo_max2 = get_max_ammo_count_for_bank(m_ship_class, 1, m_missile2 - 1);
510 if (cur_weapon->secondary_bank_ammo[1] != BLANK_FIELD)
511 m_ammo2 = cur_weapon->secondary_bank_ammo[1] * m_ammo_max2 / 100;
512 m_missile2 -= First_secondary_index;
515 GetDlgItem(IDC_MISSILE2)->EnableWindow(TRUE);
516 GetDlgItem(IDC_AMMO2)->EnableWindow(TRUE);
517 GetDlgItem(IDC_SPIN2)->EnableWindow(TRUE);
520 GetDlgItem(IDC_MISSILE2)->EnableWindow(FALSE);
521 GetDlgItem(IDC_AMMO2)->EnableWindow(FALSE);
522 GetDlgItem(IDC_SPIN2)->EnableWindow(FALSE);
525 if (cur_weapon->num_secondary_banks > 2) {
526 m_missile3 = cur_weapon->secondary_bank_weapons[2] + 1;
527 if (m_missile3 > 0) {
528 m_ammo_max3 = get_max_ammo_count_for_bank(m_ship_class, 2, m_missile3 - 1);
529 if (cur_weapon->secondary_bank_ammo[2] != BLANK_FIELD)
530 m_ammo3 = cur_weapon->secondary_bank_ammo[2] * m_ammo_max3 / 100;
531 m_missile3 -= First_secondary_index;
534 GetDlgItem(IDC_MISSILE3)->EnableWindow(TRUE);
535 GetDlgItem(IDC_AMMO3)->EnableWindow(TRUE);
536 GetDlgItem(IDC_SPIN3)->EnableWindow(TRUE);
539 GetDlgItem(IDC_MISSILE3)->EnableWindow(FALSE);
540 GetDlgItem(IDC_AMMO3)->EnableWindow(FALSE);
541 GetDlgItem(IDC_SPIN3)->EnableWindow(FALSE);
544 if (cur_weapon->num_secondary_banks > 3) {
545 m_missile4 = cur_weapon->secondary_bank_weapons[3] + 1;
546 if (m_missile4 > 0) {
547 m_ammo_max4 = get_max_ammo_count_for_bank(m_ship_class, 3, m_missile4 - 1);
548 if (cur_weapon->secondary_bank_ammo[3] != BLANK_FIELD)
549 m_ammo4 = cur_weapon->secondary_bank_ammo[3] * m_ammo_max4 / 100;
550 m_missile4 -= First_secondary_index;
553 GetDlgItem(IDC_MISSILE4)->EnableWindow(TRUE);
554 GetDlgItem(IDC_AMMO4)->EnableWindow(TRUE);
555 GetDlgItem(IDC_SPIN4)->EnableWindow(TRUE);
558 GetDlgItem(IDC_MISSILE4)->EnableWindow(FALSE);
559 GetDlgItem(IDC_AMMO4)->EnableWindow(FALSE);
560 GetDlgItem(IDC_SPIN4)->EnableWindow(FALSE);
563 m_last_item = m_cur_item;
566 if (m_ammo1 == BLANK_FIELD)
567 GetDlgItem(IDC_AMMO1)->SetWindowText("");
568 if (m_ammo2 == BLANK_FIELD)
569 GetDlgItem(IDC_AMMO2)->SetWindowText("");
570 if (m_ammo3 == BLANK_FIELD)
571 GetDlgItem(IDC_AMMO3)->SetWindowText("");
572 if (m_ammo4 == BLANK_FIELD)
573 GetDlgItem(IDC_AMMO4)->SetWindowText("");
577 void WeaponEditorDlg::OnOK()
586 void WeaponEditorDlg::OnCancel()
595 void WeaponEditorDlg::OnClose()
604 void WeaponEditorDlg::update_pilot()
611 ptr = GET_FIRST(&obj_used_list);
612 while (ptr != END_OF_LIST(&obj_used_list)) {
613 if (((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) && (ptr->flags & OF_MARKED)) {
614 weapon = &Ships[ptr->instance].weapons;
616 if (pilot.ai_class >= 0)
617 weapon->ai_class = pilot.ai_class;
619 for (i=0; i<MAX_PRIMARY_BANKS; i++)
620 if (pilot.primary_bank_weapons[i] != -2)
621 weapon->primary_bank_weapons[i] = pilot.primary_bank_weapons[i];
623 for (i=0; i<MAX_SECONDARY_BANKS; i++) {
624 if (pilot.secondary_bank_weapons[i] != -2)
625 weapon->secondary_bank_weapons[i] = pilot.secondary_bank_weapons[i];
626 if (pilot.secondary_bank_ammo[i] >= 0)
627 weapon->secondary_bank_ammo[i] = pilot.secondary_bank_ammo[i];
636 void WeaponEditorDlg::OnSelchangeMissile1()
640 m_ammo_max1 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 + First_secondary_index - 1);
641 m_ammo1 = m_ammo_max1 ? (m_ammo_max1) : 0;
645 void WeaponEditorDlg::OnSelchangeMissile2()
649 m_ammo_max2 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile2 + First_secondary_index - 1);
650 m_ammo2 = m_ammo_max2 ? (m_ammo_max2) : 0;
654 void WeaponEditorDlg::OnSelchangeMissile3()
658 m_ammo_max3 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile3 + First_secondary_index - 1);
659 m_ammo3 = m_ammo_max3 ? (m_ammo_max3) : 0;
663 void WeaponEditorDlg::OnSelchangeMissile4()
667 m_ammo_max4 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile4 + First_secondary_index - 1);
668 m_ammo4 = m_ammo_max4 ? (m_ammo_max4) : 0;