Skip to content

Commit 26c13ef

Browse files
committed
Make the source unity build-friendly
Avoid name collisions of static globals and add a missing header guard. This is enough to build all sources used by Unvanquished concatenated, except SystemInterface.cpp
1 parent 29735f6 commit 26c13ef

File tree

8 files changed

+22
-18
lines changed

8 files changed

+22
-18
lines changed

Include/RmlUi/Core/StyleSheetSpecification.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ class RMLUICORE_API StyleSheetSpecification
133133
PropertySpecification properties;
134134

135135
UniquePtr<DefaultStyleSheetParsers> default_parsers;
136+
137+
static StyleSheetSpecification* instance; // singleton
136138
};
137139

138140
} // namespace Rml

Source/Core/Elements/WidgetSlider.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737

3838
namespace Rml {
3939

40-
static const float DEFAULT_REPEAT_DELAY = 0.5f;
41-
static const float DEFAULT_REPEAT_PERIOD = 0.1f;
40+
static const float SLIDER_ARROW_REPEAT_DELAY = 0.5f;
41+
static const float SLIDER_ARROW_REPEAT_PERIOD = 0.1f;
4242

4343
WidgetSlider::WidgetSlider(ElementFormControl* _parent)
4444
{
@@ -156,7 +156,7 @@ void WidgetSlider::Update()
156156
arrow_timers[i] -= delta_time;
157157
while (arrow_timers[i] <= 0)
158158
{
159-
arrow_timers[i] += DEFAULT_REPEAT_PERIOD;
159+
arrow_timers[i] += SLIDER_ARROW_REPEAT_PERIOD;
160160
SetBarPosition(i == 0 ? OnLineDecrement() : OnLineIncrement());
161161
}
162162
}
@@ -390,13 +390,13 @@ void WidgetSlider::ProcessEvent(Event& event)
390390
}
391391
else if (event.GetTargetElement() == arrows[0])
392392
{
393-
arrow_timers[0] = DEFAULT_REPEAT_DELAY;
393+
arrow_timers[0] = SLIDER_ARROW_REPEAT_DELAY;
394394
last_update_time = Clock::GetElapsedTime();
395395
SetBarPosition(OnLineDecrement());
396396
}
397397
else if (event.GetTargetElement() == arrows[1])
398398
{
399-
arrow_timers[1] = DEFAULT_REPEAT_DELAY;
399+
arrow_timers[1] = SLIDER_ARROW_REPEAT_DELAY;
400400
last_update_time = Clock::GetElapsedTime();
401401
SetBarPosition(OnLineIncrement());
402402
}

Source/Core/StyleSheetFactory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
namespace Rml {
3838

39-
static UniquePtr<StyleSheetFactory> instance;
39+
UniquePtr<StyleSheetFactory> StyleSheetFactory::instance;
4040

4141
StyleSheetFactory::StyleSheetFactory() :
4242
selectors{

Source/Core/StyleSheetFactory.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ class StyleSheetFactory {
7878
// Custom complex selectors available for style sheets.
7979
using SelectorMap = UnorderedMap<String, StructuralSelectorType>;
8080
SelectorMap selectors;
81+
82+
static UniquePtr<StyleSheetFactory> instance; // singleton
8183
};
8284

8385
} // namespace Rml

Source/Core/StyleSheetNode.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@
3737

3838
namespace Rml {
3939

40-
static inline bool IsTextElement(const Element* element)
41-
{
42-
return element->GetTagName() == "#text";
43-
}
44-
4540
StyleSheetNode::StyleSheetNode()
4641
{
4742
CalculateAndSetSpecificity();
@@ -329,7 +324,7 @@ bool StyleSheetNode::TraverseMatch(const Element* element) const
329324
{
330325
// First check if our sibling is a text element and if so skip it. For the descendant/child combinator above we can omit this step since
331326
// text elements don't have children and thus any ancestor is not a text element.
332-
if (IsTextElement(element))
327+
if (element->GetTagName() == "#text")
333328
continue;
334329
else if (parent->Match(element) && parent->TraverseMatch(element))
335330
return true;

Source/Core/StyleSheetSpecification.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
namespace Rml {
4545

46-
static StyleSheetSpecification* instance = nullptr;
46+
StyleSheetSpecification* StyleSheetSpecification::instance = nullptr;
4747

4848

4949
struct DefaultStyleSheetParsers {

Source/Core/WidgetScroll.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737

3838
namespace Rml {
3939

40-
static const float DEFAULT_REPEAT_DELAY = 0.5f;
41-
static const float DEFAULT_REPEAT_PERIOD = 0.1f;
40+
static const float SCROLL_ARROW_REPEAT_DELAY = 0.5f;
41+
static const float SCROLL_ARROW_REPEAT_PERIOD = 0.1f;
4242

4343
WidgetScroll::WidgetScroll(Element* _parent)
4444
{
@@ -160,7 +160,7 @@ void WidgetScroll::Update()
160160
arrow_timers[i] -= delta_time;
161161
while (arrow_timers[i] <= 0)
162162
{
163-
arrow_timers[i] += DEFAULT_REPEAT_PERIOD;
163+
arrow_timers[i] += SCROLL_ARROW_REPEAT_PERIOD;
164164
SetBarPosition(i == 0 ? OnLineDecrement() : OnLineIncrement());
165165
}
166166
}
@@ -432,13 +432,13 @@ void WidgetScroll::ProcessEvent(Event& event)
432432
{
433433
if (event.GetTargetElement() == arrows[0])
434434
{
435-
arrow_timers[0] = DEFAULT_REPEAT_DELAY;
435+
arrow_timers[0] = SCROLL_ARROW_REPEAT_DELAY;
436436
last_update_time = Clock::GetElapsedTime();
437437
SetBarPosition(OnLineDecrement());
438438
}
439439
else if (event.GetTargetElement() == arrows[1])
440440
{
441-
arrow_timers[1] = DEFAULT_REPEAT_DELAY;
441+
arrow_timers[1] = SCROLL_ARROW_REPEAT_DELAY;
442442
last_update_time = Clock::GetElapsedTime();
443443
SetBarPosition(OnLineIncrement());
444444
}

Source/Debugger/CommonSource.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
*
2727
*/
2828

29+
#ifndef RMLUI_DEBUGGER_COMMONSOURCE_H
30+
#define RMLUI_DEBUGGER_COMMONSOURCE_H
31+
2932
static const char* common_rcss = R"RCSS(
3033
body
3134
{
@@ -195,3 +198,5 @@ handle#size_handle
195198
background-color: #888;
196199
}
197200
)RCSS";
201+
202+
#endif

0 commit comments

Comments
 (0)