@@ -223,28 +223,28 @@ bool CUIXmlInitBase::InitCheck(CUIXml& xml_doc, pcstr path, int index, CUICheckB
223223 strconcat (buf, path, " :text_color:e" );
224224 if (xml_doc.NavigateToNode (buf, index))
225225 {
226- color = GetColor (xml_doc, buf, index, 0x00 );
226+ color = GetColor (xml_doc, buf, index, color_rgba ( 0 , 0 , 0 , 255 ) );
227227 pWnd->SetStateTextColor (color, S_Enabled);
228228 }
229229
230230 strconcat (buf, path, " :text_color:d" );
231231 if (xml_doc.NavigateToNode (buf, index))
232232 {
233- color = GetColor (xml_doc, buf, index, 0x00 );
233+ color = GetColor (xml_doc, buf, index, color_rgba ( 0 , 0 , 0 , 255 ) );
234234 pWnd->SetStateTextColor (color, S_Disabled);
235235 }
236236
237237 strconcat (buf, path, " :text_color:t" );
238238 if (xml_doc.NavigateToNode (buf, index))
239239 {
240- color = GetColor (xml_doc, buf, index, 0x00 );
240+ color = GetColor (xml_doc, buf, index, color_rgba ( 0 , 0 , 0 , 255 ) );
241241 pWnd->SetStateTextColor (color, S_Touched);
242242 }
243243
244244 strconcat (buf, path, " :text_color:h" );
245245 if (xml_doc.NavigateToNode (buf, index))
246246 {
247- color = GetColor (xml_doc, buf, index, 0x00 );
247+ color = GetColor (xml_doc, buf, index, color_rgba ( 0 , 0 , 0 , 255 ) );
248248 pWnd->SetStateTextColor (color, S_Highlighted);
249249 }
250250
@@ -266,13 +266,13 @@ bool CUIXmlInitBase::InitSpin(CUIXml& xml_doc, pcstr path, int index, CUICustomS
266266 strconcat (foo, path, " :text_color:e" );
267267 if (xml_doc.NavigateToNode (foo, index))
268268 {
269- color = GetColor (xml_doc, foo, index, 0x00 );
269+ color = GetColor (xml_doc, foo, index, color_rgba ( 0 , 0 , 0 , 255 ) );
270270 pWnd->SetTextColor (color);
271271 }
272272 strconcat (foo, path, " :text_color:d" );
273273 if (xml_doc.NavigateToNode (foo, index))
274274 {
275- color = GetColor (xml_doc, foo, index, 0x00 );
275+ color = GetColor (xml_doc, foo, index, color_rgba ( 0 , 0 , 0 , 255 ) );
276276 pWnd->SetTextColorD (color);
277277 }
278278
@@ -354,28 +354,28 @@ bool CUIXmlInitBase::Init3tButton(CUIXml& xml_doc, pcstr path, int index, CUI3tB
354354 strconcat (buf, path, " :text_color:e" );
355355 if (xml_doc.NavigateToNode (buf, index))
356356 {
357- color = GetColor (xml_doc, buf, index, 0x00 );
357+ color = GetColor (xml_doc, buf, index, color_rgba ( 0 , 0 , 0 , 255 ) );
358358 pWnd->SetStateTextColor (color, S_Enabled);
359359 }
360360
361361 strconcat (buf, path, " :text_color:d" );
362362 if (xml_doc.NavigateToNode (buf, index))
363363 {
364- color = GetColor (xml_doc, buf, index, 0x00 );
364+ color = GetColor (xml_doc, buf, index, color_rgba ( 0 , 0 , 0 , 255 ) );
365365 pWnd->SetStateTextColor (color, S_Disabled);
366366 }
367367
368368 strconcat (buf, path, " :text_color:t" );
369369 if (xml_doc.NavigateToNode (buf, index))
370370 {
371- color = GetColor (xml_doc, buf, index, 0x00 );
371+ color = GetColor (xml_doc, buf, index, color_rgba ( 0 , 0 , 0 , 255 ) );
372372 pWnd->SetStateTextColor (color, S_Touched);
373373 }
374374
375375 strconcat (buf, path, " :text_color:h" );
376376 if (xml_doc.NavigateToNode (buf, index))
377377 {
378- color = GetColor (xml_doc, buf, index, 0x00 );
378+ color = GetColor (xml_doc, buf, index, color_rgba ( 0 , 0 , 0 , 255 ) );
379379 pWnd->SetStateTextColor (color, S_Highlighted);
380380 }
381381
@@ -521,17 +521,17 @@ bool CUIXmlInitBase::InitProgressBar(CUIXml& xml_doc, pcstr path, int index, CUI
521521 {
522522 pWnd->m_bUseColor = true ;
523523
524- pWnd->m_minColor = GetColor (xml_doc, buf, index, 0xff );
524+ pWnd->m_minColor = GetColor (xml_doc, buf, index, 0xFFFFFFFF );
525525
526526 strconcat (buf, path, " :middle_color" );
527527 if (xml_doc.NavigateToNode (buf, 0 ))
528528 {
529- pWnd->m_middleColor = GetColor (xml_doc, buf, index, 0xff );
529+ pWnd->m_middleColor = GetColor (xml_doc, buf, index, 0xFFFFFFFF );
530530 pWnd->m_bUseMiddleColor = true ;
531531 }
532532
533533 strconcat (buf, path, " :max_color" );
534- pWnd->m_maxColor = GetColor (xml_doc, buf, index, 0xff );
534+ pWnd->m_maxColor = GetColor (xml_doc, buf, index, 0xFFFFFFFF );
535535 }
536536
537537 return true ;
@@ -670,7 +670,7 @@ void CUIXmlInitBase::InitAutoFrameLineGroup(CUIXml& xml_doc, pcstr path, int ind
670670
671671bool CUIXmlInitBase::InitFont (const CUIXml& xml_doc, pcstr path, int index, u32 & color, CGameFont*& pFnt)
672672{
673- color = GetColor (xml_doc, path, index, 0xff );
673+ color = GetColor (xml_doc, path, index, 0xFFFFFFFF );
674674
675675 cpcstr font_name = xml_doc.ReadAttrib (path, index, " font" , nullptr );
676676 if (!font_name)
@@ -830,7 +830,7 @@ bool CUIXmlInitBase::InitCustomEdit(CUIXml& xml_doc, pcstr path, int index, CUIC
830830 strconcat (foo, path, " :text_color:e" );
831831 if (xml_doc.NavigateToNode (foo, index))
832832 {
833- const u32 color = GetColor (xml_doc, foo, index, 0x00 );
833+ const u32 color = GetColor (xml_doc, foo, index, color_rgba ( 0 , 0 , 0 , 255 ) );
834834 pWnd->TextItemControl ()->SetTextColor (color);
835835 }
836836
@@ -926,7 +926,7 @@ bool CUIXmlInitBase::InitTexture(const CUIXml& xml_doc, pcstr path, int index, I
926926 const bool stretch_flag = xml_doc.ReadAttribInt (path, index, " stretch" ) ? true : false ;
927927 pWnd->SetStretchTexture (stretch_flag);
928928
929- const u32 color = GetColor (xml_doc, buf, index, 0xff );
929+ const u32 color = GetColor (xml_doc, buf, index, 0xFFFFFFFF );
930930 pWnd->SetTextureColor (color);
931931
932932 if (!fis_zero (rect.width ()) && !fis_zero (rect.height ()))
@@ -1325,14 +1325,14 @@ bool CUIXmlInitBase::InitComboBox(CUIXml& xml_doc, pcstr path, int index, CUICom
13251325 strconcat (_path, path, " :text_color:e" );
13261326 if (xml_doc.NavigateToNode (_path, index))
13271327 {
1328- color = GetColor (xml_doc, _path, index, 0x00 );
1328+ color = GetColor (xml_doc, _path, index, color_rgba ( 0 , 0 , 0 , 255 ) );
13291329 pWnd->SetTextColor (color);
13301330 }
13311331
13321332 strconcat (_path, path, " :text_color:d" );
13331333 if (xml_doc.NavigateToNode (_path, index))
13341334 {
1335- color = GetColor (xml_doc, _path, index, 0x00 );
1335+ color = GetColor (xml_doc, _path, index, color_rgba ( 0 , 0 , 0 , 255 ) );
13361336 pWnd->SetTextColorD (color);
13371337 }
13381338
@@ -1347,14 +1347,11 @@ u32 CUIXmlInitBase::GetColor(const CUIXml& xml_doc, pcstr path, int index, u32 d
13471347 VERIFY (GetColorDefs ()->find (clr_def) != GetColorDefs ()->end ());
13481348 return (*m_pColorDefs)[clr_def];
13491349 }
1350- else
1351- {
1352- const int r = xml_doc.ReadAttribInt (path, index, " r" , def_clr);
1353- const int g = xml_doc.ReadAttribInt (path, index, " g" , def_clr);
1354- const int b = xml_doc.ReadAttribInt (path, index, " b" , def_clr);
1355- const int a = xml_doc.ReadAttribInt (path, index, " a" , 0xff );
1356- return color_argb (a, r, g, b);
1357- }
1350+ const int r = xml_doc.ReadAttribInt (path, index, " r" , color_get_R (def_clr));
1351+ const int g = xml_doc.ReadAttribInt (path, index, " g" , color_get_G (def_clr));
1352+ const int b = xml_doc.ReadAttribInt (path, index, " b" , color_get_B (def_clr));
1353+ const int a = xml_doc.ReadAttribInt (path, index, " a" , color_get_A (def_clr));
1354+ return color_argb (a, r, g, b);
13581355}
13591356
13601357bool CUIXmlInitBase::GetColor (pcstr color_name, u32 & color)
0 commit comments