FS2_Open
Open source remastering of the Freespace 2 engine
dumpstats.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
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 the
6  * source.
7  *
8 */
9 
10 // DumpStats.cpp : implementation file
11 //
12 
13 #include "stdafx.h"
14 #include "FRED.h"
15 #include "DumpStats.h"
16 #include "starfield/starfield.h"
17 #include "nebula/neb.h"
18 #include "cfile/cfile.h"
19 #include "globalincs/linklist.h"
20 #include "object/object.h"
21 #include "object/waypoint.h"
22 #include "jumpnode/jumpnode.h"
23 #include "mission/missiongoals.h"
24 #include "gamesnd/eventmusic.h"
25 #include "asteroid/asteroid.h"
27 #include "weapon/weapon.h"
28 
29 #ifdef _DEBUG
30 #undef THIS_FILE
31 static char THIS_FILE[] = __FILE__;
32 #endif
33 
35 // DumpStats dialog
36 
37 
38 DumpStats::DumpStats(CWnd* pParent /*=NULL*/)
39  : CDialog(DumpStats::IDD, pParent)
40 {
41  //{{AFX_DATA_INIT(DumpStats)
42  // NOTE: the ClassWizard will add member initialization here
43  //}}AFX_DATA_INIT
44 }
45 
46 
47 void DumpStats::DoDataExchange(CDataExchange* pDX)
48 {
49  CDialog::DoDataExchange(pDX);
50  //{{AFX_DATA_MAP(DumpStats)
51  // NOTE: the ClassWizard will add DDX and DDV calls here
52  //}}AFX_DATA_MAP
53 }
54 
55 
56 BEGIN_MESSAGE_MAP(DumpStats, CDialog)
57  //{{AFX_MSG_MAP(DumpStats)
58  ON_BN_CLICKED(IDC_DUMP_TO_FILE, OnDumpToFile)
59  //}}AFX_MSG_MAP
60 END_MESSAGE_MAP()
61 
63 // DumpStats message handlers
64 
65 BOOL DumpStats::OnInitDialog()
66 {
67  CDialog::OnInitDialog();
68 
69  CString buffer;
70  int i;
71 
72  // get author, title, etc
73  get_mission_stats(buffer);
74 
75  // get nebula, stars, etc.
76  get_background_stats(buffer);
77 
78  // get number or ships, waypoints, start points, etc.
79  get_object_stats(buffer);
80 
81  // get objectives / goals
82  get_objectives_and_goals(buffer);
83 
84  // get ship selection for player wings
85  get_ship_weapon_selection(buffer);
86 
87  // get messaging info
88  get_messaging_info(buffer);
89 
90  // get species ship breakdown
91  get_species_ship_breakdown(buffer);
92 
93  // get default loadouts
94  get_default_ship_loadouts(buffer);
95 
96  int num_tab_stops = 5;
97  int tab_stops[5];
98  for (i=0; i<5; i++) {
99  tab_stops[i] = (i+1) * 16;
100  }
101 
102  ((CEdit*) GetDlgItem(IDC_STATS_TEXT))->SetTabStops(num_tab_stops, tab_stops);
103  ((CEdit*) GetDlgItem(IDC_STATS_TEXT))->SetWindowText(buffer);
104 
105  return TRUE; // return TRUE unless you set the focus to a control
106  // EXCEPTION: OCX Property Pages should return FALSE
107 }
108 
110 {
111  // TODO: Add your control notification handler code here
112 
113  // get dump from window
114  CString buffer;
115  ((CEdit*) GetDlgItem(IDC_STATS_TEXT))->GetWindowText(buffer);
116 
117  CString dump_filename;
118  dump_filename.Format("%s.dmp", Mission_filename);
119 
120  CFILE *fp;
121 
122  fp = cfopen((char *)LPCTSTR(dump_filename), "wt", CFILE_NORMAL, CF_TYPE_MISSIONS);
123  cfputs((char *)LPCTSTR(buffer), fp);
124  cfclose(fp);
125 }
126 
128 {
129  CString temp;
130 
131  // Mission info
132  buffer += "\t MISSION INFO\r\n";
133 
134  temp.Format("Title: %s\r\n", The_mission.name);
135  buffer += temp;
136 
137  temp.Format("Filename: %s\r\n", Mission_filename);
138  buffer += temp;
139 
140  temp.Format("Author: %s\r\n", The_mission.author);
141  buffer += temp;
142 
143  temp.Format("Description: %s\r\n", The_mission.mission_desc);
144  buffer += temp;
145 
146  temp.Format("Notes: %s\r\n", The_mission.notes);
147  buffer += temp;
148 
150  temp.Format("Mission type: Single Player\r\n");
152  temp.Format("Mission type: Multi Coop\r\n");
154  temp.Format("Mission type: Multi Team vs. Team\r\n");
156  temp.Format("Mission type: Dogfight\r\n");
157  }
158  buffer += temp;
159 
161  temp.Format("\tNum respawns: %d\r\n", The_mission.num_respawns);
162  buffer += temp;
163  }
164 
165  if (Current_soundtrack_num >= 0) {
166  temp.Format("\tMusic: %s\r\n", Soundtracks[Current_soundtrack_num].name);
167  buffer += temp;
168  }
169 
171  buffer += "\tRed Alert\r\n";
172  }
173 
175  buffer += "\tScramble\r\n";
176  }
177 
179  buffer += "\tNo Promotions\r\n";
180  }
181 
183  buffer += "\tNo Support ships\r\n";
184  }
185 
186  temp.Format("Squadron: %s, Squadron logo: %s\r\n", The_mission.squad_name, The_mission.squad_filename);
187  buffer += temp;
188 }
189 
191 {
192  CString temp;
193  int i;
194 
195  // Background
196  buffer += "\r\n\tBACKGROUND INFO\r\n";
197 
198  // Num stars
199  temp.Format("Num_stars: %d\r\n", Num_stars);
200  buffer += temp;
201 
202  // Suns
203  temp.Format("Num_suns: %d\r\n", stars_get_num_suns());
204  buffer += temp;
205 
206  for (i=0; i<stars_get_num_suns(); i++) {
207  temp.Format("\tSun%d bitmap name: %s\r\n", i, stars_get_sun_name(i));
208  buffer += temp;
209  //temp.Format("Sun%d glow name: %s\r\n", i, Suns[i].glow_filename);
210  //buffer += temp;
211  }
212 
213  // Starfield bitmaps
214  temp.Format("Num_starfield_bitmaps: %d\r\n", stars_get_num_bitmaps());
215  buffer += temp;
216 
217  for (i=0; i<stars_get_num_bitmaps(); i++) {
218  temp.Format("\tStarfield%d bitmap name: %s\r\n", i, stars_get_bitmap_name(i));
219  buffer += temp;
220  }
221 
222  // Asteroids
223  temp.Format("Num Field Debris Chunks: %d\r\n", Asteroid_field.num_initial_asteroids);
224  buffer += temp;
226  // active or passive
228  temp.Format("\tActive Field\r\n");
229  buffer += temp;
230 
231  temp.Format("\tAsteroid Debris\r\n");
232  buffer += temp;
233  } else {
234  // passive
235  temp.Format("\tPassive Field\r\n");
236  buffer += temp;
237 
239  temp.Format("\tAsteroid Debris\r\n");
240  buffer += temp;
241  } else {
242  temp.Format("\tShip Debris\r\n");
243  buffer += temp;
244 
245  // species
246  temp.Format("\t\tSpecies: ");
247  for (i=0; i<(int)Species_info.size(); i++) {
248  if (Asteroid_field.field_debris_type[i] >= 0) {
249  temp += CString(Species_info[(Asteroid_field.field_debris_type[i] / NUM_DEBRIS_SIZES) - 1].species_name) + " ";
250  }
251  }
252 
253  temp += "\r\n";
254 
255  buffer += temp;
256  }
257  }
258  }
259 
260  // Nebula mission
261  int nebula_mission = (The_mission.flags & MISSION_FLAG_FULLNEB);
262  temp = "Nebula mission:";
263  if (nebula_mission) {
264  temp += " Yes\r\n";
265  } else {
266  temp += " No\r\n";
267  }
268  buffer += temp;
269 
270  if (nebula_mission) {
271  // range
272  temp.Format("\tNebula awacs range: %.0f\r\n", Neb2_awacs);
273  buffer += temp;
274 
275  // list of poofs
276  for (i=0; i<MAX_NEB2_POOFS; i++) {
277  if ( Neb2_poof_flags & (1<<i) ) {
278  temp.Format("\tNebula poof: %s\r\n", Neb2_poof_filenames[i]);
279  buffer += temp;
280  }
281  }
282 
283  // nebula texture
284  if (strlen(Neb2_texture_name) > 0) { //-V805
285  temp.Format("\tNebula texture: %s\r\n", Neb2_texture_name);
286  buffer += temp;
287  }
288  } else {
289  // FS! nebula pattern
290  if (Nebula_index > 0) {
291  temp.Format("\tOld style FS1 nebula filename: %s\r\n", Nebula_filenames[Nebula_index]);
292  buffer += temp;
293  }
294  }
295 
296  // Subspace mission
297  temp = "Subspace mission:";
299  temp += " Yes\r\n";
300  } else {
301  temp += " No\r\n";
302  }
303  buffer += temp;
304 }
305 
307 {
308  object *objp;
309  int obj_type_count[MAX_OBJECT_TYPES];
310  CString temp;
311  int num_small_ships, num_big_ships, num_huge_ships;
312  int i;
313 
314  memset(obj_type_count,0, sizeof(obj_type_count));
315  num_small_ships = num_big_ships = num_huge_ships= 0;
316 
317  for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
318 
319  // inc big ship or small ship count
320  if ( (objp->type == OBJ_SHIP) || (objp->type == OBJ_START) ) {
321  if ( Ship_info[Ships[objp->instance].ship_info_index].flags & SIF_SMALL_SHIP ) {
322  num_small_ships++;
323  } else if ( Ship_info[Ships[objp->instance].ship_info_index].flags & SIF_BIG_SHIP ) {
324  num_big_ships++;
325  } else if ( Ship_info[Ships[objp->instance].ship_info_index].flags & SIF_HUGE_SHIP ) {
326  num_huge_ships++;
327  }
328  }
329 
330  obj_type_count[objp->type]++;
331  }
332 
333  // Statistics
334  buffer += "\r\n\tMISSION STATISTICS\r\n";
335 
336  // OBJ_START is also a OBJ_SHIP
337  // not counting num_waves (for wings)
338  obj_type_count[OBJ_SHIP] += obj_type_count[OBJ_START];
339 
340  for (i=0; i<MAX_OBJECT_TYPES; i++) {
341  if (obj_type_count[i] > 0) {
342  switch(i) {
343  case OBJ_SHIP:
344  temp.Format("Ship Count: %d\r\n", obj_type_count[i]);
345  buffer += temp;
346  break;
347 
348  case OBJ_START:
349  temp.Format("Start Count: %d\r\n", obj_type_count[i]);
350  buffer += temp;
351  break;
352 
353  case OBJ_WAYPOINT:
354  temp.Format("Waypoint Count: %d\r\n", obj_type_count[i]);
355  buffer += temp;
356  break;
357 
358  case OBJ_WING:
359  temp.Format("Wing Count: %d\r\n", obj_type_count[i]);
360  buffer += temp;
361  break;
362 
363  case OBJ_JUMP_NODE:
364  temp.Format("Jump Node Count: %d\r\n", obj_type_count[i]);
365  buffer += temp;
366  break;
367 
368  default:
369  Int3();
370  break;
371  }
372  }
373  }
374 
375  buffer += "\r\nSHIPS\r\n";
376  temp.Format("\tNum small ships: %d\r\n", num_small_ships);
377  buffer += temp;
378 
379  temp.Format("\tNum big ships: %d\r\n", num_big_ships);
380  buffer += temp;
381 
382  temp.Format("\tNum huge ships: %d\r\n", num_huge_ships);
383  buffer += temp;
384 
385  // Waypoints
386  int total_waypoints = 0;
387  buffer += "\r\nWAYPOINTS\r\n";
388 
390  for (ii = Waypoint_lists.begin(); ii != Waypoint_lists.end(); ++ii) {
391  temp.Format("\tWaypoint: %s, count: %d\r\n", ii->get_name(), ii->get_waypoints().size());
392  buffer += temp;
393  total_waypoints += ii->get_waypoints().size();
394  }
395 
396  if (total_waypoints > 0) {
397  temp.Format("\ttotal_waypoints: %d\r\n", total_waypoints);
398  buffer += temp;
399  }
400 
401  // Jumpnodes
402  buffer += "\r\nJUMPNODES\r\n";
403 
405  for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
406  temp.Format("\tJumpnode: %s\r\n", jnp->GetName());
407  buffer += temp;
408  }
409 
410  if (Jump_nodes.size() > 0) {
411  temp.Format("\ttotal_jumpnodes: %d\r\n", Jump_nodes.size());
412  buffer += temp;
413  }
414 
415 
416  // Wings
417  int num_counted_wings = 0;
418  buffer += "\r\nWINGS\r\n";
419  for (i=0; i<MAX_WINGS; i++) {
420  if (Wings[i].wave_count > 0) {
421  temp.Format("\tWing Name: %s, wave_count: %d, num_waves: %d\r\n", Wings[i].name, Wings[i].wave_count, Wings[i].num_waves);
422  buffer += temp;
423 
424  num_counted_wings++;
425  if (num_counted_wings == Num_wings) {
426  break;
427  }
428  }
429  }
430 
431  // Escort
432  buffer += "\r\nESCORT\r\n";
433  for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
434  if ( (objp->type == OBJ_SHIP) || (objp->type == OBJ_START) ) {
435  if (Ships[objp->instance].flags & SF_ESCORT) {
436  temp.Format("\tShip name: %s, priority: %d\r\n", Ships[objp->instance].ship_name, Ships[objp->instance].escort_priority);
437  buffer += temp;
438  }
439  }
440  }
441 
442  // Hotkeys
443  buffer += "\r\nHOTKEYS\r\n";
444 
445  // ship hotkeys
446  for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
447  if ( (objp->type == OBJ_SHIP) || (objp->type == OBJ_START) ) {
448  if (Ships[objp->instance].hotkey != -1) {
449  temp.Format("\tShip name: %s, hotkey: F%d\r\n", Ships[objp->instance].ship_name, (Ships[objp->instance].hotkey + 5));
450  buffer += temp;
451  }
452  }
453  }
454 
455  // wing hotkeys
456  for (i=0; i<MAX_WINGS; i++) {
457  if (Wings[i].wave_count > 0) {
458  if (Wings[i].hotkey != -1) {
459  temp.Format("\tWing name: %s, hotkey: F%d\r\n", Wings[i].name, (Wings[i].hotkey + 5));
460  buffer += temp;
461  }
462  }
463  }
464 
465 }
466 
468 {
469  CString temp;
470  int i;
471 
472  buffer += "\r\nOBJECTIVES AND GOALS\r\n";
473 
474  // objectives
475  for (i=0; i<Num_mission_events; i++) {
476  // name, objective_text, objective_key_text
477  if ( Mission_events[i].objective_text == NULL ) {
478  continue;
479  }
480  temp.Format("\tObjective: %s, text: %s, key_text: %s\r\n", Mission_events[i].name, Mission_events[i].objective_text, Mission_events[i].objective_key_text);
481  buffer += temp;
482  }
483 
484  buffer += "\r\n";
485 
486  // goals
487  for (i=0; i<Num_goals; i++) {
488  temp.Format("\tGoal: %s, text: %s", Mission_goals[i].name, Mission_goals[i].message);
489  buffer += temp;
490 
491  switch(Mission_goals[i].type & GOAL_TYPE_MASK) {
492  case PRIMARY_GOAL:
493  buffer += ", type: primary\r\n";
494  break;
495 
496  case SECONDARY_GOAL:
497  buffer += ", type: secondary\r\n";
498  break;
499 
500  case BONUS_GOAL:
501  buffer += ", type: bonus\r\n";
502  break;
503 
504  default:
505  Int3();
506  break;
507  }
508  }
509 
510 }
511 
513 {
514  CString temp;
515  int i,j;
516 
517  buffer += "\r\nSHIP WEAPON/SELECTION\r\n";
518  buffer += "Reported numbers are in addition to assigned ships and their default weapons\r\n";
519 
520  for (i=0; i<Num_teams; i++) {
521  temp.Format("Team %d\r\n", i);
522  buffer += temp;
523 
524  // ships
525  for (j=0; j<Team_data[i].num_ship_choices; j++) {
526  temp.Format("\tShip name: %s, count %d", Ship_info[Ships[Team_data[i].ship_list[j]].ship_info_index].name, Team_data[i].ship_count[j]);
527  buffer += temp;
528 
529  if (Team_data[i].ship_list[j] == Team_data[i].default_ship) {
530  temp = " DEFAULT SHIP\r\n";
531  } else {
532  temp = "\r\n";
533  }
534  buffer += temp;
535  }
536 
537  buffer += "\r\n";
538 
539  // weapons
540  for (j=0; j<Team_data[i].num_weapon_choices; j++) {
541  //if (Team_data[i].weaponry_pool[j] > 0)
542  temp.Format("\tWeapon name: %s, count %d\r\n", Weapon_info[Team_data[i].weaponry_pool[j]].name, Team_data[i].weaponry_count[j]);
543  buffer += temp;
544 
545  }
546  }
547 
548 }
549 
551 {
552  CString temp;
553  object *objp;
554  ship *shipp;
555 
556  buffer += "\r\nSHIP ACCEPTED ORDERS\r\n";
557 
558  // go through all ships and check (.orders_accepted against default_orders)
559  for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
560  if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
561  shipp = &Ships[objp->instance];
562 
564  temp.Format("\tShip: %s with nonstandard accepted orders\r\n", shipp->ship_name);
565  buffer += temp;
566  }
567  }
568  }
569 }
570 
572 {
573  CString temp;
574  int i;
575  int species;
576  object *objp;
577  ship *shipp;
578 
579  buffer += "\r\nSHIP SPECIES BREAKDOWN\r\n";
580 
581 
582  for (species=0; (uint) species < Species_info.size(); species++) {
583  buffer += Species_info[species].species_name;
584  buffer += "\r\n";
585 
586  // fighter wings
587  buffer += "\tFighter wings:\r\n";
588  for (i=0; i<MAX_WINGS; i++) {
589  if (Wings[i].wave_count > 0) {
590  int wing_leader_shipnum = Wings[i].ship_index[Wings[i].special_ship];
591  if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].species == species) {
592  if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].flags & SIF_FIGHTER) {
593  temp.Format("\t\tWing: %s, count: %d, waves: %d, type: %s\r\n", Wings[i].name, Wings[i].wave_count, Wings[i].num_waves, Ship_info[Ships[wing_leader_shipnum].ship_info_index].name);
594  buffer += temp;
595  }
596  }
597  }
598  }
599 
600  // bomber wings
601  buffer += "\tBomber wings:\r\n";
602  for (i=0; i<MAX_WINGS; i++) {
603  if (Wings[i].wave_count > 0) {
604  int wing_leader_shipnum = Wings[i].ship_index[Wings[i].special_ship];
605  if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].species == species) {
606  if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].flags & SIF_BOMBER) {
607  temp.Format("\t\tWing: %s, count: %d, waves: %d, type: %s\r\n", Wings[i].name, Wings[i].wave_count, Wings[i].num_waves, Ship_info[Ships[wing_leader_shipnum].ship_info_index].name);
608  buffer += temp;
609  }
610  }
611  }
612  }
613 
614  buffer += "\tFreighters, Cargo, Transports:\r\n";
615  // freighters and transports (cargo)
616  for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
617  if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
618  shipp = &Ships[objp->instance];
619 
620  if (Ship_info[shipp->ship_info_index].species == species) {
621  //if (shipp->wingnum == -1)
622  //if (shipp->cargo1 > 0)
623  if (Ship_info[shipp->ship_info_index].flags & (SIF_FREIGHTER | SIF_TRANSPORT | SIF_CARGO)) {
624  temp.Format("\t\tName: %s Type: %s, Cargo: %s\r\n", shipp->ship_name, Ship_info[shipp->ship_info_index].name, Cargo_names[shipp->cargo1]);
625  buffer += temp;
626  }
627  }
628  }
629  }
630 
631  buffer += "\tNav buoy, Escape pod, Sentry gun:\r\n";
632  for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
633  if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
634  shipp = &Ships[objp->instance];
635 
636  if (Ship_info[shipp->ship_info_index].species == species) {
637  //if (shipp->wingnum == -1)
638  //if (shipp->cargo1 > 0)
640  temp.Format("\t\tName: %s, Type: %s Cargo: %s\r\n", shipp->ship_name, Ship_info[shipp->ship_info_index].name, Cargo_names[shipp->cargo1]);
641  buffer += temp;
642  }
643  }
644  }
645  }
646 
647 
648  // cruiser
649  buffer += "\tCruiser:\r\n";
650  for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
651  if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
652  shipp = &Ships[objp->instance];
653 
654  if (Ship_info[shipp->ship_info_index].species == species) {
655  //if (shipp->wingnum == -1)
656  //if (shipp->cargo1 > 0)
657  if (Ship_info[shipp->ship_info_index].flags & (SIF_CRUISER)) {
658  temp.Format("\t\tName: %s, Type: %s, Cargo: %s\r\n", shipp->ship_name, Ship_info[shipp->ship_info_index].name, Cargo_names[shipp->cargo1]);
659  buffer += temp;
660  }
661  }
662  }
663  }
664 
665  // dry dock, cap, super cap
666  buffer += "\tDry dock, Capital, Supercap:\r\n";
667  for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
668  if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
669  shipp = &Ships[objp->instance];
670 
671  if (Ship_info[shipp->ship_info_index].species == species) {
672  //if (shipp->wingnum == -1)
673  //if (shipp->cargo1 > 0)
675  temp.Format("\t\tName: %s, Type: %s, Cargo: %s\r\n", shipp->ship_name, Ship_info[shipp->ship_info_index].name, Cargo_names[shipp->cargo1]);
676  buffer += temp;
677  }
678  }
679  }
680  }
681 
682  buffer += "\r\n";
683  }
684 }
685 
686 void dump_loadout(ship *shipp, CString &loadout)
687 {
688  CString temp;
689  char *weapon_name;
690 
691  loadout = "";
692 
693 // PRIMARY
694  int pri_idx, sec_idx;
695 
696  for (pri_idx=0; pri_idx < shipp->weapons.num_primary_banks; pri_idx++) {
697  if (shipp->weapons.primary_bank_weapons[pri_idx] == -1) {
698  weapon_name = "none";
699  } else {
700  weapon_name = Weapon_info[shipp->weapons.primary_bank_weapons[pri_idx]].name;
701  }
702  temp.Format("\t\t\tPrimary[%d]: %s\r\n", pri_idx+1, weapon_name);
703  loadout += temp;
704  }
705 
706 // SECONDARY
707  for (sec_idx=0; sec_idx < shipp->weapons.num_secondary_banks; sec_idx++) {
708  if (shipp->weapons.secondary_bank_weapons[sec_idx] == -1) {
709  weapon_name = "none";
710  } else {
711  weapon_name = Weapon_info[shipp->weapons.secondary_bank_weapons[sec_idx]].name;
712  }
713  temp.Format("\t\t\tSecondary[%d]: %s\r\n", sec_idx+1, weapon_name);
714  loadout += temp;
715  }
716 
717 // TURRET
718  ship_subsys *ss;
719  for (ss = GET_FIRST(&shipp->subsys_list); ss != END_OF_LIST(&shipp->subsys_list); ss = GET_NEXT(ss) ) {
720  if ( (ss->system_info->type == SUBSYSTEM_TURRET) ) {
721 // ss->weapons.num_primary_banks, ss->weapons.num_secondary_banks, ss->weapons.primary_bank_weapons[3], ss->weapons.secondary_bank_weapons[2]
722 // ss->system_info->primary_banks, ss->system_info->secondary_banks
723  temp.Format("\t\t\tTurret: %s\r\n", ss->system_info->subobj_name);
724  loadout += temp;
725 
726  // PRIMARY
727  for (pri_idx=0; pri_idx < ss->weapons.num_primary_banks; pri_idx++) {
728  if (ss->weapons.primary_bank_weapons[pri_idx] == -1) {
729  weapon_name = "none";
730  } else {
731  weapon_name = Weapon_info[ss->weapons.primary_bank_weapons[pri_idx]].name;
732  }
733  temp.Format("\t\t\t\tPrimary[%d]: %s\r\n", pri_idx+1, weapon_name);
734  loadout += temp;
735  }
736 
737  // SECONDARY
738  for (sec_idx=0; sec_idx < ss->weapons.num_secondary_banks; sec_idx++) {
739  if (ss->weapons.secondary_bank_weapons[sec_idx] == -1) {
740  weapon_name = "none";
741  } else {
742  weapon_name = Weapon_info[ss->weapons.secondary_bank_weapons[sec_idx]].name;
743  }
744  temp.Format("\t\t\t\tSecondary[%d]: %s\r\n", sec_idx+1, weapon_name);
745  loadout += temp;
746  }
747  }
748  }
749 
750 }
751 
753 {
754  int i;
755  int species;
756  object *objp;
757  ship *shipp;
758  CString temp, loadout;
759 
760  buffer += "\r\nSHIP SPECIES BREAKDOWN\r\n";
761 
762 
763  for (species=0; (uint) species < Species_info.size(); species++) {
764  buffer += Species_info[species].species_name;
765  buffer += "\r\n";
766 
767  // fighter wings
768  buffer += "\tFighter wings:\r\n";
769  for (i=0; i<MAX_WINGS; i++) {
770  if (Wings[i].wave_count > 0) {
771  int wing_leader_shipnum = Wings[i].ship_index[Wings[i].special_ship];
772  if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].species == species) {
773  if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].flags & SIF_FIGHTER) {
774  temp.Format("\t\tWing: %s\r\n", Wings[i].name);
775  buffer += temp;
776  dump_loadout(&Ships[wing_leader_shipnum], loadout);
777  buffer += loadout;
778  }
779  }
780  }
781  }
782 
783  // bomber wings
784  buffer += "\tBomber wings:\r\n";
785  for (i=0; i<MAX_WINGS; i++) {
786  if (Wings[i].wave_count > 0) {
787  int wing_leader_shipnum = Wings[i].ship_index[Wings[i].special_ship];
788  if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].species == species) {
789  if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].flags & SIF_BOMBER) {
790  temp.Format("\t\tWing: %s\r\n", Wings[i].name);
791  buffer += temp;
792  dump_loadout(&Ships[wing_leader_shipnum], loadout);
793  buffer += loadout;
794  }
795  }
796  }
797  }
798 
799  buffer += "\tFreighters, Cargo, Transports:\r\n";
800  // freighters and transports (cargo)
801  for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
802  if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
803  shipp = &Ships[objp->instance];
804 
805  if (Ship_info[shipp->ship_info_index].species == species) {
806  //if (shipp->wingnum == -1)
807  //if (shipp->cargo1 > 0)
808  if (Ship_info[shipp->ship_info_index].flags & (SIF_FREIGHTER | SIF_TRANSPORT)) {
809  temp.Format("\t\tName: %s\r\n", shipp->ship_name);
810  buffer += temp;
811  dump_loadout(shipp, loadout);
812  buffer += loadout;
813  }
814  }
815  }
816  }
817 
818  buffer += "\tEscape pod, Sentry gun:\r\n";
819  for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
820  if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
821  shipp = &Ships[objp->instance];
822 
823  if (Ship_info[shipp->ship_info_index].species == species) {
824  //if (shipp->wingnum == -1)
825  //if (shipp->cargo1 > 0)
826  if (Ship_info[shipp->ship_info_index].flags & (SIF_ESCAPEPOD | SIF_SENTRYGUN)) {
827  temp.Format("\t\tName: %s\r\n", shipp->ship_name);
828  buffer += temp;
829  dump_loadout(shipp, loadout);
830  buffer += loadout;
831  }
832  }
833  }
834  }
835 
836 
837  // cruiser
838  buffer += "\tCruiser:\r\n";
839  for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
840  if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
841  shipp = &Ships[objp->instance];
842 
843  if (Ship_info[shipp->ship_info_index].species == species) {
844  //if (shipp->wingnum == -1)
845  //if (shipp->cargo1 > 0)
846  if (Ship_info[shipp->ship_info_index].flags & (SIF_CRUISER)) {
847  temp.Format("\t\tName: %s\r\n", shipp->ship_name);
848  buffer += temp;
849  dump_loadout(shipp, loadout);
850  buffer += loadout;
851  }
852  }
853  }
854  }
855 
856  // dry dock, cap, super cap
857  buffer += "\tCapital, Supercap:\r\n";
858  for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
859  if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
860  shipp = &Ships[objp->instance];
861 
862  if (Ship_info[shipp->ship_info_index].species == species) {
863  //if (shipp->wingnum == -1)
864  //if (shipp->cargo1 > 0)
865  if (Ship_info[shipp->ship_info_index].flags & (SIF_CAPITAL|SIF_SUPERCAP)) {
866  temp.Format("\t\tName: %s\r\n", shipp->ship_name);
867  buffer += temp;
868  dump_loadout(shipp, loadout);
869  buffer += loadout;
870  }
871  }
872  }
873  }
874 
875  buffer += "\r\n";
876  }
877  // go through all wings
878 
879  // go through all ships not in wings and FLYABLE
880 
881  // print primary, secondary, and BIG turrets
882 }
field_type_t field_type
Definition: asteroid.h:136
int Neb2_poof_flags
Definition: neb.cpp:64
#define MAX_OBJECT_TYPES
Definition: object.h:49
char Neb2_texture_name[MAX_FILENAME_LEN]
Definition: neb.cpp:75
wing Wings[MAX_WINGS]
Definition: ship.cpp:128
virtual void DoDataExchange(CDataExchange *pDX)
Definition: dumpstats.cpp:47
#define CFILE_NORMAL
Definition: cfile.h:89
int i
Definition: multi_pxo.cpp:466
uint num_respawns
Definition: missionparse.h:141
model_subsystem * system_info
Definition: ship.h:314
int primary_bank_weapons[MAX_SHIP_PRIMARY_BANKS]
Definition: ship.h:103
#define BONUS_GOAL
Definition: missiongoals.h:30
int Num_mission_events
char name[NAME_LENGTH]
Definition: weapon.h:322
int num_primary_banks
Definition: ship.h:99
int game_type
Definition: missionparse.h:138
#define MISSION_FLAG_FULLNEB
Definition: missionparse.h:70
int Current_soundtrack_num
Definition: eventmusic.cpp:59
weapon_info Weapon_info[MAX_WEAPON_TYPES]
Definition: weapons.cpp:79
#define SIF_SUPERCAP
Definition: ship.h:901
ship_weapon weapons
Definition: ship.h:658
afx_msg void OnDumpToFile()
Definition: dumpstats.cpp:109
void get_default_ship_loadouts(CString &buffer)
Definition: dumpstats.cpp:752
#define MISSION_FLAG_SCRAMBLE
Definition: missionparse.h:85
int escort_priority
Definition: ship.h:541
char name[NAME_LENGTH]
Definition: missionparse.h:131
#define MAX_WINGS
Definition: globals.h:50
#define SIF_CRUISER
Definition: ship.h:887
ship_weapon weapons
Definition: ship.h:362
#define stars_get_bitmap_name(x)
Definition: starfield.h:81
#define SIF_CARGO
Definition: ship.h:884
#define NUM_DEBRIS_SIZES
Definition: asteroid.h:26
int Nebula_index
#define TRUE
Definition: pstypes.h:399
#define MISSION_TYPE_MULTI
Definition: missionparse.h:62
#define PRIMARY_GOAL
Definition: missiongoals.h:28
#define MISSION_FLAG_NO_PROMOTION
Definition: missionparse.h:69
Definition: cfile.h:28
object obj_used_list
Definition: object.cpp:53
void get_background_stats(CString &buffer)
Definition: dumpstats.cpp:190
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: Glext.h:5156
uint flags
Definition: ship.h:644
object * objp
Definition: lua.cpp:3105
#define Int3()
Definition: pstypes.h:292
SOUNDTRACK_INFO Soundtracks[MAX_SOUNDTRACKS]
Definition: eventmusic.cpp:57
char Neb2_poof_filenames[MAX_NEB2_POOFS][MAX_FILENAME_LEN]
Definition: neb.cpp:60
ship * shipp
Definition: lua.cpp:9162
mission_goal Mission_goals[MAX_GOALS]
SCP_list< waypoint_list > Waypoint_lists
Definition: waypoint.cpp:9
DumpStats(CWnd *pParent=NULL)
Definition: dumpstats.cpp:38
SCP_list< CJumpNode > Jump_nodes
Definition: jumpnode.cpp:16
GLenum type
Definition: Gl.h:1492
#define MISSION_TYPE_MULTI_COOP
Definition: missionparse.h:64
int hotkey
Definition: ship.h:540
int num_initial_asteroids
Definition: asteroid.h:135
float Neb2_awacs
Definition: neb.cpp:156
ship_subsys subsys_list
Definition: ship.h:630
#define SIF_CAPITAL
Definition: ship.h:889
#define SIF_BOMBER
Definition: ship.h:886
int orders_accepted
Definition: ship.h:624
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
#define OBJ_WAYPOINT
Definition: object.h:36
int instance
Definition: object.h:150
int Num_stars
Definition: starfield.cpp:58
#define MISSION_TYPE_SINGLE
Definition: missionparse.h:61
char squad_filename[MAX_FILENAME_LEN]
Definition: missionparse.h:144
#define OBJ_START
Definition: object.h:35
#define SIF_BIG_SHIP
Definition: ship.h:944
#define SIF_NAVBUOY
Definition: ship.h:891
unsigned int uint
Definition: pstypes.h:64
#define cfopen(...)
Definition: cfile.h:134
char * Nebula_filenames[NUM_NEBULAS]
#define MISSION_FLAG_RED_ALERT
Definition: missionparse.h:84
#define SIF_SMALL_SHIP
Definition: ship.h:943
int num_secondary_banks
Definition: ship.h:100
#define IDC_STATS_TEXT
Definition: resource.h:1032
mission_event Mission_events[MAX_MISSION_EVENTS]
int num_weapon_choices
Definition: missionparse.h:539
#define SIF_SENTRYGUN
Definition: ship.h:892
#define SUBSYSTEM_TURRET
Definition: model.h:54
char squad_name[NAME_LENGTH]
Definition: missionparse.h:145
#define stars_get_sun_name(x)
Definition: starfield.h:80
char cargo1
Definition: ship.h:549
char notes[NOTES_LENGTH]
Definition: missionparse.h:136
GLuint buffer
Definition: Glext.h:5492
int Num_wings
Definition: ship.cpp:120
int secondary_bank_weapons[MAX_SHIP_SECONDARY_BANKS]
Definition: ship.h:104
int Num_teams
Definition: ship.h:534
char Mission_filename[80]
cfbp fp
Definition: cfile.cpp:1065
void get_ship_weapon_selection(CString &buffer)
Definition: dumpstats.cpp:512
#define stars_get_num_bitmaps()
Definition: starfield.h:68
#define GOAL_TYPE_MASK
Definition: missiongoals.h:34
#define IDC_DUMP_TO_FILE
Definition: resource.h:336
#define SIF_DRYDOCK
Definition: ship.h:902
#define SECONDARY_GOAL
Definition: missiongoals.h:29
void get_mission_stats(CString &buffer)
Definition: dumpstats.cpp:127
#define OBJ_SHIP
Definition: object.h:32
void get_species_ship_breakdown(CString &buffer)
Definition: dumpstats.cpp:571
GLbitfield flags
Definition: Glext.h:6722
#define SIF_HUGE_SHIP
Definition: ship.h:945
GLuint const GLchar * name
Definition: Glext.h:5608
int BOOL
Definition: config.h:80
#define SIF_FREIGHTER
Definition: ship.h:888
ship Ships[MAX_SHIPS]
Definition: ship.cpp:122
#define SIF_ESCAPEPOD
Definition: ship.h:893
void dump_loadout(ship *shipp, CString &loadout)
Definition: dumpstats.cpp:686
void get_object_stats(CString &buffer)
Definition: dumpstats.cpp:306
int cfputs(const char *str, CFILE *cfile)
Definition: cfile.cpp:1504
int field_debris_type[MAX_ACTIVE_DEBRIS_TYPES]
Definition: asteroid.h:138
int special_ship
Definition: ship.h:1537
char subobj_name[MAX_NAME_LEN]
Definition: model.h:172
#define CF_TYPE_MISSIONS
Definition: cfile.h:74
int ship_info_index
Definition: ship.h:539
#define MAX_NEB2_POOFS
Definition: neb.h:45
SCP_vector< ship_info > Ship_info
Definition: ship.cpp:164
#define SIF_TRANSPORT
Definition: ship.h:890
#define SIF_FIGHTER
Definition: ship.h:885
SCP_vector< species_info > Species_info
char mission_desc[MISSION_DESC_LENGTH]
Definition: missionparse.h:137
int ship_get_default_orders_accepted(ship_info *sip)
Definition: ship.cpp:5480
void get_objectives_and_goals(CString &buffer)
Definition: dumpstats.cpp:467
void get_messaging_info(CString &buffer)
Definition: dumpstats.cpp:550
debris_genre_t debris_genre
Definition: asteroid.h:137
team_data Team_data[MAX_TVT_TEAMS]
#define SF_ESCORT
Definition: ship.h:438
int temp
Definition: lua.cpp:4996
int ship_index[MAX_SHIPS_PER_WING]
Definition: ship.h:1531
asteroid_field Asteroid_field
Definition: asteroid.cpp:64
mission The_mission
#define OBJ_WING
Definition: object.h:42
int cfclose(CFILE *cfile)
Definition: cfile.cpp:895
int Num_goals
char type
Definition: object.h:146
support_ship_info support_ships
Definition: missionparse.h:143
char * Cargo_names[]
#define stars_get_num_suns()
Definition: starfield.h:69
char author[NAME_LENGTH]
Definition: missionparse.h:132
int num_ship_choices
Definition: missionparse.h:531
#define OBJ_JUMP_NODE
Definition: object.h:45
char ship_name[NAME_LENGTH]
Definition: ship.h:604
#define MISSION_FLAG_SUBSPACE
Definition: missionparse.h:68
#define MISSION_TYPE_MULTI_TEAMS
Definition: missionparse.h:65
#define MISSION_TYPE_MULTI_DOGFIGHT
Definition: missionparse.h:66