mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-13 12:47:13 +00:00
Merge branch 'dev' into feat/sdl-support
This commit is contained in:
commit
197bf0033f
238
.github/workflows/build-linux.yml
vendored
Normal file
238
.github/workflows/build-linux.yml
vendored
Normal file
|
|
@ -0,0 +1,238 @@
|
|||
name: Build Linux Release
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- '**.cpp'
|
||||
- '**.h'
|
||||
- '**.c'
|
||||
- '**/meson.build'
|
||||
- 'meson.build'
|
||||
- '**/CMakeLists.txt'
|
||||
- 'CMakeLists.txt'
|
||||
- '.github/workflows/build-linux.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- '**.cpp'
|
||||
- '**.h'
|
||||
- '**.c'
|
||||
- '**/meson.build'
|
||||
- 'meson.build'
|
||||
- '**/CMakeLists.txt'
|
||||
- 'CMakeLists.txt'
|
||||
- '.github/workflows/build-linux.yml'
|
||||
|
||||
jobs:
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential python3 python3-pip python3-setuptools libgl1-mesa-dev libglu1-mesa-dev libglfw3-dev libpng-dev pkg-config clang lld ccache libssl-dev
|
||||
# Set a reasonable ccache size
|
||||
ccache -M 5G || true
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Cache pip packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('.github/workflows/build-linux.yml') }}
|
||||
|
||||
- name: Install Meson and Ninja (pip)
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install meson ninja
|
||||
|
||||
- name: Restore ccache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: ${{ runner.os }}-ccache-${{ hashFiles('**/meson.build') }}
|
||||
|
||||
- name: Restore meson cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/meson
|
||||
key: ${{ runner.os }}-meson-${{ hashFiles('**/meson.build') }}
|
||||
|
||||
- name: Configure Meson
|
||||
env:
|
||||
CC: "ccache clang"
|
||||
CXX: "ccache clang++"
|
||||
CCACHE_DIR: ${{ runner.temp }}/ccache
|
||||
run: |
|
||||
mkdir -p "$CCACHE_DIR"
|
||||
export CCACHE_DIR="$CCACHE_DIR"
|
||||
meson setup build_meson --wipe --buildtype=release
|
||||
|
||||
- name: Build with Meson
|
||||
env:
|
||||
CC: "ccache clang"
|
||||
CXX: "ccache clang++"
|
||||
CCACHE_DIR: ${{ runner.temp }}/ccache
|
||||
run: |
|
||||
export CCACHE_DIR="${{ runner.temp }}/ccache"
|
||||
# Use all available cores for faster parallel builds
|
||||
meson compile -C build_meson -j $(nproc) -v Minecraft.Client
|
||||
|
||||
- name: Install patchelf
|
||||
run: sudo apt-get install -y patchelf
|
||||
|
||||
- name: Bundle executable + libraries
|
||||
env:
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
EXE_PATH=build_meson/Minecraft.Client/Minecraft.Client
|
||||
if [ ! -f "$EXE_PATH" ]; then
|
||||
echo "ERROR: expected executable at $EXE_PATH" >&2
|
||||
ls -la build_meson || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SHORT_SHA=$(echo "$GITHUB_SHA" | cut -c1-8)
|
||||
BUNDLE=out/minecraft-client-linux-${SHORT_SHA}
|
||||
mkdir -p "$BUNDLE/lib"
|
||||
|
||||
# Copy the binary
|
||||
cp "$EXE_PATH" "$BUNDLE/Minecraft.Client"
|
||||
|
||||
# Collect non-system shared library dependencies and copy them in.
|
||||
# Exclude glibc/libstdc++/libgcc — these are ABI-specific and must
|
||||
# come from the user's system, not from the build runner.
|
||||
ldd "$EXE_PATH" \
|
||||
| awk '/=>/ { print $3 }' \
|
||||
| grep -v '^(' \
|
||||
| grep -Ev '/(libc|libm|libdl|libpthread|librt|libgcc_s|libstdc\+\+|ld-linux)[^/]*\.so' \
|
||||
| sort -u \
|
||||
| while read -r lib; do
|
||||
[ -f "$lib" ] && cp "$lib" "$BUNDLE/lib/" || true
|
||||
done
|
||||
|
||||
# Patch the binary RPATH so it finds libs in ./lib at runtime
|
||||
patchelf --set-rpath '$ORIGIN/lib' "$BUNDLE/Minecraft.Client"
|
||||
|
||||
# Write a launcher script
|
||||
cat > "$BUNDLE/run.sh" << 'RUNEOF'
|
||||
#!/usr/bin/env bash
|
||||
# 4JCraft Linux launcher
|
||||
# -------------------------------------------------------------------
|
||||
# IMPORTANT: Before running, copy the "Common" assets folder from
|
||||
# https://github.com/smartcmd/MinecraftConsoles/releases/tag/nightly
|
||||
# (LCEWindows64.zip → extract → copy "Common" next to this script)
|
||||
# -------------------------------------------------------------------
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
if [ ! -d "$DIR/Common" ]; then
|
||||
echo "ERROR: Missing 'Common' assets folder."
|
||||
echo "Download LCEWindows64.zip from:"
|
||||
echo " https://github.com/smartcmd/MinecraftConsoles/releases/tag/nightly"
|
||||
echo "Extract it and copy the 'Common' folder next to this run.sh file."
|
||||
exit 1
|
||||
fi
|
||||
cd "$DIR"
|
||||
exec ./Minecraft.Client "$@"
|
||||
RUNEOF
|
||||
chmod +x "$BUNDLE/run.sh"
|
||||
|
||||
# Write a README
|
||||
cat > "$BUNDLE/README.txt" << 'EOF'
|
||||
4JCraft Linux Build
|
||||
===================
|
||||
This bundle contains:
|
||||
Minecraft.Client - compiled Linux binary
|
||||
lib/ - all required shared libraries (GL, GLFW, png, zlib, X11 etc.)
|
||||
run.sh - launcher script
|
||||
|
||||
To run:
|
||||
1. Download LCEWindows64.zip from the MinecraftConsoles nightly release:
|
||||
https://github.com/smartcmd/MinecraftConsoles/releases/tag/nightly
|
||||
2. Extract it and copy the "Common" folder into this directory
|
||||
(so you have Common/ sitting next to run.sh)
|
||||
3. Run: ./run.sh [--width W] [--height H] [--fullscreen]
|
||||
EOF
|
||||
|
||||
echo "Bundle ready: $BUNDLE"
|
||||
ls -lh "$BUNDLE" "$BUNDLE/lib"
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: minecraft-client-linux-${{ github.sha }}
|
||||
path: out/minecraft-client-linux-*/
|
||||
retention-days: 7
|
||||
build-linux-debug:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential python3 python3-pip python3-setuptools libgl1-mesa-dev libglu1-mesa-dev libglfw3-dev libpng-dev pkg-config clang lld ccache libssl-dev
|
||||
# Set a reasonable ccache size
|
||||
ccache -M 5G || true
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Cache pip packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('.github/workflows/build-linux.yml') }}
|
||||
|
||||
- name: Install Meson and Ninja (pip)
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install meson ninja
|
||||
|
||||
- name: Restore ccache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: ${{ runner.os }}-ccache-debug-${{ hashFiles('**/meson.build') }}
|
||||
|
||||
- name: Restore meson cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/meson
|
||||
key: ${{ runner.os }}-meson-debug-${{ hashFiles('**/meson.build') }}
|
||||
|
||||
- name: Configure Meson (debug)
|
||||
env:
|
||||
CC: "ccache clang"
|
||||
CXX: "ccache clang++"
|
||||
CCACHE_DIR: ${{ runner.temp }}/ccache
|
||||
run: |
|
||||
mkdir -p "$CCACHE_DIR"
|
||||
export CCACHE_DIR="$CCACHE_DIR"
|
||||
meson setup build_debug --wipe --buildtype=debug
|
||||
|
||||
- name: Build Debug with Meson
|
||||
env:
|
||||
CC: "ccache clang"
|
||||
CXX: "ccache clang++"
|
||||
CCACHE_DIR: ${{ runner.temp }}/ccache
|
||||
run: |
|
||||
export CCACHE_DIR="${{ runner.temp }}/ccache"
|
||||
# Use all available cores for faster parallel builds
|
||||
meson compile -C build_debug -j $(nproc) -v Minecraft.Client
|
||||
|
||||
- name: Upload debug executable
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: minecraft-client-linux-debug_exe-${{ github.sha }}
|
||||
path: build_debug/Minecraft.Client/Minecraft.Client
|
||||
retention-days: 7
|
||||
208
.github/workflows/ci.yml
vendored
208
.github/workflows/ci.yml
vendored
|
|
@ -1,208 +0,0 @@
|
|||
name: CI
|
||||
# remade the CI now not broken anymore
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
paths:
|
||||
- '**.cpp'
|
||||
- '**.h'
|
||||
- '**.c'
|
||||
- '**/meson.build'
|
||||
- 'meson.build'
|
||||
- '**/CMakeLists.txt'
|
||||
- 'CMakeLists.txt'
|
||||
- '.github/workflows/ci.yml'
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
paths:
|
||||
- '**.cpp'
|
||||
- '**.h'
|
||||
- '**.c'
|
||||
- '**/meson.build'
|
||||
- 'meson.build'
|
||||
- '**/CMakeLists.txt'
|
||||
- 'CMakeLists.txt'
|
||||
- '.github/workflows/ci.yml'
|
||||
|
||||
jobs:
|
||||
build-release:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
BUILD_DIR: build_meson
|
||||
BUNDLE_DIR: out/minecraft-client
|
||||
concurrency:
|
||||
group: build-linux-release-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq build-essential python3 python3-pip \
|
||||
libgl1-mesa-dev libglu1-mesa-dev libsdl2-dev libglfw3-dev libpng-dev \
|
||||
zlib1g-dev pkg-config clang lld ccache libssl-dev patchelf > /dev/null
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install Meson and Ninja
|
||||
run: pip install meson ninja -q
|
||||
|
||||
- name: Restore ccache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: ${{ runner.os }}-ccache-release-${{ hashFiles('**/meson.build') }}
|
||||
|
||||
- name: Configure Meson
|
||||
run: |
|
||||
mkdir -p ${{ runner.temp }}/ccache
|
||||
CC="ccache clang" CXX="ccache clang++" CCACHE_DIR="${{ runner.temp }}/ccache" \
|
||||
meson setup ${{ env.BUILD_DIR }} --buildtype=release -Dwarning_level=0 > /dev/null
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
CCACHE_DIR="${{ runner.temp }}/ccache" \
|
||||
ninja -C ${{ env.BUILD_DIR }} -j$(nproc) > /dev/null
|
||||
|
||||
- name: Prepare bundle directory
|
||||
run: mkdir -p ${{ env.BUNDLE_DIR }}/lib
|
||||
|
||||
- name: Copy binary
|
||||
run: cp ${{ env.BUILD_DIR }}/Minecraft.Client/Minecraft.Client ${{ env.BUNDLE_DIR }}/
|
||||
|
||||
- name: Copy source assets
|
||||
run: |
|
||||
cp -r Minecraft.Assets/Common ${{ env.BUNDLE_DIR }}/
|
||||
cp -r Minecraft.Assets/Common/music ${{ env.BUNDLE_DIR }}/
|
||||
cp -r Minecraft.Assets/DurangoMedia/Sound ${{ env.BUNDLE_DIR }}/
|
||||
|
||||
- name: Copy built assets
|
||||
run: |
|
||||
mkdir -p ${{ env.BUNDLE_DIR }}/Common/Media
|
||||
cp ${{ env.BUILD_DIR }}/Minecraft.Assets/MediaLinux.arc ${{ env.BUNDLE_DIR }}/Common/Media/
|
||||
cp ${{ env.BUILD_DIR }}/Minecraft.Assets/languages.loc ${{ env.BUNDLE_DIR }}/Common/
|
||||
|
||||
- name: Collect shared libraries
|
||||
run: |
|
||||
EXE="${{ env.BUNDLE_DIR }}/Minecraft.Client"
|
||||
ldd "$EXE" | awk '/=>/ { print $3 }' | grep -v '^(' | \
|
||||
grep -Ev '/(libc|libm|libdl|libpthread|librt|libgcc_s|libstdc\+\+|ld-linux)[^/]*\.so' | \
|
||||
sort -u | xargs -I{} cp -L {} ${{ env.BUNDLE_DIR }}/lib/ || true
|
||||
|
||||
- name: Fix RPATH
|
||||
run: patchelf --set-rpath '$ORIGIN/lib' ${{ env.BUNDLE_DIR }}/Minecraft.Client
|
||||
## useless but still good
|
||||
- name: Generate launcher and readme
|
||||
run: |
|
||||
cat > ${{ env.BUNDLE_DIR }}/run.sh << 'EOF'
|
||||
#!/usr/bin/env bash
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
cd "$DIR"
|
||||
export LD_LIBRARY_PATH="$DIR/lib:$LD_LIBRARY_PATH"
|
||||
exec ./Minecraft.Client "$@"
|
||||
EOF
|
||||
chmod +x ${{ env.BUNDLE_DIR }}/run.sh
|
||||
|
||||
echo -e "4JCraft Linux Build\nRun via ./run.sh" > ${{ env.BUNDLE_DIR }}/README.txt
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: minecraft-client-linux
|
||||
path: ${{ env.BUNDLE_DIR }}
|
||||
retention-days: 7
|
||||
|
||||
build-debug:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
BUILD_DIR: build_debug
|
||||
BUNDLE_DIR: out/minecraft-client-debug
|
||||
concurrency:
|
||||
group: build-linux-debug-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq build-essential python3 python3-pip \
|
||||
libgl1-mesa-dev libglu1-mesa-dev libsdl2-dev libglfw3-dev libpng-dev \
|
||||
zlib1g-dev pkg-config clang lld ccache libssl-dev patchelf > /dev/null
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install Meson and Ninja
|
||||
run: pip install meson ninja -q
|
||||
|
||||
- name: Restore ccache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: ${{ runner.os }}-ccache-debug-${{ hashFiles('**/meson.build') }}
|
||||
|
||||
- name: Configure Meson
|
||||
run: |
|
||||
mkdir -p ${{ runner.temp }}/ccache
|
||||
CC="ccache clang" CXX="ccache clang++" CCACHE_DIR="${{ runner.temp }}/ccache" \
|
||||
meson setup ${{ env.BUILD_DIR }} --buildtype=debug -Dwarning_level=0 > /dev/null
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
CCACHE_DIR="${{ runner.temp }}/ccache" \
|
||||
ninja -C ${{ env.BUILD_DIR }} -j$(nproc) > /dev/null
|
||||
|
||||
- name: Prepare bundle directory
|
||||
run: mkdir -p ${{ env.BUNDLE_DIR }}/lib
|
||||
|
||||
- name: Copy binary
|
||||
run: cp ${{ env.BUILD_DIR }}/Minecraft.Client/Minecraft.Client ${{ env.BUNDLE_DIR }}/Minecraft.Client.debug
|
||||
|
||||
- name: Copy source assets
|
||||
run: |
|
||||
cp -r Minecraft.Assets/Common ${{ env.BUNDLE_DIR }}/
|
||||
cp -r Minecraft.Assets/Common/music ${{ env.BUNDLE_DIR }}/
|
||||
cp -r Minecraft.Assets/DurangoMedia/Sound ${{ env.BUNDLE_DIR }}/
|
||||
|
||||
- name: Copy built assets
|
||||
run: |
|
||||
mkdir -p ${{ env.BUNDLE_DIR }}/Common/Media
|
||||
cp ${{ env.BUILD_DIR }}/Minecraft.Assets/MediaLinux.arc ${{ env.BUNDLE_DIR }}/Common/Media/
|
||||
cp ${{ env.BUILD_DIR }}/Minecraft.Assets/languages.loc ${{ env.BUNDLE_DIR }}/Common/
|
||||
|
||||
- name: Collect shared libraries
|
||||
run: |
|
||||
EXE="${{ env.BUNDLE_DIR }}/Minecraft.Client.debug"
|
||||
ldd "$EXE" | awk '/=>/ { print $3 }' | grep -v '^(' | \
|
||||
grep -Ev '/(libc|libm|libdl|libpthread|librt|libgcc_s|libstdc\+\+|ld-linux)[^/]*\.so' | \
|
||||
sort -u | xargs -I{} cp -L {} ${{ env.BUNDLE_DIR }}/lib/ || true
|
||||
|
||||
- name: Fix RPATH
|
||||
run: patchelf --set-rpath '$ORIGIN/lib' ${{ env.BUNDLE_DIR }}/Minecraft.Client.debug
|
||||
|
||||
- name: Generate launcher
|
||||
run: |
|
||||
cat > ${{ env.BUNDLE_DIR }}/run_debug.sh << 'EOF'
|
||||
#!/usr/bin/env bash
|
||||
DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
cd "$DIR"
|
||||
export LD_LIBRARY_PATH="$DIR/lib:$LD_LIBRARY_PATH"
|
||||
exec ./Minecraft.Client.debug "$@"
|
||||
EOF
|
||||
chmod +x ${{ env.BUNDLE_DIR }}/run_debug.sh
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: minecraft-client-linux-debug
|
||||
path: ${{ env.BUNDLE_DIR }}
|
||||
retention-days: 7
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -29,7 +29,7 @@ meson-logs/
|
|||
*.out
|
||||
*.d
|
||||
compile_commands.json
|
||||
|
||||
.clangd
|
||||
|
||||
|
||||
# ----- Scratch / legacy -----
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
class ConsoleInputSource
|
||||
{
|
||||
public:
|
||||
virtual ~ConsoleInputSource(){}
|
||||
virtual void info(const std::wstring& string) = 0;
|
||||
virtual void warn(const std::wstring& string) = 0;
|
||||
virtual std::wstring getConsoleName() = 0;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ public:
|
|||
bool sneaking;
|
||||
|
||||
Input(); // 4J - added
|
||||
virtual ~Input(){}
|
||||
|
||||
virtual void tick(LocalPlayer *player);
|
||||
|
||||
|
|
@ -19,4 +20,4 @@ private:
|
|||
|
||||
bool lReset;
|
||||
bool rReset;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ PlayerChunkMap::PlayerChunk::PlayerChunk(int x, int z, PlayerChunkMap *pcm) : po
|
|||
|
||||
PlayerChunkMap::PlayerChunk::~PlayerChunk()
|
||||
{
|
||||
delete changedTiles.data;
|
||||
delete[] changedTiles.data; //4jcraft, changed to []
|
||||
}
|
||||
|
||||
// 4J added - construct an an array of flags that indicate which entities are still waiting to have network packets sent out to say that they have been removed
|
||||
|
|
@ -797,4 +797,4 @@ void PlayerChunkMap::setRadius(int newRadius)
|
|||
assert(radius >= MIN_VIEW_DISTANCE);
|
||||
this->radius = newRadius;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4111,7 +4111,7 @@ void CMinecraftApp::loadStringTable()
|
|||
{
|
||||
byteArray locFile = m_mediaArchive->getFile(localisationFile);
|
||||
m_stringTable = new StringTable(locFile.data, locFile.length);
|
||||
delete locFile.data;
|
||||
delete[] locFile.data;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -285,12 +285,12 @@ __int64 ConsoleSchematicFile::applyBlocksAndData(LevelChunk *chunk, AABB *chunkB
|
|||
PIXBeginNamedEvent(0,"Setting Block data");
|
||||
chunk->setBlockData(blockData);
|
||||
PIXEndNamedEvent();
|
||||
delete blockData.data;
|
||||
delete[] blockData.data; //4jcraft changed to array delete
|
||||
chunk->recalcHeightmapOnly();
|
||||
PIXBeginNamedEvent(0,"Setting Data data");
|
||||
chunk->setDataData(dataData);
|
||||
PIXEndNamedEvent();
|
||||
delete dataData.data;
|
||||
delete[] dataData.data; //4jcraft, same here
|
||||
|
||||
// A basic pass through to roughly do the lighting. At this point of post-processing, we don't have all the neighbouring chunks loaded in,
|
||||
// so any lighting here should be things that won't propagate out of this chunk.
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ protected:
|
|||
|
||||
public:
|
||||
GameRuleDefinition();
|
||||
virtual ~GameRuleDefinition(){}
|
||||
|
||||
virtual ConsoleGameRules::EGameRuleType getActionType() = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ public:
|
|||
// was being mixed in with all the game information as they have
|
||||
// completely different lifespans.
|
||||
|
||||
virtual ~GrSource(){}
|
||||
virtual bool requiresTexturePack()=0;
|
||||
virtual UINT getRequiredTexturePackId()=0;
|
||||
virtual std::wstring getDefaultSaveName()=0;
|
||||
|
|
|
|||
|
|
@ -1108,7 +1108,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||
app.SetXuiServerAction(ProfileManager.GetPrimaryPad(),eXuiServerAction_PauseServer,(void *)TRUE);
|
||||
|
||||
// wait for the server to be in a non-ticking state
|
||||
pServer->m_serverPausedEvent->WaitForSignal(INFINITY);
|
||||
pServer->m_serverPausedEvent->WaitForSignal(INFINITE);
|
||||
|
||||
#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
|
||||
// Swap these two messages around as one is too long to display at 480
|
||||
|
|
@ -1926,7 +1926,7 @@ void CGameNetworkManager::ServerReadyWait()
|
|||
{
|
||||
if (m_hServerReadyEvent != NULL)
|
||||
{
|
||||
m_hServerReadyEvent->WaitForSignal(INFINITY);
|
||||
m_hServerReadyEvent->WaitForSignal(INFINITE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1990,7 +1990,7 @@ void CGameNetworkManager::ServerStoppedWait()
|
|||
{
|
||||
if (m_hServerStoppedEvent != NULL)
|
||||
{
|
||||
m_hServerStoppedEvent->WaitForSignal(INFINITY);
|
||||
m_hServerStoppedEvent->WaitForSignal(INFINITE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@ private:
|
|||
|
||||
public:
|
||||
LookAtEntityHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, int titleId, eINSTANCEOF type);
|
||||
~LookAtEntityHint();
|
||||
//TODO: 4jcraft added, this was not implemented
|
||||
~LookAtEntityHint(){};
|
||||
|
||||
virtual bool onLookAtEntity(eINSTANCEOF type);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ LookAtTileHint::LookAtTileHint(eTutorial_Hint id, Tutorial *tutorial, int tiles[
|
|||
{
|
||||
m_iTilesCount = tilesLength;
|
||||
|
||||
//TODO: 4jcraft: allocating but never freeing mem, leak
|
||||
m_iTiles= new int [m_iTilesCount];
|
||||
for(unsigned int i=0;i<m_iTilesCount;i++)
|
||||
{
|
||||
|
|
@ -65,4 +66,4 @@ bool LookAtTileHint::onLookAt(int id,int iData)
|
|||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ private:
|
|||
|
||||
public:
|
||||
LookAtTileHint(eTutorial_Hint id, Tutorial *tutorial, int tiles[], unsigned int tilesLength, int iconOverride = -1, int iData=-1, int iDataOverride = -1);
|
||||
~LookAtTileHint();
|
||||
//TODO: 4jcraft, added, destructor was never implemented
|
||||
~LookAtTileHint(){};
|
||||
|
||||
virtual bool onLookAt(int id, int iData=0);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ private:
|
|||
|
||||
public:
|
||||
TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], unsigned int itemsLength);
|
||||
~TakeItemHint();
|
||||
//TODO: 4jcraft, added, it was never implemented
|
||||
virtual ~TakeItemHint(){};
|
||||
|
||||
virtual bool onTake( std::shared_ptr<ItemInstance> item );
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public:
|
|||
bool m_isFullTutorial;
|
||||
public:
|
||||
Tutorial(int iPad, bool isFullTutorial = false);
|
||||
~Tutorial();
|
||||
virtual ~Tutorial();
|
||||
void tick();
|
||||
|
||||
int getPad() { return m_iPad; }
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ protected:
|
|||
|
||||
public:
|
||||
TutorialHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, eHintType type, bool allowFade = true);
|
||||
virtual ~TutorialHint(){}
|
||||
|
||||
eTutorial_Hint getId() { return m_id; }
|
||||
|
||||
|
|
@ -50,4 +51,4 @@ public:
|
|||
virtual bool onLookAtEntity(eINSTANCEOF type);
|
||||
virtual int tick();
|
||||
virtual bool allowFade() { return m_allowFade; }
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ void CConsoleMinecraftApp::ExitGame()
|
|||
}
|
||||
void CConsoleMinecraftApp::FatalLoadError()
|
||||
{
|
||||
app.DebugPrintf("CConsoleMinecraftApp::FatalLoadError - asserting 0 and dying...\n");
|
||||
assert(0);
|
||||
}
|
||||
|
||||
void CConsoleMinecraftApp::CaptureSaveThumbnail()
|
||||
|
|
|
|||
|
|
@ -699,10 +699,6 @@ ProfileManager.Initialise(TITLEID_MINECRAFT,
|
|||
&app.uiGameDefinedDataChangedBitmask
|
||||
);
|
||||
|
||||
byteArray baOptionsIcon = app.getArchiveFile(L"DefaultOptionsImage228x128.png");
|
||||
byteArray baSaveThumbnail = app.getArchiveFile(L"DefaultSaveThumbnail64x64.png");
|
||||
byteArray baSaveImage = app.getArchiveFile(L"DefaultSaveImage228x128.png");
|
||||
|
||||
// set a function to be called when there's a sign in change, so we can exit a level if the primary player signs out
|
||||
ProfileManager.SetSignInChangeCallback(&CConsoleMinecraftApp::SignInChangeCallback,(LPVOID)&app);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ protected:
|
|||
|
||||
public:
|
||||
MultiPlayerGameMode(Minecraft *minecraft, ClientConnection *connection);
|
||||
virtual ~MultiPlayerGameMode(){}
|
||||
static void creativeDestroyBlock(Minecraft *minecraft, MultiPlayerGameMode *gameMode, int x, int y, int z, int face);
|
||||
void adjustPlayer(std::shared_ptr<Player> player);
|
||||
bool isCutScene();
|
||||
|
|
@ -64,4 +65,4 @@ public:
|
|||
virtual bool isInputAllowed(int mapping) { return true; }
|
||||
virtual bool isTutorial() { return false; }
|
||||
virtual Tutorial *getTutorial() { return NULL; }
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ TileRenderer::TileRenderer( LevelSource* level, int xMin, int yMin, int zMin, un
|
|||
|
||||
TileRenderer::~TileRenderer()
|
||||
{
|
||||
delete cache;
|
||||
delete[] cache; //4jcraft, changed to []
|
||||
}
|
||||
|
||||
TileRenderer::TileRenderer( LevelSource* level )
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ public:
|
|||
int texHeight;
|
||||
|
||||
Model(); // 4J added
|
||||
virtual ~Model(){}
|
||||
virtual void render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) {}
|
||||
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0) {}
|
||||
virtual void prepareMobModel(std::shared_ptr<Mob> mob, float time, float r, float a) {}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,6 @@ class BufferedImage;
|
|||
class MemTextureProcessor
|
||||
{
|
||||
public:
|
||||
virtual ~MemTextureProcessor(){}
|
||||
virtual BufferedImage *process(BufferedImage *read) = 0;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public:
|
|||
using AbstractTexturePack::getResource;
|
||||
|
||||
DLCTexturePack(DWORD id, DLCPack *pack, TexturePack *fallback);
|
||||
~DLCTexturePack();
|
||||
~DLCTexturePack(){};
|
||||
|
||||
virtual std::wstring getResource(const std::wstring& name);
|
||||
virtual DLCPack * getDLCPack();
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class TexturePack
|
|||
public:
|
||||
|
||||
TexturePack() { m_bHasAudio=false;}
|
||||
virtual ~TexturePack(){}
|
||||
virtual bool hasData() = 0;
|
||||
virtual bool hasAudio() { return m_bHasAudio;}
|
||||
virtual void setHasAudio(bool bVal) {m_bHasAudio=bVal;}
|
||||
|
|
|
|||
|
|
@ -60,11 +60,17 @@ void StitchedTexture::freeFrameTextures()
|
|||
|
||||
StitchedTexture::~StitchedTexture()
|
||||
{
|
||||
for(AUTO_VAR(it, frames->begin()); it != frames->end(); ++it)
|
||||
{
|
||||
delete *it;
|
||||
// 4jcraft, added null check
|
||||
// the constructor does not allocate the frames vector.
|
||||
// in some scenarios the destructor/delete is called
|
||||
// without ever calling ::init()
|
||||
if(frames) {
|
||||
for(AUTO_VAR(it, frames->begin()); it != frames->end(); ++it)
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
delete frames;
|
||||
}
|
||||
delete frames;
|
||||
}
|
||||
|
||||
void StitchedTexture::initUVs(float U0, float V0, float U1, float V1)
|
||||
|
|
@ -351,4 +357,4 @@ int StitchedTexture::getFlags() const
|
|||
bool StitchedTexture::hasOwnData()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,4 +86,4 @@ public:
|
|||
void setFlags(int flags); // 4J added
|
||||
virtual void freeFrameTextures(); // 4J added
|
||||
virtual bool hasOwnData(); // 4J Added
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -193,4 +193,4 @@ Texture *TextureManager::createTexture(const std::wstring &name, int mode, int w
|
|||
// 4J Stu - Don't clamp as it causes issues with how we signal non-mipmmapped textures to the pixel shader
|
||||
//return createTexture(name, mode, width, height, Texture::WM_CLAMP, format, Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap, NULL);
|
||||
return createTexture(name, mode, width, height, Texture::WM_WRAP, format, Texture::TFLT_NEAREST, Texture::TFLT_NEAREST, mipmap, NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#pragma once
|
||||
#include "MemoryTracker.h"
|
||||
class ByteBuffer;
|
||||
class IntBuffer;
|
||||
class FloatBuffer;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ private:
|
|||
|
||||
public:
|
||||
JumpControl(Mob *mob);
|
||||
virtual ~JumpControl(){}
|
||||
|
||||
void jump();
|
||||
//genuinly, why tf is this VIRTUAL
|
||||
virtual void tick();
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ private:
|
|||
|
||||
public:
|
||||
LookControl(Mob *mob);
|
||||
virtual ~LookControl(){}
|
||||
|
||||
void setLookAt(std::shared_ptr<Entity> target, float yMax, float xMax);
|
||||
void setLookAt(double x, double y, double z, float yMax, float xMax);
|
||||
|
|
@ -30,4 +31,4 @@ public:
|
|||
double getWantedX();
|
||||
double getWantedY();
|
||||
double getWantedZ();
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ private:
|
|||
|
||||
public:
|
||||
MoveControl(Mob *mob);
|
||||
virtual ~MoveControl(){}
|
||||
|
||||
bool hasWanted();
|
||||
float getSpeed();
|
||||
|
|
@ -31,4 +32,4 @@ public:
|
|||
|
||||
private:
|
||||
float rotlerp(float a, float b, float max);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class Player;
|
|||
class Container
|
||||
{
|
||||
public:
|
||||
virtual ~Container(){}
|
||||
static const int LARGE_MAX_STACK_SIZE = 64;
|
||||
|
||||
virtual unsigned int getContainerSize() = 0;
|
||||
|
|
@ -20,4 +21,4 @@ public:
|
|||
virtual bool stillValid(std::shared_ptr<Player> player) = 0;
|
||||
virtual void startOpen() = 0;
|
||||
virtual void stopOpen() = 0;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ private:
|
|||
|
||||
public:
|
||||
CraftingContainer(AbstractContainerMenu *menu, unsigned int w, unsigned int h);
|
||||
~CraftingContainer();
|
||||
virtual ~CraftingContainer();
|
||||
|
||||
virtual unsigned int getContainerSize();
|
||||
virtual std::shared_ptr<ItemInstance> getItem(unsigned int slot);
|
||||
|
|
@ -29,4 +29,4 @@ public:
|
|||
void startOpen() { } // TODO Auto-generated method stub
|
||||
void stopOpen() { } // TODO Auto-generated method stub
|
||||
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class Player;
|
|||
class Merchant
|
||||
{
|
||||
public:
|
||||
virtual ~Merchant(){}
|
||||
virtual void setTradingPlayer(std::shared_ptr<Player> player) = 0;
|
||||
virtual std::shared_ptr<Player> getTradingPlayer() = 0;
|
||||
virtual MerchantRecipeList *getOffers(std::shared_ptr<Player> forPlayer) = 0;
|
||||
|
|
@ -14,4 +15,4 @@ public:
|
|||
virtual void notifyTrade(MerchantRecipe *activeRecipe) = 0;
|
||||
virtual void notifyTradeUpdated(std::shared_ptr<ItemInstance> item) = 0;
|
||||
virtual int getDisplayName() = 0;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ private:
|
|||
public:
|
||||
// 4J Stu Added a ctor to init items
|
||||
ResultContainer();
|
||||
virtual ~ResultContainer(){}
|
||||
|
||||
virtual unsigned int getContainerSize();
|
||||
virtual std::shared_ptr<ItemInstance> getItem(unsigned int slot);
|
||||
|
|
@ -23,4 +24,4 @@ public:
|
|||
|
||||
void startOpen() { } // TODO Auto-generated method stub
|
||||
void stopOpen() { } // TODO Auto-generated method stub
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,7 +15,11 @@ BufferedOutputStream::BufferedOutputStream(OutputStream *out, int size)
|
|||
|
||||
BufferedOutputStream::~BufferedOutputStream()
|
||||
{
|
||||
delete buf.data;
|
||||
//4jcraft, changed to [], deallocates internal buffer
|
||||
//TODO: ArrayWithLength.h doesnt have a destructor.
|
||||
//this wouldnt need to be done manually.
|
||||
//but for some reason the destructor is commented out in the source code?
|
||||
delete[] buf.data;
|
||||
}
|
||||
|
||||
//Flushes this buffered output stream. This forces any buffered output bytes to be written out to the underlying output stream.
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ private:
|
|||
ItemInstance() { _init(-1,0,0); }
|
||||
|
||||
public:
|
||||
~ItemInstance();
|
||||
virtual ~ItemInstance();
|
||||
std::shared_ptr<ItemInstance> remove(int count);
|
||||
|
||||
Item *getItem() const;
|
||||
|
|
@ -151,4 +151,4 @@ public:
|
|||
|
||||
int getBaseRepairCost();
|
||||
void setRepairCost(int cost);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -342,6 +342,6 @@ std::shared_ptr<Packet> MapItem::getUpdatePacket(std::shared_ptr<ItemInstance> i
|
|||
if (data.data == NULL || data.length == 0) return nullptr;
|
||||
|
||||
std::shared_ptr<Packet> retval = std::shared_ptr<Packet>(new ComplexItemDataPacket((short) Item::map->id, (short) itemInstance->getAuxValue(), data));
|
||||
delete data.data;
|
||||
delete[] data.data; //4jcraft, changed to []
|
||||
return retval;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ protected:
|
|||
|
||||
public:
|
||||
Dimension();
|
||||
~Dimension();
|
||||
virtual ~Dimension();
|
||||
virtual ChunkSource *createRandomLevelSource() const;
|
||||
virtual ChunkSource *createFlatLevelSource() const;
|
||||
virtual ChunkStorage *createStorage(File dir);
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ public:
|
|||
LevelChunk(Level *level, int x, int z);
|
||||
LevelChunk(Level *level, byteArray blocks, int x, int z);
|
||||
LevelChunk(Level *level, int x, int z, LevelChunk *lc);
|
||||
~LevelChunk();
|
||||
virtual ~LevelChunk();
|
||||
|
||||
virtual bool isAt(int x, int z);
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ protected:
|
|||
virtual void setTagData(CompoundTag *tag); // 4J - removed CompoundTag *playerTag
|
||||
|
||||
public:
|
||||
virtual ~LevelData(){}
|
||||
virtual __int64 getSeed();
|
||||
virtual int getXSpawn();
|
||||
virtual int getYSpawn();
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ public:
|
|||
static const std::wstring NETHER_FOLDER;
|
||||
static const std::wstring ENDER_FOLDER;
|
||||
|
||||
virtual ~LevelStorage(){}
|
||||
virtual LevelData *prepareLevel() = 0;
|
||||
virtual void checkSession() = 0;
|
||||
virtual ChunkStorage *createChunkStorage(Dimension *dimension) = 0;
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ charArray MapItemSavedData::HoldingPlayer::nextUpdatePacket(std::shared_ptr<Item
|
|||
memcpy(lastSentDecorations.data, data.data, data.length);
|
||||
return data;
|
||||
}
|
||||
delete data.data;
|
||||
delete[] data.data; //4jcraft, changed to []
|
||||
}
|
||||
std::shared_ptr<ServerPlayer> servPlayer = std::dynamic_pointer_cast<ServerPlayer>(player);
|
||||
for (int d = 0; d < 10; d++)
|
||||
|
|
|
|||
|
|
@ -19,4 +19,4 @@ public:
|
|||
virtual void saveMapIdLookup() = 0;
|
||||
virtual void deleteMapFilesForPlayer(std::shared_ptr<Player> player) = 0;
|
||||
virtual void saveAllCachedData() = 0;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ private:
|
|||
|
||||
public:
|
||||
SavedData(const std::wstring& id);
|
||||
virtual ~SavedData(){}
|
||||
|
||||
virtual void load(CompoundTag *tag) = 0;
|
||||
virtual void save(CompoundTag *tag) = 0;
|
||||
|
|
@ -22,4 +23,4 @@ public:
|
|||
void setDirty();
|
||||
void setDirty(bool dirty);
|
||||
bool isDirty();
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -16,7 +16,13 @@ AwardStatPacket::AwardStatPacket(int statId, int count)
|
|||
{
|
||||
this->statId = statId;
|
||||
|
||||
this->m_paramData.data = (uint8_t *) new int(count);
|
||||
// 4jcraft, changed from (uint8_t*) new int(count); to:
|
||||
// new uint8_t[sizeof(int)];
|
||||
// and memcpy of the integer into the array
|
||||
// reason: operator missmatch, array is deleted with delete[]
|
||||
// and typesafety
|
||||
this->m_paramData.data = new uint8_t[sizeof(int)];
|
||||
memcpy(this->m_paramData.data, &count, sizeof(int));
|
||||
this->m_paramData.length = sizeof(int);
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +36,7 @@ AwardStatPacket::~AwardStatPacket()
|
|||
{
|
||||
if (m_paramData.data != NULL)
|
||||
{
|
||||
delete [] m_paramData.data;
|
||||
delete[] m_paramData.data;
|
||||
m_paramData.data = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public:
|
|||
const int id;
|
||||
|
||||
public:
|
||||
PacketStatistics(int id) : id( id ), count( 0 ), totalSize( 0 ), samplesPos( 0 ), firstSampleTime( 0 ) { countSamples[0] = 0; sizeSamples[0] = 0; }
|
||||
PacketStatistics(int id) : count( 0 ), totalSize( 0 ), samplesPos( 0 ), firstSampleTime( 0 ), id( id ) { countSamples[0] = 0; sizeSamples[0] = 0; }
|
||||
void addPacket(int bytes);
|
||||
int getCount();
|
||||
double getAverageSize();
|
||||
|
|
@ -61,6 +61,7 @@ public:
|
|||
const __int64 createTime;
|
||||
|
||||
Packet();
|
||||
virtual ~Packet(){}
|
||||
|
||||
static std::shared_ptr<Packet> getPacket(int id);
|
||||
|
||||
|
|
@ -110,4 +111,4 @@ public:
|
|||
|
||||
protected:
|
||||
static void writeNbt(CompoundTag *tag, DataOutputStream *dos);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ class GameCommandPacket;
|
|||
class PacketListener
|
||||
{
|
||||
public:
|
||||
virtual ~PacketListener(){}
|
||||
virtual bool isServerPacketListener() = 0;
|
||||
virtual void handleBlockRegionUpdate(std::shared_ptr<BlockRegionUpdatePacket> packet);
|
||||
virtual void onUnhandledPacket(std::shared_ptr<Packet> packet);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ RemoveEntitiesPacket::RemoveEntitiesPacket(intArray ids)
|
|||
|
||||
RemoveEntitiesPacket::~RemoveEntitiesPacket()
|
||||
{
|
||||
delete ids.data;
|
||||
delete[] ids.data; //4jcraft, changed to []
|
||||
}
|
||||
|
||||
void RemoveEntitiesPacket::read(DataInputStream *dis) //throws IOException
|
||||
|
|
|
|||
|
|
@ -12,14 +12,14 @@ AABB::ThreadStorage *AABB::tlsDefault = NULL;
|
|||
|
||||
AABB::ThreadStorage::ThreadStorage()
|
||||
{
|
||||
pool = new AABB[POOL_SIZE];
|
||||
pool = new AABB[POOL_SIZE]; //4jcraft, needs to be deleted with delete[]
|
||||
poolPointer = 0;
|
||||
}
|
||||
|
||||
|
||||
AABB::ThreadStorage::~ThreadStorage()
|
||||
{
|
||||
delete pool;
|
||||
delete[] pool; //4jcraft, changed to []
|
||||
}
|
||||
|
||||
void AABB::CreateNewThreadStorage()
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ public:
|
|||
static const int IS_ALPHA_CUT_OUT = 4;
|
||||
#endif
|
||||
|
||||
virtual ~Icon() {} // added by 4jcraft, needed for abstract class
|
||||
|
||||
virtual int getX() const = 0;
|
||||
virtual int getY() const = 0;
|
||||
virtual int getWidth() const = 0;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ protected:
|
|||
|
||||
public:
|
||||
BiomeDecorator(Biome *biome);
|
||||
virtual ~BiomeDecorator(){}
|
||||
|
||||
|
||||
void decorate(Level *level, Random *random, int xo, int zo);
|
||||
|
||||
|
|
@ -72,4 +74,4 @@ protected:
|
|||
void decorateDepthSpan(int count, Feature *feature, int y0, int y1);
|
||||
void decorateDepthAverage(int count, Feature *feature, int yMid, int ySpan);
|
||||
void decorateOres();
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ void BiomeSource::getBiomeBlock(BiomeArray& biomes, int x, int z, int w, int h,
|
|||
{
|
||||
BiomeArray tmp = cache->getBiomeBlockAt(x, z);
|
||||
System::arraycopy(tmp, 0, &biomes, 0, w * h);
|
||||
delete tmp.data; // MGH - added, the caching creates this array from the indices now.
|
||||
delete[] tmp.data; // MGH - added, the caching creates this array from the indices now. //4jcraft made it array delete
|
||||
//return biomes;
|
||||
}
|
||||
|
||||
|
|
@ -635,4 +635,4 @@ bool BiomeSource::getIsMatch(float *frac)
|
|||
|
||||
// Consider as suitable if we've got all the critical ones, and in total 9 or more - currently there's 8 critical so this just forces at least 1 more others
|
||||
return ( typeCount >= 9 );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public:
|
|||
#else
|
||||
static __int64 findSeed(LevelType *generator); // 4J added
|
||||
#endif
|
||||
~BiomeSource();
|
||||
virtual ~BiomeSource();
|
||||
|
||||
public:
|
||||
std::vector<Biome *> getPlayerSpawnBiomes() { return playerSpawnBiomes; }
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
bool HouseFeature::place(Level *level, Random *random, int x, int y, int z)
|
||||
{
|
||||
while (y > 0 && !level->getMaterial(x, y - 1, z)->blocksMotion())
|
||||
while (y > 0 && !level->getMaterial(x, y - 1, z)->blocksMotion()) {
|
||||
y--;
|
||||
|
||||
}
|
||||
int w = random->nextInt(7) + 7;
|
||||
int h = 4 + random->nextInt(3) / 2;
|
||||
int d = random->nextInt(7) + 7;
|
||||
|
|
@ -190,4 +190,4 @@ bool HouseFeature::place(Level *level, Random *random, int x, int y, int z)
|
|||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,9 @@ bool LakeFeature::place(Level *level, Random *random, int x, int y, int z)
|
|||
{
|
||||
x -= 8;
|
||||
z -= 8;
|
||||
while (y > 5 && level->isEmptyTile(x, y, z))
|
||||
while (y > 5 && level->isEmptyTile(x, y, z)) {
|
||||
y--;
|
||||
}
|
||||
if (y <= 4)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -172,4 +173,4 @@ bool LakeFeature::place(Level *level, Random *random, int x, int y, int z)
|
|||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@ protected:
|
|||
|
||||
public:
|
||||
LargeFeature();
|
||||
~LargeFeature();
|
||||
virtual ~LargeFeature();
|
||||
|
||||
virtual void apply(ChunkSource *ChunkSource, Level *level, int xOffs, int zOffs, byteArray blocks);
|
||||
|
||||
protected:
|
||||
virtual void addFeature(Level *level, int x, int z, int xOffs, int zOffs, byteArray blocks) {}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ class TreeFeature : public Feature
|
|||
{
|
||||
private:
|
||||
const int baseHeight;
|
||||
const bool addJungleFeatures;
|
||||
const int trunkType;
|
||||
const int leafType;
|
||||
const bool addJungleFeatures;
|
||||
|
||||
public:
|
||||
TreeFeature(bool doUpdate);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ BiomeOverrideLayer::BiomeOverrideLayer(int seedMixup) : Layer(seedMixup)
|
|||
#endif
|
||||
if( file == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
DWORD error = GetLastError();
|
||||
// DWORD error = GetLastError();
|
||||
//assert(false);
|
||||
app.DebugPrintf("Biome override not found, using plains as default\n");
|
||||
|
||||
|
|
@ -78,4 +78,4 @@ intArray BiomeOverrideLayer::getArea(int xo, int yo, int w, int h)
|
|||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public:
|
|||
static LayerArray getDefaultLayers(__int64 seed, LevelType *levelType);
|
||||
|
||||
Layer(__int64 seedMixup);
|
||||
virtual ~Layer(){}
|
||||
|
||||
virtual void init(__int64 seed);
|
||||
virtual void initRandom(__int64 x, __int64 y);
|
||||
|
|
@ -33,4 +34,4 @@ protected:
|
|||
|
||||
public:
|
||||
virtual intArray getArea(int xo, int yo, int w, int h) = 0;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ class Synth
|
|||
{
|
||||
public:
|
||||
virtual double getValue(double x, double y) = 0;
|
||||
virtual ~Synth(){}
|
||||
|
||||
doubleArray create(int width, int height);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -188,7 +188,8 @@ LevelChunk *TheEndLevelRandomLevelSource::getChunk(int xOffs, int zOffs)
|
|||
levelChunk->recalcHeightmap();
|
||||
|
||||
//delete blocks.data; // Don't delete the blocks as the array data is actually owned by the chunk now
|
||||
delete biomes.data;
|
||||
//4jcraft changed to []
|
||||
delete[] biomes.data;
|
||||
|
||||
return levelChunk;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ private:
|
|||
int maxPlaceCount;
|
||||
|
||||
PieceWeight(EPieceClass pieceClass, int weight, int maxPlaceCount);
|
||||
virtual ~PieceWeight(){}
|
||||
virtual bool doPlace(int depth);
|
||||
bool isValid();
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue