Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
586084d
sdl redefines these
Un1q32 Jan 4, 2026
fe850a3
enable -Wall
Un1q32 Jan 4, 2026
0f14e6c
stuff
Un1q32 Jan 4, 2026
07c8c60
actually just disable warns for raknet this is insane
Un1q32 Jan 4, 2026
8377e0b
unused thing
Un1q32 Jan 4, 2026
5a270fd
sign compare
Un1q32 Jan 4, 2026
e9c5e78
this was missed in the last warn pr
Un1q32 Jan 4, 2026
679f620
misleading indentation
Un1q32 Jan 4, 2026
dde3d6e
sign compare
Un1q32 Jan 4, 2026
deb362f
gcc is annoying
Un1q32 Jan 4, 2026
326e78c
parenthesis
Un1q32 Jan 4, 2026
5dabb62
msvc thing
Un1q32 Jan 4, 2026
839056a
fix
Un1q32 Jan 4, 2026
4ed8402
sign compare
Un1q32 Jan 4, 2026
07de4bc
msvc
Un1q32 Jan 4, 2026
e1c3831
unused
Un1q32 Jan 4, 2026
b4bad7a
parenthesis
Un1q32 Jan 4, 2026
7b50d12
unused
Un1q32 Jan 4, 2026
139a2fc
sign compare
Un1q32 Jan 4, 2026
3a8f40f
dont break aliasing rules
Un1q32 Jan 4, 2026
30f776a
sign compare
Un1q32 Jan 4, 2026
00a420f
overlaping
Un1q32 Jan 4, 2026
64bbac0
sign compare
Un1q32 Jan 4, 2026
225d22a
sign compare
Un1q32 Jan 4, 2026
4ccc7fb
sign compare
Un1q32 Jan 4, 2026
6dd4434
sign compare
Un1q32 Jan 4, 2026
434cc43
sign compare
Un1q32 Jan 4, 2026
ecee03e
sign compare
Un1q32 Jan 4, 2026
7232093
sign compare
Un1q32 Jan 4, 2026
95ff178
sign compare
Un1q32 Jan 4, 2026
5eb047b
sign compare
Un1q32 Jan 4, 2026
13645ae
sign compare
Un1q32 Jan 4, 2026
aa3d271
sign compare, this variable should prolly be unsigned already but wha…
Un1q32 Jan 4, 2026
e2dda28
sign compare
Un1q32 Jan 4, 2026
64faa63
initialize
Un1q32 Jan 4, 2026
7ee393c
check error suggested by green matt
Un1q32 Jan 4, 2026
e6b25ca
fix
Un1q32 Jan 4, 2026
47a90a8
sign compare
Un1q32 Jan 4, 2026
a90e9eb
fix
Un1q32 Jan 4, 2026
d32af71
fix
Un1q32 Jan 4, 2026
c9ba16e
sign compare
Un1q32 Jan 4, 2026
633572a
sign compare
Un1q32 Jan 4, 2026
75a0105
sign compare
Un1q32 Jan 4, 2026
d350845
sign compare
Un1q32 Jan 4, 2026
02e267a
sign compare
Un1q32 Jan 4, 2026
7cacb1e
sign compare
Un1q32 Jan 4, 2026
9bd852b
sign compare
Un1q32 Jan 4, 2026
48a7554
misleading indentation
Un1q32 Jan 4, 2026
d1ef774
parenthesis
Un1q32 Jan 4, 2026
9f82ca2
parenthesis
Un1q32 Jan 4, 2026
0416455
init
Un1q32 Jan 4, 2026
c217104
actually print error
Un1q32 Jan 4, 2026
d58dc4f
replace memcpy with union
Un1q32 Jan 4, 2026
5c1e340
fix
Un1q32 Jan 4, 2026
9e13955
sign compare
Un1q32 Jan 4, 2026
73211fe
sign compare
Un1q32 Jan 4, 2026
f0c58a4
aliasing
Un1q32 Jan 4, 2026
a7f37c6
fix
Un1q32 Jan 4, 2026
c83eaf3
unused, and handle all cases
Un1q32 Jan 4, 2026
826d390
sign compare
Un1q32 Jan 4, 2026
fd6f7dd
fix
Un1q32 Jan 4, 2026
a58186e
sign compare
Un1q32 Jan 4, 2026
a00d5f9
silence warns with pragmas
Un1q32 Jan 4, 2026
b0ac17f
sign compare
Un1q32 Jan 4, 2026
ed73509
remove unused stuff
Un1q32 Jan 4, 2026
bbe7d19
unused var
Un1q32 Jan 4, 2026
31be67d
enable -Werror for wasm in the workflow, not always in the build script
Un1q32 Jan 5, 2026
5d33c21
comments explaining unused variable things
Un1q32 Jan 5, 2026
4f6c901
readd thing
Un1q32 Jan 5, 2026
96f69b7
rename macro
Un1q32 Jan 5, 2026
01b2481
fputs to LOG_E
Un1q32 Jan 5, 2026
f75098c
comment out instead of removing
Un1q32 Jan 5, 2026
514e921
comment out instead of removing
Un1q32 Jan 5, 2026
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
sudo apt-get update
sudo apt-get install --no-install-recommends -y cmake ninja-build
- name: Build
run: ./build-wasm.sh
run: ./build-wasm.sh -DWERROR=ON
macos:
strategy:
fail-fast: false
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ endif()
set(CXX_EXTENSIONS OFF)

