2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
10 * $Logfile: /Freespace2/code/Fred2/WeaponEditorDlg.cpp $
15 * Weapon editor dialog box handling code
18 * Revision 1.3 2002/06/09 04:41:17 relnev
19 * added copyright header
21 * Revision 1.2 2002/05/07 03:16:44 theoddone33
22 * The Great Newline Fix
24 * Revision 1.1.1.1 2002/05/03 03:28:09 root
28 * 4 4/28/99 11:13p Dave
29 * Temporary checkin of artillery code.
31 * 3 4/23/99 12:01p Johnson
34 * 2 10/07/98 6:28p Dave
35 * Initial checkin. Renamed all relevant stuff to be Fred2 instead of
36 * Fred. Globalized mission and campaign file extensions. Removed Silent
37 * Threat specific code.
39 * 1 10/07/98 3:02p Dave
41 * 1 10/07/98 3:00p Dave
43 * 17 5/14/98 5:31p Hoffoss
44 * Fixed some stupid behaviour in this editor related to ammo counts being
47 * 16 4/22/98 11:27a Hoffoss
48 * Make big weapons available for capital ships as well as big ships (why
49 * the hell a capital ship isn't a big ship is beyond me, though).
51 * 15 4/14/98 11:46a Johnson
52 * Added window enables for spinners, but it seems to be ignored.
54 * 14 2/26/98 10:44a Johnson
55 * Fixed bug with SetRange() not being called on editor first open.
57 * 13 2/22/98 1:32a Hoffoss
58 * Changed editor to use raw ammo counts isntead of percentages, and make
59 * it select first item in list by default.
61 * 12 2/13/98 3:38p Johnson
62 * Fixed bug where multi ship editing won't update player ships.
64 * 11 12/11/97 5:46p Hoffoss
65 * Changed Fred to not display weapons that are not available to various
68 * 10 9/16/97 9:41p Hoffoss
69 * Changed Fred code around to stop using Parse_player structure for
70 * player information, and use actual ships instead.
72 * 9 5/30/97 4:50p Hoffoss
73 * Added code to allow marked ship editing of data in child dialogs of
76 * 8 4/21/97 5:02p Hoffoss
77 * Player/player status editing supported, and both saved and loaded from
80 * 7 4/16/97 2:02p Hoffoss
81 * Fixed bug Mike created by changing code while I had file checked out
84 * 6 4/16/97 1:59p Hoffoss
85 * Weapon editor now fully functional.
87 * 5 4/10/97 3:20p Mike
88 * Change hull damage to be like shields.
90 * 4 4/09/97 11:48a Hoffoss
91 * Initial work to weapon editor.
93 * 3 3/31/97 6:07p Hoffoss
94 * Fixed several errors, including BG editor not graying fields, BG editor
95 * not updating image when changed, Removed obsolete data from Weapon
96 * editor, priority not being saved when missions saved, priority not
97 * editable in initial orders editor.
99 * 2 2/17/97 5:28p Hoffoss
100 * Checked RCS headers, added them were missing, changing description to
101 * something better, etc where needed.
108 #include "weaponeditordlg.h"
109 #include "linklist.h"
110 #include "management.h"
114 #define BLANK_FIELD -99
117 #define new DEBUG_NEW
119 static char THIS_FILE[] = __FILE__;
122 /////////////////////////////////////////////////////////////////////////////
123 // WeaponEditorDlg dialog
125 WeaponEditorDlg::WeaponEditorDlg(CWnd* pParent /*=NULL*/)
126 : CDialog(WeaponEditorDlg::IDD, pParent)
128 //{{AFX_DATA_INIT(WeaponEditorDlg)
147 int save_number(char *str, int *val)
153 sprintf(buf, "%d", num);
154 if (strncmp(str, buf, strlen(buf)))
161 void WeaponEditorDlg::DoDataExchange(CDataExchange* pDX)
165 CDialog::DoDataExchange(pDX);
166 //{{AFX_DATA_MAP(WeaponEditorDlg)
167 DDX_Control(pDX, IDC_SPIN4, m_spin4);
168 DDX_Control(pDX, IDC_SPIN3, m_spin3);
169 DDX_Control(pDX, IDC_SPIN2, m_spin2);
170 DDX_Control(pDX, IDC_SPIN1, m_spin1);
171 DDX_CBIndex(pDX, IDC_AI_CLASS, m_ai_class);
172 DDX_CBIndex(pDX, IDC_GUN1, m_gun1);
173 DDX_CBIndex(pDX, IDC_GUN2, m_gun2);
174 DDX_CBIndex(pDX, IDC_GUN3, m_gun3);
175 DDX_CBIndex(pDX, IDC_MISSILE1, m_missile1);
176 DDX_CBIndex(pDX, IDC_MISSILE2, m_missile2);
177 DDX_CBIndex(pDX, IDC_MISSILE3, m_missile3);
178 DDX_CBIndex(pDX, IDC_MISSILE4, m_missile4);
179 DDX_LBIndex(pDX, IDC_LIST, m_cur_item);
182 if (pDX->m_bSaveAndValidate) {
183 GetDlgItem(IDC_AMMO1)->GetWindowText(str);
184 if (save_number((char *) (LPCSTR) str, &m_ammo1)) {
185 m_ammo_max1 = (m_missile1 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 + First_secondary_index - 1);
188 if (m_ammo1 > m_ammo_max1)
189 m_ammo1 = m_ammo_max1;
192 GetDlgItem(IDC_AMMO2)->GetWindowText(str);
193 if (save_number((char *) (LPCSTR) str, &m_ammo2)) {
194 m_ammo_max2 = (m_missile2 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 1, m_missile2 + First_secondary_index - 1);
197 if (m_ammo2 > m_ammo_max2)
198 m_ammo2 = m_ammo_max2;
201 GetDlgItem(IDC_AMMO3)->GetWindowText(str);
202 if (save_number((char *) (LPCSTR) str, &m_ammo3)) {
203 m_ammo_max3 = (m_missile3 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 2, m_missile3 + First_secondary_index - 1);
206 if (m_ammo3 > m_ammo_max3)
207 m_ammo3 = m_ammo_max3;
210 GetDlgItem(IDC_AMMO4)->GetWindowText(str);
211 if (save_number((char *) (LPCSTR) str, &m_ammo4)) {
212 m_ammo_max4 = (m_missile4 <= 0) ? 0 : get_max_ammo_count_for_bank(m_ship_class, 3, m_missile4 + First_secondary_index - 1);
215 if (m_ammo4 > m_ammo_max4)
216 m_ammo4 = m_ammo_max4;
219 m_spin1.SetRange(0, m_ammo_max1);
220 m_spin2.SetRange(0, m_ammo_max2);
221 m_spin3.SetRange(0, m_ammo_max3);
222 m_spin4.SetRange(0, m_ammo_max4);
225 if (m_ammo1 != BLANK_FIELD)
226 DDX_Text(pDX, IDC_AMMO1, m_ammo1);
228 GetDlgItem(IDC_AMMO1)->SetWindowText("");
230 if (m_ammo2 != BLANK_FIELD)
231 DDX_Text(pDX, IDC_AMMO2, m_ammo2);
233 GetDlgItem(IDC_AMMO2)->SetWindowText("");
235 if (m_ammo3 != BLANK_FIELD)
236 DDX_Text(pDX, IDC_AMMO3, m_ammo3);
238 GetDlgItem(IDC_AMMO3)->SetWindowText("");
240 if (m_ammo4 != BLANK_FIELD)
241 DDX_Text(pDX, IDC_AMMO4, m_ammo4);
243 GetDlgItem(IDC_AMMO4)->SetWindowText("");
247 BEGIN_MESSAGE_MAP(WeaponEditorDlg, CDialog)
248 //{{AFX_MSG_MAP(WeaponEditorDlg)
249 ON_LBN_SELCHANGE(IDC_LIST, OnSelchangeList)
251 ON_CBN_SELCHANGE(IDC_MISSILE1, OnSelchangeMissile1)
252 ON_CBN_SELCHANGE(IDC_MISSILE2, OnSelchangeMissile2)
253 ON_CBN_SELCHANGE(IDC_MISSILE3, OnSelchangeMissile3)
254 ON_CBN_SELCHANGE(IDC_MISSILE4, OnSelchangeMissile4)
258 /////////////////////////////////////////////////////////////////////////////
259 // WeaponEditorDlg message handlers
261 BOOL WeaponEditorDlg::OnInitDialog()
263 int i, z, big = 1, end1, end2, inst, flag = 0;
265 model_subsystem *psub;
266 ship_subsys *ssl, *pss;
270 CDialog::OnInitDialog();
273 m_ship = Objects[cur_object_index].instance;
275 end1 = First_secondary_index;
276 end2 = Num_weapon_types;
278 list = (CListBox *) GetDlgItem(IDC_LIST);
280 z = list->AddString("Pilot");
282 list->SetItemDataPtr(z, &pilot);
283 ptr = GET_FIRST(&obj_used_list);
284 while (ptr != END_OF_LIST(&obj_used_list)) {
285 if (((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) && (ptr->flags & OF_MARKED)) {
286 inst = ptr->instance;
287 if (!(ship_get_SIF(inst) & (SIF_BIG_SHIP | SIF_HUGE_SHIP)))
291 pilot = Ships[inst].weapons;
292 m_ship_class = Ships[inst].ship_info_index;
296 SDL_assert(Ships[inst].ship_info_index == m_ship_class);
297 if (pilot.ai_class != Ships[inst].weapons.ai_class)
298 pilot.ai_class = BLANK_FIELD;
300 for (i=0; i<MAX_PRIMARY_BANKS; i++)
301 if (pilot.primary_bank_weapons[i] != Ships[inst].weapons.primary_bank_weapons[i])
302 pilot.primary_bank_weapons[i] = BLANK_FIELD;
304 for (i=0; i<MAX_SECONDARY_BANKS; i++) {
305 if (pilot.secondary_bank_weapons[i] != Ships[inst].weapons.secondary_bank_weapons[i])
306 pilot.secondary_bank_weapons[i] = BLANK_FIELD;
307 if (pilot.secondary_bank_ammo[i] != Ships[inst].weapons.secondary_bank_ammo[i])
308 pilot.secondary_bank_ammo[i] = BLANK_FIELD;
317 if (!(ship_get_SIF(m_ship) & (SIF_BIG_SHIP | SIF_HUGE_SHIP)))
320 m_ship_class = Ships[m_ship].ship_info_index;
321 list->SetItemDataPtr(z, &Ships[m_ship].weapons);
322 ssl = &Ships[m_ship].subsys_list;
323 for (pss = GET_FIRST(ssl); pss != END_OF_LIST(ssl); pss = GET_NEXT(pss)) {
324 psub = pss->system_info;
325 if (psub->type == SUBSYSTEM_TURRET) {
326 z = list->AddString(psub->subobj_name);
327 list->SetItemDataPtr(z, &pss->weapons);
332 box = (CComboBox *) GetDlgItem(IDC_AI_CLASS);
333 for (i=0; i<Num_ai_classes; i++){
334 box->AddString(Ai_class_names[i]);
337 for (i=0; i<end1; i++){
338 if ((Weapon_info[i].wi_flags & WIF_CHILD) || (!big && (Weapon_info[i].wi_flags & WIF_BIG_ONLY))){
343 box = (CComboBox *) GetDlgItem(IDC_GUN1);
344 box->AddString("None");
345 for (i=0; i<end1; i++){
346 box->AddString(Weapon_info[i].name);
349 box = (CComboBox *) GetDlgItem(IDC_GUN2);
350 box->AddString("None");
351 for (i=0; i<end1; i++){
352 box->AddString(Weapon_info[i].name);
355 box = (CComboBox *) GetDlgItem(IDC_GUN3);
356 box->AddString("None");
357 for (i=0; i<end1; i++){
358 box->AddString(Weapon_info[i].name);
361 for (i=First_secondary_index; i<end2; i++){
362 if ((Weapon_info[i].wi_flags & WIF_CHILD) || (!big && (Weapon_info[i].wi_flags & WIF_BIG_ONLY))){
367 box = (CComboBox *) GetDlgItem(IDC_MISSILE1);
368 box->AddString("None");
369 for (i=First_secondary_index; i<end2; i++){
370 box->AddString(Weapon_info[i].name);
373 box = (CComboBox *) GetDlgItem(IDC_MISSILE2);
374 box->AddString("None");
375 for (i=First_secondary_index; i<end2; i++){
376 box->AddString(Weapon_info[i].name);
379 box = (CComboBox *) GetDlgItem(IDC_MISSILE3);
380 box->AddString("None");
381 for (i=First_secondary_index; i<end2; i++){
382 box->AddString(Weapon_info[i].name);
385 box = (CComboBox *) GetDlgItem(IDC_MISSILE4);
386 box->AddString("None");
387 for (i=First_secondary_index; i<end2; i++){
388 box->AddString(Weapon_info[i].name);
398 void WeaponEditorDlg::OnSelchangeList()
405 void WeaponEditorDlg::change_selection()
407 CString a1, a2, a3, a4;
409 GetDlgItem(IDC_AMMO1)->GetWindowText(a1);
410 GetDlgItem(IDC_AMMO2)->GetWindowText(a2);
411 GetDlgItem(IDC_AMMO3)->GetWindowText(a3);
412 GetDlgItem(IDC_AMMO4)->GetWindowText(a4);
414 if (m_last_item >= 0) {
415 cur_weapon->ai_class = m_ai_class;
416 cur_weapon->primary_bank_weapons[0] = m_gun1 - 1;
417 cur_weapon->primary_bank_weapons[1] = m_gun2 - 1;
418 cur_weapon->primary_bank_weapons[2] = m_gun3 - 1;
420 m_missile1 += First_secondary_index;
422 cur_weapon->secondary_bank_weapons[0] = m_missile1 - 1;
424 m_missile2 += First_secondary_index;
426 cur_weapon->secondary_bank_weapons[1] = m_missile2 - 1;
428 m_missile3 += First_secondary_index;
430 cur_weapon->secondary_bank_weapons[2] = m_missile3 - 1;
432 m_missile4 += First_secondary_index;
434 cur_weapon->secondary_bank_weapons[3] = m_missile4 - 1;
435 cur_weapon->secondary_bank_ammo[0] = m_ammo_max1 ? (m_ammo1 * 100 / m_ammo_max1) : 0;
436 cur_weapon->secondary_bank_ammo[1] = m_ammo_max2 ? (m_ammo2 * 100 / m_ammo_max2) : 0;
437 cur_weapon->secondary_bank_ammo[2] = m_ammo_max3 ? (m_ammo3 * 100 / m_ammo_max3) : 0;
438 cur_weapon->secondary_bank_ammo[3] = m_ammo_max4 ? (m_ammo4 * 100 / m_ammo_max4) : 0;
441 cur_weapon->secondary_bank_ammo[0] = BLANK_FIELD;
443 cur_weapon->secondary_bank_ammo[1] = BLANK_FIELD;
445 cur_weapon->secondary_bank_ammo[2] = BLANK_FIELD;
447 cur_weapon->secondary_bank_ammo[3] = BLANK_FIELD;
451 m_gun1 = m_gun2 = m_gun3 = m_missile1 = m_missile2 = m_missile3 = m_missile4 = -1;
452 m_ammo1 = m_ammo2 = m_ammo3 = m_ammo4 = BLANK_FIELD;
453 m_ammo_max1 = m_ammo_max2 = m_ammo_max3 = m_ammo_max4 = 0;
454 if (m_cur_item < 0) {
455 m_last_item = m_cur_item;
456 GetDlgItem(IDC_GUN1)->EnableWindow(FALSE);
457 GetDlgItem(IDC_GUN2)->EnableWindow(FALSE);
458 GetDlgItem(IDC_GUN3)->EnableWindow(FALSE);
459 GetDlgItem(IDC_MISSILE1)->EnableWindow(FALSE);
460 GetDlgItem(IDC_MISSILE2)->EnableWindow(FALSE);
461 GetDlgItem(IDC_MISSILE3)->EnableWindow(FALSE);
462 GetDlgItem(IDC_MISSILE4)->EnableWindow(FALSE);
463 GetDlgItem(IDC_AMMO1)->EnableWindow(FALSE);
464 GetDlgItem(IDC_AMMO2)->EnableWindow(FALSE);
465 GetDlgItem(IDC_AMMO3)->EnableWindow(FALSE);
466 GetDlgItem(IDC_AMMO4)->EnableWindow(FALSE);
467 GetDlgItem(IDC_SPIN1)->EnableWindow(FALSE);
468 GetDlgItem(IDC_SPIN2)->EnableWindow(FALSE);
469 GetDlgItem(IDC_SPIN3)->EnableWindow(FALSE);
470 GetDlgItem(IDC_SPIN4)->EnableWindow(FALSE);
471 GetDlgItem(IDC_AI_CLASS)->EnableWindow(FALSE);
476 cur_weapon = (ship_weapon *) ((CListBox *) GetDlgItem(IDC_LIST))->GetItemDataPtr(m_cur_item);
477 GetDlgItem(IDC_AI_CLASS)->EnableWindow(TRUE);
478 m_ai_class = cur_weapon->ai_class;
480 if (cur_weapon->num_primary_banks > 0) {
481 m_gun1 = cur_weapon->primary_bank_weapons[0] + 1;
482 GetDlgItem(IDC_GUN1)->EnableWindow(TRUE);
484 GetDlgItem(IDC_GUN1)->EnableWindow(FALSE);
486 if (cur_weapon->num_primary_banks > 1) {
487 m_gun2 = cur_weapon->primary_bank_weapons[1] + 1;
488 GetDlgItem(IDC_GUN2)->EnableWindow(TRUE);
490 GetDlgItem(IDC_GUN2)->EnableWindow(FALSE);
492 if (cur_weapon->num_primary_banks > 2) {
493 m_gun3 = cur_weapon->primary_bank_weapons[2] + 1;
494 GetDlgItem(IDC_GUN3)->EnableWindow(TRUE);
496 GetDlgItem(IDC_GUN3)->EnableWindow(FALSE);
498 if (cur_weapon->num_secondary_banks > 0) {
499 m_missile1 = cur_weapon->secondary_bank_weapons[0] + 1;
500 if (m_missile1 > 0) {
501 m_ammo_max1 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 - 1);
502 if (cur_weapon->secondary_bank_ammo[0] != BLANK_FIELD)
503 m_ammo1 = cur_weapon->secondary_bank_ammo[0] * m_ammo_max1 / 100;
504 m_missile1 -= First_secondary_index;
507 GetDlgItem(IDC_MISSILE1)->EnableWindow(TRUE);
508 GetDlgItem(IDC_AMMO1)->EnableWindow(TRUE);
509 GetDlgItem(IDC_SPIN1)->EnableWindow(TRUE);
512 GetDlgItem(IDC_MISSILE1)->EnableWindow(FALSE);
513 GetDlgItem(IDC_AMMO1)->EnableWindow(FALSE);
514 GetDlgItem(IDC_SPIN1)->EnableWindow(FALSE);
517 if (cur_weapon->num_secondary_banks > 1) {
518 m_missile2 = cur_weapon->secondary_bank_weapons[1] + 1;
519 if (m_missile2 > 0) {
520 m_ammo_max2 = get_max_ammo_count_for_bank(m_ship_class, 1, m_missile2 - 1);
521 if (cur_weapon->secondary_bank_ammo[1] != BLANK_FIELD)
522 m_ammo2 = cur_weapon->secondary_bank_ammo[1] * m_ammo_max2 / 100;
523 m_missile2 -= First_secondary_index;
526 GetDlgItem(IDC_MISSILE2)->EnableWindow(TRUE);
527 GetDlgItem(IDC_AMMO2)->EnableWindow(TRUE);
528 GetDlgItem(IDC_SPIN2)->EnableWindow(TRUE);
531 GetDlgItem(IDC_MISSILE2)->EnableWindow(FALSE);
532 GetDlgItem(IDC_AMMO2)->EnableWindow(FALSE);
533 GetDlgItem(IDC_SPIN2)->EnableWindow(FALSE);
536 if (cur_weapon->num_secondary_banks > 2) {
537 m_missile3 = cur_weapon->secondary_bank_weapons[2] + 1;
538 if (m_missile3 > 0) {
539 m_ammo_max3 = get_max_ammo_count_for_bank(m_ship_class, 2, m_missile3 - 1);
540 if (cur_weapon->secondary_bank_ammo[2] != BLANK_FIELD)
541 m_ammo3 = cur_weapon->secondary_bank_ammo[2] * m_ammo_max3 / 100;
542 m_missile3 -= First_secondary_index;
545 GetDlgItem(IDC_MISSILE3)->EnableWindow(TRUE);
546 GetDlgItem(IDC_AMMO3)->EnableWindow(TRUE);
547 GetDlgItem(IDC_SPIN3)->EnableWindow(TRUE);
550 GetDlgItem(IDC_MISSILE3)->EnableWindow(FALSE);
551 GetDlgItem(IDC_AMMO3)->EnableWindow(FALSE);
552 GetDlgItem(IDC_SPIN3)->EnableWindow(FALSE);
555 if (cur_weapon->num_secondary_banks > 3) {
556 m_missile4 = cur_weapon->secondary_bank_weapons[3] + 1;
557 if (m_missile4 > 0) {
558 m_ammo_max4 = get_max_ammo_count_for_bank(m_ship_class, 3, m_missile4 - 1);
559 if (cur_weapon->secondary_bank_ammo[3] != BLANK_FIELD)
560 m_ammo4 = cur_weapon->secondary_bank_ammo[3] * m_ammo_max4 / 100;
561 m_missile4 -= First_secondary_index;
564 GetDlgItem(IDC_MISSILE4)->EnableWindow(TRUE);
565 GetDlgItem(IDC_AMMO4)->EnableWindow(TRUE);
566 GetDlgItem(IDC_SPIN4)->EnableWindow(TRUE);
569 GetDlgItem(IDC_MISSILE4)->EnableWindow(FALSE);
570 GetDlgItem(IDC_AMMO4)->EnableWindow(FALSE);
571 GetDlgItem(IDC_SPIN4)->EnableWindow(FALSE);
574 m_last_item = m_cur_item;
577 if (m_ammo1 == BLANK_FIELD)
578 GetDlgItem(IDC_AMMO1)->SetWindowText("");
579 if (m_ammo2 == BLANK_FIELD)
580 GetDlgItem(IDC_AMMO2)->SetWindowText("");
581 if (m_ammo3 == BLANK_FIELD)
582 GetDlgItem(IDC_AMMO3)->SetWindowText("");
583 if (m_ammo4 == BLANK_FIELD)
584 GetDlgItem(IDC_AMMO4)->SetWindowText("");
588 void WeaponEditorDlg::OnOK()
597 void WeaponEditorDlg::OnCancel()
606 void WeaponEditorDlg::OnClose()
615 void WeaponEditorDlg::update_pilot()
622 ptr = GET_FIRST(&obj_used_list);
623 while (ptr != END_OF_LIST(&obj_used_list)) {
624 if (((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)) && (ptr->flags & OF_MARKED)) {
625 weapon = &Ships[ptr->instance].weapons;
627 if (pilot.ai_class >= 0)
628 weapon->ai_class = pilot.ai_class;
630 for (i=0; i<MAX_PRIMARY_BANKS; i++)
631 if (pilot.primary_bank_weapons[i] != -2)
632 weapon->primary_bank_weapons[i] = pilot.primary_bank_weapons[i];
634 for (i=0; i<MAX_SECONDARY_BANKS; i++) {
635 if (pilot.secondary_bank_weapons[i] != -2)
636 weapon->secondary_bank_weapons[i] = pilot.secondary_bank_weapons[i];
637 if (pilot.secondary_bank_ammo[i] >= 0)
638 weapon->secondary_bank_ammo[i] = pilot.secondary_bank_ammo[i];
647 void WeaponEditorDlg::OnSelchangeMissile1()
651 m_ammo_max1 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile1 + First_secondary_index - 1);
652 m_ammo1 = m_ammo_max1 ? (m_ammo_max1) : 0;
656 void WeaponEditorDlg::OnSelchangeMissile2()
660 m_ammo_max2 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile2 + First_secondary_index - 1);
661 m_ammo2 = m_ammo_max2 ? (m_ammo_max2) : 0;
665 void WeaponEditorDlg::OnSelchangeMissile3()
669 m_ammo_max3 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile3 + First_secondary_index - 1);
670 m_ammo3 = m_ammo_max3 ? (m_ammo_max3) : 0;
674 void WeaponEditorDlg::OnSelchangeMissile4()
678 m_ammo_max4 = get_max_ammo_count_for_bank(m_ship_class, 0, m_missile4 + First_secondary_index - 1);
679 m_ammo4 = m_ammo_max4 ? (m_ammo_max4) : 0;