Skip to content

Commit 12efb28

Browse files
committed
Merge https://github.com/supertuxkart/stk-code into command-manager-prototype
As the merged changes include fixing 5138 in the main repo which was already kind of fixed here, I had to take a bit of care
2 parents 683a1b1 + 88cd5cf commit 12efb28

29 files changed

+164
-110
lines changed

data/skins/cartoon-coal/button.png

-814 Bytes
Loading
-782 Bytes
Loading
250 Bytes
Loading
193 Bytes
Loading

data/skins/cartoon-coal/spinner.png

198 Bytes
Loading
296 Bytes
Loading
389 Bytes
Loading
269 Bytes
Loading

data/skins/cartoon-coal/stkskin.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ Here you can configure advanced theming rules for this skin
269269
<color type="emphasis_text" state="focused" r="255" g="226" b="56" />
270270

271271
<!-- Color used for red/blue items in list (e.g. player team color in networking) -->
272-
<color type="list_blue" state="neutral" r="0" g="0" b="180" />
273-
<color type="list_blue" state="focused" r="0" g="0" b="255" />
274-
<color type="list_red" state="neutral" r="255" g="0" b="0" />
275-
<color type="list_red" state="focused" r="255" g="0" b="0" />
272+
<color type="list_blue" state="neutral" r="0" g="0" b="90" />
273+
<color type="list_blue" state="focused" r="0" g="0" b="225" />
274+
<color type="list_red" state="neutral" r="255" g="30" b="30" />
275+
<color type="list_red" state="focused" r="145" g="0" b="0" />
276276

277277
<!-- Color used to fade out background when a dialog is shown -->
278278
<color type="dialog_background" state="neutral" a="120" r="0" g="0" b="0" />
Loading
373 Bytes
Loading
10.2 KB
Loading

data/skins/classic-coal/stkskin.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Here you can configure advanced theming rules for this skin
120120
<element type="selectionHalo" image="bubble.png" />
121121
<element type="focusHalo" image="glass_iconhighlight_focus.png" />
122122

123-
<element type="spinner" state="neutral" common="y" image="glassspinner.png"
123+
<element type="spinner" state="neutral" image="glassspinner.png"
124124
left_border="110" right_border="110" top_border="0" bottom_border="36"
125125
preserve_h_aspect_ratios="true" hborder_out_portion="0.0" />
126126

@@ -254,10 +254,10 @@ Here you can configure advanced theming rules for this skin
254254
<color type="emphasis_text" state="focused" r="255" g="226" b="56" />
255255

256256
<!-- Color used for red/blue items in list (e.g. player team color in networking) -->
257-
<color type="list_blue" state="neutral" r="0" g="0" b="180" />
258-
<color type="list_blue" state="focused" r="0" g="0" b="255" />
259-
<color type="list_red" state="neutral" r="255" g="0" b="0" />
260-
<color type="list_red" state="focused" r="255" g="0" b="0" />
257+
<color type="list_blue" state="neutral" r="0" g="0" b="115" />
258+
<color type="list_blue" state="focused" r="45" g="45" b="255" />
259+
<color type="list_red" state="neutral" r="255" g="30" b="30" />
260+
<color type="list_red" state="focused" r="255" g="30" b="30" />
261261

262262
<!-- Color used to fade out background when a dialog is shown -->
263263
<color type="dialog_background" state="neutral" a="120" r="0" g="0" b="0" />

lib/irrlicht/source/Irrlicht/CGUIContextMenu.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,6 @@ void CGUIContextMenu::draw()
531531
// loop through all menu items
532532

533533
rect = AbsoluteRect;
534-
s32 y = AbsoluteRect.UpperLeftCorner.Y;
535534