# Warnings
add_compile_options(-Wall)
if(WERROR)
add_compile_options(-Werror)
endif()
Expand Down Expand Up @@ -93,3 +94,4 @@ endif()
# Disable warnings on third party libraries
target_compile_options(stb_vorbis PRIVATE -w)
target_compile_options(stb_image PRIVATE -w)
target_compile_options(raknet PRIVATE -w)
2 changes: 1 addition & 1 deletion build-wasm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ mkdir -p build
cd build

# Configure Build
emcmake cmake -GNinja -DWERROR=ON "$@" ../../
emcmake cmake -GNinja "$@" ../../

# Build
cmake --build .
Expand Down
4 changes: 2 additions & 2 deletions compat/KeyCodes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#elif __APPLE__
#elif defined(__APPLE__) && !defined(USE_SDL)
// https://i.stack.imgur.com/LD8pT.png
#define AKEYCODE_FORWARD_DEL 0x75
#define AKEYCODE_ARROW_LEFT 0x7B
Expand All @@ -37,4 +37,4 @@

#define AKEYCODE_ARROW_LEFT AKEYCODE_DPAD_LEFT
#define AKEYCODE_ARROW_RIGHT AKEYCODE_DPAD_RIGHT
#endif
#endif
7 changes: 7 additions & 0 deletions compat/Unused.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#ifdef __GNUC__
#define MC_UNUSED __attribute__((unused))
#else
#define MC_UNUSED
#endif
2 changes: 1 addition & 1 deletion platforms/android/AppPlatform_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ void AppPlatform_android::changeKeyboardVisibility(bool bShown)

// lInputMethodManager.hideSoftInput(...).
jmethodID MethodHideSoftInput = pEnv->GetMethodID(ClassInputMethodManager, "hideSoftInputFromWindow","(Landroid/os/IBinder;I)Z");
jboolean lResult = pEnv->CallBooleanMethod(lInputMethodManager, MethodHideSoftInput,lBinder, flags);
pEnv->CallBooleanMethod(lInputMethodManager, MethodHideSoftInput,lBinder, flags);

m_bIsKeyboardShown = false; // just treat it as hidden anyways why not
}
Expand Down
50 changes: 25 additions & 25 deletions platforms/android/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,30 @@ struct engine
NinecraftApp* ninecraftApp = nullptr;
};

static float mapStick(AInputEvent* event, int32_t axis)
{
const float deadZone = .265f;
float value = AMotionEvent_getAxisValue(event, axis, 0);
if (value > deadZone)
return (value - deadZone) / (1.f - deadZone);
else if (value < -deadZone)
return (value + deadZone) / (1.f - deadZone);
else
return 0.f;
}

static float mapTrigger(AInputEvent* event, int32_t axis)
{
const float deadZone = .1f;
float value = AMotionEvent_getAxisValue(event, axis, 0);
if (value > deadZone)
return (value - deadZone) / (1.f - deadZone);
else
return 0.f;
}

