Skip to content

Commit

Permalink
Misc. improvements
Browse files Browse the repository at this point in the history
- Fix MSVC compilation
- Improve some repetitive code
  • Loading branch information
Alayan-stk-2 committed May 22, 2024
1 parent 2923a86 commit c086a67
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 29 deletions.
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ add_definitions( -DSUPERTUXKART_VERSION="${PROJECT_VERSION}" )
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
include(CMakeDependentOption)

if(MSVC)
cmake_policy(SET CMP0043 OLD)
endif()

include(BuildTypeSTKRelease)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to STKRelease")
Expand Down Expand Up @@ -523,7 +519,8 @@ endif()
if(MSVC)
# VS will automatically add NDEBUG for release mode, but only _DEBUG in debug mode.
# Since STK uses DEBUG, this is added for debug compilation only:
set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:DEBUG>)
cmake_policy(SET CMP0043 OLD)
set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG)
else()
# All non VS generators used create only a single compile mode, so
# compile flags can be simplye be added
Expand Down
32 changes: 9 additions & 23 deletions src/states_screens/race_gui_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,35 +1034,21 @@ void RaceGUIBase::drawPlayerIcon(AbstractKart *kart, int x, int y, int w,
bool is_local)
{
#ifndef SERVER_ONLY
video::ITexture *icon =
kart->getKartProperties()->getIconMaterial()->getTexture();
video::ITexture *icon = kart->getKartProperties()->getIconMaterial()->getTexture();

CaptureTheFlag* ctf = dynamic_cast<CaptureTheFlag*>(World::getWorld());
unsigned int kart_id = kart->getWorldKartId();

// CTF
if (ctf)
if (ctf && (ctf->getRedHolder() == (int)kart_id ||
ctf->getBlueHolder() == (int)kart_id))
{
if (ctf->getRedHolder() == (int)kart_id)
{
video::ITexture* red =
irr_driver->getTexture(FileManager::GUI_ICON, "red_flag.png");
const core::rect<s32> rect(core::position2d<s32>(0, 0),
red->getSize());
const core::rect<s32> pos1
(x - 20, y - 10, x + w - 20, y + w - 30);
draw2DImage(red, pos1, rect, NULL, NULL, true);
}
else if (ctf->getBlueHolder() == (int)kart_id)
{
video::ITexture* blue =
irr_driver->getTexture(FileManager::GUI_ICON, "blue_flag.png");
const core::rect<s32> rect(core::position2d<s32>(0, 0),
blue->getSize());
const core::rect<s32> pos1
(x - 20, y - 10, x + w - 20, y + w - 30);
draw2DImage(blue, pos1, rect, NULL, NULL, true);
}
video::ITexture* flag = irr_driver->getTexture(FileManager::GUI_ICON,
(ctf->getRedHolder() == (int)kart_id) ? "red_flag.png" : "blue_flag.png");

const core::rect<s32> rect(core::position2d<s32>(0, 0), flag->getSize());
const core::rect<s32> pos1(x - 20, y - 10, x + w - 20, y + w - 30);
draw2DImage(flag, pos1, rect, NULL, NULL, true);
}

const core::rect<s32> pos(x, y, x+w, y+w);
Expand Down
2 changes: 1 addition & 1 deletion src/tracks/track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ void Track::createPhysicsModel(unsigned int main_track_count,
// -----------------------------------------------------------------------------


/** Convert the graohics track into its physics equivalents.
/** Convert the graphics track into its physics equivalents.
* \param mesh The mesh to convert.
* \param node The scene node.
*/
Expand Down

0 comments on commit c086a67

Please sign in to comment.