Fixed remaining compiler warnings

Some warnings (e.g. in Opus and the tests) can't be fixed, only suppressed.
This commit is contained in:
Kai Blaschke 2024-02-28 18:11:55 +01:00
parent 28d486446c
commit cd23817bf1
No known key found for this signature in database
GPG Key ID: B014B6811527389F
49 changed files with 148 additions and 197 deletions

View File

@ -819,7 +819,7 @@ private:
auto newImage = std::make_shared<Image>(processImageOperations(operations, *image)); auto newImage = std::make_shared<Image>(processImageOperations(operations, *image));
// Fix fully transparent pixels inverting the underlying display pixel on Windows (allowing this could be made configurable per cursor later!) // Fix fully transparent pixels inverting the underlying display pixel on Windows (allowing this could be made configurable per cursor later!)
newImage->forEachPixel([](unsigned x, unsigned y, Vec4B& pixel) { if (!pixel[3]) pixel[0] = pixel[1] = pixel[2] = 0; }); newImage->forEachPixel([](unsigned /*x*/, unsigned /*y*/, Vec4B& pixel) { if (!pixel[3]) pixel[0] = pixel[1] = pixel[2] = 0; });
entry->image = std::move(newImage); entry->image = std::move(newImage);

View File

@ -81,7 +81,7 @@ void PcP2PNetworkingService::setJoinRemote(HostAddressWithPort location) {
setJoinLocation(JoinRemote(location)); setJoinLocation(JoinRemote(location));
} }
void Star::PcP2PNetworkingService::setActivityData(String const& title, Maybe<pair<uint16_t, uint16_t>> party) { void Star::PcP2PNetworkingService::setActivityData(String const&, Maybe<pair<uint16_t, uint16_t>>) {
#ifdef STAR_ENABLE_DISCORD_INTEGRATION #ifdef STAR_ENABLE_DISCORD_INTEGRATION
MutexLocker discordLocker(m_state->discordMutex); MutexLocker discordLocker(m_state->discordMutex);
#endif #endif

View File

@ -98,7 +98,7 @@ void PcPlatformServicesState::onGameOverlayActivated(GameOverlayActivated_t* cal
} }
#endif #endif
PcPlatformServicesUPtr PcPlatformServices::create(String const& path, StringList platformArguments) { PcPlatformServicesUPtr PcPlatformServices::create(String const&, StringList platformArguments) {
auto services = unique_ptr<PcPlatformServices>(new PcPlatformServices); auto services = unique_ptr<PcPlatformServices>(new PcPlatformServices);
services->m_state = make_shared<PcPlatformServicesState>(); services->m_state = make_shared<PcPlatformServicesState>();

View File

@ -720,7 +720,6 @@ void OpenGl20Renderer::GlRenderBuffer::set(List<RenderPrimitive>& primitives) {
float textureIndex = 0.0f; float textureIndex = 0.0f;
Vec2F textureOffset = {}; Vec2F textureOffset = {};
Texture* lastTexture = nullptr;
for (auto& primitive : primitives) { for (auto& primitive : primitives) {
if (auto tri = primitive.ptr<RenderTriangle>()) { if (auto tri = primitive.ptr<RenderTriangle>()) {
tie(textureIndex, textureOffset) = addCurrentTexture(std::move(tri->texture)); tie(textureIndex, textureOffset) = addCurrentTexture(std::move(tri->texture));
@ -781,7 +780,7 @@ bool OpenGl20Renderer::logGlErrorSummary(String prefix) {
} else { } else {
Logger::error("<UNRECOGNIZED GL ERROR>"); Logger::error("<UNRECOGNIZED GL ERROR>");
} }
} while (error = glGetError()); } while ((error = glGetError()));
return true; return true;
} }
return false; return false;
@ -897,8 +896,6 @@ void OpenGl20Renderer::renderGlBuffer(GlRenderBuffer const& renderBuffer, Mat3F
//Assumes the passed effect program is currently in use. //Assumes the passed effect program is currently in use.
void OpenGl20Renderer::setupGlUniforms(Effect& effect) { void OpenGl20Renderer::setupGlUniforms(Effect& effect) {
GLuint program = effect.program;
m_positionAttribute = effect.getAttribute("vertexPosition"); m_positionAttribute = effect.getAttribute("vertexPosition");
m_texCoordAttribute = effect.getAttribute("vertexTextureCoordinate"); m_texCoordAttribute = effect.getAttribute("vertexTextureCoordinate");
m_texIndexAttribute = effect.getAttribute("vertexTextureIndex"); m_texIndexAttribute = effect.getAttribute("vertexTextureIndex");

View File

@ -858,7 +858,7 @@ shared_ptr<Assets::AssetData> Assets::loadImage(AssetPath const& path) const {
for (auto& directives : path.directives.list()) for (auto& directives : path.directives.list())
directives.loadOperations(); directives.loadOperations();
path.directives.forEach([&](auto const& entry, Directives const& directives) { path.directives.forEach([&](auto const& entry, Directives const&) {
addImageOperationReferences(entry.operation, referencePaths); addImageOperationReferences(entry.operation, referencePaths);
}); // TODO: This can definitely be better, was changed quickly to support the new Directives. }); // TODO: This can definitely be better, was changed quickly to support the new Directives.
@ -875,7 +875,7 @@ shared_ptr<Assets::AssetData> Assets::loadImage(AssetPath const& path) const {
return unlockDuring([&]() { return unlockDuring([&]() {
auto newData = make_shared<ImageData>(); auto newData = make_shared<ImageData>();
Image newImage = *source->image; Image newImage = *source->image;
path.directives.forEach([&](auto const& entry, Directives const& directives) { path.directives.forEach([&](auto const& entry, Directives const&) {
if (auto error = entry.operation.template ptr<ErrorImageOperation>()) if (auto error = entry.operation.template ptr<ErrorImageOperation>())
std::rethrow_exception(error->exception); std::rethrow_exception(error->exception);
else else

View File

@ -473,7 +473,7 @@ void Mixer::setGroupVolume(MixerGroup group, float targetValue, float rampTime)
} }
} }
void Mixer::update(float dt, PositionalAttenuationFunction positionalAttenuationFunction) { void Mixer::update(float, PositionalAttenuationFunction positionalAttenuationFunction) {
{ {
MutexLocker locker(m_queueMutex); MutexLocker locker(m_queueMutex);
eraseWhere(m_audios, [&](auto& p) { eraseWhere(m_audios, [&](auto& p) {

View File

@ -333,7 +333,6 @@ void ClientApplication::processInput(InputEvent const& event) {
} }
m_input->handleInput(event, processed); m_input->handleInput(event, processed);
WorldCamera& camera = m_worldPainter->camera();
auto config = m_root->configuration(); auto config = m_root->configuration();
int zoomOffset = 0; int zoomOffset = 0;
@ -709,7 +708,7 @@ void ClientApplication::updateMods(float dt) {
} }
} }
void ClientApplication::updateModsWarning(float dt) { void ClientApplication::updateModsWarning(float) {
if (m_errorScreen->accepted()) if (m_errorScreen->accepted())
changeState(MainAppState::Splash); changeState(MainAppState::Splash);
} }
@ -720,7 +719,7 @@ void ClientApplication::updateSplash(float dt) {
changeState(MainAppState::Title); changeState(MainAppState::Title);
} }
void ClientApplication::updateError(float dt) { void ClientApplication::updateError(float) {
if (m_errorScreen->accepted()) if (m_errorScreen->accepted())
changeState(MainAppState::Title); changeState(MainAppState::Title);
} }

View File

@ -115,7 +115,7 @@ std::pair<Image, Vec2I> Font::render(String::Char c) {
for (unsigned y = 0; y != height; ++y) { for (unsigned y = 0; y != height; ++y) {
uint8_t* p = slot->bitmap.buffer + y * slot->bitmap.pitch; uint8_t* p = slot->bitmap.buffer + y * slot->bitmap.pitch;
for (unsigned x = 0; x != width; ++x) { for (unsigned x = 0; x != width; ++x) {
if (x >= 0 && y >= 0 && x < width && y < height) { if (x < width && y < height) {
uint8_t value = *(p + x); uint8_t value = *(p + x);
if (m_alphaThreshold) { if (m_alphaThreshold) {
if (value >= m_alphaThreshold) { if (value >= m_alphaThreshold) {

View File

@ -182,7 +182,7 @@ ImageOperation imageOperationFromString(StringView string) {
c[0] |= (c[0] << 4); c[0] |= (c[0] << 4);
c[1] |= (c[1] << 4); c[1] |= (c[1] << 4);
c[2] |= (c[2] << 4); c[2] |= (c[2] << 4);
c[3] = 255; c[3] = static_cast<char>(255);
} }
else if (hexLen == 4) { else if (hexLen == 4) {
nibbleDecode(hexPtr, 4, c, 4); nibbleDecode(hexPtr, 4, c, 4);
@ -193,7 +193,7 @@ ImageOperation imageOperationFromString(StringView string) {
} }
else if (hexLen == 6) { else if (hexLen == 6) {
hexDecode(hexPtr, 6, c, 4); hexDecode(hexPtr, 6, c, 4);
c[3] = 255; c[3] = static_cast<char>(255);
} }
else if (hexLen == 8) { else if (hexLen == 8) {
hexDecode(hexPtr, 8, c, 4); hexDecode(hexPtr, 8, c, 4);

View File

@ -47,7 +47,7 @@ LuaValue LuaConverter<LuaCallbacks>::from(LuaEngine& engine, LuaCallbacks const&
return table; return table;
} }
Maybe<LuaCallbacks> LuaConverter<LuaCallbacks>::to(LuaEngine& engine, LuaValue const& v) { Maybe<LuaCallbacks> LuaConverter<LuaCallbacks>::to(LuaEngine&, LuaValue const&) {
return {}; return {};
} }

View File

@ -196,7 +196,7 @@ bool ActionBar::sendEvent(InputEvent const& event) {
return false; return false;
} }
void ActionBar::update(float dt) { void ActionBar::update(float) {
auto inventory = m_player->inventory(); auto inventory = m_player->inventory();
auto abl = inventory->selectedActionBarLocation(); auto abl = inventory->selectedActionBarLocation();
if (abl.is<CustomBarIndex>()) { if (abl.is<CustomBarIndex>()) {

View File

@ -169,11 +169,10 @@ void BubbleSeparator<T>::forEach(function<void(Bubble&, T&)> func) {
} }
template <typename T> template <typename T>
void BubbleSeparator<T>::update(float dt) { void BubbleSeparator<T>::update(float) {
m_bubbles.exec([this](Bubble& bubble) { m_bubbles.exec([this](Bubble& bubble) {
Vec2F delta = bubble.seperatedOffset - bubble.currentOffset; Vec2F delta = bubble.seperatedOffset - bubble.currentOffset;
bubble.currentOffset += m_tweenFactor * delta; bubble.currentOffset += m_tweenFactor * delta;
bubble.currentPosition = bubble.currentDestination + bubble.currentOffset; bubble.currentPosition = bubble.currentDestination + bubble.currentOffset;
}); });
} }

View File

@ -102,7 +102,7 @@ void Cinematic::setPlayer(PlayerPtr player) {
m_player = player; m_player = player;
} }
void Cinematic::update(float dt) { void Cinematic::update(float) {
m_currentTimeSkip = {}; m_currentTimeSkip = {};
for (auto timeSkip : m_timeSkips) { for (auto timeSkip : m_timeSkips) {
if (currentTimecode() >= timeSkip.availableTime && currentTimecode() < timeSkip.skipToTime) if (currentTimecode() >= timeSkip.availableTime && currentTimecode() < timeSkip.skipToTime)

View File

@ -50,7 +50,7 @@ void CodexInterface::show() {
updateCodexList(); updateCodexList();
} }
void CodexInterface::tick(float dt) { void CodexInterface::tick(float) {
updateCodexList(); updateCodexList();
} }

View File

@ -1365,11 +1365,9 @@ void MainInterface::renderDebug() {
m_debugTextRect = RectF::null(); m_debugTextRect = RectF::null();
counter = 0; for (size_t index = 0; index < logMapValues.size(); ++index) {
for (auto const& pair : logMapValues) {
TextPositioning positioning = { Vec2F(m_config->debugOffset[0], windowHeight() - m_config->debugOffset[1] - m_config->fontSize * interfaceScale() * counter) }; TextPositioning positioning = { Vec2F(m_config->debugOffset[0], windowHeight() - m_config->debugOffset[1] - m_config->fontSize * interfaceScale() * counter) };
m_guiContext->renderText(formatted[counter], positioning); m_guiContext->renderText(formatted[index], positioning);
++counter;
} }
m_guiContext->setFontSize(8); m_guiContext->setFontSize(8);
m_guiContext->setDefaultFont(); m_guiContext->setDefaultFont();
@ -1515,7 +1513,7 @@ bool MainInterface::overButton(PolyI buttonPoly, Vec2I const& mousePos) const {
return buttonPoly.contains(mousePos); return buttonPoly.contains(mousePos);
} }
bool MainInterface::overlayClick(Vec2I const& mousePos, MouseButton mouseButton) { bool MainInterface::overlayClick(Vec2I const& mousePos, MouseButton) {
PolyI mainBarPoly = m_config->mainBarPoly; PolyI mainBarPoly = m_config->mainBarPoly;
Vec2I barPos = mainBarPosition(); Vec2I barPos = mainBarPosition();
mainBarPoly.translate(barPos); mainBarPoly.translate(barPos);

View File

@ -149,7 +149,6 @@ void TeamBar::buildTeamBar() {
Vec2I offset; Vec2I offset;
size_t controlIndex = 0; size_t controlIndex = 0;
size_t memberIndex = 0;
float portraitScale = assets->json("/interface/windowconfig/teambar.config:memberPortraitScale").toFloat(); float portraitScale = assets->json("/interface/windowconfig/teambar.config:memberPortraitScale").toFloat();
int memberSize = assets->json("/interface/windowconfig/teambar.config:memberSize").toInt(); int memberSize = assets->json("/interface/windowconfig/teambar.config:memberSize").toInt();
@ -158,7 +157,6 @@ void TeamBar::buildTeamBar() {
Uuid myUuid = player->clientContext()->playerUuid(); Uuid myUuid = player->clientContext()->playerUuid();
for (auto member : teamClient->members()) { for (auto member : teamClient->members()) {
if (member.uuid == myUuid) { if (member.uuid == myUuid) {
memberIndex++;
continue; continue;
} }
@ -217,7 +215,6 @@ void TeamBar::buildTeamBar() {
offset[1] -= memberSpacing; offset[1] -= memberSpacing;
controlIndex++; controlIndex++;
memberIndex++;
} }
auto inviteButton = fetchChild<ButtonWidget>("inviteButton"); auto inviteButton = fetchChild<ButtonWidget>("inviteButton");

View File

@ -120,7 +120,7 @@ TeleportDialog::TeleportDialog(UniverseClientPtr client,
fetchChild<ButtonWidget>("btnTeleport")->setEnabled(destList->selectedItem() != NPos); fetchChild<ButtonWidget>("btnTeleport")->setEnabled(destList->selectedItem() != NPos);
} }
void TeleportDialog::tick(float dt) { void TeleportDialog::tick(float) {
if (!m_client->worldClient()->playerCanReachEntity(m_sourceEntityId)) if (!m_client->worldClient()->playerCanReachEntity(m_sourceEntityId))
dismiss(); dismiss();
} }

View File

@ -13,7 +13,6 @@
constexpr int VOICE_SAMPLE_RATE = 48000; constexpr int VOICE_SAMPLE_RATE = 48000;
constexpr int VOICE_FRAME_SIZE = 960; constexpr int VOICE_FRAME_SIZE = 960;
constexpr int VOICE_MAX_FRAME_SIZE = 6 * VOICE_FRAME_SIZE;
constexpr int VOICE_MAX_PACKET_SIZE = 3 * 1276; constexpr int VOICE_MAX_PACKET_SIZE = 3 * 1276;
constexpr uint16_t VOICE_VERSION = 1; constexpr uint16_t VOICE_VERSION = 1;
@ -421,7 +420,7 @@ void Voice::mix(int16_t* buffer, size_t frameCount, unsigned channels) {
} }
} }
void Voice::update(float dt, PositionalAttenuationFunction positionalAttenuationFunction) { void Voice::update(float, PositionalAttenuationFunction positionalAttenuationFunction) {
for (auto& entry : m_speakers) { for (auto& entry : m_speakers) {
if (SpeakerPtr& speaker = entry.second) { if (SpeakerPtr& speaker = entry.second) {
if (positionalAttenuationFunction) { if (positionalAttenuationFunction) {
@ -465,7 +464,7 @@ StringList Voice::availableDevices() {
StringList deviceList; StringList deviceList;
if (devices > 0) { if (devices > 0) {
deviceList.reserve(devices); deviceList.reserve(devices);
for (size_t i = 0; i != devices; ++i) for (int i = 0; i != devices; ++i)
deviceList.emplace_back(SDL_GetAudioDeviceName(i, 1)); deviceList.emplace_back(SDL_GetAudioDeviceName(i, 1));
} }
deviceList.sort(); deviceList.sort();
@ -482,7 +481,6 @@ int Voice::send(DataStreamBuffer& out, size_t budget) {
return 0; return 0;
std::vector<ByteArray> encodedChunks = std::move(m_encodedChunks); std::vector<ByteArray> encodedChunks = std::move(m_encodedChunks);
size_t encodedChunksLength = m_encodedChunksLength;
m_encodedChunksLength = 0; m_encodedChunksLength = 0;
encodeLock.unlock(); encodeLock.unlock();
@ -642,7 +640,7 @@ void Voice::closeDevice() {
m_deviceOpen = false; m_deviceOpen = false;
} }
bool Voice::playSpeaker(SpeakerPtr const& speaker, int channels) { bool Voice::playSpeaker(SpeakerPtr const& speaker, int) {
if (speaker->playing || speaker->audioStream->samples.size() < speaker->minimumPlaySamples) if (speaker->playing || speaker->audioStream->samples.size() < speaker->minimumPlaySamples)
return false; return false;

View File

@ -35,7 +35,7 @@ void WirePane::reset() {
m_connecting = false; m_connecting = false;
} }
void WirePane::update(float dt) { void WirePane::update(float) {
if (!active()) if (!active())
return; return;
if (!m_worldClient->inWorld()) { if (!m_worldClient->inWorld()) {

View File

@ -664,7 +664,7 @@ void ActorMovementController::controlFly(Vec2F const& velocity) {
m_controlFly = velocity; m_controlFly = velocity;
} }
Maybe<pair<Vec2F, bool>> ActorMovementController::pathMove(Vec2F const& position, bool run, Maybe<PlatformerAStar::Parameters> const& parameters) { Maybe<pair<Vec2F, bool>> ActorMovementController::pathMove(Vec2F const& position, bool, Maybe<PlatformerAStar::Parameters> const& parameters) {
if (!m_pathController) if (!m_pathController)
m_pathController = make_shared<PathController>(world()); m_pathController = make_shared<PathController>(world());
@ -1214,7 +1214,7 @@ Maybe<bool> PathController::findPath(ActorMovementController& movementController
if (!merged) { if (!merged) {
// try to splice the new path onto the current path // try to splice the new path onto the current path
auto& newPathStart = path.at(0); auto& newPathStart = path.at(0);
for (size_t i = m_edgeIndex; i < m_path->size(); ++i) { for (size_t i = m_edgeIndex; i < m_path->size(); i += 2) {
auto& edge = m_path->at(i); auto& edge = m_path->at(i);
if (edge.target.position == newPathStart.source.position) { if (edge.target.position == newPathStart.source.position) {
// splice the new path onto our current path up to this index // splice the new path onto our current path up to this index
@ -1228,7 +1228,6 @@ Maybe<bool> PathController::findPath(ActorMovementController& movementController
merged = true; merged = true;
break; break;
} }
i++;
} }
} }
} }
@ -1456,7 +1455,7 @@ bool PathController::validateEdge(ActorMovementController& movementController, P
bool PathController::movingCollision(ActorMovementController& movementController, PolyF const& collisionPoly) { bool PathController::movingCollision(ActorMovementController& movementController, PolyF const& collisionPoly) {
bool collided = false; bool collided = false;
movementController.forEachMovingCollision(collisionPoly.boundBox(), [&](MovingCollisionId id, PhysicsMovingCollision mc, PolyF poly, RectF bounds) { movementController.forEachMovingCollision(collisionPoly.boundBox(), [&](MovingCollisionId, PhysicsMovingCollision, PolyF poly, RectF) {
if (poly.intersects(collisionPoly)) { if (poly.intersects(collisionPoly)) {
// set collided and stop iterating // set collided and stop iterating
collided = true; collided = true;

View File

@ -70,7 +70,7 @@ Drawable::ImagePart& Drawable::ImagePart::removeDirectives(bool keepImageCenterP
Drawable Drawable::makeLine(Line2F const& line, float lineWidth, Color const& color, Vec2F const& position) { Drawable Drawable::makeLine(Line2F const& line, float lineWidth, Color const& color, Vec2F const& position) {
Drawable drawable; Drawable drawable;
drawable.part = LinePart{std::move(line), lineWidth}; drawable.part = LinePart{std::move(line), lineWidth, {}};
drawable.color = color; drawable.color = color;
drawable.position = position; drawable.position = position;
@ -110,7 +110,7 @@ Drawable::Drawable()
Drawable::Drawable(Json const& json) { Drawable::Drawable(Json const& json) {
if (auto line = json.opt("line")) { if (auto line = json.opt("line")) {
part = LinePart{jsonToLine2F(*line), json.getFloat("width")}; part = LinePart{jsonToLine2F(*line), json.getFloat("width"), {}};
} else if (auto poly = json.opt("poly")) { } else if (auto poly = json.opt("poly")) {
part = PolyPart{jsonToPolyF(*poly)}; part = PolyPart{jsonToPolyF(*poly)};
} else if (auto image = json.opt("image")) { } else if (auto image = json.opt("image")) {

View File

@ -935,7 +935,7 @@ List<Drawable> Humanoid::renderSkull() const {
Root::singleton().speciesDatabase()->species(m_identity.species)->skull(), 1.0f, true, Vec2F())}; Root::singleton().speciesDatabase()->species(m_identity.species)->skull(), 1.0f, true, Vec2F())};
} }
Humanoid Humanoid::makeDummy(Gender gender) { Humanoid Humanoid::makeDummy(Gender) {
auto assets = Root::singleton().assets(); auto assets = Root::singleton().assets();
Humanoid humanoid(assets->json("/humanoid.config")); Humanoid humanoid(assets->json("/humanoid.config"));

View File

@ -238,7 +238,7 @@ Vec2U ImageMetadataDatabase::calculateImageSize(AssetPath const& path) const {
for (auto& directives : path.directives.list()) for (auto& directives : path.directives.list())
directives.loadOperations(); directives.loadOperations();
bool complete = path.directives.forEachAbortable([&](auto const& entry, Directives const& directives) -> bool { bool complete = path.directives.forEachAbortable([&](auto const& entry, Directives const&) -> bool {
entry.operation.call(osa); entry.operation.call(osa);
return !osa.hasError; return !osa.hasError;
}); });

View File

@ -624,9 +624,7 @@ void MovementController::tickMaster(float dt) {
Vec2F newVelocity = relativeVelocity + m_surfaceVelocity; Vec2F newVelocity = relativeVelocity + m_surfaceVelocity;
Vec2F pos = position();
PolyF body = collisionBody(); PolyF body = collisionBody();
RectF boundBox = body.boundBox();
updateLiquidPercentage(); updateLiquidPercentage();
@ -736,7 +734,7 @@ void MovementController::forEachMovingCollision(RectF const& region, function<bo
} }
} }
void MovementController::updateForceRegions(float dt) { void MovementController::updateForceRegions(float) {
auto geometry = world()->geometry(); auto geometry = world()->geometry();
auto pos = position(); auto pos = position();
auto body = collisionBody(); auto body = collisionBody();
@ -804,7 +802,6 @@ void MovementController::updateForceRegions(float dt) {
} }
void MovementController::updateLiquidPercentage() { void MovementController::updateLiquidPercentage() {
auto geometry = world()->geometry();
auto pos = position(); auto pos = position();
auto body = collisionBody(); auto body = collisionBody();
RectF boundBox = body.boundBox(); RectF boundBox = body.boundBox();

View File

@ -2186,7 +2186,7 @@ Maybe<String> Player::inspectionLogName() const {
return identifier; return identifier;
} }
Maybe<String> Player::inspectionDescription(String const& species) const { Maybe<String> Player::inspectionDescription(String const&) const {
return m_description; return m_description;
} }

View File

@ -444,7 +444,7 @@ void PlayerInventory::condenseBagStacks(String const& bagType) {\
bag->condenseStacks(); bag->condenseStacks();
m_customBar.forEach([&](auto const& index, CustomBarLink& link) { m_customBar.forEach([&](auto const&, CustomBarLink& link) {
if (link.first) { if (link.first) {
if (auto bs = link.first->ptr<BagSlot>()) { if (auto bs = link.first->ptr<BagSlot>()) {
if (bs->first == bagType && !bag->at(bs->second)) if (bs->first == bagType && !bag->at(bs->second))

View File

@ -157,7 +157,7 @@ void StatCollection::tickMaster(float dt) {
m_stats.update(dt); m_stats.update(dt);
} }
void StatCollection::tickSlave(float dt) { void StatCollection::tickSlave(float) {
m_stats.update(0.0f); m_stats.update(0.0f);
} }

View File

@ -7,7 +7,7 @@ namespace Star {
SystemWorldServerThread::SystemWorldServerThread(Vec3I const& location, SystemWorldServerPtr systemWorld, String storageFile) SystemWorldServerThread::SystemWorldServerThread(Vec3I const& location, SystemWorldServerPtr systemWorld, String storageFile)
: Thread(strf("SystemWorldServer: {}", location)) : Thread(strf("SystemWorldServer: {}", location))
, m_systemLocation(location) , m_systemLocation(location)
, m_systemWorld(move(systemWorld)) , m_systemWorld(std::move(systemWorld))
, m_storageFile(storageFile) , m_storageFile(storageFile)
{ {
} }

View File

@ -524,7 +524,7 @@ List<PhysicsForceRegion> ToolUser::forceRegions() const {
return ds; return ds;
} }
void ToolUser::render(RenderCallback* renderCallback, bool inToolRange, bool shifting, EntityRenderLayer renderLayer) { void ToolUser::render(RenderCallback* renderCallback, bool, bool shifting, EntityRenderLayer renderLayer) {
if (m_suppress.get()) { if (m_suppress.get()) {
for (auto item : {m_primaryHandItem.get(), m_altHandItem.get()}) { for (auto item : {m_primaryHandItem.get(), m_altHandItem.get()}) {
if (auto activeItem = as<ActiveItem>(item)) { if (auto activeItem = as<ActiveItem>(item)) {

View File

@ -487,7 +487,7 @@ void UniverseClient::stopLua() {
m_scriptContexts.clear(); m_scriptContexts.clear();
} }
bool UniverseClient::reloadPlayer(Json const& data, Uuid const& uuid, bool resetInterfaces, bool showIndicator) { bool UniverseClient::reloadPlayer(Json const& data, Uuid const&, bool resetInterfaces, bool showIndicator) {
auto player = mainPlayer(); auto player = mainPlayer();
bool playerInWorld = player->inWorld(); bool playerInWorld = player->inWorld();
auto world = as<WorldClient>(player->world()); auto world = as<WorldClient>(player->world());

View File

@ -1369,7 +1369,6 @@ void WorldClient::collectLiquid(List<Vec2I> const& tilePositions, LiquidId liqui
return; return;
float bucketSize = Root::singleton().assets()->json("/items/defaultParameters.config:liquidItems.bucketSize").toFloat(); float bucketSize = Root::singleton().assets()->json("/items/defaultParameters.config:liquidItems.bucketSize").toFloat();
unsigned drainedUnits = 0;
float nextUnit = bucketSize; float nextUnit = bucketSize;
List<Vec2I> maybeDrainTiles; List<Vec2I> maybeDrainTiles;
@ -1386,7 +1385,7 @@ void WorldClient::collectLiquid(List<Vec2I> const& tilePositions, LiquidId liqui
liquid.take(nextUnit); liquid.take(nextUnit);
nextUnit = bucketSize; nextUnit = bucketSize;
for (auto& previousTile : maybeDrainTiles) for (size_t i = 0; i < maybeDrainTiles.size(); ++i)
m_predictedTiles[pos].liquid.emplace(EmptyLiquidId, 0.0f); m_predictedTiles[pos].liquid.emplace(EmptyLiquidId, 0.0f);
maybeDrainTiles.clear(); maybeDrainTiles.clear();

View File

@ -92,7 +92,7 @@ namespace WorldImpl {
} }
template <typename TileSectorArray> template <typename TileSectorArray>
CollisionKind tileCollisionKind(shared_ptr<TileSectorArray> const& tileSectorArray, EntityMapPtr const& entityMap, CollisionKind tileCollisionKind(shared_ptr<TileSectorArray> const& tileSectorArray, EntityMapPtr const&,
Vec2I const& pos) { Vec2I const& pos) {
return tileSectorArray->tile(pos).collision; return tileSectorArray->tile(pos).collision;
} }
@ -226,7 +226,7 @@ namespace WorldImpl {
if (!isRealMaterial(material)) if (!isRealMaterial(material))
return false; return false;
auto isAdjacentToConnectable = [&](Vec2I const& pos, unsigned distance, bool foreground) { auto isAdjacentToConnectable = [&](Vec2I const& pos, int distance, bool foreground) {
if (pos.y() - distance < 0) if (pos.y() - distance < 0)
return true; return true;
@ -237,7 +237,7 @@ namespace WorldImpl {
for (int x = pos.x() - distance; x != maxX; ++x) { for (int x = pos.x() - distance; x != maxX; ++x) {
tPos[0] = x; tPos[0] = x;
if (tPos != pos) { if (tPos != pos) {
auto& tile = getTile(tPos); const auto& tile = getTile(tPos);
if (isConnectableMaterial(foreground ? tile.foreground : tile.background)) if (isConnectableMaterial(foreground ? tile.foreground : tile.background))
return true; return true;
} }
@ -286,7 +286,7 @@ namespace WorldImpl {
if (!materialDatabase->canPlaceInLayer(material, layer)) if (!materialDatabase->canPlaceInLayer(material, layer))
return false; return false;
auto& tile = getTile(pos); const auto& tile = getTile(pos);
if (layer == TileLayer::Background) { if (layer == TileLayer::Background) {
if (tile.background != EmptyMaterialId && tile.background != ObjectPlatformMaterialId) if (tile.background != EmptyMaterialId && tile.background != ObjectPlatformMaterialId)
return false; return false;

View File

@ -629,7 +629,7 @@ void WorldLayout::expandBiomeRegion(Vec2I const& position, int newWidth) {
pair<size_t, size_t> WorldLayout::findLayerAndCell(int x, int y) const { pair<size_t, size_t> WorldLayout::findLayerAndCell(int x, int y) const {
// find the target layer // find the target layer
size_t targetLayerIndex; size_t targetLayerIndex{};
for (size_t i = 0; i < m_layers.size(); ++i) { for (size_t i = 0; i < m_layers.size(); ++i) {
if (m_layers[i].yStart < y) if (m_layers[i].yStart < y)
targetLayerIndex = i; targetLayerIndex = i;

View File

@ -25,19 +25,6 @@ EnumMap<WorldEdgeForceRegionType> const WorldEdgeForceRegionTypeNames{
{WorldEdgeForceRegionType::Bottom, "Bottom"}, {WorldEdgeForceRegionType::Bottom, "Bottom"},
{WorldEdgeForceRegionType::TopAndBottom, "TopAndBottom"}}; {WorldEdgeForceRegionType::TopAndBottom, "TopAndBottom"}};
VisitableWorldParameters::VisitableWorldParameters() {
threatLevel = 0;
gravity = 0;
airless = false;
disableDeathDrops = false;
terraformed = false;
worldEdgeForceRegions = WorldEdgeForceRegionType::None;
}
VisitableWorldParameters::VisitableWorldParameters(VisitableWorldParameters const& visitableWorldParameters) {
*this = visitableWorldParameters;
}
VisitableWorldParameters::VisitableWorldParameters(Json const& store) { VisitableWorldParameters::VisitableWorldParameters(Json const& store) {
typeName = store.getString("typeName", ""); typeName = store.getString("typeName", "");
threatLevel = store.getFloat("threatLevel"); threatLevel = store.getFloat("threatLevel");
@ -54,8 +41,6 @@ VisitableWorldParameters::VisitableWorldParameters(Json const& store) {
worldEdgeForceRegions = WorldEdgeForceRegionTypeNames.getLeft(store.getString("worldEdgeForceRegions", "None")); worldEdgeForceRegions = WorldEdgeForceRegionTypeNames.getLeft(store.getString("worldEdgeForceRegions", "None"));
} }
VisitableWorldParameters::~VisitableWorldParameters() {}
Json VisitableWorldParameters::store() const { Json VisitableWorldParameters::store() const {
return JsonObject{{"typeName", typeName}, return JsonObject{{"typeName", typeName},
{"threatLevel", threatLevel}, {"threatLevel", threatLevel},
@ -104,15 +89,6 @@ void VisitableWorldParameters::write(DataStream& ds) const {
ds << worldEdgeForceRegions; ds << worldEdgeForceRegions;
} }
TerrestrialWorldParameters::TerrestrialWorldParameters() {
blendSize = 0;
dayLength = 0;
}
TerrestrialWorldParameters::TerrestrialWorldParameters(TerrestrialWorldParameters const& terrestrialWorldParameters) {
*this = terrestrialWorldParameters;
}
TerrestrialWorldParameters::TerrestrialWorldParameters(Json const& store) : VisitableWorldParameters(store) { TerrestrialWorldParameters::TerrestrialWorldParameters(Json const& store) : VisitableWorldParameters(store) {
auto loadTerrestrialRegion = [](Json const& config) { auto loadTerrestrialRegion = [](Json const& config) {
return TerrestrialRegion{config.getString("biome"), return TerrestrialRegion{config.getString("biome"),
@ -122,19 +98,19 @@ TerrestrialWorldParameters::TerrestrialWorldParameters(Json const& store) : Visi
config.getString("fgOreSelector"), config.getString("fgOreSelector"),
config.getString("bgOreSelector"), config.getString("bgOreSelector"),
config.getString("subBlockSelector"), config.getString("subBlockSelector"),
(LiquidId)config.getUInt("caveLiquid"), static_cast<LiquidId>(config.getUInt("caveLiquid")),
config.getFloat("caveLiquidSeedDensity"), config.getFloat("caveLiquidSeedDensity"),
(LiquidId)config.getUInt("oceanLiquid"), static_cast<LiquidId>(config.getUInt("oceanLiquid")),
(int)config.getInt("oceanLiquidLevel"), static_cast<int>(config.getInt("oceanLiquidLevel")),
(bool)config.getBool("encloseLiquids"), config.getBool("encloseLiquids"),
(bool)config.getBool("fillMicrodungeons")}; config.getBool("fillMicrodungeons")};
}; };
auto loadTerrestrialLayer = [loadTerrestrialRegion](Json const& config) { auto loadTerrestrialLayer = [loadTerrestrialRegion](Json const& config) {
return TerrestrialLayer{(int)config.getInt("layerMinHeight"), return TerrestrialLayer{static_cast<int>(config.getInt("layerMinHeight")),
(int)config.getInt("layerBaseHeight"), static_cast<int>(config.getInt("layerBaseHeight")),
jsonToStringList(config.get("dungeons")), jsonToStringList(config.get("dungeons")),
(int)config.getInt("dungeonXVariance"), static_cast<int>(config.getInt("dungeonXVariance")),
loadTerrestrialRegion(config.get("primaryRegion")), loadTerrestrialRegion(config.get("primaryRegion")),
loadTerrestrialRegion(config.get("primarySubRegion")), loadTerrestrialRegion(config.get("primarySubRegion")),
config.getArray("secondaryRegions").transformed(loadTerrestrialRegion), config.getArray("secondaryRegions").transformed(loadTerrestrialRegion),
@ -333,14 +309,11 @@ void TerrestrialWorldParameters::write(DataStream& ds) const {
AsteroidsWorldParameters::AsteroidsWorldParameters() { AsteroidsWorldParameters::AsteroidsWorldParameters() {
airless = true; airless = true;
asteroidTopLevel = 0;
asteroidBottomLevel = 0;
blendSize = 0;
} }
AsteroidsWorldParameters::AsteroidsWorldParameters(Json const& store) : VisitableWorldParameters(store) { AsteroidsWorldParameters::AsteroidsWorldParameters(Json const& store) : VisitableWorldParameters(store) {
asteroidTopLevel = store.getInt("asteroidTopLevel"); asteroidTopLevel = static_cast<int>(store.getInt("asteroidTopLevel"));
asteroidBottomLevel = store.getInt("asteroidBottomLevel"); asteroidBottomLevel = static_cast<int>(store.getInt("asteroidBottomLevel"));
blendSize = store.getFloat("blendSize"); blendSize = store.getFloat("blendSize");
asteroidBiome = store.getString("asteroidBiome"); asteroidBiome = store.getString("asteroidBiome");
ambientLightLevel = jsonToColor(store.get("ambientLightLevel")); ambientLightLevel = jsonToColor(store.get("ambientLightLevel"));
@ -376,12 +349,10 @@ void AsteroidsWorldParameters::write(DataStream& ds) const {
ds << ambientLightLevel; ds << ambientLightLevel;
} }
FloatingDungeonWorldParameters::FloatingDungeonWorldParameters() {}
FloatingDungeonWorldParameters::FloatingDungeonWorldParameters(Json const& store) : VisitableWorldParameters(store) { FloatingDungeonWorldParameters::FloatingDungeonWorldParameters(Json const& store) : VisitableWorldParameters(store) {
dungeonBaseHeight = store.getInt("dungeonBaseHeight"); dungeonBaseHeight = static_cast<int>(store.getInt("dungeonBaseHeight"));
dungeonSurfaceHeight = store.getInt("dungeonSurfaceHeight"); dungeonSurfaceHeight = static_cast<int>(store.getInt("dungeonSurfaceHeight"));
dungeonUndergroundLevel = store.getInt("dungeonUndergroundLevel"); dungeonUndergroundLevel = static_cast<int>(store.getInt("dungeonUndergroundLevel"));
primaryDungeon = store.getString("primaryDungeon"); primaryDungeon = store.getString("primaryDungeon");
biome = store.optString("biome"); biome = store.optString("biome");
ambientLightLevel = jsonToColor(store.get("ambientLightLevel")); ambientLightLevel = jsonToColor(store.get("ambientLightLevel"));
@ -438,7 +409,7 @@ void FloatingDungeonWorldParameters::write(DataStream& ds) const {
Json diskStoreVisitableWorldParameters(VisitableWorldParametersConstPtr const& parameters) { Json diskStoreVisitableWorldParameters(VisitableWorldParametersConstPtr const& parameters) {
if (!parameters) if (!parameters)
return Json(); return {};
return parameters->store().setAll({{"type", WorldParametersTypeNames.getRight(parameters->type())}}); return parameters->store().setAll({{"type", WorldParametersTypeNames.getRight(parameters->type())}});
} }
@ -459,7 +430,7 @@ VisitableWorldParametersPtr diskLoadVisitableWorldParameters(Json const& store)
ByteArray netStoreVisitableWorldParameters(VisitableWorldParametersConstPtr const& parameters) { ByteArray netStoreVisitableWorldParameters(VisitableWorldParametersConstPtr const& parameters) {
if (!parameters) if (!parameters)
return ByteArray(); return {};
DataStreamBuffer ds; DataStreamBuffer ds;
ds.write(parameters->type()); ds.write(parameters->type());
@ -509,7 +480,7 @@ TerrestrialWorldParametersPtr generateTerrestrialWorldParameters(String const& t
auto dayLengthRange = jsonToVec2F(config.get("dayLengthRange")); auto dayLengthRange = jsonToVec2F(config.get("dayLengthRange"));
auto threatLevelRange = jsonToVec2F(config.query("threatRange")); auto threatLevelRange = jsonToVec2F(config.query("threatRange"));
float threatLevel = staticRandomDouble(seed, "ThreatLevel") * (threatLevelRange[1] - threatLevelRange[0]) + threatLevelRange[0]; auto threatLevel = static_cast<float>(staticRandomDouble(seed, "ThreatLevel") * (threatLevelRange[1] - threatLevelRange[0]) + threatLevelRange[0]);
auto surfaceBiomeSeed = staticRandomU64(seed, "SurfaceBiomeSeed"); auto surfaceBiomeSeed = staticRandomU64(seed, "SurfaceBiomeSeed");
auto readRegion = [liquidsDatabase, threatLevel, seed](Json const& regionConfig, String const& layerName, int layerBaseHeight) { auto readRegion = [liquidsDatabase, threatLevel, seed](Json const& regionConfig, String const& layerName, int layerBaseHeight) {
@ -539,7 +510,7 @@ TerrestrialWorldParametersPtr generateTerrestrialWorldParameters(String const& t
if (auto oceanLiquid = staticRandomValueFrom(regionConfig.getArray("oceanLiquid", {}), seed, "oceanLiquid", layerName.utf8Ptr()).optString()) { if (auto oceanLiquid = staticRandomValueFrom(regionConfig.getArray("oceanLiquid", {}), seed, "oceanLiquid", layerName.utf8Ptr()).optString()) {
region.oceanLiquid = liquidsDatabase->liquidId(*oceanLiquid); region.oceanLiquid = liquidsDatabase->liquidId(*oceanLiquid);
region.oceanLiquidLevel = regionConfig.getInt("oceanLevelOffset", 0) + layerBaseHeight; region.oceanLiquidLevel = static_cast<int>(regionConfig.getInt("oceanLevelOffset", 0) + layerBaseHeight);
} else { } else {
region.oceanLiquid = EmptyLiquidId; region.oceanLiquid = EmptyLiquidId;
region.oceanLiquidLevel = 0; region.oceanLiquidLevel = 0;
@ -561,30 +532,32 @@ TerrestrialWorldParametersPtr generateTerrestrialWorldParameters(String const& t
TerrestrialWorldParameters::TerrestrialLayer layer; TerrestrialWorldParameters::TerrestrialLayer layer;
layer.layerMinHeight = layerConfig.getFloat("layerLevel"); layer.layerMinHeight = static_cast<int>(layerConfig.getFloat("layerLevel"));
layer.layerBaseHeight = layerConfig.getFloat("baseHeight"); layer.layerBaseHeight = static_cast<int>(layerConfig.getFloat("baseHeight"));
auto primaryRegionList = layerConfig.getArray("primaryRegion"); auto primaryRegionList = layerConfig.getArray("primaryRegion");
auto primaryRegionConfigName = staticRandomFrom(primaryRegionList, seed, layerName.utf8Ptr(), "PrimaryRegionSelection").toString(); auto primaryRegionConfigName = staticRandomFrom(primaryRegionList, seed, layerName.utf8Ptr(), "PrimaryRegionSelection").toString();
Json primaryRegionConfig = jsonMerge(regionDefaults, regionTypes.get(primaryRegionConfigName)); Json primaryRegionConfig = jsonMerge(regionDefaults, regionTypes.get(primaryRegionConfigName));
layer.primaryRegion = readRegion(primaryRegionConfig, layerName, layer.layerBaseHeight); layer.primaryRegion = readRegion(primaryRegionConfig, layerName, layer.layerBaseHeight);
auto subRegionList = primaryRegionConfig.getArray("subRegion"); {
Json subRegionConfig; auto subRegionList = primaryRegionConfig.getArray("subRegion");
if (subRegionList.size() > 0) { Json subRegionConfig;
String subRegionName = staticRandomFrom(subRegionList, seed, layerName, primaryRegionConfigName).toString(); if (!subRegionList.empty()) {
subRegionConfig = jsonMerge(regionDefaults, regionTypes.get(subRegionName)); String subRegionName = staticRandomFrom(subRegionList, seed, layerName, primaryRegionConfigName).toString();
} else { subRegionConfig = jsonMerge(regionDefaults, regionTypes.get(subRegionName));
subRegionConfig = primaryRegionConfig; } else {
subRegionConfig = primaryRegionConfig;
}
layer.primarySubRegion = readRegion(subRegionConfig, layerName, layer.layerBaseHeight);
} }
layer.primarySubRegion = readRegion(subRegionConfig, layerName, layer.layerBaseHeight);
Vec2U secondaryRegionCountRange = jsonToVec2U(layerConfig.get("secondaryRegionCount")); Vec2U secondaryRegionCountRange = jsonToVec2U(layerConfig.get("secondaryRegionCount"));
int secondaryRegionCount = staticRandomI32Range(secondaryRegionCountRange[0], secondaryRegionCountRange[1], seed, layerName, "SecondaryRegionCount"); int secondaryRegionCount = staticRandomI32Range(static_cast<int>(secondaryRegionCountRange[0]), static_cast<int>(secondaryRegionCountRange[1]), seed, layerName, "SecondaryRegionCount");
auto secondaryRegionList = layerConfig.getArray("secondaryRegions"); auto secondaryRegionList = layerConfig.getArray("secondaryRegions");
if (secondaryRegionList.size() > 0) { if (!secondaryRegionList.empty()) {
staticRandomShuffle(secondaryRegionList, seed, layerName, "SecondaryRegionShuffle"); staticRandomShuffle(secondaryRegionList, seed, layerName, "SecondaryRegionShuffle");
for (auto regionName : secondaryRegionList) { for (const auto& regionName : secondaryRegionList) {
if (secondaryRegionCount <= 0) if (secondaryRegionCount <= 0)
break; break;
Json secondaryRegionConfig = jsonMerge(regionDefaults, regionTypes.get(regionName.toString())); Json secondaryRegionConfig = jsonMerge(regionDefaults, regionTypes.get(regionName.toString()));
@ -592,7 +565,7 @@ TerrestrialWorldParametersPtr generateTerrestrialWorldParameters(String const& t
auto subRegionList = secondaryRegionConfig.getArray("subRegion"); auto subRegionList = secondaryRegionConfig.getArray("subRegion");
Json subRegionConfig; Json subRegionConfig;
if (subRegionList.size() > 0) { if (!subRegionList.empty()) {
String subRegionName = staticRandomFrom(subRegionList, seed, layerName, regionName.toString()).toString(); String subRegionName = staticRandomFrom(subRegionList, seed, layerName, regionName.toString()).toString();
subRegionConfig = jsonMerge(regionDefaults, regionTypes.get(subRegionName)); subRegionConfig = jsonMerge(regionDefaults, regionTypes.get(subRegionName));
} else { } else {
@ -611,7 +584,7 @@ TerrestrialWorldParametersPtr generateTerrestrialWorldParameters(String const& t
Vec2U dungeonCountRange = layerConfig.opt("dungeonCountRange").apply(jsonToVec2U).value(); Vec2U dungeonCountRange = layerConfig.opt("dungeonCountRange").apply(jsonToVec2U).value();
unsigned dungeonCount = staticRandomU32Range(dungeonCountRange[0], dungeonCountRange[1], seed, layerName, "DungeonCount"); unsigned dungeonCount = staticRandomU32Range(dungeonCountRange[0], dungeonCountRange[1], seed, layerName, "DungeonCount");
layer.dungeons.appendAll(dungeonPool.selectUniques(dungeonCount, staticRandomHash64(seed, layerName, "DungeonChoice"))); layer.dungeons.appendAll(dungeonPool.selectUniques(dungeonCount, staticRandomHash64(seed, layerName, "DungeonChoice")));
layer.dungeonXVariance = layerConfig.getInt("dungeonXVariance", 0); layer.dungeonXVariance = static_cast<int>(layerConfig.getInt("dungeonXVariance", 0));
return layer; return layer;
}; };
@ -674,7 +647,7 @@ AsteroidsWorldParametersPtr generateAsteroidsWorldParameters(uint64_t seed) {
auto gravityRange = jsonToVec2F(asteroidsConfig.get("gravityRange")); auto gravityRange = jsonToVec2F(asteroidsConfig.get("gravityRange"));
auto threatLevelRange = jsonToVec2F(asteroidsConfig.get("threatRange")); auto threatLevelRange = jsonToVec2F(asteroidsConfig.get("threatRange"));
parameters->threatLevel = staticRandomDouble(seed, "ThreatLevel") * (threatLevelRange[1] - threatLevelRange[0]) + threatLevelRange[0]; parameters->threatLevel = static_cast<float>(staticRandomDouble(seed, "ThreatLevel") * (threatLevelRange[1] - threatLevelRange[0]) + threatLevelRange[0]);
parameters->typeName = "asteroids"; parameters->typeName = "asteroids";
parameters->worldSize = jsonToVec2U(asteroidsConfig.get("worldSize")); parameters->worldSize = jsonToVec2U(asteroidsConfig.get("worldSize"));
parameters->gravity = staticRandomFloatRange(gravityRange[0], gravityRange[1], seed, "WorldGravity"); parameters->gravity = staticRandomFloatRange(gravityRange[0], gravityRange[1], seed, "WorldGravity");
@ -685,8 +658,8 @@ AsteroidsWorldParametersPtr generateAsteroidsWorldParameters(uint64_t seed) {
parameters->disableDeathDrops = asteroidsConfig.getBool("disableDeathDrops", false); parameters->disableDeathDrops = asteroidsConfig.getBool("disableDeathDrops", false);
parameters->worldEdgeForceRegions = WorldEdgeForceRegionTypeNames.getLeft(asteroidsConfig.getString("worldEdgeForceRegions", "TopAndBottom")); parameters->worldEdgeForceRegions = WorldEdgeForceRegionTypeNames.getLeft(asteroidsConfig.getString("worldEdgeForceRegions", "TopAndBottom"));
parameters->asteroidTopLevel = asteroidsConfig.getInt("asteroidsTop"); parameters->asteroidTopLevel = static_cast<int>(asteroidsConfig.getInt("asteroidsTop"));
parameters->asteroidBottomLevel = asteroidsConfig.getInt("asteroidsBottom"); parameters->asteroidBottomLevel = static_cast<int>(asteroidsConfig.getInt("asteroidsBottom"));
parameters->blendSize = asteroidsConfig.getFloat("blendSize"); parameters->blendSize = asteroidsConfig.getFloat("blendSize");
parameters->asteroidBiome = biome; parameters->asteroidBiome = biome;
parameters->ambientLightLevel = jsonToColor(asteroidsConfig.get("ambientLightLevel")); parameters->ambientLightLevel = jsonToColor(asteroidsConfig.get("ambientLightLevel"));
@ -716,9 +689,9 @@ FloatingDungeonWorldParametersPtr generateFloatingDungeonWorldParameters(String
parameters->disableDeathDrops = worldConfig.getBool("disableDeathDrops", false); parameters->disableDeathDrops = worldConfig.getBool("disableDeathDrops", false);
parameters->worldEdgeForceRegions = WorldEdgeForceRegionTypeNames.getLeft(worldConfig.getString("worldEdgeForceRegions", "Top")); parameters->worldEdgeForceRegions = WorldEdgeForceRegionTypeNames.getLeft(worldConfig.getString("worldEdgeForceRegions", "Top"));
parameters->dungeonBaseHeight = worldConfig.getInt("dungeonBaseHeight"); parameters->dungeonBaseHeight = static_cast<int>(worldConfig.getInt("dungeonBaseHeight"));
parameters->dungeonSurfaceHeight = worldConfig.getInt("dungeonSurfaceHeight", parameters->dungeonBaseHeight); parameters->dungeonSurfaceHeight = static_cast<int>(worldConfig.getInt("dungeonSurfaceHeight", parameters->dungeonBaseHeight));
parameters->dungeonUndergroundLevel = worldConfig.getInt("dungeonUndergroundLevel", 0); parameters->dungeonUndergroundLevel = static_cast<int>(worldConfig.getInt("dungeonUndergroundLevel", 0));
parameters->primaryDungeon = worldConfig.getString("primaryDungeon"); parameters->primaryDungeon = worldConfig.getString("primaryDungeon");
parameters->biome = worldConfig.optString("biome"); parameters->biome = worldConfig.optString("biome");
parameters->ambientLightLevel = jsonToColor(worldConfig.get("ambientLightLevel")); parameters->ambientLightLevel = jsonToColor(worldConfig.get("ambientLightLevel"));

View File

@ -36,11 +36,11 @@ STAR_STRUCT(AsteroidsWorldParameters);
STAR_STRUCT(FloatingDungeonWorldParameters); STAR_STRUCT(FloatingDungeonWorldParameters);
struct VisitableWorldParameters { struct VisitableWorldParameters {
VisitableWorldParameters(); VisitableWorldParameters() = default;
VisitableWorldParameters(VisitableWorldParameters const& visitableWorldParameters); VisitableWorldParameters(VisitableWorldParameters const& visitableWorldParameters) = default;
VisitableWorldParameters(Json const& store); explicit VisitableWorldParameters(Json const& store);
virtual ~VisitableWorldParameters(); virtual ~VisitableWorldParameters() = default;
virtual WorldParametersType type() const = 0; virtual WorldParametersType type() const = 0;
@ -50,18 +50,18 @@ struct VisitableWorldParameters {
virtual void write(DataStream& ds) const; virtual void write(DataStream& ds) const;
String typeName; String typeName;
float threatLevel; float threatLevel{};
Vec2U worldSize; Vec2U worldSize;
float gravity; float gravity{};
bool airless; bool airless{false};
WeatherPool weatherPool; WeatherPool weatherPool;
StringList environmentStatusEffects; StringList environmentStatusEffects;
Maybe<StringList> overrideTech; Maybe<StringList> overrideTech;
Maybe<List<Directives>> globalDirectives; Maybe<List<Directives>> globalDirectives;
BeamUpRule beamUpRule; BeamUpRule beamUpRule;
bool disableDeathDrops; bool disableDeathDrops{false};
bool terraformed; bool terraformed{false};
WorldEdgeForceRegionType worldEdgeForceRegions; WorldEdgeForceRegionType worldEdgeForceRegions{WorldEdgeForceRegionType::None};
}; };
struct TerrestrialWorldParameters : VisitableWorldParameters { struct TerrestrialWorldParameters : VisitableWorldParameters {
@ -75,14 +75,14 @@ struct TerrestrialWorldParameters : VisitableWorldParameters {
String bgOreSelector; String bgOreSelector;
String subBlockSelector; String subBlockSelector;
LiquidId caveLiquid; LiquidId caveLiquid{};
float caveLiquidSeedDensity; float caveLiquidSeedDensity{};
LiquidId oceanLiquid; LiquidId oceanLiquid{};
int oceanLiquidLevel; int oceanLiquidLevel{};
bool encloseLiquids; bool encloseLiquids{false};
bool fillMicrodungeons; bool fillMicrodungeons{false};
}; };
struct TerrestrialLayer { struct TerrestrialLayer {
@ -102,67 +102,67 @@ struct TerrestrialWorldParameters : VisitableWorldParameters {
Vec2F subRegionSizeRange; Vec2F subRegionSizeRange;
}; };
TerrestrialWorldParameters(); TerrestrialWorldParameters() = default;
TerrestrialWorldParameters(TerrestrialWorldParameters const& terrestrialWorldParameters); TerrestrialWorldParameters(TerrestrialWorldParameters const& terrestrialWorldParameters) = default;
TerrestrialWorldParameters(Json const& store); explicit TerrestrialWorldParameters(Json const& store);
TerrestrialWorldParameters &operator=(TerrestrialWorldParameters const& terrestrialWorldParameters); TerrestrialWorldParameters &operator=(TerrestrialWorldParameters const& terrestrialWorldParameters);
virtual WorldParametersType type() const override; WorldParametersType type() const override;
virtual Json store() const override; Json store() const override;
virtual void read(DataStream& ds) override; void read(DataStream& ds) override;
virtual void write(DataStream& ds) const override; void write(DataStream& ds) const override;
String primaryBiome; String primaryBiome;
LiquidId primarySurfaceLiquid; LiquidId primarySurfaceLiquid{};
String sizeName; String sizeName;
float hueShift; float hueShift{};
SkyColoring skyColoring; SkyColoring skyColoring;
float dayLength; float dayLength{};
Json blockNoiseConfig; Json blockNoiseConfig;
Json blendNoiseConfig; Json blendNoiseConfig;
float blendSize; float blendSize{};
TerrestrialLayer spaceLayer; TerrestrialLayer spaceLayer{};
TerrestrialLayer atmosphereLayer; TerrestrialLayer atmosphereLayer{};
TerrestrialLayer surfaceLayer; TerrestrialLayer surfaceLayer{};
TerrestrialLayer subsurfaceLayer; TerrestrialLayer subsurfaceLayer{};
List<TerrestrialLayer> undergroundLayers; List<TerrestrialLayer> undergroundLayers;
TerrestrialLayer coreLayer; TerrestrialLayer coreLayer{};
}; };
struct AsteroidsWorldParameters : VisitableWorldParameters { struct AsteroidsWorldParameters : VisitableWorldParameters {
AsteroidsWorldParameters(); AsteroidsWorldParameters();
AsteroidsWorldParameters(Json const& store); explicit AsteroidsWorldParameters(Json const& store);
virtual WorldParametersType type() const override; WorldParametersType type() const override;
virtual Json store() const override; Json store() const override;
virtual void read(DataStream& ds) override; void read(DataStream& ds) override;
virtual void write(DataStream& ds) const override; void write(DataStream& ds) const override;
int asteroidTopLevel; int asteroidTopLevel{};
int asteroidBottomLevel; int asteroidBottomLevel{};
float blendSize; float blendSize{};
String asteroidBiome; String asteroidBiome;
Color ambientLightLevel; Color ambientLightLevel;
}; };
struct FloatingDungeonWorldParameters : VisitableWorldParameters { struct FloatingDungeonWorldParameters : VisitableWorldParameters {
FloatingDungeonWorldParameters(); FloatingDungeonWorldParameters() = default;
FloatingDungeonWorldParameters(Json const& store); explicit FloatingDungeonWorldParameters(Json const& store);
virtual WorldParametersType type() const override; WorldParametersType type() const override;
virtual Json store() const override; Json store() const override;
virtual void read(DataStream& ds) override; void read(DataStream& ds) override;
virtual void write(DataStream& ds) const override; void write(DataStream& ds) const override;
int dungeonBaseHeight; int dungeonBaseHeight;
int dungeonSurfaceHeight; int dungeonSurfaceHeight;

View File

@ -535,7 +535,8 @@ List<PacketPtr> WorldServer::getOutgoingPackets(ConnectionId clientId) {
Maybe<Json> WorldServer::receiveMessage(ConnectionId fromConnection, String const& message, JsonArray const& args) { Maybe<Json> WorldServer::receiveMessage(ConnectionId fromConnection, String const& message, JsonArray const& args) {
Maybe<Json> result; Maybe<Json> result;
for (auto& p : m_scriptContexts) { for (auto& p : m_scriptContexts) {
if (result = p.second->handleMessage(message, fromConnection == ServerConnectionId, args)) result = p.second->handleMessage(message, fromConnection == ServerConnectionId, args);
if (result)
break; break;
} }
return result; return result;

View File

@ -256,7 +256,6 @@ void WorldStorage::generateQueue(Maybe<size_t> sectorGenerationLevelLimit, funct
}); });
} }
unsigned total = 0;
while (!m_generationQueue.empty()) { while (!m_generationQueue.empty()) {
if (sectorGenerationLevelLimit && *sectorGenerationLevelLimit == 0) if (sectorGenerationLevelLimit && *sectorGenerationLevelLimit == 0)
break; break;
@ -266,7 +265,6 @@ void WorldStorage::generateQueue(Maybe<size_t> sectorGenerationLevelLimit, funct
m_generationQueue.removeFirst(); m_generationQueue.removeFirst();
if (sectorGenerationLevelLimit) if (sectorGenerationLevelLimit)
*sectorGenerationLevelLimit -= p.second; *sectorGenerationLevelLimit -= p.second;
total += p.second;
} }
} catch (std::exception const& e) { } catch (std::exception const& e) {
m_db.rollback(); m_db.rollback();

View File

@ -111,7 +111,7 @@ Maybe<Json> Entity::receiveMessage(ConnectionId, String const&, JsonArray const&
return {}; return {};
} }
void Entity::update(float dt, uint64_t) {} void Entity::update(float, uint64_t) {}
void Entity::render(RenderCallback*) {} void Entity::render(RenderCallback*) {}

View File

@ -14,7 +14,7 @@ void ToolUserItem::uninit() {
m_hand = {}; m_hand = {};
} }
void ToolUserItem::update(float dt, FireMode, bool, HashSet<MoveControlType> const&) {} void ToolUserItem::update(float, FireMode, bool, HashSet<MoveControlType> const&) {}
bool ToolUserItem::initialized() const { bool ToolUserItem::initialized() const {
return (bool)m_owner; return (bool)m_owner;

View File

@ -43,11 +43,11 @@ List<Drawable> ArmorItem::drawables() const {
return drawables; return drawables;
} }
float ArmorItem::getAngle(float aimAngle) { float ArmorItem::getAngle(float) {
return -25.0f * Constants::deg2rad; return -25.0f * Constants::deg2rad;
} }
void ArmorItem::fire(FireMode mode, bool shifting, bool edgeTriggered) {} void ArmorItem::fire(FireMode, bool, bool) {}
void ArmorItem::fireTriggered() {} void ArmorItem::fireTriggered() {}
List<String> const& ArmorItem::colorOptions() { List<String> const& ArmorItem::colorOptions() {

View File

@ -31,7 +31,7 @@ ItemPtr InspectionTool::clone() const {
return make_shared<InspectionTool>(*this); return make_shared<InspectionTool>(*this);
} }
void InspectionTool::update(float dt, FireMode fireMode, bool, HashSet<MoveControlType> const&) { void InspectionTool::update(float, FireMode fireMode, bool, HashSet<MoveControlType> const&) {
m_currentAngle = world()->geometry().diff(owner()->aimPosition(), owner()->position()).angle(); m_currentAngle = world()->geometry().diff(owner()->aimPosition(), owner()->position()).angle();
m_currentPosition = owner()->position() + owner()->handPosition(hand(), m_lightPosition - m_handPosition); m_currentPosition = owner()->position() + owner()->handPosition(hand(), m_lightPosition - m_handPosition);
SpatialLogger::logPoint("world", m_currentPosition, {0, 0, 255, 255}); SpatialLogger::logPoint("world", m_currentPosition, {0, 0, 255, 255});

View File

@ -42,7 +42,7 @@ StringSet InstrumentItem::effectSources() const {
return m_inactiveEffectSources; return m_inactiveEffectSources;
} }
void InstrumentItem::update(float dt, FireMode, bool, HashSet<MoveControlType> const&) { void InstrumentItem::update(float, FireMode, bool, HashSet<MoveControlType> const&) {
if (entityMode() == EntityMode::Master) { if (entityMode() == EntityMode::Master) {
if (active()) { if (active()) {
m_activeCooldown--; m_activeCooldown--;

View File

@ -119,7 +119,7 @@ void MaterialItem::update(float dt, FireMode fireMode, bool shifting, HashSet<Mo
} }
} }
void MaterialItem::render(RenderCallback* renderCallback, EntityRenderLayer renderLayer) { void MaterialItem::render(RenderCallback* renderCallback, EntityRenderLayer) {
if (m_collisionOverride != TileCollisionOverride::None) { if (m_collisionOverride != TileCollisionOverride::None) {
float pulseLevel = 1.f - 0.3f * 0.5f * ((float)sin(2 * Constants::pi * 4.0 * Time::monotonicTime()) + 1.f); float pulseLevel = 1.f - 0.3f * 0.5f * ((float)sin(2 * Constants::pi * 4.0 * Time::monotonicTime()) + 1.f);
Color color = Color::rgba(owner()->favoriteColor()).mix(Color::White); Color color = Color::rgba(owner()->favoriteColor()).mix(Color::White);
@ -190,8 +190,8 @@ void MaterialItem::fire(FireMode mode, bool shifting, bool edgeTriggered) {
: Root::singleton().materialDatabase()->materialCollisionKind(m_material); : Root::singleton().materialDatabase()->materialCollisionKind(m_material);
size_t total = 0; size_t total = 0;
for (int i = 0; i != steps; ++i) { for (unsigned i = 0; i != steps; ++i) {
auto placementOrigin = aimPosition + diff * (1.0f - ((float)i / steps)); auto placementOrigin = aimPosition + diff * (1.0f - (static_cast<float>(i) / steps));
if (!owner()->inToolRange(placementOrigin)) if (!owner()->inToolRange(placementOrigin))
continue; continue;
@ -218,7 +218,7 @@ void MaterialItem::fire(FireMode mode, bool shifting, bool edgeTriggered) {
m_lastAimPosition = aimPosition; m_lastAimPosition = aimPosition;
} }
void MaterialItem::endFire(FireMode mode, bool shifting) { void MaterialItem::endFire(FireMode, bool) {
m_lastAimPosition.reset(); m_lastAimPosition.reset();
} }

View File

@ -24,7 +24,7 @@ List<Drawable> UnlockItem::drawables() const {
return m_drawables; return m_drawables;
} }
List<Drawable> UnlockItem::preview(PlayerPtr const& viewer) const { List<Drawable> UnlockItem::preview(PlayerPtr const&) const {
return iconDrawables(); return iconDrawables();
} }

View File

@ -470,7 +470,7 @@ LuaValue LuaConverter<Drawable>::from(LuaEngine& engine, Drawable const& v) {
return table; return table;
} }
Maybe<Drawable> LuaConverter<Drawable>::to(LuaEngine& engine, LuaValue const& v) { Maybe<Drawable> LuaConverter<Drawable>::to(LuaEngine&, LuaValue const& v) {
if (auto table = v.ptr<LuaTable>()) { if (auto table = v.ptr<LuaTable>()) {
Maybe<Drawable> result; Maybe<Drawable> result;
result.emplace(); result.emplace();

View File

@ -124,7 +124,6 @@ bool TextPainter::processWrapText(StringView text, unsigned* wrapWidth, WrapText
m_fontTextureGroup.switchFont(font); m_fontTextureGroup.switchFont(font);
int lines = 0; int lines = 0;
size_t i = 0;
auto it = text.begin(); auto it = text.begin();
auto end = text.end(); auto end = text.end();
@ -150,8 +149,6 @@ bool TextPainter::processWrapText(StringView text, unsigned* wrapWidth, WrapText
if (Text::isEscapeCode(character)) if (Text::isEscapeCode(character))
escIt = it; escIt = it;
++i;
if (escIt != end) { if (escIt != end) {
if (character == Text::EndEsc) { if (character == Text::EndEsc) {
@ -432,7 +429,6 @@ RectF TextPainter::doRenderLine(StringView text, TextPositioning const& position
pos.hAnchor = HorizontalAnchor::LeftAnchor; pos.hAnchor = HorizontalAnchor::LeftAnchor;
} }
bool escape = false;
String escapeCode; String escapeCode;
RectF bounds = RectF::withSize(pos.pos, Vec2F()); RectF bounds = RectF::withSize(pos.pos, Vec2F());
Text::TextCallback textCallback = [&](StringView text) { Text::TextCallback textCallback = [&](StringView text) {

View File

@ -203,7 +203,7 @@ void Pane::update(float dt) {
} }
} }
void Pane::tick(float dt) { void Pane::tick(float) {
m_playingSounds.filter([](pair<String, AudioInstancePtr> const& p) { m_playingSounds.filter([](pair<String, AudioInstancePtr> const& p) {
return p.second->finished() == false; return p.second->finished() == false;
}); });

View File

@ -384,7 +384,7 @@ bool ScrollArea::sendEvent(InputEvent const& event) {
return true; return true;
} }
void ScrollArea::update(float dt) { void ScrollArea::update(float) {
if (!m_visible) if (!m_visible)
return; return;

View File

@ -9,7 +9,7 @@ VerticalLayout::VerticalLayout(VerticalAnchor verticalAnchor, int verticalSpacin
disableScissoring(); disableScissoring();
} }
void VerticalLayout::update(float dt) { void VerticalLayout::update(float) {
m_size = Vec2I(0, 0); m_size = Vec2I(0, 0);
if (m_members.empty()) if (m_members.empty())