static bool s_lastR = false;
static bool s_lastL = false;
// static float mapStick(AInputEvent* event, int32_t axis)
// {
// const float deadZone = .265f;
// float value = AMotionEvent_getAxisValue(event, axis, 0);
// if (value > deadZone)
// return (value - deadZone) / (1.f - deadZone);
// else if (value < -deadZone)
// return (value + deadZone) / (1.f - deadZone);
// else
// return 0.f;
// }

// static float mapTrigger(AInputEvent* event, int32_t axis)
// {
// const float deadZone = .1f;
// float value = AMotionEvent_getAxisValue(event, axis, 0);
// if (value > deadZone)
// return (value - deadZone) / (1.f - deadZone);
// else
// return 0.f;
// }

// static bool s_lastR = false;
// static bool s_lastL = false;

static char getCharFromKey(int32_t keyCode, int32_t metaState)
{
Expand Down Expand Up @@ -470,4 +470,4 @@ void android_main(struct android_app* state) {
exit:
engine.ninecraftApp->saveOptions();
delete engine.ninecraftApp;
}
}
4 changes: 2 additions & 2 deletions platforms/ios/minecraftpeViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ - (void)viewDidLoad
else if (![EAGLContext setCurrentContext:aContext])
NSLog(@"Failed to set ES context current");

self.context = aContext;
self.context = aContext;

[(EAGLView *)self.view setContext:context];
[(EAGLView *)self.view setFramebuffer];
Expand Down Expand Up @@ -247,7 +247,7 @@ - (void)viewDidUnload
// Tear down context.
if ([EAGLContext currentContext] == context)
[EAGLContext setCurrentContext:nil];
self.context = nil;
self.context = nil;
}

- (void)initView
Expand Down
3 changes: 1 addition & 2 deletions platforms/sdl/sdl1/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ static void initGraphics()
#if MCE_GFX_API_OGL
if (!mce::Platform::OGL::InitBindings())
{
const char* const GL_ERROR_MSG = "Error initializing GL extensions. OpenGL 2.0 or later is required.";
LOG_E("Error initializing GL extensions. OpenGL 2.0 or later is required.");
exit(EXIT_FAILURE);
}
#else
#endif
}

Expand Down
2 changes: 2 additions & 0 deletions platforms/sound/directsound/CustomSoundSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
#include <stdexcept>
#include <vector>

#ifdef _MSVC_VER
#pragma comment(lib, "dsound.lib")
#pragma comment(lib, "dxguid.lib")
#pragma comment(lib, "winmm.lib")
#endif

#include <mmsystem.h>
#include <dsound.h>
Expand Down
6 changes: 3 additions & 3 deletions platforms/sound/openal/SoundStreamAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void SoundStreamAL::_createBuffers()