536535
for (s32 i=0; i<(s32)Items.size(); ++i)
537536
{
@@ -549,7 +548,6 @@ void CGUIContextMenu::draw()
549548
rect.UpperLeftCorner.Y += 1;
550549
skin->draw2DRectangle(this, skin->getColor(EGDC_3D_HIGH_LIGHT), rect, clip);
551550

552-
y += 10;
553551
}
554552
else
555553
{

lib/irrlicht/source/Irrlicht/CIrrDeviceSDL.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
152152
#endif
153153
#ifdef ANDROID
154154
Android_initDisplayCutout(&TopPadding, &BottomPadding, &LeftPadding, &RightPadding, &InitialOrientation);
155+
#else
156+
(void)InitialOrientation;
155157
#endif
156158
core::stringc sdlversion = "Compiled SDL Version ";
157159
sdlversion += Info.version.major;

lib/irrlicht/source/Irrlicht/CMeshManipulator.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,6 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
14931493

14941494
// Main algorithm
14951495
u32 highest = 0;
1496-
u32 drawcalls = 0;
14971496
for (;;)
14981497
{
14991498
if (tc[highest].drawn)
@@ -1582,7 +1581,6 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
15821581
lru.add(tc[highest].ind[0]);
15831582
lru.add(tc[highest].ind[1]);
15841583
highest = lru.add(tc[highest].ind[2], true);
1585-
drawcalls++;
15861584
}
15871585

15881586
buf->setBoundingBox(mb->getBoundingBox());
@@ -1605,7 +1603,6 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
16051603

16061604
// Main algorithm
16071605
u32 highest = 0;
1608-
u32 drawcalls = 0;
16091606
for (;;)
16101607
{
16111608
if (tc[highest].drawn)
@@ -1694,7 +1691,6 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
16941691
lru.add(tc[highest].ind[0]);
16951692
lru.add(tc[highest].ind[1]);
16961693
highest = lru.add(tc[highest].ind[2]);
1697-
drawcalls++;
16981694
}
16991695

17001696
buf->setBoundingBox(mb->getBoundingBox());
@@ -1718,7 +1714,6 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
17181714

17191715
// Main algorithm
17201716
u32 highest = 0;
1721-
u32 drawcalls = 0;
17221717
for (;;)
17231718
{
17241719
if (tc[highest].drawn)
@@ -1807,7 +1802,6 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
18071802
lru.add(tc[highest].ind[0]);
18081803
lru.add(tc[highest].ind[1]);
18091804
highest = lru.add(tc[highest].ind[2]);
1810-
drawcalls++;
18111805
}
18121806

18131807
buf->setBoundingBox(mb->getBoundingBox());

lib/irrlicht/source/Irrlicht/CNullDriver.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -947,8 +947,9 @@ const SLight& CNullDriver::getDynamicLight(u32 idx) const
947947
{
948948
if ( idx < Lights.size() )
949949
return Lights[idx];
950-
else
951-
return *((SLight*)0);
950+
static const SLight defaultLight;
951+
os::Printer::log("Error: CNullDriver::getDynamicLight was invoked with an invalid index.", ELL_ERROR);
952+
return defaultLight;
952953
}
953954

954955

lib/irrlicht/source/Irrlicht/COSOperator.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ namespace irr
3131
{
3232

3333
// constructor linux
34-
COSOperator::COSOperator(const core::stringc& osVersion, IrrlichtDevice* device)
35-
: OperatingSystem(osVersion), IrrDevice(device)
34+
COSOperator::COSOperator(const core::stringc& osVersion, IrrlichtDevice* /*device*/)
35+
: OperatingSystem(osVersion)
3636
{
3737
}
3838

3939

4040
// constructor
4141
COSOperator::COSOperator(const core::stringc& osVersion)
42-
: OperatingSystem(osVersion), IrrDevice(NULL)
42+
: OperatingSystem(osVersion)
4343
{
4444
#ifdef _DEBUG
4545
setDebugName("COSOperator");

lib/irrlicht/source/Irrlicht/COSOperator.h

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class COSOperator : public IOSOperator
4242
private:
4343

4444
core::stringc OperatingSystem;
45-
IrrlichtDevice* IrrDevice;
4645

4746
};
4847

lib/irrlicht/source/Irrlicht/CSceneManager.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,12 @@ const core::aabbox3d<f32>& CSceneManager::getBoundingBox() const
906906
{
907907
_IRR_DEBUG_BREAK_IF(true) // Bounding Box of Scene Manager wanted.
908908

909-
// should never be used.
910-
return *((core::aabbox3d<f32>*)0);
909+
os::Printer::log("Unexpected call to CSceneManager::getBoundingBox()", ELL_ERROR);
910+
// Static default bounding box to return in case this function is called unexpectedly
911+
static const core::aabbox3d<f32> defaultBox;
912+
913+
// Should never be used, but we return a safe reference instead of dereferencing a null pointer.
914+
return defaultBox;
911915
}
912916

913917

lib/irrlicht/source/Irrlicht/os.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ namespace os
236236
//! generates a pseudo random number
237237
f32 Randomizer::frand()
238238
{
239-
return rand()*(1.f/rMax);
239+
return rand()*(1.f/static_cast<f32>(rMax));
240240
}
241241

242242
s32 Randomizer::randMax()

src/guiengine/event_handler.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,12 @@ int EventHandler::findIDClosestWidget(const NavigationDirection nav, const int p
540540
// - it corresponds to the current widget
541541
// - it corresponds to an invisible or disabled widget
542542
// - the player is not allowed to select it
543+
// - Its base coordinates are negative (such as buttons within ribbons)
543544
if (w_test == NULL || !Widget::isFocusableId(i) || w == w_test ||
544545
(!w_test->isVisible() && ignore_disabled) ||
545546
(!w_test->isActivated() && ignore_disabled) ||
546-
(playerID != PLAYER_ID_GAME_MASTER && !w_test->m_supports_multiplayer))
547+
(playerID != PLAYER_ID_GAME_MASTER && !w_test->m_supports_multiplayer) ||
548+
(w_test->m_x < 0) || (w_test->m_y < 0))
547549
continue;
548550

549551
// Ignore empty ribbon widgets and lists

src/guiengine/widget.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,10 @@ namespace GUIEngine
520520
*/
521521
int getID() const { return m_id; }
522522

523+
/** Get the name used for this widget in the GUI files or set in the code
524+
* Use only for debugging. */
525+
std::string getName() { return m_properties[PROP_ID]; }
526+
523527
/** Get whether this object is allowed to receive focus */
524528
bool isFocusable() const { return m_focusable; }
525529

src/network/protocols/server_lobby.cpp

+16-6
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,9 @@ void ServerLobby::asynchronousUpdate()
12001200
m_item_seed = (uint32_t)StkTime::getTimeSinceEpoch();
12011201
ItemManager::updateRandomSeed(m_item_seed);
12021202
m_game_setup->setRace(winner_vote, m_extra_seconds);
1203+
1204+
// For spectators that don't have the track, remember their
1205+
// spectate mode and don't load the track
12031206
std::string track_name = winner_vote.m_track_name;
12041207
if (ServerConfig::m_soccer_tournament)
12051208
{
@@ -1208,13 +1211,14 @@ void ServerLobby::asynchronousUpdate()
12081211
m_tournament_arenas[m_tournament_game] = track_name;
12091212
}
12101213
auto peers = STKHost::get()->getPeers();
1211-
std::map<std::shared_ptr<STKPeer>, AlwaysSpectateMode> bad_spectators;
1214+
std::map<std::shared_ptr<STKPeer>,
1215+
AlwaysSpectateMode> previous_spectate_mode;
12121216
for (auto peer : peers)
12131217
{
12141218
if (peer->alwaysSpectate() &&
12151219
peer->getClientAssets().second.count(track_name) == 0)
12161220
{
1217-
bad_spectators[peer] = peer->getAlwaysSpectate();
1221+
previous_spectate_mode[peer] = peer->getAlwaysSpectate();
12181222
peer->setAlwaysSpectate(ASM_NONE);
12191223
peer->setWaitingForGame(true);
12201224
m_peers_ready.erase(peer);
@@ -1223,8 +1227,9 @@ void ServerLobby::asynchronousUpdate()
12231227
bool has_always_on_spectators = false;
12241228
auto players = STKHost::get()
12251229
->getPlayersForNewGame(&has_always_on_spectators);
1226-
for (auto& p: bad_spectators)
1227-
p.first->setAlwaysSpectate(p.second);
1230+
for (auto& p: previous_spectate_mode)
1231+
if (p.first)
1232+
p.first->setAlwaysSpectate(p.second);
12281233
auto ai_instance = m_ai_peer.lock();
12291234
if (supportsAI())
12301235
{
@@ -1315,7 +1320,7 @@ void ServerLobby::asynchronousUpdate()
13151320
sendMessageToPeers(load_world_message);
13161321
// updatePlayerList so the in lobby players (if any) can see always
13171322
// spectators join the game
1318-
if (has_always_on_spectators || !bad_spectators.empty())
1323+
if (has_always_on_spectators || !previous_spectate_mode.empty())
13191324
updatePlayerList();
13201325
delete load_world_message;
13211326

@@ -3994,7 +3999,12 @@ void ServerLobby::handleUnencryptedConnection(std::shared_ptr<STKPeer> peer,
39943999
unsigned max_players = ServerConfig::m_server_max_players;
39954000
// We need to reserve at least 1 slot for new player
39964001
if (player_count + ai_add + 1 > max_players)
3997-
ai_add = max_players - player_count - 1;
4002+
{
4003+
if (max_players >= player_count + 1)
4004+
ai_add = max_players - player_count - 1;
4005+
else
4006+
ai_add = 0;
4007+
}
39984008
for (unsigned i = 0; i < ai_add; i++)
39994009
{
40004010
#ifdef SERVER_ONLY

src/network/stk_peer.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,12 @@ class STKPeer : public NoCopy
329329
m_default_always_spectate.store(mode);
330330
}
331331
// ------------------------------------------------------------------------
332-
bool alwaysSpectate() const
333-
{ return m_always_spectate.load() != ASM_NONE; }
334-
// ------------------------------------------------------------------------
335332
AlwaysSpectateMode getAlwaysSpectate() const
336333
{ return (AlwaysSpectateMode)m_always_spectate.load(); }
337334
// ------------------------------------------------------------------------
335+
bool alwaysSpectate() const
336+
{ return m_always_spectate.load() != ASM_NONE; }
337+
// ------------------------------------------------------------------------
338338
bool isCommandSpectator() const
339339
{ return m_always_spectate.load() == ASM_COMMAND; }
340340
// ------------------------------------------------------------------------

src/states_screens/arenas_screen.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ void ArenasScreen::eventCallback(Widget* widget, const std::string& name, const
213213
Track* clicked_track = track_manager->getTrack(selection);
214214
if (clicked_track != NULL)
215215
{
216+
// In favorite edit mode, switch the status of the selected track
216217
if (getWidget<CheckBoxWidget>("favorite")->getState())
217218
{
218219
if(PlayerManager::getCurrentPlayer()->isFavoriteTrack(clicked_track->getIdent()))

src/states_screens/kart_selection.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ EventPropagation FocusDispatcher::focused(const int player_id)
148148
// ->getIrrlichtElement()->getID() <<
149149
// ")" << std::endl;
150150

151-
m_parent->m_kart_widgets[n].m_player_ident_spinner
152-
->setFocusForPlayer(player_id);
153-
151+
m_parent->m_kart_widgets[n].m_player_ident_spinner->setFocusForPlayer(player_id);
154152

155153
return GUIEngine::EVENT_BLOCK;
156154
}
@@ -438,6 +436,8 @@ void KartSelectionScreen::init()
438436
// if kart from config not found, select the first instead
439437
w->setSelection(0, 0, true);
440438
}
439+
440+
m_dispatcher->setVisible(false);
441441
}
442442
else
443443
{

0 commit comments

Comments
 (0)