From 8898ad9b25fca6afe2374d293a981db02a83d7e9 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Thu, 31 May 2012 14:46:27 +0000 Subject: Committing the documentation to svn to have it accessible online --- Doc/doxygen/html/_system_design_8cpp_source.html | 285 +++++++++++++++++++++++ 1 file changed, 285 insertions(+) create mode 100644 Doc/doxygen/html/_system_design_8cpp_source.html (limited to 'Doc/doxygen/html/_system_design_8cpp_source.html') diff --git a/Doc/doxygen/html/_system_design_8cpp_source.html b/Doc/doxygen/html/_system_design_8cpp_source.html new file mode 100644 index 0000000..8e31257 --- /dev/null +++ b/Doc/doxygen/html/_system_design_8cpp_source.html @@ -0,0 +1,285 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/Stars45/SystemDesign.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
SystemDesign.cpp
+
+
+Go to the documentation of this file.
1 /* Project Starshatter 4.5
+
2  Destroyer Studios LLC
+
3  Copyright © 1997-2004. All Rights Reserved.
+
4 
+
5  SUBSYSTEM: Stars.exe
+
6  FILE: SystemDesign.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12  Weapon Design parameters class
+
13 */
+
14 
+
15 #include "MemDebug.h"
+
16 #include "SystemDesign.h"
+
17 #include "Component.h"
+
18 
+
19 #include "Game.h"
+
20 #include "Bitmap.h"
+
21 #include "DataLoader.h"
+
22 #include "ParseUtil.h"
+
23 
+
24 // +--------------------------------------------------------------------+
+
25 
+ +
27 
+
28 #define GET_DEF_TEXT(p,d,x) if(p->name()->value()==(#x))GetDefText(d->x,p,filename)
+
29 #define GET_DEF_NUM(p,d,x) if(p->name()->value()==(#x))GetDefNumber(d->x,p,filename)
+
30 
+
31 // +--------------------------------------------------------------------+
+
32 
+ +
34 { }
+
35 
+ +
37 {
+ +
39 }
+
40 
+
41 // +--------------------------------------------------------------------+
+
42 
+
43 void
+
44 SystemDesign::Initialize(const char* filename)
+
45 {
+
46  Print("Loading System Designs '%s'\n", filename);
+
47 
+
48  // Load Design File:
+ +
50  BYTE* block;
+
51 
+
52  int blocklen = loader->LoadBuffer(filename, block, true);
+
53  Parser parser(new(__FILE__,__LINE__) BlockReader((const char*) block, blocklen));
+
54  Term* term = parser.ParseTerm();
+
55 
+
56  if (!term) {
+
57  Print("ERROR: could not parse '%s'\n", filename);
+
58  exit(-3);
+
59  }
+
60  else {
+
61  TermText* file_type = term->isText();
+
62  if (!file_type || file_type->value() != "SYSTEM") {
+
63  Print("ERROR: invalid system design file '%s'\n", filename);
+
64  exit(-4);
+
65  }
+
66  }
+
67 
+
68  int type = 1;
+
69 
+
70  do {
+
71  delete term;
+
72 
+
73  term = parser.ParseTerm();
+
74 
+
75  if (term) {
+
76  TermDef* def = term->isDef();
+
77  if (def) {
+
78  if (def->name()->value() == "system") {
+
79 
+
80  if (!def->term() || !def->term()->isStruct()) {
+
81  Print("WARNING: system structure missing in '%s'\n", filename);
+
82  }
+
83  else {
+
84  TermStruct* val = def->term()->isStruct();
+
85  SystemDesign* design = new(__FILE__,__LINE__) SystemDesign;
+
86 
+
87  for (int i = 0; i < val->elements()->size(); i++) {
+
88  TermDef* pdef = val->elements()->at(i)->isDef();
+
89  if (pdef) {
+
90  GET_DEF_TEXT(pdef, design, name);
+
91 
+
92  else if (pdef->name()->value()==("component")) {
+
93  if (!pdef->term() || !pdef->term()->isStruct()) {
+
94  Print("WARNING: component structure missing in system '%s' in '%s'\n", (const char*) design->name, filename);
+
95  }
+
96  else {
+
97  TermStruct* val2 = pdef->term()->isStruct();
+
98  ComponentDesign* comp_design = new(__FILE__,__LINE__) ComponentDesign;
+
99 
+
100  for (int i = 0; i < val2->elements()->size(); i++) {
+
101  TermDef* pdef2 = val2->elements()->at(i)->isDef();
+
102  if (pdef2) {
+
103  GET_DEF_TEXT(pdef2, comp_design, name);
+
104  else GET_DEF_TEXT(pdef2, comp_design, abrv);
+
105  else GET_DEF_NUM (pdef2, comp_design, repair_time);
+
106  else GET_DEF_NUM (pdef2, comp_design, replace_time);
+
107  else GET_DEF_NUM (pdef2, comp_design, spares);
+
108  else GET_DEF_NUM (pdef2, comp_design, affects);
+
109 
+
110  else {
+
111  Print("WARNING: parameter '%s' ignored in '%s'\n",
+
112  pdef2->name()->value().data(), filename);
+
113  }
+
114  }
+
115  }
+
116 
+
117  design->components.append(comp_design);
+
118  }
+
119  }
+
120 
+
121  else {
+
122  Print("WARNING: parameter '%s' ignored in '%s'\n",
+
123  pdef->name()->value().data(), filename);
+
124  }
+
125  }
+
126  else {
+
127  Print("WARNING: term ignored in '%s'\n", filename);
+
128  val->elements()->at(i)->print();
+
129  }
+
130  }
+
131 
+
132  catalog.append(design);
+
133  }
+
134  }
+
135 
+
136  else
+
137  Print("WARNING: unknown definition '%s' in '%s'\n",
+
138  def->name()->value().data(), filename);
+
139  }
+
140  else {
+
141  Print("WARNING: term ignored in '%s'\n", filename);
+
142  term->print();
+
143  }
+
144  }
+
145  }
+
146  while (term);
+
147 
+
148  loader->ReleaseBuffer(block);
+
149 }
+
150 
+
151 // +--------------------------------------------------------------------+
+
152 
+
153 void
+ +
155 {
+
156  catalog.destroy();
+
157 }
+
158 
+
159 // +--------------------------------------------------------------------+
+
160 
+ +
162 SystemDesign::Find(const char* name)
+
163 {
+
164  SystemDesign test;
+
165  test.name = name;
+
166  return catalog.find(&test);
+
167 }
+
168 
+
+
+ + + + -- cgit v1.1