ALuint buffers[2];
alGenBuffers(2, buffers);
for (int i = 0; i < sizeof(buffers) / sizeof(ALuint); i++)
for (size_t i = 0; i < sizeof(buffers) / sizeof(ALuint); i++)
{
_buffers.push_back(buffers[i]);
_bufferIdMap.insert(std::make_pair(buffers[i], i ));
Expand Down Expand Up @@ -108,7 +108,7 @@ bool SoundStreamAL::_open(const std::string& fileName)
else _alFormat = AL_FORMAT_MONO16;

size_t size = _buffers.size();
for (int i = 0; i < size; i++)
for (size_t i = 0; i < size; i++)
{
if (!_stream(i)) return false;
}
Expand Down Expand Up @@ -168,4 +168,4 @@ void SoundStreamAL::_publishBuffer(unsigned int destBufferId, const SoundBuffer&
{
alBufferData(_buffers[destBufferId], _alFormat, sourceBuffer.m_pData, sourceBuffer.m_dataSize * sizeof(int16_t), m_info.sample_rate);
AL_ERROR_CHECK();
}
}
1 change: 0 additions & 1 deletion platforms/sound/openal/SoundSystemAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ void SoundSystemAL::playAt(const SoundDesc& sound, const Vec3& pos, float volume
return;

bool bIsGUI = AL_FALSE;
float distance = 0.0f;
if (pos == Vec3::ZERO)
{
bIsGUI = AL_TRUE;
Expand Down
4 changes: 2 additions & 2 deletions platforms/windows/AppPlatform_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ void AppPlatform_win32::saveScreenshot(const std::string& fileName, int width, i
sprintf(str, "%s\\%s", ".", "Screenshots");

// https://stackoverflow.com/a/8233867
DWORD ftyp = GetFileAttributesA(str);

DWORD error = GetLastError();
if (error == ERROR_PATH_NOT_FOUND || error == ERROR_FILE_NOT_FOUND || error == ERROR_INVALID_NAME)
{
Expand Down Expand Up @@ -150,6 +148,8 @@ void AppPlatform_win32::createUserInput()
m_UserInputStatus = 1;
break;
}
default:
break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/client/gui/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "client/renderer/renderer/RenderMaterialGroup.hpp"
#include "renderer/ShaderConstants.hpp"

#ifdef _WIN32
#ifdef _MSVC_VER
#pragma warning(disable : 4244)
#endif

Expand Down
3 changes: 2 additions & 1 deletion source/client/gui/components/OptionList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ void OptionList::initMultiplayerMenu()
#ifdef __EMSCRIPTEN
m_items[currentIndex]->setDisabled(true);
#endif
(void)currentIndex; // compiler will warn about an unused variable sometimes if this isn't here
}

void OptionList::initMiscMenu()
Expand All @@ -358,4 +359,4 @@ void OptionList::initMiscMenu()
if (!Screen::isMenuPanoramaAvailable())
m_items[idxPano]->setDisabled(true);
#endif
}
}
2 changes: 1 addition & 1 deletion source/client/gui/components/TextInputBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ std::string TextInputBox::_sanitizePasteText(const std::string& text) const
std::string sanitized;
sanitized.reserve(text.length());

for (int i = 0; i < text.length(); ++i)
for (size_t i = 0; i < text.length(); ++i)
{
char c = text[i];
if (!IsInvalidCharacter(c))
Expand Down
2 changes: 1 addition & 1 deletion source/client/gui/screens/CreateWorldScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void CreateWorldScreen::buttonClicked(Button* pButton)
std::string levelNickname = Util::stringTrim(nameStr);
std::string levelUniqueName = levelNickname;

for (int i = 0; i < sizeof(g_CreateWorldFilterArray); i++)
for (size_t i = 0; i < sizeof(g_CreateWorldFilterArray); i++)
{
std::string str;
str.push_back(g_CreateWorldFilterArray[i]);
Expand Down
4 changes: 2 additions & 2 deletions source/client/gui/screens/JoinGameScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ void JoinGameScreen::tick()
std::vector<PingedCompatibleServer>* pGames = &m_pAvailableGamesList->m_games;
for (int i = int(pGames->size() - 1); i >= 0; i--)
{
int j = 0;
for (; j < int(serverListFiltered.size()); j++)
size_t j = 0;
for (; j < serverListFiltered.size(); j++)
{
if (serverListFiltered[j].m_address == (*pGames)[i].m_address)
break;
Expand Down
4 changes: 2 additions & 2 deletions source/client/gui/screens/OptionsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

OptionsScreen::OptionsScreen() :
m_pList(nullptr),
m_currentCategory(OC_VIDEO),
m_videoButton(MIN_CATEGORY_BUTTON_ID, "Video"),
m_controlsButton(MIN_CATEGORY_BUTTON_ID + 1, "Controls"),
m_multiplayerButton(MIN_CATEGORY_BUTTON_ID + 2, "Multiplayer"),
m_miscButton(MAX_CATEGORY_BUTTON_ID, "Misc"),
m_backButton(BACK_BUTTON_ID, "Done"),
m_currentCategory(OC_VIDEO)
m_backButton(BACK_BUTTON_ID, "Done")
{
}

Expand Down
2 changes: 1 addition & 1 deletion source/client/gui/screens/SelectWorldScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void SelectWorldScreen::tick()
std::string levelNickname = Util::stringTrim(userInput[0]);
std::string levelUniqueName = levelNickname;

for (int i = 0; i < sizeof(g_SelectWorldFilterArray); i++)
for (size_t i = 0; i < sizeof(g_SelectWorldFilterArray); i++)
{
std::string str;
str.push_back(g_SelectWorldFilterArray[i]);
Expand Down
6 changes: 3 additions & 3 deletions source/client/gui/screens/StartMenuScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ void StartMenuScreen::draw2dTitle()
{
Textures* tx = m_pMinecraft->m_pTextures;

bool crampedMode = false;
// bool crampedMode = false;

currentShaderColor = Color::WHITE;

Expand All @@ -559,7 +559,7 @@ void StartMenuScreen::draw2dTitle()

if (m_width * 3 / 4 < m_2dTitleBounds.w)
{
crampedMode = true;
// crampedMode = true;
yPos = 4;
}

Expand Down Expand Up @@ -588,7 +588,7 @@ void StartMenuScreen::draw2dTitle()

if (m_width * 3 / 4 < m_2dTitleBounds.w)
{
crampedMode = true;
// crampedMode = true;
yPos = 4;
}

Expand Down
4 changes: 2 additions & 2 deletions source/client/multiplayer/MultiPlayerLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void MultiPlayerLevel::tick()
_setTime(getTime() + 1); // Bypasses the normally-required update to LevelListeners
updateSkyDarken();

for (int i = 0; i < 10 && i < m_reEntries.size(); i++)
for (size_t i = 0; i < 10 && i < m_reEntries.size(); i++)
{
Entity* pEntity = m_reEntries[i];
if (std::find(m_entities.begin(), m_entities.end(), pEntity) != m_entities.end())
Expand Down Expand Up @@ -51,4 +51,4 @@ void MultiPlayerLevel::putEntity(int id, Entity* e)
}

m_entitiesById[id] = e;
}
}
2 changes: 1 addition & 1 deletion source/client/network/ClientSideNetworkHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& rakGuid, ChunkDa
m_pLevel->setTileNoUpdate(TilePos(x16 + (k & 0xF), yPos + i, z16 + (k >> 4)), tiles[i]);
}

int idx = ((k & 0xF) << 11) | ((k >> 4) << 7) + yPos;
int idx = ((k & 0xF) << 11) | (((k >> 4) << 7) + yPos);
memcpy(&pChunk->m_tileData.m_data[idx >> 1], datas, sizeof datas);
}

Expand Down
4 changes: 2 additions & 2 deletions source/client/options/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void Options::_load()
{
std::vector<std::string> strings = readPropertiesFromFile(m_filePath);

for (int i = 0; i < strings.size(); i += 2)
for (size_t i = 0; i < strings.size(); i += 2)
{
std::string key = strings[i], value = strings[i + 1];

Expand Down Expand Up @@ -250,7 +250,7 @@ void Options::savePropertiesToFile(const std::string& filePath, std::vector<std:

os << "#Config file for Minecraft PE. The # at the start denotes a comment, removing it makes it a command.\n\n";

for (int i = 0; i < properties.size(); i += 2)
for (size_t i = 0; i < properties.size(); i += 2)
os << properties[i] << ':' << properties[i + 1] << '\n';
}

Expand Down
3 changes: 2 additions & 1 deletion source/client/player/input/Keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
SPDX-License-Identifier: BSD-1-Clause
********************************************************************/

#include <stddef.h>
#include "Keyboard.hpp"

#include "GameMods.hpp"
Expand All @@ -28,7 +29,7 @@ void Keyboard::feed(KeyState state, int key)

bool Keyboard::next()
{
if (_index + 1 >= _inputs.size())
if ((size_t)_index + 1 >= _inputs.size())
return false;

_index++;
Expand Down
3 changes: 2 additions & 1 deletion source/client/player/input/MouseDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
SPDX-License-Identifier: BSD-1-Clause
********************************************************************/

#include <stddef.h>
#include "MouseDevice.hpp"

MouseDevice::MouseDevice()
Expand Down Expand Up @@ -51,7 +52,7 @@ short MouseDevice::getY()

bool MouseDevice::next()
{
if (_index + 1 >= _inputs.size())
if ((size_t)_index + 1 >= _inputs.size())
return false;

_index++;
Expand Down
Loading