Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions AI/Wrappers/CUtils/Util.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,7 @@ static void util_initFileSelector(const char* suffix) {
fileSelectorSuffix = suffix;
}

#if defined(__APPLE__)
static int util_fileSelector(struct dirent* fileDesc) {
#else
static int util_fileSelector(const struct dirent* fileDesc) {
#endif
return util_endsWith(fileDesc->d_name, fileSelectorSuffix);
}

Expand Down
2 changes: 1 addition & 1 deletion doc/site/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ draft = false
{{< /cards >}}
{{< cards >}}
{{< card title="Tech Annihilation" image="/showcase/ta.jpeg" link="https://github.com/techannihilation/TA" >}}
{{< card title="SplinterFaction" image="showcase/splinter_faction.jpg" link="splinterfaction.info" >}}
{{< card title="SplinterFaction" image="showcase/splinter_faction.jpg" link="https://splinterfaction.info" >}}
{{< card title="Mechcommander: Legacy" image="/showcase/mcl.jpg" link="https://github.com/SpringMCLegacy/SpringMCLegacy/wiki" >}}
{{< /cards >}}

Expand Down
4 changes: 3 additions & 1 deletion rts/Lua/LuaTextures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ std::string LuaTextures::Create(const Texture& tex)
} break;
}

if (glGetError() != GL_NO_ERROR) {
if (const GLenum texErr = glGetError(); texErr != GL_NO_ERROR) {
LOG_L(L_ERROR, "[LuaTextures::%s] glTexImage failed: target=0x%x size=%dx%d fmt=0x%x dataFmt=0x%x dataType=0x%x border=%d glError=0x%x",
__func__, tex.target, tex.xsize, tex.ysize, tex.format, dataFormat, dataType, tex.border, texErr);
glDeleteTextures(1, &texID);
glBindTexture(tex.target, currentBinding);
return "";
Expand Down
2 changes: 1 addition & 1 deletion rts/Rendering/IconHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "Rendering/GL/RenderBuffersFwd.h"
#include "Rendering/Textures/TextureAtlas.h"

class UnitDef;
struct UnitDef;
class CTextureRenderAtlas;

namespace icon {
Expand Down
6 changes: 3 additions & 3 deletions rts/Rml/SolLua/bind/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ struct lua_iterator_state
sol::state_view l{s};
int index = 0;
int count = keytable.size();
while (keytable.get<sol::object>(++index).get_type() != sol::type::nil && index <= count) {
while (keytable.get<sol::object>(++index).get_type() != sol::type::lua_nil && index <= count) {
this->keys.emplace_back(sol::object(l, sol::in_place, index));
}
} else {
Expand Down Expand Up @@ -199,7 +199,7 @@ createNewIndexFunction(std::shared_ptr<Rml::SolLua::SolLuaDataModel> data, const
}
if (value.is<sol::table>()) {
auto value_raw = value.as<sol::table>().raw_get<sol::object>("__raw");
if (value_raw != sol::nil && value_raw.is<sol::function>()) {
if (value_raw != sol::lua_nil && value_raw.is<sol::function>()) {
// new value is a datamodel proxy, so get the underlying table to assign
prop.as<sol::table>().raw_set(solkey, value_raw.as<sol::function>().call<sol::object>(value));
} else {
Expand Down Expand Up @@ -290,7 +290,7 @@ sol::table openDataModel(Rml::Context& self, const Rml::String& name, sol::objec
}
if (value.is<sol::table>()) {
auto value_raw = value.as<sol::table>().raw_get<sol::object>("__raw");
if (value_raw != sol::nil && value_raw.is<sol::function>()) {
if (value_raw != sol::lua_nil && value_raw.is<sol::function>()) {
// new value is a datamodel proxy, so get the underlying table to assign
data->Table.raw_set(key, value_raw.as<sol::function>().call<sol::object>(value));
} else {
Expand Down
2 changes: 1 addition & 1 deletion rts/Rml/SolLua/bind/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ namespace Rml::SolLua

void Set(const sol::this_state L, const std::string& name, const sol::object& value)
{
if (value.get_type() == sol::type::nil) {
if (value.get_type() == sol::type::lua_nil) {
m_element->RemoveProperty(name);
return;
}
Expand Down
6 changes: 3 additions & 3 deletions rts/Rml/SolLua/bind/bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace Rml::SolLua

sol::object makeObjectFromVariant(const Rml::Variant* variant, sol::state_view s)
{
if (!variant) return sol::make_object(s, sol::nil);
if (!variant) return sol::make_object(s, sol::lua_nil);

switch (variant->GetType())
{
Expand Down Expand Up @@ -69,10 +69,10 @@ namespace Rml::SolLua
case Rml::Variant::VOIDPTR:
return sol::make_object(s, variant->Get<void*>());
default:
return sol::make_object(s, sol::nil);
return sol::make_object(s, sol::lua_nil);
}

return sol::make_object(s, sol::nil);
return sol::make_object(s, sol::lua_nil);
}

} // end namespace Rml::SolLua
2 changes: 1 addition & 1 deletion rts/Sim/Misc/SmoothHeightMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace SmoothHeightMeshNamespace {
*/
class SmoothHeightMesh
{
friend class SmoothHeightMeshDrawer;
friend struct SmoothHeightMeshDrawer;

public:

Expand Down
4 changes: 2 additions & 2 deletions rts/Sim/MoveTypes/Components/MoveTypesComponents.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "System/Ecs/Components/BaseComponents.h"
#include <System/Threading/ThreadPool.h>

struct CUnit;
struct CFeature;
class CUnit;
class CFeature;

namespace MoveTypes {

Expand Down
2 changes: 1 addition & 1 deletion rts/Sim/MoveTypes/MoveDefHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CUnit;
class LuaTable;

namespace MoveTypes {
class CheckCollisionQuery;
struct CheckCollisionQuery;
}

namespace MoveDefs {
Expand Down
4 changes: 2 additions & 2 deletions rts/Sim/MoveTypes/Utils/UnitTrapCheckUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#ifndef UNIT_TRAP_CHECK_UTILS_H__
#define UNIT_TRAP_CHECK_UTILS_H__

struct CFeature;
struct CUnit;
class CFeature;
class CUnit;

namespace MoveTypes {
void RegisterFeatureForUnitTrapCheck(CFeature* object);
Expand Down
2 changes: 1 addition & 1 deletion rts/Sim/Path/HAPFS/PathSearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "System/float3.h"

class CSolidObject;
class MoveDef;
struct MoveDef;

namespace HAPFS {
struct PathSearch {
Expand Down
2 changes: 1 addition & 1 deletion rts/Sim/Path/QTPFS/Components/PathSpeedModInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace QTPFS {

class INode;
struct INode;

struct NodeLayerSpeedInfoSweep {
static constexpr std::size_t page_size = MoveDefHandler::MAX_MOVE_DEFS;
Expand Down
4 changes: 2 additions & 2 deletions rts/Sim/Units/CommandAI/BuilderCAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,13 +891,13 @@ void CBuilderCAI::ExecuteGuard(Command& c)
StopSlowGuard();
}
return;
} else if (b->curReclaim && owner->unitDef->canReclaim) {
} else if (b->curReclaim && !b->curReclaim->detached && owner->unitDef->canReclaim) {
StopSlowGuard();
if (!ReclaimObject(b->curReclaim)) {
StopMove();
}
return;
} else if (b->curResurrect && owner->unitDef->canResurrect) {
} else if (b->curResurrect && !b->curResurrect->detached && owner->unitDef->canResurrect) {
StopSlowGuard();
if (!ResurrectObject(b->curResurrect)) {
StopMove();
Expand Down
19 changes: 19 additions & 0 deletions rts/Sim/Units/UnitTypes/Builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,15 @@ void CBuilder::SetRepairTarget(CUnit* target)
void CBuilder::SetReclaimTarget(CSolidObject* target)
{
RECOIL_DETAILED_TRACY_ZONE;
// A target already being destroyed (detached) cannot have a death dependence
// registered (AddDeathDependence no-ops on detached objects), which would leave
// curReclaim dangling. This happens when ~CObject's DependentDied cascade re-enters
// reclaim logic mid-deletion (e.g. CBuilderCAI::ExecuteGuard reading a guardee's
// stale curReclaim) on the very feature being freed. Refuse the dead target.
assert(target != nullptr);
if (target->detached)
return;

if (dynamic_cast<CFeature*>(target) != nullptr && !static_cast<CFeature*>(target)->def->reclaimable)
return;

Expand All @@ -630,6 +639,11 @@ void CBuilder::SetReclaimTarget(CSolidObject* target)
void CBuilder::SetResurrectTarget(CFeature* target)
{
RECOIL_DETAILED_TRACY_ZONE;
// see SetReclaimTarget: never depend on an object that is already being destroyed
assert(target != nullptr);
if (target->detached)
return;

if (curResurrect == target || target->udef == nullptr)
return;

Expand All @@ -646,6 +660,11 @@ void CBuilder::SetResurrectTarget(CFeature* target)
void CBuilder::SetCaptureTarget(CUnit* target)
{
RECOIL_DETAILED_TRACY_ZONE;
// see SetReclaimTarget: never depend on an object that is already being destroyed
assert(target != nullptr);
if (target->detached)
return;

if (target == curCapture)
return;

Expand Down
2 changes: 1 addition & 1 deletion rts/System/FileSystem/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace Impl {
return std::string(reinterpret_cast<const char*>(utf8.c_str()));
}
RECOIL_FORCE_INLINE std::string StoreUTF8AsString(const std::u8string_view& utf8) {
return std::string(reinterpret_cast<const char*>(utf8.data()));
return std::string(reinterpret_cast<const char*>(utf8.data()), utf8.size());
}
RECOIL_FORCE_INLINE std::string StorePathAsString(const fs::path& path) {
return StoreUTF8AsString(path.u8string());
Expand Down
21 changes: 15 additions & 6 deletions rts/System/Log/DefaultFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,15 @@ void log_filter_section_setMinLevel(int level, const char* section)
// (same string but will not become garbage)
section = *registeredSection;

if (level == log_filter_section_getDefaultMinLevel(section)) {
using P = decltype(log_filter::sectionMinLevels)::value_type;

const auto sectionComparer = [](const P& a, const P& b) { return (log_filter_section_compare()(a.first, b.first)); };
const auto sectionMinLevel = std::lower_bound(secLvls.begin(), secLvls.begin() + log_filter::numLevels, P{section, 0}, sectionComparer);
// locate any existing override for this section (the array is kept sorted)
using P = decltype(log_filter::sectionMinLevels)::value_type;
const auto sectionComparer = [](const P& a, const P& b) { return (log_filter_section_compare()(a.first, b.first)); };
const auto sectionMinLevel = std::lower_bound(secLvls.begin(), secLvls.begin() + log_filter::numLevels, P{section, 0}, sectionComparer);
const bool exists = (sectionMinLevel != (secLvls.begin() + log_filter::numLevels) && strcmp(sectionMinLevel->first, section) == 0);

if (sectionMinLevel == (secLvls.begin() + log_filter::numLevels) || strcmp(sectionMinLevel->first, section) != 0)
if (level == log_filter_section_getDefaultMinLevel(section)) {
// back to default: drop any existing override (nothing to do otherwise)
if (!exists)
return;

// erase
Expand All @@ -175,6 +177,13 @@ void log_filter_section_setMinLevel(int level, const char* section)
return;
}

// non-default: update any existing override in-place
if (exists) {
sectionMinLevel->second = level;
return;
}

// add a net new override
secLvls[log_filter::numLevels++] = {section, level};

// swap into position
Expand Down
18 changes: 0 additions & 18 deletions rts/System/Platform/Mac/SDLMain.h

This file was deleted.

Loading