43 cout<<
"Panic exit - no configuration"<<endl;
65 if (node->
Name() !=
"vegaconfig") {
66 cout<<
"this is no Vegastrike config file"<<endl;
69 vector< easyDomNode* >::const_iterator siter;
70 for (siter = node->
subnodes.begin(); siter != node->
subnodes.end(); siter++) {
72 if (cnode->
Name() ==
"variables")
74 else if (cnode->
Name() ==
"colors")
76 else if (cnode->
Name() ==
"bindings")
79 cout<<
"Unknown tag: "<<cnode->
Name()<<endl;
89 cout<<
"only one variable section allowed"<<endl;
94 vector< easyDomNode* >::const_iterator siter;
95 for (siter = node->
subnodes.begin(); siter != node->
subnodes.end(); siter++) {
106 if ( section.empty() )
107 cout<<
"no name given for section"<<endl;
108 vector< easyDomNode* >::const_iterator siter;
109 for (siter = node->
subnodes.begin(); siter != node->
subnodes.end(); siter++) {
114 if (cnode->
Name() ==
"var")
115 doVar( prefix, cnode );
116 else if (cnode->
Name() ==
"section")
119 cout<<
"neither a variable nor a section"<<endl;
128 if (node->
Name() !=
"section") {
129 cout<<
"not a section"<<endl;
143 string hashname = prefix+name;
146 cout<<
"no name given for variable "<<name<<
" "<<value<<
" "<<endl;
153 if (node->
Name() !=
"var") {
154 cout<<
"not a variable"<<endl;
164 if (node->
Name() !=
"color") {
165 cout<<
"no color definition"<<endl;
169 cout<<
"no color name given"<<endl;
173 string hashname = prefix+name;
181 if ( r.empty() || g.empty() || b.empty() || a.empty() ) {
182 cout<<
"neither name nor r,g,b given for color "<<node->
Name()<<endl;
185 float rf = atof( r.c_str() );
186 float gf = atof( g.c_str() );
187 float bf = atof( b.c_str() );
188 float af = atof( a.c_str() );
206 string ref_section = node->
attr_value(
"section" );
208 if ( ref_section.empty() ) {
209 cout<<
"you have to give a referenced section when referencing colors"<<endl;
210 ref_section =
"default";
212 getColor( ref_section, ref_name, refcol );
215 vc.
name = ref_section+
"/"+ref_name;
223 color->
r = refcol[0];
224 color->
g = refcol[1];
225 color->
b = refcol[2];
226 color->
a = refcol[3];
240 cout<<
"only one variable section allowed"<<endl;
245 vector< easyDomNode* >::const_iterator siter;
246 for (siter = node->
subnodes.begin(); siter != node->
subnodes.end(); siter++) {
256 string hashname = section+
"/"+subsection+
"/"+name;
257 std::map< string, string >::iterator it;
269 string hashname = section+
"/"+name;
270 std::map< string, string >::iterator it;
282 vector< easyDomNode* >::const_iterator siter;
283 for (siter = section->
subnodes.begin(); siter != section->
subnodes.end(); siter++) {
285 if ( (cnode)->attr_value(
"name" ) == name )
288 static bool foundshouldwarn =
false;
289 static bool shouldwarn =
true;
290 if (!foundshouldwarn) {
291 if (name !=
"debug_config") {
293 foundshouldwarn =
true;
297 cout<<
"WARNING: no var named "<<name<<
" in section "<<section->
attr_value(
"name" )<<
" using default: "<<defaultval
306 color[3] = ( (float) (hexcolor&0xff) )/256.0;
307 color[2] = ( (float) ( (hexcolor&0xff00)>>8 ) )/256.0;
308 color[1] = ( (float) ( (hexcolor&0xff0000)>>16 ) )/256.0;
309 color[0] = ( (float) ( (hexcolor&0xff000000)>>24 ) )/256.0;
311 getColor( section, name, color,
true );
318 string hashname = section+
"/"+name;
319 std::map< string, vColor >::iterator it;
321 color[0] = (*it).second.r;
322 color[1] = (*it).second.g;
323 color[2] = (*it).second.b;
324 color[3] = (*it).second.a;
325 }
else if (!have_color) {
326 color[0] = color[1] = color[2] = color[3] = 1.0f;
334 vector< easyDomNode* >::const_iterator siter;
335 for (siter = node->
subnodes.begin(); siter != node->
subnodes.end(); siter++) {
337 if ( (cnode)->attr_value(
"name" ) == name ) {
338 color[0] = (cnode)->color->r;
339 color[1] = (cnode)->
color->
g;
340 color[2] = (cnode)->color->b;
341 color[3] = (cnode)->color->a;
345 if (have_color ==
false) {
351 cout<<
"WARNING: color "<<name<<
" not defined, using default (white)"<<endl;
353 cout<<
"WARNING: color "<<name<<
" not defined, using default (hexcolor)"<<endl;
368 vector< easyDomNode* >::const_iterator siter;
369 for (siter = startnode->
subnodes.begin(); siter != startnode->
subnodes.end(); siter++) {
371 string scan_name = (cnode)->attr_value(
"name" );
372 if (scan_name == section)
375 cout<<
"WARNING: no section/variable/color named "<<section<<endl;
392 if (sectionnode != NULL) {
398 string hashname = section+
"/"+name;
406 if (sectionnode != NULL) {
408 if (subnode != NULL) {
415 string hashname = section+
"/"+subsection+
"/"+name;