mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-01-16 13:58:43 +01:00
Add clang-tidy support and fix modernize-use-nullptr (#966)
C++11 standardizes the "nullptr" keyword, which replaces the implementation-defined macro null pointer "NULL" or a hardcoded 0. --------- Co-authored-by: Tamás Bálint Misius <lbphacker@gmail.com>
This commit is contained in:
parent
0506bc4f89
commit
7394a1c081
4
.clang-tidy
Normal file
4
.clang-tidy
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
Checks: '-*,modernize-use-nullptr'
|
||||
WarningsAsErrors: true
|
||||
...
|
29
.github/build.sh
vendored
29
.github/build.sh
vendored
@ -69,6 +69,9 @@ if [[ -z ${BSH_NO_PACKAGES-} ]]; then
|
||||
export PATH=$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/tools/bin:$PATH
|
||||
sdkmanager "platforms;$android_platform"
|
||||
)
|
||||
if [[ $BSH_LINT == yes ]]; then
|
||||
sudo apt install clang-tidy
|
||||
fi
|
||||
;;
|
||||
windows)
|
||||
if [[ $BSH_BUILD_PLATFORM-$BSH_HOST_LIBC == windows-mingw ]]; then
|
||||
@ -79,6 +82,9 @@ if [[ -z ${BSH_NO_PACKAGES-} ]]; then
|
||||
pacman -S --noconfirm --needed mingw-w64-ucrt-x86_64-{pkgconf,bzip2,luajit,jsoncpp,curl,SDL2,libpng,meson,fftw,jq}
|
||||
fi
|
||||
export PKG_CONFIG=$(which pkg-config.exe)
|
||||
if [[ $BSH_LINT == yes ]]; then
|
||||
pacman -S --noconfirm --needed mingw-w64-ucrt-x86_64-clang-tools-extra
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
linux)
|
||||
@ -86,17 +92,29 @@ if [[ -z ${BSH_NO_PACKAGES-} ]]; then
|
||||
if [[ $BSH_STATIC_DYNAMIC == static ]]; then
|
||||
sudo apt install libc6-dev libc6-dev-i386
|
||||
else
|
||||
sudo apt install libluajit-5.1-dev libcurl4-openssl-dev libfftw3-dev zlib1g-dev libsdl2-dev libbz2-dev libjsoncpp-dev
|
||||
sudo apt install libluajit-5.1-dev libcurl4-openssl-dev libfftw3-dev zlib1g-dev libsdl2-dev libbz2-dev libjsoncpp-dev libpng-dev
|
||||
fi
|
||||
if [[ $PACKAGE_MODE == appimage ]]; then
|
||||
sudo apt install libfuse2
|
||||
fi
|
||||
if [[ $BSH_LINT == yes ]]; then
|
||||
sudo apt install clang-tidy
|
||||
fi
|
||||
;;
|
||||
darwin)
|
||||
brew install binutils # pkg-config
|
||||
if [[ $BSH_STATIC_DYNAMIC != static ]]; then
|
||||
brew install luajit fftw zlib sdl2 bzip2 jsoncpp # curl
|
||||
fi
|
||||
if [[ $BSH_LINT == yes ]]; then
|
||||
# gg brew :(
|
||||
# https://stackoverflow.com/questions/53111082/how-to-install-clang-tidy-on-macos
|
||||
brew install llvm
|
||||
ln -s "$(brew --prefix llvm)/bin/clang-format" "/usr/local/bin/clang-format"
|
||||
ln -s "$(brew --prefix llvm)/bin/clang-tidy" "/usr/local/bin/clang-tidy"
|
||||
ln -s "$(brew --prefix llvm)/bin/clang-apply-replacements" "/usr/local/bin/clang-apply-replacements"
|
||||
ln -s "$(brew --prefix llvm)/bin/run-clang-tidy" "/usr/local/bin/run-clang-tidy"
|
||||
fi
|
||||
;;
|
||||
emscripten)
|
||||
git clone https://github.com/emscripten-core/emsdk.git --branch 3.1.30
|
||||
@ -218,6 +236,9 @@ x86_64-darwin-macos-debug)
|
||||
meson_configure+=$'\t'-Dbuild_font=true
|
||||
;;
|
||||
esac
|
||||
if [[ $BSH_LINT == yes ]]; then
|
||||
meson_configure+=$'\t'-Dclang_tidy=true
|
||||
fi
|
||||
if [[ $PACKAGE_MODE == nohttp ]]; then
|
||||
meson_configure+=$'\t'-Dhttp=false
|
||||
fi
|
||||
@ -436,6 +457,12 @@ if [[ $PACKAGE_MODE == steam ]]; then
|
||||
meson configure -Dcan_install=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $BSH_LINT == yes ]]; then
|
||||
meson compile -v clang-tidy
|
||||
exit 0
|
||||
fi
|
||||
|
||||
meson_compile=meson$'\t'compile
|
||||
meson_compile+=$'\t'-v
|
||||
if [[ $BSH_BUILD_PLATFORM == windows ]] && [[ $PACKAGE_MODE != backendvs ]]; then
|
||||
|
116
.github/prepare.py
vendored
116
.github/prepare.py
vendored
@ -95,56 +95,56 @@ app_name_slug = re.sub('[^A-Za-z0-9]', '_', app_name)
|
||||
build_matrix = []
|
||||
publish_matrix = []
|
||||
# consider disabling line wrapping to edit this monstrosity
|
||||
for arch, platform, libc, statdyn, bplatform, runson, suffix, reason, dbgsuffix, mode, starcatcher, dbgrel, priority in [
|
||||
( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-22.04', '', 'check', None, None, None, 'debug', 0 ), # priority = 0: static debug build
|
||||
( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-22.04', '', 'publish', '.dbg', None, 'x86_64-lin-gcc-static', 'release', 10 ),
|
||||
( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-22.04', '', 'publish', '.dbg', 'steam', 'x86_64-lin-gcc-static', 'release', -5 ), # priority = -5: steam build
|
||||
( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-22.04', '', 'archive', '.dbg', 'appimage', None, 'release', 0 ), # priority = 0: appimage release
|
||||
( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-22.04', '', 'check', None, None, None, 'debug', 10 ),
|
||||
( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-22.04', '', 'check', None, 'nohttp', None, 'debug', 10 ),
|
||||
( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-22.04', '', 'check', None, 'nolua', None, 'debug', 10 ),
|
||||
( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-22.04', '', 'check', None, None, None, 'release', 10 ),
|
||||
# ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-22.04', '', 'check', None, None, None, 'debug', 10 ), # ubuntu-22.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them; worse, it's a different toolchain
|
||||
# ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-22.04', '', 'archive', '.dbg', None, None, 'release', 10 ), # ubuntu-22.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them; worse, it's a different toolchain
|
||||
# ( 'x86_64', 'windows', 'mingw', 'dynamic', 'linux', 'ubuntu-22.04', '', 'check', None, None, None, 'debug', 10 ), # ubuntu-22.04 doesn't have ucrt64-capable mingw >_>
|
||||
# ( 'x86_64', 'windows', 'mingw', 'dynamic', 'linux', 'ubuntu-22.04', '', 'check', None, None, None, 'release', 10 ), # ubuntu-22.04 doesn't have ucrt64-capable mingw >_>
|
||||
( 'x86_64', 'windows', 'mingw', 'static', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 0 ), # priority = 0: static debug build
|
||||
( 'x86_64', 'windows', 'mingw', 'static', 'windows', 'windows-2019', '.exe', 'archive', '.dbg', None, None, 'release', 10 ),
|
||||
( 'x86_64', 'windows', 'mingw', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 10 ),
|
||||
( 'x86_64', 'windows', 'mingw', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'release', 10 ),
|
||||
( 'x86_64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 0 ), # priority = 0: static debug build
|
||||
( 'x86_64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', 'publish', '.pdb', None, 'x86_64-win-msvc-static', 'release', 10 ),
|
||||
( 'x86_64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', 'publish', '.pdb', 'steam', 'x86_64-win-msvc-static', 'release', -5 ), # priority = -5: steam build
|
||||
( 'x86_64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 10 ),
|
||||
# ( 'x86_64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, 'backendvs', None, 'debug', 0 ), # priority = 0: backend=vs build
|
||||
( 'x86_64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'release', 10 ),
|
||||
( 'x86', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 0 ), # priority = 0: static debug build
|
||||
( 'x86', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', 'publish', '.pdb', None, 'i686-win-msvc-static', 'release', 10 ),
|
||||
( 'x86', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 10 ),
|
||||
( 'x86', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'release', 10 ),
|
||||
( 'aarch64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 0 ), # priority = 0: static debug build
|
||||
( 'aarch64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', 'publish', '.pdb', None, 'arm64-win-msvc-static', 'release', 10 ),
|
||||
( 'aarch64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 10 ),
|
||||
( 'aarch64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'release', 10 ),
|
||||
( 'x86_64', 'darwin', 'macos', 'static', 'darwin', 'macos-13', '.dmg', 'check', None, None, None, 'debug', 0 ), # priority = 0: static debug build
|
||||
( 'x86_64', 'darwin', 'macos', 'static', 'darwin', 'macos-13', '.dmg', 'publish', None, None, 'x86_64-mac-gcc-static', 'release', 10 ), # I have no idea how to separate debug info on macos
|
||||
( 'x86_64', 'darwin', 'macos', 'static', 'darwin', 'macos-13', '.dmg', 'publish', None, 'steam', 'x86_64-mac-gcc-static', 'release', -5 ), # priority = -5: steam build, see above regarding debug info
|
||||
( 'x86_64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-13', '.dmg', 'check', None, None, None, 'debug', 10 ),
|
||||
( 'x86_64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-13', '.dmg', 'check', None, None, None, 'release', 10 ),
|
||||
( 'aarch64', 'darwin', 'macos', 'static', 'darwin', 'macos-13', '.dmg', 'check', None, None, None, 'debug', 0 ), # priority = 0: static debug build
|
||||
( 'aarch64', 'darwin', 'macos', 'static', 'darwin', 'macos-13', '.dmg', 'publish', None, None, 'arm64-mac-gcc-static', 'release', 10 ),
|
||||
# ( 'aarch64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-13', '.dmg', 'check', None, None, None, 'debug', 10 ), # macos-11.0 is x86_64 and I haven't yet figured out how to get homebrew to install aarch64 libs on x86_64
|
||||
# ( 'aarch64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-13', '.dmg', 'check', None, None, None, 'release', 10 ), # macos-11.0 is x86_64 and I haven't yet figured out how to get homebrew to install aarch64 libs on x86_64
|
||||
( 'x86', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'check', None, None, None, 'debug', 0 ), # priority = 0: rarely used debug build
|
||||
( 'x86', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'publish', '.dbg', None, 'i686-and-gcc-static', 'release', 10 ),
|
||||
( 'x86_64', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'check', None, None, None, 'debug', 0 ), # priority = 0: rarely used debug build
|
||||
( 'x86_64', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'publish', '.dbg', None, 'x86_64-and-gcc-static', 'release', 10 ),
|
||||
( 'arm', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'check', None, None, None, 'debug', 0 ), # priority = 0: rarely used debug build
|
||||
( 'arm', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'publish', '.dbg', None, 'arm-and-gcc-static', 'release', 10 ),
|
||||
( 'aarch64', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'check', None, None, None, 'debug', 0 ), # priority = 0: rarely used debug build
|
||||
( 'aarch64', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'publish', '.dbg', None, 'arm64-and-gcc-static', 'release', 10 ),
|
||||
( 'wasm32', 'emscripten', 'emscripten', 'static', 'linux', 'ubuntu-22.04', '.tar', 'check', None, None, None, 'debug', 0 ), # priority = 0: rarely used debug build
|
||||
( 'wasm32', 'emscripten', 'emscripten', 'static', 'linux', 'ubuntu-22.04', '.tar', 'publish', None, 'emscripten', 'wasm32-ems-static', 'release', 10 ), # I have no idea how to separate debug info on emscripten
|
||||
for arch, platform, libc, statdyn, bplatform, runson, suffix, reason, dbgsuffix, mode, starcatcher, dbgrel, priority, lint in [
|
||||
( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-22.04', '', 'check', None, None, None, 'debug', 0, False ), # priority = 0: static debug build
|
||||
( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-22.04', '', 'publish', '.dbg', None, 'x86_64-lin-gcc-static', 'release', 10, False ),
|
||||
( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-22.04', '', 'publish', '.dbg', 'steam', 'x86_64-lin-gcc-static', 'release', -5, False ), # priority = -5: steam build
|
||||
( 'x86_64', 'linux', 'gnu', 'static', 'linux', 'ubuntu-22.04', '', 'archive', '.dbg', 'appimage', None, 'release', 0, False ), # priority = 0: appimage release
|
||||
( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-22.04', '', 'check', None, None, None, 'debug', 10, True ), # the only debug job that lints; this covers the font editor and the renderer
|
||||
( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-22.04', '', 'check', None, 'nohttp', None, 'debug', 10, False ),
|
||||
( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-22.04', '', 'check', None, 'nolua', None, 'debug', 10, False ),
|
||||
( 'x86_64', 'linux', 'gnu', 'dynamic', 'linux', 'ubuntu-22.04', '', 'check', None, None, None, 'release', 10, False ),
|
||||
# ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-22.04', '', 'check', None, None, None, 'debug', 10, False ), # ubuntu-22.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them; worse, it's a different toolchain
|
||||
# ( 'x86_64', 'windows', 'mingw', 'static', 'linux', 'ubuntu-22.04', '', 'archive', '.dbg', None, None, 'release', 10, False ), # ubuntu-22.04 doesn't have windows TLS headers somehow and I haven't yet figured out how to get them; worse, it's a different toolchain
|
||||
# ( 'x86_64', 'windows', 'mingw', 'dynamic', 'linux', 'ubuntu-22.04', '', 'check', None, None, None, 'debug', 10, False ), # ubuntu-22.04 doesn't have ucrt64-capable mingw >_>
|
||||
# ( 'x86_64', 'windows', 'mingw', 'dynamic', 'linux', 'ubuntu-22.04', '', 'check', None, None, None, 'release', 10, False ), # ubuntu-22.04 doesn't have ucrt64-capable mingw >_>
|
||||
( 'x86_64', 'windows', 'mingw', 'static', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 0, False ), # priority = 0: static debug build
|
||||
( 'x86_64', 'windows', 'mingw', 'static', 'windows', 'windows-2019', '.exe', 'archive', '.dbg', None, None, 'release', 10, False ),
|
||||
( 'x86_64', 'windows', 'mingw', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 10, False ),
|
||||
( 'x86_64', 'windows', 'mingw', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'release', 10, True ),
|
||||
( 'x86_64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 0, False ), # priority = 0: static debug build
|
||||
( 'x86_64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', 'publish', '.pdb', None, 'x86_64-win-msvc-static', 'release', 10, False ),
|
||||
( 'x86_64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', 'publish', '.pdb', 'steam', 'x86_64-win-msvc-static', 'release', -5, False ), # priority = -5: steam build
|
||||
( 'x86_64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 10, False ),
|
||||
# ( 'x86_64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, 'backendvs', None, 'debug', 0, False ), # priority = 0: backend=vs build
|
||||
( 'x86_64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'release', 10, False ),
|
||||
( 'x86', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 0, False ), # priority = 0: static debug build
|
||||
( 'x86', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', 'publish', '.pdb', None, 'i686-win-msvc-static', 'release', 10, False ),
|
||||
( 'x86', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 10, False ),
|
||||
( 'x86', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'release', 10, False ),
|
||||
( 'aarch64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 0, False ), # priority = 0: static debug build
|
||||
( 'aarch64', 'windows', 'msvc', 'static', 'windows', 'windows-2019', '.exe', 'publish', '.pdb', None, 'arm64-win-msvc-static', 'release', 10, False ),
|
||||
( 'aarch64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'debug', 10, False ),
|
||||
( 'aarch64', 'windows', 'msvc', 'dynamic', 'windows', 'windows-2019', '.exe', 'check', None, None, None, 'release', 10, False ),
|
||||
( 'x86_64', 'darwin', 'macos', 'static', 'darwin', 'macos-13', '.dmg', 'check', None, None, None, 'debug', 0, False ), # priority = 0: static debug build
|
||||
( 'x86_64', 'darwin', 'macos', 'static', 'darwin', 'macos-13', '.dmg', 'publish', None, None, 'x86_64-mac-gcc-static', 'release', 10, False ), # I have no idea how to separate debug info on macos
|
||||
( 'x86_64', 'darwin', 'macos', 'static', 'darwin', 'macos-13', '.dmg', 'publish', None, 'steam', 'x86_64-mac-gcc-static', 'release', -5, False ), # priority = -5: steam build, see above regarding debug info
|
||||
( 'x86_64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-13', '.dmg', 'check', None, None, None, 'debug', 10, False ),
|
||||
( 'x86_64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-13', '.dmg', 'check', None, None, None, 'release', 10, False ), # TODO: enable lint once apple clang ships clang-tidy
|
||||
( 'aarch64', 'darwin', 'macos', 'static', 'darwin', 'macos-13', '.dmg', 'check', None, None, None, 'debug', 0, False ), # priority = 0: static debug build
|
||||
( 'aarch64', 'darwin', 'macos', 'static', 'darwin', 'macos-13', '.dmg', 'publish', None, None, 'arm64-mac-gcc-static', 'release', 10, False ),
|
||||
# ( 'aarch64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-13', '.dmg', 'check', None, None, None, 'debug', 10, False ), # macos-11.0 is x86_64 and I haven't yet figured out how to get homebrew to install aarch64 libs on x86_64
|
||||
# ( 'aarch64', 'darwin', 'macos', 'dynamic', 'darwin', 'macos-13', '.dmg', 'check', None, None, None, 'release', 10, False ), # macos-11.0 is x86_64 and I haven't yet figured out how to get homebrew to install aarch64 libs on x86_64
|
||||
( 'x86', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'check', None, None, None, 'debug', 0, False ), # priority = 0: rarely used debug build
|
||||
( 'x86', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'publish', '.dbg', None, 'i686-and-gcc-static', 'release', 10, False ),
|
||||
( 'x86_64', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'check', None, None, None, 'debug', 0, False ), # priority = 0: rarely used debug build
|
||||
( 'x86_64', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'publish', '.dbg', None, 'x86_64-and-gcc-static', 'release', 10, False ),
|
||||
( 'arm', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'check', None, None, None, 'debug', 0, False ), # priority = 0: rarely used debug build
|
||||
( 'arm', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'publish', '.dbg', None, 'arm-and-gcc-static', 'release', 10, False ),
|
||||
( 'aarch64', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'check', None, None, None, 'debug', 0, False ), # priority = 0: rarely used debug build
|
||||
( 'aarch64', 'android', 'bionic', 'static', 'linux', 'ubuntu-22.04', '.apk', 'publish', '.dbg', None, 'arm64-and-gcc-static', 'release', 10, True ),
|
||||
( 'wasm32', 'emscripten', 'emscripten', 'static', 'linux', 'ubuntu-22.04', '.tar', 'check', None, None, None, 'debug', 0, False ), # priority = 0: rarely used debug build
|
||||
( 'wasm32', 'emscripten', 'emscripten', 'static', 'linux', 'ubuntu-22.04', '.tar', 'publish', None, 'emscripten', 'wasm32-ems-static', 'release', 10, False ), # I have no idea how to separate debug info on emscripten, TODO: enable lint once emscripten ships clang-tidy
|
||||
]:
|
||||
if priority < do_priority:
|
||||
continue
|
||||
@ -193,13 +193,14 @@ for arch, platform, libc, statdyn, bplatform, runso
|
||||
shell = 'bash'
|
||||
if msys2_bash:
|
||||
shell = 'msys2 {0}'
|
||||
build_matrix.append({
|
||||
item = {
|
||||
'bsh_build_platform': bplatform, # part of the unique portion of the matrix
|
||||
'bsh_host_arch': arch, # part of the unique portion of the matrix
|
||||
'bsh_host_platform': platform, # part of the unique portion of the matrix
|
||||
'bsh_host_libc': libc, # part of the unique portion of the matrix
|
||||
'bsh_static_dynamic': statdyn, # part of the unique portion of the matrix
|
||||
'bsh_debug_release': dbgrel, # part of the unique portion of the matrix
|
||||
'bsh_lint': 'no',
|
||||
'runs_on': runson,
|
||||
'force_msys2_bash': msys2_bash and 'yes' or 'no',
|
||||
'package_suffix': suffix,
|
||||
@ -213,7 +214,18 @@ for arch, platform, libc, statdyn, bplatform, runso
|
||||
'debug_asset_name': debug_asset_name,
|
||||
'job_name': job_name,
|
||||
'shell': shell,
|
||||
})
|
||||
}
|
||||
build_matrix.append(item)
|
||||
if lint:
|
||||
lint_item = item.copy()
|
||||
lint_item['publish'] = 'no'
|
||||
lint_item['artifact'] = 'no'
|
||||
lint_item['separate_debug'] = 'no'
|
||||
lint_item['bsh_lint'] = 'yes'
|
||||
if lint_item['runs_on'] == 'ubuntu-22.04':
|
||||
lint_item['runs_on'] = 'ubuntu-24.04'
|
||||
lint_item['job_name'] = lint_item['job_name'].replace('build', 'lint', 1)
|
||||
build_matrix.append(lint_item)
|
||||
if publish:
|
||||
publish_matrix.append({
|
||||
'bsh_build_platform': bplatform, # part of the unique portion of the matrix
|
||||
|
1
.github/workflows/build.yaml
vendored
1
.github/workflows/build.yaml
vendored
@ -111,6 +111,7 @@ jobs:
|
||||
BSH_STATIC_DYNAMIC: ${{ matrix.bsh_static_dynamic }}
|
||||
BSH_BUILD_PLATFORM: ${{ matrix.bsh_build_platform }}
|
||||
BSH_DEBUG_RELEASE: ${{ matrix.bsh_debug_release }}
|
||||
BSH_LINT: ${{ matrix.bsh_lint }}
|
||||
RELEASE_NAME: ${{ needs.prepare.outputs.release_name }}
|
||||
RELEASE_TYPE: ${{ needs.prepare.outputs.release_type }}
|
||||
MOD_ID: ${{ needs.prepare.outputs.mod_id }}
|
||||
|
21
meson.build
21
meson.build
@ -453,6 +453,7 @@ foreach embedded_file : embedded_files
|
||||
) ]
|
||||
endforeach
|
||||
|
||||
powder_files += powder_external_files
|
||||
powder_files += data_files
|
||||
render_files += data_files
|
||||
font_files += data_files
|
||||
@ -479,6 +480,8 @@ if get_option('export_lua_symbols')
|
||||
endif
|
||||
endif
|
||||
|
||||
clang_tidy_sources = []
|
||||
|
||||
if get_option('build_powder')
|
||||
powder_deps += project_deps + [
|
||||
threads_dep,
|
||||
@ -518,6 +521,7 @@ if get_option('build_powder')
|
||||
override_options: target_options,
|
||||
)
|
||||
endif
|
||||
clang_tidy_sources += powder_files
|
||||
endif
|
||||
|
||||
if get_option('build_render')
|
||||
@ -546,6 +550,7 @@ if get_option('build_render')
|
||||
link_depends: copied_dlls,
|
||||
override_options: target_options,
|
||||
)
|
||||
clang_tidy_sources += render_files
|
||||
endif
|
||||
|
||||
if get_option('build_font')
|
||||
@ -571,4 +576,20 @@ if get_option('build_font')
|
||||
link_depends: copied_dlls,
|
||||
override_options: target_options,
|
||||
)
|
||||
clang_tidy_sources += font_files
|
||||
endif
|
||||
|
||||
if get_option('clang_tidy')
|
||||
clang_tidy = find_program('run-clang-tidy')
|
||||
run_target(
|
||||
'clang-tidy',
|
||||
command: [
|
||||
clang_tidy,
|
||||
'-p', meson.project_build_root(),
|
||||
'-config-file', files('.clang-tidy'),
|
||||
'-quiet',
|
||||
'-warnings-as-errors=*',
|
||||
clang_tidy_sources,
|
||||
],
|
||||
)
|
||||
endif
|
||||
|
@ -329,3 +329,9 @@ option(
|
||||
value: false,
|
||||
description: 'Export Lua symbols to enable loading of Lua shared modules'
|
||||
)
|
||||
option(
|
||||
'clang_tidy',
|
||||
type: 'boolean',
|
||||
value: false,
|
||||
description: 'Run clang-tidy to lint programming issues'
|
||||
)
|
||||
|
@ -83,7 +83,7 @@ if host_platform == 'windows'
|
||||
rc_conf_data.set('WINUTF8_XML', winutf8_xml_path)
|
||||
rc_conf_data.set('ICON_EXE_ICO', icon_exe_ico_path)
|
||||
rc_conf_data.set('ICON_CPS_ICO', icon_cps_ico_path)
|
||||
powder_files += windows_mod.compile_resources(
|
||||
powder_external_files += windows_mod.compile_resources(
|
||||
configure_file(
|
||||
input: 'powder-res.template.rc',
|
||||
output: 'powder-res.rc',
|
||||
|
@ -30,7 +30,7 @@ ByteString format::UnixtimeToDate(time_t unixtime, ByteString dateFormat, bool l
|
||||
|
||||
ByteString format::UnixtimeToDateMini(time_t unixtime)
|
||||
{
|
||||
time_t currentTime = time(NULL);
|
||||
time_t currentTime = time(nullptr);
|
||||
struct tm currentTimeData = *gmtime(¤tTime);
|
||||
struct tm timeData = *gmtime(&unixtime);
|
||||
|
||||
@ -135,10 +135,10 @@ static std::unique_ptr<PlaneAdapter<std::vector<uint32_t>>> readPNG(
|
||||
{
|
||||
png_infop info = nullptr;
|
||||
auto deleter = [&info](png_struct *png) {
|
||||
png_destroy_read_struct(&png, &info, NULL);
|
||||
png_destroy_read_struct(&png, &info, nullptr);
|
||||
};
|
||||
auto png = std::unique_ptr<png_struct, decltype(deleter)>(
|
||||
png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL,
|
||||
png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr,
|
||||
[](png_structp png, png_const_charp msg) {
|
||||
fprintf(stderr, "PNG error: %s\n", msg);
|
||||
},
|
||||
@ -235,7 +235,7 @@ std::unique_ptr<std::vector<char>> format::PixelsToPNG(PlaneAdapter<std::vector<
|
||||
png_destroy_write_struct(&png, &info);
|
||||
};
|
||||
auto png = std::unique_ptr<png_struct, decltype(deleter)>(
|
||||
png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,
|
||||
png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr,
|
||||
[](png_structp png, png_const_charp msg) {
|
||||
fprintf(stderr, "PNG error: %s\n", msg);
|
||||
},
|
||||
@ -272,13 +272,13 @@ std::unique_ptr<std::vector<char>> format::PixelsToPNG(PlaneAdapter<std::vector<
|
||||
|
||||
png_set_write_fn(png.get(), static_cast<void *>(&writeFn), [](png_structp png, png_bytep data, size_t length) {
|
||||
(*static_cast<decltype(writeFn) *>(png_get_io_ptr(png)))(png, data, length);
|
||||
}, NULL);
|
||||
}, nullptr);
|
||||
png_set_IHDR(png.get(), info, input.Size().X, input.Size().Y, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
|
||||
png_write_info(png.get(), info);
|
||||
png_set_filler(png.get(), 0x00, PNG_FILLER_AFTER);
|
||||
png_set_bgr(png.get());
|
||||
png_write_image(png.get(), const_cast<png_bytepp>(rowPointers.data()));
|
||||
png_write_end(png.get(), NULL);
|
||||
png_write_end(png.get(), nullptr);
|
||||
|
||||
return std::make_unique<std::vector<char>>(std::move(output));
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ static void BlueScreen(String detailMessage, std::optional<std::vector<String>>
|
||||
crashInfo << "Please attach this file to your report.\n\n";
|
||||
crashInfo << "Version: " << VersionInfo().FromUtf8() << "\n";
|
||||
crashInfo << "Tag: " << VCS_TAG << "\n";
|
||||
crashInfo << "Date: " << format::UnixtimeToDate(time(NULL), "%Y-%m-%dT%H:%M:%SZ", false).FromUtf8() << "\n";
|
||||
crashInfo << "Date: " << format::UnixtimeToDate(time(nullptr), "%Y-%m-%dT%H:%M:%SZ", false).FromUtf8() << "\n";
|
||||
if (stackTrace)
|
||||
{
|
||||
crashInfo << "Stack trace; Main is at 0x" << Format::Hex() << intptr_t(Main) << ":\n";
|
||||
|
@ -10,9 +10,9 @@
|
||||
|
||||
int desktopWidth = 1280;
|
||||
int desktopHeight = 1024;
|
||||
SDL_Window *sdl_window = NULL;
|
||||
SDL_Renderer *sdl_renderer = NULL;
|
||||
SDL_Texture *sdl_texture = NULL;
|
||||
SDL_Window *sdl_window = nullptr;
|
||||
SDL_Renderer *sdl_renderer = nullptr;
|
||||
SDL_Texture *sdl_texture = nullptr;
|
||||
bool vsyncHint = false;
|
||||
WindowFrameOps currentFrameOps;
|
||||
bool momentumScroll = true;
|
||||
@ -99,11 +99,11 @@ static void CalculateMousePosition(int *x, int *y)
|
||||
|
||||
void blit(pixel *vid)
|
||||
{
|
||||
SDL_UpdateTexture(sdl_texture, NULL, vid, WINDOWW * sizeof (Uint32));
|
||||
SDL_UpdateTexture(sdl_texture, nullptr, vid, WINDOWW * sizeof (Uint32));
|
||||
// need to clear the renderer if there are black edges (fullscreen, or resizable window)
|
||||
if (currentFrameOps.fullscreen || currentFrameOps.resizable)
|
||||
SDL_RenderClear(sdl_renderer);
|
||||
SDL_RenderCopy(sdl_renderer, sdl_texture, NULL, NULL);
|
||||
SDL_RenderCopy(sdl_renderer, sdl_texture, nullptr, nullptr);
|
||||
SDL_RenderPresent(sdl_renderer);
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ void SDLClose()
|
||||
// sdl closes the display. this is an nvidia driver weirdness but
|
||||
// technically an sdl bug. glfw has this fixed:
|
||||
// https://github.com/glfw/glfw/commit/9e6c0c747be838d1f3dc38c2924a47a42416c081
|
||||
SDL_GL_LoadLibrary(NULL);
|
||||
SDL_GL_LoadLibrary(nullptr);
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
SDL_GL_UnloadLibrary();
|
||||
}
|
||||
@ -197,18 +197,18 @@ void SDLSetScreen()
|
||||
if (sdl_texture)
|
||||
{
|
||||
SDL_DestroyTexture(sdl_texture);
|
||||
sdl_texture = NULL;
|
||||
sdl_texture = nullptr;
|
||||
}
|
||||
if (sdl_renderer)
|
||||
{
|
||||
SDL_DestroyRenderer(sdl_renderer);
|
||||
sdl_renderer = NULL;
|
||||
sdl_renderer = nullptr;
|
||||
}
|
||||
if (sdl_window)
|
||||
{
|
||||
SaveWindowPosition();
|
||||
SDL_DestroyWindow(sdl_window);
|
||||
sdl_window = NULL;
|
||||
sdl_window = nullptr;
|
||||
}
|
||||
|
||||
unsigned int flags = 0;
|
||||
|
@ -40,8 +40,8 @@ static int _bson_errprintf( const char *, ... );
|
||||
bson_printf_func bson_errprintf = _bson_errprintf;
|
||||
|
||||
/* ObjectId fuzz functions. */
|
||||
static int ( *oid_fuzz_func )( void ) = NULL;
|
||||
static int ( *oid_inc_func )( void ) = NULL;
|
||||
static int ( *oid_fuzz_func )( void ) = nullptr;
|
||||
static int ( *oid_inc_func )( void ) = nullptr;
|
||||
|
||||
/* ----------------------------
|
||||
READING
|
||||
@ -89,7 +89,7 @@ static void _bson_reset( bson *b ) {
|
||||
b->finished = 0;
|
||||
b->stackPos = 0;
|
||||
b->err = 0;
|
||||
b->errstr = NULL;
|
||||
b->errstr = nullptr;
|
||||
}
|
||||
|
||||
int bson_size( const bson *b ) {
|
||||
@ -178,7 +178,7 @@ void bson_oid_gen( bson_oid_t *oid ) {
|
||||
static int incr = 0;
|
||||
static int fuzz = 0;
|
||||
int i;
|
||||
int t = time( NULL );
|
||||
int t = time( nullptr );
|
||||
|
||||
if( oid_inc_func )
|
||||
i = oid_inc_func();
|
||||
@ -305,7 +305,7 @@ void bson_iterator_init( bson_iterator *i, const bson *b ) {
|
||||
void bson_iterator_from_buffer( bson_iterator *i, const char *buffer ) {
|
||||
i->cur = buffer + 4;
|
||||
i->first = 1;
|
||||
i->last = NULL;
|
||||
i->last = nullptr;
|
||||
}
|
||||
|
||||
bson_type bson_find( bson_iterator *it, const bson *obj, const char *name ) {
|
||||
@ -515,7 +515,7 @@ const char *bson_iterator_code( const bson_iterator *i ) {
|
||||
case BSON_CODEWSCOPE:
|
||||
return bson_iterator_value( i ) + 8;
|
||||
default:
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -581,7 +581,7 @@ void bson_iterator_subiterator( const bson_iterator *i, bson_iterator *sub ) {
|
||||
|
||||
static void _bson_init_size( bson *b, int size ) {
|
||||
if( size == 0 )
|
||||
b->data = NULL;
|
||||
b->data = nullptr;
|
||||
else
|
||||
b->data = ( char * )bson_malloc( size );
|
||||
b->dataSize = size;
|
||||
@ -667,8 +667,8 @@ void bson_destroy( bson *b ) {
|
||||
if (b->data)
|
||||
bson_free( b->data );
|
||||
b->err = 0;
|
||||
b->data = 0;
|
||||
b->cur = 0;
|
||||
b->data = nullptr;
|
||||
b->cur = nullptr;
|
||||
b->finished = 1;
|
||||
}
|
||||
|
||||
@ -853,7 +853,7 @@ int bson_append_element( bson *b, const char *name_or_null, const bson_iterator
|
||||
bson_iterator_next( &next );
|
||||
size = next.cur - elem->cur;
|
||||
|
||||
if ( name_or_null == NULL ) {
|
||||
if ( name_or_null == nullptr ) {
|
||||
if( bson_ensure_space( b, size ) == BSON_ERROR )
|
||||
return BSON_ERROR;
|
||||
bson_append( b, elem->cur, size );
|
||||
@ -919,7 +919,7 @@ int bson_append_finish_array( bson *b ) {
|
||||
|
||||
/* Error handling and allocators. */
|
||||
|
||||
static bson_err_handler err_handler = NULL;
|
||||
static bson_err_handler err_handler = nullptr;
|
||||
|
||||
bson_err_handler set_bson_err_handler( bson_err_handler func ) {
|
||||
bson_err_handler old = err_handler;
|
||||
|
@ -10,9 +10,9 @@ static size_t outputSizeIncrement = 0x100000U;
|
||||
BZ2WCompressResult BZ2WCompress(std::vector<char> &dest, std::span<const char> srcData, size_t maxSize)
|
||||
{
|
||||
bz_stream stream;
|
||||
stream.bzalloc = NULL;
|
||||
stream.bzfree = NULL;
|
||||
stream.opaque = NULL;
|
||||
stream.bzalloc = nullptr;
|
||||
stream.bzfree = nullptr;
|
||||
stream.opaque = nullptr;
|
||||
if (BZ2_bzCompressInit(&stream, 9, 0, 0) != BZ_OK)
|
||||
{
|
||||
return BZ2WCompressNomem;
|
||||
@ -56,9 +56,9 @@ BZ2WCompressResult BZ2WCompress(std::vector<char> &dest, std::span<const char> s
|
||||
BZ2WDecompressResult BZ2WDecompress(std::vector<char> &dest, std::span<const char> srcData, size_t maxSize)
|
||||
{
|
||||
bz_stream stream;
|
||||
stream.bzalloc = NULL;
|
||||
stream.bzfree = NULL;
|
||||
stream.opaque = NULL;
|
||||
stream.bzalloc = nullptr;
|
||||
stream.bzfree = nullptr;
|
||||
stream.opaque = nullptr;
|
||||
if (BZ2_bzDecompressInit(&stream, 0, 0) != BZ_OK)
|
||||
{
|
||||
return BZ2WDecompressNomem;
|
||||
|
@ -310,7 +310,7 @@ void Client::RenameStamp(ByteString stampID, ByteString newName)
|
||||
|
||||
ByteString Client::AddStamp(std::unique_ptr<GameSave> saveData)
|
||||
{
|
||||
auto now = (uint64_t)time(NULL);
|
||||
auto now = (uint64_t)time(nullptr);
|
||||
if (lastStampTime != now)
|
||||
{
|
||||
lastStampTime = now;
|
||||
|
@ -453,7 +453,7 @@ void GameSave::readOPS(const std::vector<char> &data)
|
||||
unsigned char *fanData = nullptr;
|
||||
unsigned char *wallData = nullptr;
|
||||
unsigned char *soapLinkData = nullptr;
|
||||
unsigned char *pressData = NULL, *vxData = NULL, *vyData = NULL, *ambientData = NULL, *blockAirData = nullptr, *gravityData = nullptr;
|
||||
unsigned char *pressData = nullptr, *vxData = nullptr, *vyData = nullptr, *ambientData = nullptr, *blockAirData = nullptr, *gravityData = nullptr;
|
||||
unsigned int inputDataLen = data.size(), bsonDataLen = 0, partsDataLen, partsPosDataLen, fanDataLen, wallDataLen, soapLinkDataLen;
|
||||
unsigned int pressDataLen, vxDataLen, vyDataLen, ambientDataLen, blockAirDataLen, gravityDataLen;
|
||||
unsigned partsCount = 0;
|
||||
@ -462,7 +462,7 @@ void GameSave::readOPS(const std::vector<char> &data)
|
||||
bool fakeNewerVersion = false; // used for development builds only
|
||||
|
||||
bson b;
|
||||
b.data = NULL;
|
||||
b.data = nullptr;
|
||||
auto bson_deleter = [](bson * b) { bson_destroy(b); };
|
||||
// Use unique_ptr with a custom deleter to ensure that bson_destroy is called even when an exception is thrown
|
||||
std::unique_ptr<bson, decltype(bson_deleter)> b_ptr(&b, bson_deleter);
|
||||
@ -2479,7 +2479,7 @@ std::pair<bool, std::vector<char>> GameSave::serialiseOPS() const
|
||||
}
|
||||
|
||||
bson b;
|
||||
b.data = NULL;
|
||||
b.data = nullptr;
|
||||
auto bson_deleter = [](bson * b) { bson_destroy(b); };
|
||||
// Use unique_ptr with a custom deleter to ensure that bson_destroy is called even when an exception is thrown
|
||||
std::unique_ptr<bson, decltype(bson_deleter)> b_ptr(&b, bson_deleter);
|
||||
|
@ -19,7 +19,7 @@ namespace http
|
||||
query += str;
|
||||
};
|
||||
|
||||
time_t currentTime = time(NULL);
|
||||
time_t currentTime = time(nullptr);
|
||||
|
||||
if(period)
|
||||
{
|
||||
|
@ -52,14 +52,14 @@ namespace http
|
||||
|
||||
struct RequestHandleHttp : public RequestHandle
|
||||
{
|
||||
curl_slist *curlHeaders = NULL;
|
||||
curl_slist *curlHeaders = nullptr;
|
||||
#ifdef REQUEST_USE_CURL_MIMEPOST
|
||||
curl_mime *curlPostFields = NULL;
|
||||
curl_mime *curlPostFields = nullptr;
|
||||
#else
|
||||
curl_httppost *curlPostFieldsFirst = NULL;
|
||||
curl_httppost *curlPostFieldsLast = NULL;
|
||||
#endif
|
||||
CURL *curlEasy = NULL;
|
||||
CURL *curlEasy = nullptr;
|
||||
char curlErrorBuffer[CURL_ERROR_SIZE];
|
||||
bool curlAddedToMulti = false;
|
||||
bool gotStatusLine = false;
|
||||
@ -139,7 +139,7 @@ namespace http
|
||||
void UnregisterRequestHandle(std::shared_ptr<RequestHandle> requestHandle);
|
||||
|
||||
bool curlGlobalInit = false;
|
||||
CURLM *curlMulti = NULL;
|
||||
CURLM *curlMulti = nullptr;
|
||||
|
||||
void Wake()
|
||||
{
|
||||
@ -152,7 +152,7 @@ namespace http
|
||||
{
|
||||
int dontcare;
|
||||
#ifdef REQUEST_USE_CURL_MULTI_POLL
|
||||
HandleCURLMcode(curl_multi_poll(curlMulti, NULL, 0, 100000, &dontcare));
|
||||
HandleCURLMcode(curl_multi_poll(curlMulti, nullptr, 0, 100000, &dontcare));
|
||||
#else
|
||||
constexpr auto TickMs = 100;
|
||||
if (requestHandles.size())
|
||||
@ -285,7 +285,7 @@ namespace http
|
||||
void RequestManagerImpl::WorkerExit()
|
||||
{
|
||||
curl_multi_cleanup(curlMulti);
|
||||
curlMulti = NULL;
|
||||
curlMulti = nullptr;
|
||||
curl_global_cleanup();
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ namespace http
|
||||
}
|
||||
DWORD pemLength;
|
||||
// get required buffer size first
|
||||
if (!CryptBinaryToStringA(context->pbCertEncoded, context->cbCertEncoded, CRYPT_STRING_BASE64HEADER, NULL, &pemLength))
|
||||
if (!CryptBinaryToStringA(context->pbCertEncoded, context->cbCertEncoded, CRYPT_STRING_BASE64HEADER, nullptr, &pemLength))
|
||||
{
|
||||
return die("CryptBinaryToStringA failed");
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace Clipboard
|
||||
class WindowsClipboardImpl : public ClipboardImpl
|
||||
{
|
||||
UINT saveClipboardFormat = 0;
|
||||
HWND ourHwnd = NULL;
|
||||
HWND ourHwnd = nullptr;
|
||||
DWORD seqNumber = 0; // 0 is invalid
|
||||
|
||||
class ClipboardSession
|
||||
@ -170,7 +170,7 @@ namespace Clipboard
|
||||
std::cerr << "cannot announce save on clipboard: EmptyClipboard failed: " << ::GetLastError() << std::endl;
|
||||
return;
|
||||
}
|
||||
::SetClipboardData(saveClipboardFormat, NULL);
|
||||
::SetClipboardData(saveClipboardFormat, nullptr);
|
||||
std::cerr << "announced save on clipboard" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ std::optional<ByteString> CallActivityStringFunc(const char *funcName)
|
||||
auto funcMth = CHECK(env->GetMethodID(mPowderActivity, funcName, "()Ljava/lang/String;"));
|
||||
auto resultRef = CHECK((jstring)env->CallObjectMethod(activityInst, funcMth));
|
||||
Defer deleteStr([env, resultRef]() { env->DeleteLocalRef(resultRef); });
|
||||
auto *resultBytes = CHECK(env->GetStringUTFChars(resultRef, 0));
|
||||
auto *resultBytes = CHECK(env->GetStringUTFChars(resultRef, nullptr));
|
||||
Defer deleteUtf([env, resultRef, resultBytes]() { env->ReleaseStringUTFChars(resultRef, resultBytes); });
|
||||
result = resultBytes;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace Platform
|
||||
{
|
||||
ByteString DefaultDdir()
|
||||
{
|
||||
auto ddir = std::unique_ptr<char, decltype(&SDL_free)>(SDL_GetPrefPath(NULL, APPDATA), SDL_free);
|
||||
auto ddir = std::unique_ptr<char, decltype(&SDL_free)>(SDL_GetPrefPath(nullptr, APPDATA), SDL_free);
|
||||
return ddir.get();
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace Platform
|
||||
ByteString GetCwd()
|
||||
{
|
||||
ByteString cwd;
|
||||
char *cwdPtr = getcwd(NULL, 0);
|
||||
char *cwdPtr = getcwd(nullptr, 0);
|
||||
if (cwdPtr)
|
||||
{
|
||||
cwd = cwdPtr;
|
||||
@ -26,7 +26,7 @@ void Millisleep(long int t)
|
||||
struct timespec s;
|
||||
s.tv_sec = t / 1000;
|
||||
s.tv_nsec = (t % 1000) * 10000000;
|
||||
nanosleep(&s, NULL);
|
||||
nanosleep(&s, nullptr);
|
||||
}
|
||||
|
||||
bool Stat(ByteString filename)
|
||||
|
@ -28,7 +28,7 @@ void DoRestart()
|
||||
ByteString ExecutableName()
|
||||
{
|
||||
auto firstApproximation = ExecutableNameFirstApprox();
|
||||
auto rp = std::unique_ptr<char, decltype(std::free) *>(realpath(firstApproximation.data(), NULL), std::free);
|
||||
auto rp = std::unique_ptr<char, decltype(std::free) *>(realpath(firstApproximation.data(), nullptr), std::free);
|
||||
if (!rp)
|
||||
{
|
||||
std::cerr << "realpath: " << errno << std::endl;
|
||||
|
@ -16,7 +16,7 @@ namespace Platform
|
||||
ByteString GetCwd()
|
||||
{
|
||||
ByteString cwd;
|
||||
auto cwdPtr = std::unique_ptr<wchar_t, decltype(&free)>(_wgetcwd(NULL, 0), free);
|
||||
auto cwdPtr = std::unique_ptr<wchar_t, decltype(&free)>(_wgetcwd(nullptr, 0), free);
|
||||
if (cwdPtr)
|
||||
{
|
||||
cwd = WinNarrow(cwdPtr.get());
|
||||
@ -26,7 +26,7 @@ ByteString GetCwd()
|
||||
|
||||
void OpenURI(ByteString uri)
|
||||
{
|
||||
if (int(INT_PTR(ShellExecuteW(NULL, NULL, WinWiden(uri).c_str(), NULL, NULL, SW_SHOWNORMAL))) <= 32)
|
||||
if (int(INT_PTR(ShellExecuteW(nullptr, nullptr, WinWiden(uri).c_str(), nullptr, nullptr, SW_SHOWNORMAL))) <= 32)
|
||||
{
|
||||
fprintf(stderr, "cannot open URI: ShellExecute(...) failed\n");
|
||||
}
|
||||
@ -167,13 +167,13 @@ std::vector<ByteString> DirectoryList(ByteString directory)
|
||||
|
||||
ByteString WinNarrow(const std::wstring &source)
|
||||
{
|
||||
int buffer_size = WideCharToMultiByte(CP_UTF8, 0, source.c_str(), source.size(), nullptr, 0, NULL, NULL);
|
||||
int buffer_size = WideCharToMultiByte(CP_UTF8, 0, source.c_str(), source.size(), nullptr, 0, nullptr, nullptr);
|
||||
if (!buffer_size)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
std::string output(buffer_size, 0);
|
||||
if (!WideCharToMultiByte(CP_UTF8, 0, source.c_str(), source.size(), output.data(), buffer_size, NULL, NULL))
|
||||
if (!WideCharToMultiByte(CP_UTF8, 0, source.c_str(), source.size(), output.data(), buffer_size, nullptr, nullptr))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
@ -201,7 +201,7 @@ ByteString ExecutableName()
|
||||
while (true)
|
||||
{
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
if (!GetModuleFileNameW(NULL, buf.data(), DWORD(buf.size())))
|
||||
if (!GetModuleFileNameW(nullptr, buf.data(), DWORD(buf.size())))
|
||||
{
|
||||
std::cerr << "GetModuleFileNameW: " << GetLastError() << std::endl;
|
||||
return "";
|
||||
@ -220,7 +220,7 @@ void DoRestart()
|
||||
ByteString exename = ExecutableName();
|
||||
if (exename.length())
|
||||
{
|
||||
int ret = int(INT_PTR(ShellExecuteW(NULL, NULL, WinWiden(exename).c_str(), NULL, NULL, SW_SHOWNORMAL)));
|
||||
int ret = int(INT_PTR(ShellExecuteW(nullptr, nullptr, WinWiden(exename).c_str(), nullptr, nullptr, SW_SHOWNORMAL)));
|
||||
if (ret <= 32)
|
||||
{
|
||||
fprintf(stderr, "cannot restart: ShellExecute(...) failed: code %i\n", ret);
|
||||
@ -255,8 +255,8 @@ bool Install()
|
||||
auto wExtraKey = Platform::WinWiden(extraKey);
|
||||
auto wExtraValue = Platform::WinWiden(extraValue);
|
||||
HKEY k;
|
||||
ok = ok && RegCreateKeyExW(HKEY_CURRENT_USER, wPath.c_str(), 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &k, NULL) == ERROR_SUCCESS;
|
||||
ok = ok && RegSetValueExW(k, NULL, 0, REG_SZ, reinterpret_cast<const BYTE *>(wValue.c_str()), (wValue.size() + 1) * 2) == ERROR_SUCCESS;
|
||||
ok = ok && RegCreateKeyExW(HKEY_CURRENT_USER, wPath.c_str(), 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, nullptr, &k, nullptr) == ERROR_SUCCESS;
|
||||
ok = ok && RegSetValueExW(k, nullptr, 0, REG_SZ, reinterpret_cast<const BYTE *>(wValue.c_str()), (wValue.size() + 1) * 2) == ERROR_SUCCESS;
|
||||
if (wExtraKey.size())
|
||||
{
|
||||
ok = ok && RegSetValueExW(k, wExtraKey.c_str(), 0, REG_SZ, reinterpret_cast<const BYTE *>(wExtraValue.c_str()), (wExtraValue.size() + 1) * 2) == ERROR_SUCCESS;
|
||||
@ -265,7 +265,7 @@ bool Install()
|
||||
return ok;
|
||||
};
|
||||
|
||||
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||
auto exe = Platform::ExecutableName();
|
||||
#ifndef IDI_DOC_ICON
|
||||
// make this fail so I don't remove #include "resource.h" again and get away with it
|
||||
@ -287,11 +287,11 @@ bool Install()
|
||||
ok = ok && createKey("Software\\Classes\\PowderToySave", "Powder Toy Save");
|
||||
ok = ok && createKey("Software\\Classes\\PowderToySave\\DefaultIcon", icon);
|
||||
ok = ok && createKey("Software\\Classes\\PowderToySave\\shell\\open\\command", open);
|
||||
IShellLinkW *shellLink = NULL;
|
||||
IPersistFile *shellLinkPersist = NULL;
|
||||
IShellLinkW *shellLink = nullptr;
|
||||
IPersistFile *shellLinkPersist = nullptr;
|
||||
wchar_t programsPath[MAX_PATH];
|
||||
ok = ok && SHGetFolderPathW(NULL, CSIDL_PROGRAMS, NULL, SHGFP_TYPE_CURRENT, programsPath) == S_OK;
|
||||
ok = ok && CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLinkW, (LPVOID *)&shellLink) == S_OK;
|
||||
ok = ok && SHGetFolderPathW(nullptr, CSIDL_PROGRAMS, nullptr, SHGFP_TYPE_CURRENT, programsPath) == S_OK;
|
||||
ok = ok && CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLinkW, (LPVOID *)&shellLink) == S_OK;
|
||||
ok = ok && shellLink->SetPath(Platform::WinWiden(exe).c_str()) == S_OK;
|
||||
ok = ok && shellLink->SetWorkingDirectory(Platform::WinWiden(path).c_str()) == S_OK;
|
||||
ok = ok && shellLink->SetDescription(Platform::WinWiden(APPNAME).c_str()) == S_OK;
|
||||
@ -331,7 +331,7 @@ bool UpdateStart(std::span<const char> data)
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((uintptr_t)ShellExecute(NULL, L"open", Platform::WinWiden(exeName).c_str(), NULL, NULL, SW_SHOWNORMAL) <= 32)
|
||||
if ((uintptr_t)ShellExecute(nullptr, L"open", Platform::WinWiden(exeName).c_str(), nullptr, nullptr, SW_SHOWNORMAL) <= 32)
|
||||
{
|
||||
Platform::RemoveFile(exeName);
|
||||
return false;
|
||||
|
@ -57,7 +57,7 @@ std::optional<std::vector<String>> StackTrace()
|
||||
Defer symCleanup([process]() {
|
||||
SymCleanup(process);
|
||||
});
|
||||
SymInitialize(process, NULL, TRUE);
|
||||
SymInitialize(process, nullptr, TRUE);
|
||||
|
||||
CONTEXT context{};
|
||||
context.ContextFlags = CONTEXT_FULL;
|
||||
@ -106,7 +106,7 @@ std::optional<std::vector<String>> StackTrace()
|
||||
std::vector<String> res;
|
||||
for (auto i = 0; i < 100; ++i)
|
||||
{
|
||||
if (!StackWalk64(machine, process, thread, &frame, &context, NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL))
|
||||
if (!StackWalk64(machine, process, thread, &frame, &context, nullptr, SymFunctionTableAccess64, SymGetModuleBase64, nullptr))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ float RNG::uniform01()
|
||||
|
||||
RNG::RNG()
|
||||
{
|
||||
s[0] = time(NULL);
|
||||
s[0] = time(nullptr);
|
||||
s[1] = 614;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ void SurfaceNormals::Draw()
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (sim->eval_move(PT_PHOT, mr.fin_x, mr.fin_y, NULL))
|
||||
if (sim->eval_move(PT_PHOT, mr.fin_x, mr.fin_y, nullptr))
|
||||
{
|
||||
int rt = TYP(sim->pmap[mr.fin_y][mr.fin_x]);
|
||||
int lt = TYP(sim->pmap[y][x]);
|
||||
|
@ -56,7 +56,7 @@ void VideoBuffer::Resize(Vec2<int> size, bool resample)
|
||||
if (resample)
|
||||
{
|
||||
std::array<std::unique_ptr<Resampler>, PIXELCHANNELS> resamplers;
|
||||
Resampler::Contrib_List *clist_x = NULL, *clist_y = NULL;
|
||||
Resampler::Contrib_List *clist_x = nullptr, *clist_y = nullptr;
|
||||
for (auto &ptr : resamplers)
|
||||
{
|
||||
ptr = std::make_unique<Resampler>(
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
ConsoleView::ConsoleView():
|
||||
ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, 150)),
|
||||
commandField(NULL)
|
||||
commandField(nullptr)
|
||||
{
|
||||
commandField = new ui::Textbox(ui::Point(0, Size.Y-16), ui::Point(Size.X, 16), "");
|
||||
commandField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
ElementSearchActivity::ElementSearchActivity(GameController * gameController, std::vector<Tool*> tools) :
|
||||
WindowActivity(ui::Point(-1, -1), ui::Point(236, 302)),
|
||||
firstResult(NULL),
|
||||
firstResult(nullptr),
|
||||
gameController(gameController),
|
||||
tools(tools),
|
||||
toolTip(""),
|
||||
@ -61,7 +61,7 @@ ElementSearchActivity::ElementSearchActivity(GameController * gameController, st
|
||||
|
||||
void ElementSearchActivity::searchTools(String query)
|
||||
{
|
||||
firstResult = NULL;
|
||||
firstResult = nullptr;
|
||||
for (auto &toolButton : toolButtons) {
|
||||
scrollPanel->RemoveChild(toolButton);
|
||||
delete toolButton;
|
||||
|
@ -212,7 +212,7 @@ void FileBrowserActivity::NotifyDone(Task * task)
|
||||
createButtons = true;
|
||||
totalFiles = files.size();
|
||||
delete loadFiles;
|
||||
loadFiles = NULL;
|
||||
loadFiles = nullptr;
|
||||
if (!files.size())
|
||||
{
|
||||
progressBar->Visible = false;
|
||||
|
@ -538,7 +538,7 @@ void FontEditor::Translate(std::array<std::array<char, MAX_WIDTH>, FONT_H> &pixe
|
||||
|
||||
void FontEditor::OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt)
|
||||
{
|
||||
if (IsFocused(NULL))
|
||||
if (IsFocused(nullptr))
|
||||
{
|
||||
switch(scan)
|
||||
{
|
||||
|
@ -71,14 +71,14 @@
|
||||
GameController::GameController():
|
||||
firstTick(true),
|
||||
foundSignID(-1),
|
||||
activePreview(NULL),
|
||||
search(NULL),
|
||||
renderOptions(NULL),
|
||||
loginWindow(NULL),
|
||||
console(NULL),
|
||||
tagsWindow(NULL),
|
||||
localBrowser(NULL),
|
||||
options(NULL),
|
||||
activePreview(nullptr),
|
||||
search(nullptr),
|
||||
renderOptions(nullptr),
|
||||
loginWindow(nullptr),
|
||||
console(nullptr),
|
||||
tagsWindow(nullptr),
|
||||
localBrowser(nullptr),
|
||||
options(nullptr),
|
||||
debugFlags(0),
|
||||
HasDone(false)
|
||||
{
|
||||
@ -482,7 +482,7 @@ void GameController::CopyRegion(ui::Point point1, ui::Point point2)
|
||||
Json::Value clipboardInfo;
|
||||
clipboardInfo["type"] = "clipboard";
|
||||
clipboardInfo["username"] = Client::Ref().GetAuthUser().Username;
|
||||
clipboardInfo["date"] = (Json::Value::UInt64)time(NULL);
|
||||
clipboardInfo["date"] = (Json::Value::UInt64)time(nullptr);
|
||||
Client::Ref().SaveAuthorInfo(&clipboardInfo);
|
||||
newSave->authors = clipboardInfo;
|
||||
|
||||
@ -904,31 +904,31 @@ void GameController::Update()
|
||||
if(renderOptions && renderOptions->HasExited)
|
||||
{
|
||||
delete renderOptions;
|
||||
renderOptions = NULL;
|
||||
renderOptions = nullptr;
|
||||
}
|
||||
|
||||
if(search && search->HasExited)
|
||||
{
|
||||
delete search;
|
||||
search = NULL;
|
||||
search = nullptr;
|
||||
}
|
||||
|
||||
if(activePreview && activePreview->HasExited)
|
||||
{
|
||||
delete activePreview;
|
||||
activePreview = NULL;
|
||||
activePreview = nullptr;
|
||||
}
|
||||
|
||||
if(loginWindow && loginWindow->HasExited)
|
||||
{
|
||||
delete loginWindow;
|
||||
loginWindow = NULL;
|
||||
loginWindow = nullptr;
|
||||
}
|
||||
|
||||
if(localBrowser && localBrowser->HasDone)
|
||||
{
|
||||
delete localBrowser;
|
||||
localBrowser = NULL;
|
||||
localBrowser = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1223,7 +1223,7 @@ void GameController::OpenLocalSaveWindow(bool asCurrent)
|
||||
localSaveInfo["type"] = "localsave";
|
||||
localSaveInfo["username"] = Client::Ref().GetAuthUser().Username;
|
||||
localSaveInfo["title"] = gameModel->GetSaveFile()->GetName();
|
||||
localSaveInfo["date"] = (Json::Value::UInt64)time(NULL);
|
||||
localSaveInfo["date"] = (Json::Value::UInt64)time(nullptr);
|
||||
Client::Ref().SaveAuthorInfo(&localSaveInfo);
|
||||
gameSave->authors = localSaveInfo;
|
||||
|
||||
@ -1378,7 +1378,7 @@ void GameController::OpenOptions()
|
||||
void GameController::ShowConsole()
|
||||
{
|
||||
if (!console)
|
||||
console = new ConsoleController(NULL, commandInterface.get());
|
||||
console = new ConsoleController(nullptr, commandInterface.get());
|
||||
if (console->GetView() != ui::Engine::Ref().GetWindow())
|
||||
ui::Engine::Ref().ShowWindow(console->GetView());
|
||||
}
|
||||
@ -1392,7 +1392,7 @@ void GameController::HideConsole()
|
||||
|
||||
void GameController::OpenRenderOptions()
|
||||
{
|
||||
renderOptions = new RenderController(gameModel->GetSimulation(), gameModel->GetRenderer(), &gameModel->GetRendererSettings(), NULL);
|
||||
renderOptions = new RenderController(gameModel->GetSimulation(), gameModel->GetRenderer(), &gameModel->GetRendererSettings(), nullptr);
|
||||
ui::Engine::Ref().ShowWindow(renderOptions->GetView());
|
||||
}
|
||||
|
||||
@ -1498,7 +1498,7 @@ void GameController::ChangeBrush()
|
||||
void GameController::ClearSim()
|
||||
{
|
||||
HistorySnapshot();
|
||||
gameModel->SetSave(NULL, false);
|
||||
gameModel->SetSave(nullptr, false);
|
||||
gameModel->ClearSimulation();
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ GameView::GameView():
|
||||
recordingFolder(0),
|
||||
currentPoint(ui::Point(0, 0)),
|
||||
lastPoint(ui::Point(0, 0)),
|
||||
activeBrush(NULL),
|
||||
activeBrush(nullptr),
|
||||
saveSimulationButtonEnabled(false),
|
||||
saveReuploadAllowed(true),
|
||||
drawMode(DrawPoints),
|
||||
@ -660,11 +660,11 @@ void GameView::NotifyColourSelectorVisibilityChanged(GameModel * sender)
|
||||
{
|
||||
ToolButton * button = *iter;
|
||||
RemoveComponent(button);
|
||||
button->SetParentWindow(NULL);
|
||||
button->SetParentWindow(nullptr);
|
||||
}
|
||||
|
||||
RemoveComponent(colourPicker);
|
||||
colourPicker->SetParentWindow(NULL);
|
||||
colourPicker->SetParentWindow(nullptr);
|
||||
|
||||
if(sender->GetColourSelectorVisibility())
|
||||
{
|
||||
@ -992,7 +992,7 @@ int GameView::Record(bool record)
|
||||
}
|
||||
else if (!recording)
|
||||
{
|
||||
time_t startTime = time(NULL);
|
||||
time_t startTime = time(nullptr);
|
||||
recordingFolder = startTime;
|
||||
Platform::MakeDirectory("recordings");
|
||||
Platform::MakeDirectory(ByteString::Build("recordings", PATH_SEP_CHAR, recordingFolder));
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
SignWindow::SignWindow(SignTool * tool_, Simulation * sim_, int signID_, ui::Point position_):
|
||||
ui::Window(ui::Point(-1, -1), ui::Point(250, 87)),
|
||||
tool(tool_),
|
||||
movingSign(NULL),
|
||||
movingSign(nullptr),
|
||||
signMoving(false),
|
||||
sim(sim_),
|
||||
signID(signID_),
|
||||
|
@ -9,13 +9,13 @@
|
||||
using namespace ui;
|
||||
|
||||
Component::Component(Point position, Point size):
|
||||
parentstate_(0),
|
||||
_parent(NULL),
|
||||
parentstate_(nullptr),
|
||||
_parent(nullptr),
|
||||
drawn(false),
|
||||
textPosition(0, 0),
|
||||
textSize(0, 0),
|
||||
iconPosition(0, 0),
|
||||
menu(NULL),
|
||||
menu(nullptr),
|
||||
Position(position),
|
||||
Size(size),
|
||||
Enabled(true),
|
||||
@ -93,9 +93,9 @@ void Component::SetParentWindow(Window* window)
|
||||
|
||||
void Component::SetParent(Panel* new_parent)
|
||||
{
|
||||
if(new_parent == NULL)
|
||||
if(new_parent == nullptr)
|
||||
{
|
||||
if(_parent != NULL)
|
||||
if(_parent != nullptr)
|
||||
{
|
||||
// remove from current parent and send component to parent state
|
||||
for(int i = 0; i < _parent->GetChildCount(); ++i)
|
||||
|
@ -13,7 +13,7 @@ using namespace ui;
|
||||
Engine::Engine():
|
||||
drawingFrequencyLimit(0),
|
||||
FrameIndex(0),
|
||||
state_(NULL),
|
||||
state_(nullptr),
|
||||
windowTargetPosition(0, 0),
|
||||
FastQuit(1),
|
||||
GlobalQuit(true),
|
||||
@ -157,7 +157,7 @@ int Engine::CloseWindow()
|
||||
}
|
||||
else
|
||||
{
|
||||
state_ = NULL;
|
||||
state_ = nullptr;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -177,7 +177,7 @@ int Engine::CloseWindow()
|
||||
|
||||
void Engine::Tick()
|
||||
{
|
||||
if(state_ != NULL)
|
||||
if(state_ != nullptr)
|
||||
state_->DoTick(dt);
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ void Panel::RemoveChild(Component* c)
|
||||
//remove child from parent. Does not free memory
|
||||
children.erase(children.begin() + i);
|
||||
if (this->GetParentWindow()->IsFocused(c))
|
||||
this->GetParentWindow()->FocusComponent(NULL);
|
||||
this->GetParentWindow()->FocusComponent(nullptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ void ScrollPanel::XOnMouseMoved(int x, int y)
|
||||
{
|
||||
child->MouseDownInside = false;
|
||||
}
|
||||
GetParentWindow()->FocusComponent(NULL);
|
||||
GetParentWindow()->FocusComponent(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,10 +17,10 @@ Window::Window(Point _position, Point _size):
|
||||
Size(_size),
|
||||
AllowExclusiveDrawing(true),
|
||||
DoesTextInput(false),
|
||||
okayButton(NULL),
|
||||
cancelButton(NULL),
|
||||
focusedComponent_(NULL),
|
||||
hoverComponent(NULL),
|
||||
okayButton(nullptr),
|
||||
cancelButton(nullptr),
|
||||
focusedComponent_(nullptr),
|
||||
hoverComponent(nullptr),
|
||||
debugMode(false),
|
||||
halt(false),
|
||||
destruct(false),
|
||||
@ -40,7 +40,7 @@ Window::~Window()
|
||||
|
||||
void Window::AddComponent(Component* c)
|
||||
{
|
||||
if (c->GetParentWindow() == NULL)
|
||||
if (c->GetParentWindow() == nullptr)
|
||||
{
|
||||
c->SetParentWindow(this);
|
||||
c->MouseInside = false;
|
||||
@ -81,14 +81,14 @@ void Window::RemoveComponent(Component* c)
|
||||
//Make sure any events don't continue
|
||||
halt = true;
|
||||
if (Components[i] == focusedComponent_)
|
||||
focusedComponent_ = NULL;
|
||||
focusedComponent_ = nullptr;
|
||||
if (Components[i] == hoverComponent)
|
||||
hoverComponent = NULL;
|
||||
hoverComponent = nullptr;
|
||||
|
||||
Components.erase(Components.begin() + i);
|
||||
|
||||
// we're done
|
||||
c->SetParentWindow(NULL);
|
||||
c->SetParentWindow(nullptr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -111,9 +111,9 @@ void Window::RemoveComponent(unsigned idx)
|
||||
halt = true;
|
||||
// free component and remove it.
|
||||
if (Components[idx] == focusedComponent_)
|
||||
focusedComponent_ = NULL;
|
||||
focusedComponent_ = nullptr;
|
||||
if (Components[idx] == hoverComponent)
|
||||
hoverComponent = NULL;
|
||||
hoverComponent = nullptr;
|
||||
delete Components[idx];
|
||||
Components.erase(Components.begin() + idx);
|
||||
}
|
||||
@ -197,9 +197,9 @@ void Window::DoDraw()
|
||||
(focusedComponent_ == child ? 0x00FF00_rgb : 0xFF0000_rgb).WithAlpha(0x5A));
|
||||
}
|
||||
// the component the mouse is hovering over and the focused component are always drawn last
|
||||
if (hoverComponent && hoverComponent->GetParent() == NULL)
|
||||
if (hoverComponent && hoverComponent->GetParent() == nullptr)
|
||||
drawChild(hoverComponent);
|
||||
if (focusedComponent_ && focusedComponent_ != hoverComponent && focusedComponent_->GetParent() == NULL)
|
||||
if (focusedComponent_ && focusedComponent_ != hoverComponent && focusedComponent_->GetParent() == nullptr)
|
||||
drawChild(focusedComponent_);
|
||||
if (debugMode && focusedComponent_)
|
||||
{
|
||||
@ -277,7 +277,7 @@ void Window::DoKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, b
|
||||
debugMode = !debugMode;
|
||||
if (debugMode)
|
||||
{
|
||||
if (focusedComponent_!=NULL)
|
||||
if (focusedComponent_!=nullptr)
|
||||
{
|
||||
if (shift)
|
||||
{
|
||||
@ -357,7 +357,7 @@ void Window::DoKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, b
|
||||
return;
|
||||
}
|
||||
//on key press
|
||||
if (focusedComponent_ != NULL)
|
||||
if (focusedComponent_ != nullptr)
|
||||
{
|
||||
if (focusedComponent_->Enabled && focusedComponent_->Visible)
|
||||
focusedComponent_->OnKeyPress(key, scan, repeat, shift, ctrl, alt);
|
||||
@ -381,7 +381,7 @@ void Window::DoKeyRelease(int key, int scan, bool repeat, bool shift, bool ctrl,
|
||||
if(debugMode)
|
||||
return;
|
||||
//on key unpress
|
||||
if (focusedComponent_ != NULL)
|
||||
if (focusedComponent_ != nullptr)
|
||||
{
|
||||
if (focusedComponent_->Enabled && focusedComponent_->Visible)
|
||||
focusedComponent_->OnKeyRelease(key, scan, repeat, shift, ctrl, alt);
|
||||
@ -398,7 +398,7 @@ void Window::DoTextInput(String text)
|
||||
if (debugMode)
|
||||
return;
|
||||
//on key unpress
|
||||
if (focusedComponent_ != NULL)
|
||||
if (focusedComponent_ != nullptr)
|
||||
{
|
||||
if (focusedComponent_->Enabled && focusedComponent_->Visible)
|
||||
focusedComponent_->OnTextInput(text);
|
||||
@ -412,7 +412,7 @@ void Window::DoTextInput(String text)
|
||||
|
||||
void Window::DoTextEditing(String text)
|
||||
{
|
||||
if (focusedComponent_ != NULL)
|
||||
if (focusedComponent_ != nullptr)
|
||||
{
|
||||
if (focusedComponent_->Enabled && focusedComponent_->Visible)
|
||||
focusedComponent_->OnTextEditing(text);
|
||||
@ -449,7 +449,7 @@ void Window::DoMouseDown(int x_, int y_, unsigned button)
|
||||
}
|
||||
|
||||
if (!clickState)
|
||||
FocusComponent(NULL);
|
||||
FocusComponent(nullptr);
|
||||
|
||||
if (debugMode)
|
||||
return;
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
PreviewController::PreviewController(int saveID, int saveDate, SavePreviewType savePreviewType, std::function<void ()> onDone_, std::unique_ptr<VideoBuffer> thumbnail):
|
||||
saveId(saveID),
|
||||
loginWindow(NULL),
|
||||
loginWindow(nullptr),
|
||||
HasExited(false)
|
||||
{
|
||||
previewModel = new PreviewModel();
|
||||
@ -48,7 +48,7 @@ void PreviewController::Update()
|
||||
if (loginWindow && loginWindow->HasExited == true)
|
||||
{
|
||||
delete loginWindow;
|
||||
loginWindow = NULL;
|
||||
loginWindow = nullptr;
|
||||
}
|
||||
if (previewModel->GetDoOpen() && previewModel->GetSaveInfo() && previewModel->GetSaveInfo()->GetGameSave())
|
||||
{
|
||||
|
@ -36,9 +36,9 @@
|
||||
|
||||
PreviewView::PreviewView(std::unique_ptr<VideoBuffer> newSavePreview):
|
||||
ui::Window(ui::Point(-1, -1), ui::Point((XRES/2)+210, (YRES/2)+150)),
|
||||
submitCommentButton(NULL),
|
||||
addCommentBox(NULL),
|
||||
commentWarningLabel(NULL),
|
||||
submitCommentButton(nullptr),
|
||||
addCommentBox(nullptr),
|
||||
commentWarningLabel(nullptr),
|
||||
userIsAuthor(false),
|
||||
doOpen(false),
|
||||
doError(false),
|
||||
@ -617,7 +617,7 @@ void PreviewView::submitComment()
|
||||
else
|
||||
{
|
||||
isSubmittingComment = true;
|
||||
FocusComponent(NULL);
|
||||
FocusComponent(nullptr);
|
||||
|
||||
addCommentRequest = std::make_unique<http::AddCommentRequest>(c->SaveID(), comment);
|
||||
addCommentRequest->Start();
|
||||
@ -641,13 +641,13 @@ void PreviewView::NotifyCommentBoxEnabledChanged(PreviewModel * sender)
|
||||
{
|
||||
RemoveComponent(addCommentBox);
|
||||
delete addCommentBox;
|
||||
addCommentBox = NULL;
|
||||
addCommentBox = nullptr;
|
||||
}
|
||||
if(submitCommentButton)
|
||||
{
|
||||
RemoveComponent(submitCommentButton);
|
||||
delete submitCommentButton;
|
||||
submitCommentButton = NULL;
|
||||
submitCommentButton = nullptr;
|
||||
}
|
||||
if(sender->GetCommentBoxEnabled())
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
|
||||
RenderView::RenderView():
|
||||
ui::Window(ui::Point(0, 0), ui::Point(XRES, WINDOWH)),
|
||||
ren(NULL),
|
||||
ren(nullptr),
|
||||
toolTip(""),
|
||||
toolTipPresence(0),
|
||||
isToolTipFadingIn(false)
|
||||
|
@ -109,7 +109,7 @@ void LocalSaveActivity::saveWrite(ByteString finalFilename)
|
||||
localSaveInfo["type"] = "localsave";
|
||||
localSaveInfo["username"] = Client::Ref().GetAuthUser().Username;
|
||||
localSaveInfo["title"] = finalFilename;
|
||||
localSaveInfo["date"] = (Json::Value::UInt64)time(NULL);
|
||||
localSaveInfo["date"] = (Json::Value::UInt64)time(nullptr);
|
||||
Client::Ref().SaveAuthorInfo(&localSaveInfo);
|
||||
{
|
||||
auto gameSave = save->TakeGameSave();
|
||||
|
@ -61,7 +61,7 @@ ServerSaveActivity::ServerSaveActivity(std::unique_ptr<SaveInfo> newSave, OnUplo
|
||||
thumbnailRenderer(nullptr),
|
||||
save(std::move(newSave)),
|
||||
onUploaded(onUploaded_),
|
||||
saveUploadTask(NULL)
|
||||
saveUploadTask(nullptr)
|
||||
{
|
||||
titleLabel = new ui::Label(ui::Point(4, 5), ui::Point((Size.X/2)-8, 16), "");
|
||||
titleLabel->SetTextColour(style::Colour::InformationTitle);
|
||||
@ -158,7 +158,7 @@ ServerSaveActivity::ServerSaveActivity(std::unique_ptr<SaveInfo> newSave, bool s
|
||||
thumbnailRenderer(nullptr),
|
||||
save(std::move(newSave)),
|
||||
onUploaded(onUploaded_),
|
||||
saveUploadTask(NULL)
|
||||
saveUploadTask(nullptr)
|
||||
{
|
||||
ui::Label * titleLabel = new ui::Label(ui::Point(0, 0), Size, "Saving to server...");
|
||||
titleLabel->SetTextColour(style::Colour::InformationTitle);
|
||||
@ -218,7 +218,7 @@ void ServerSaveActivity::AddAuthorInfo()
|
||||
serverSaveInfo["title"] = save->GetName().ToUtf8();
|
||||
serverSaveInfo["description"] = save->GetDescription().ToUtf8();
|
||||
serverSaveInfo["published"] = (int)save->GetPublished();
|
||||
serverSaveInfo["date"] = (Json::Value::UInt64)time(NULL);
|
||||
serverSaveInfo["date"] = (Json::Value::UInt64)time(nullptr);
|
||||
Client::Ref().SaveAuthorInfo(&serverSaveInfo);
|
||||
{
|
||||
auto gameSave = save->TakeGameSave();
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
SearchController::SearchController(std::function<void ()> onDone_):
|
||||
activePreview(NULL),
|
||||
activePreview(nullptr),
|
||||
nextQueryTime(0.0f),
|
||||
nextQueryDone(true),
|
||||
instantOpen(false),
|
||||
@ -72,7 +72,7 @@ void SearchController::Update()
|
||||
if(activePreview && activePreview->HasExited)
|
||||
{
|
||||
delete activePreview;
|
||||
activePreview = NULL;
|
||||
activePreview = nullptr;
|
||||
if(searchModel->GetLoadedSave())
|
||||
{
|
||||
Exit();
|
||||
|
@ -19,9 +19,9 @@
|
||||
|
||||
SearchView::SearchView():
|
||||
ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, WINDOWH)),
|
||||
c(NULL),
|
||||
c(nullptr),
|
||||
saveButtons(std::vector<ui::SaveButton*>()),
|
||||
errorLabel(NULL),
|
||||
errorLabel(nullptr),
|
||||
changed(true),
|
||||
lastChanged(0),
|
||||
pageCount(0),
|
||||
@ -409,11 +409,11 @@ void SearchView::NotifyTagListChanged(SearchModel * sender)
|
||||
if (motdLabel)
|
||||
{
|
||||
RemoveComponent(motdLabel);
|
||||
motdLabel->SetParentWindow(NULL);
|
||||
motdLabel->SetParentWindow(nullptr);
|
||||
}
|
||||
|
||||
RemoveComponent(tagsLabel);
|
||||
tagsLabel->SetParentWindow(NULL);
|
||||
tagsLabel->SetParentWindow(nullptr);
|
||||
|
||||
for (size_t i = 0; i < tagButtons.size(); i++)
|
||||
{
|
||||
@ -564,7 +564,7 @@ void SearchView::NotifySaveListChanged(SearchModel * sender)
|
||||
{
|
||||
RemoveComponent(errorLabel);
|
||||
delete errorLabel;
|
||||
errorLabel = NULL;
|
||||
errorLabel = nullptr;
|
||||
}
|
||||
for (size_t i = 0; i < saveButtons.size(); i++)
|
||||
{
|
||||
|
@ -152,7 +152,7 @@ static const struct luaL_Reg bit_funcs[] = {
|
||||
{ "ror", bit_ror },
|
||||
{ "bswap", bit_bswap },
|
||||
{ "tohex", bit_tohex },
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
/* Signed right-shifts are implementation-defined per C89/C99.
|
||||
|
@ -12,7 +12,7 @@ Luna<LuaButton>::RegType LuaButton::methods[] = {
|
||||
method(LuaButton, size),
|
||||
method(LuaButton, visible),
|
||||
method(LuaButton, enabled),
|
||||
{0, 0}
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
||||
LuaButton::LuaButton(lua_State *L) :
|
||||
|
@ -47,10 +47,10 @@ void LuaBz2::Open(lua_State *L)
|
||||
LFUNC(compress),
|
||||
LFUNC(decompress),
|
||||
#undef LFUNC
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, reg);
|
||||
luaL_register(L, nullptr, reg);
|
||||
#define LCONSTAS(k, v) lua_pushinteger(L, int(v)); lua_setfield(L, -2, k)
|
||||
LCONSTAS("COMPRESS_NOMEM" , BZ2WCompressNomem );
|
||||
LCONSTAS("COMPRESS_LIMIT" , BZ2WCompressLimit );
|
||||
|
@ -12,7 +12,7 @@ Luna<LuaCheckbox>::RegType LuaCheckbox::methods[] = {
|
||||
method(LuaCheckbox, size),
|
||||
method(LuaCheckbox, visible),
|
||||
method(LuaCheckbox, checked),
|
||||
{0, 0}
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
||||
LuaCheckbox::LuaCheckbox(lua_State *L) :
|
||||
|
@ -856,10 +856,10 @@ void LuaElements::Open(lua_State *L)
|
||||
LFUNC(getByName),
|
||||
#undef LFUNC
|
||||
{ "free", ffree },
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, reg);
|
||||
luaL_register(L, nullptr, reg);
|
||||
#define LCONST(v) lua_pushinteger(L, int(v)); lua_setfield(L, -2, #v)
|
||||
#define LCONSTAS(k, v) lua_pushinteger(L, int(v)); lua_setfield(L, -2, k)
|
||||
LCONST(TYPE_PART);
|
||||
|
@ -59,10 +59,10 @@ void LuaEvent::Open(lua_State *L)
|
||||
LFUNC(getModifiers),
|
||||
#undef LFUNC
|
||||
{ "register", fregister },
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, reg);
|
||||
luaL_register(L, nullptr, reg);
|
||||
#define LVICONST(id, v) lua_pushinteger(L, VariantIndex<GameControllerEvent, id>()); lua_setfield(L, -2, v)
|
||||
LVICONST(TextInputEvent , "TEXTINPUT" );
|
||||
LVICONST(TextEditingEvent , "TEXTEDITING" );
|
||||
|
@ -109,10 +109,10 @@ void LuaFileSystem::Open(lua_State *L)
|
||||
LFUNC(move),
|
||||
LFUNC(copy),
|
||||
#undef LFUNC
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, reg);
|
||||
luaL_register(L, nullptr, reg);
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setglobal(L, "fileSystem");
|
||||
lua_setglobal(L, "fs");
|
||||
|
@ -284,10 +284,10 @@ void LuaGraphics::Open(lua_State *L)
|
||||
LFUNC(getHexColor),
|
||||
LFUNC(setClipRect),
|
||||
#undef LFUNC
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, reg);
|
||||
luaL_register(L, nullptr, reg);
|
||||
#define LCONSTAS(k, v) lua_pushinteger(L, int(v)); lua_setfield(L, -2, k)
|
||||
LCONSTAS("WIDTH", WINDOWW);
|
||||
LCONSTAS("HEIGHT", WINDOWH);
|
||||
|
@ -375,13 +375,13 @@ void LuaHttp::Open(lua_State *L)
|
||||
LFUNC(cancel),
|
||||
LFUNC(finish),
|
||||
#undef LFUNC
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
luaL_newmetatable(L, "HTTPRequest");
|
||||
lua_pushcfunction(L, HTTPRequest_gc);
|
||||
lua_setfield(L, -2, "__gc");
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, reg);
|
||||
luaL_register(L, nullptr, reg);
|
||||
lua_setfield(L, -2, "__index");
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
@ -392,10 +392,10 @@ void LuaHttp::Open(lua_State *L)
|
||||
LFUNC(post),
|
||||
LFUNC(getAuthToken),
|
||||
#undef LFUNC
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, reg);
|
||||
luaL_register(L, nullptr, reg);
|
||||
lua_setglobal(L, "http");
|
||||
}
|
||||
}
|
||||
|
@ -490,10 +490,10 @@ void LuaInterface::Open(lua_State *L)
|
||||
LFUNC(mousePosition),
|
||||
LFUNC(activeTool),
|
||||
#undef LFUNC
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, reg);
|
||||
luaL_register(L, nullptr, reg);
|
||||
#define LCONSTAS(k, v) lua_pushinteger(L, int(v)); lua_setfield(L, -2, k)
|
||||
LCONSTAS("MOUSEUP_NORMAL" , GameController::mouseUpNormal);
|
||||
LCONSTAS("MOUSEUP_BLUR" , GameController::mouseUpBlur);
|
||||
|
@ -10,7 +10,7 @@ Luna<LuaLabel>::RegType LuaLabel::methods[] = {
|
||||
method(LuaLabel, position),
|
||||
method(LuaLabel, size),
|
||||
method(LuaLabel, visible),
|
||||
{0, 0}
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
||||
LuaLabel::LuaLabel(lua_State *L) :
|
||||
|
@ -263,10 +263,10 @@ void LuaMisc::Open(lua_State *L)
|
||||
LFUNC(compatChunk),
|
||||
#undef LFUNC
|
||||
{ "log", flog },
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, reg);
|
||||
luaL_register(L, nullptr, reg);
|
||||
#define LCONST(v) lua_pushinteger(L, int(v)); lua_setfield(L, -2, #v)
|
||||
LCONST(DEBUG_PARTS);
|
||||
LCONST(DEBUG_ELEMENTPOP);
|
||||
|
@ -70,10 +70,10 @@ void LuaPlatform::Open(lua_State *L)
|
||||
LFUNC(clipboardCopy),
|
||||
LFUNC(clipboardPaste),
|
||||
#undef LFUNC
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, reg);
|
||||
luaL_register(L, nullptr, reg);
|
||||
lua_pushvalue(L, -1);
|
||||
lua_setglobal(L, "platform");
|
||||
lua_setglobal(L, "plat");
|
||||
|
@ -11,7 +11,7 @@ Luna<LuaProgressBar>::RegType LuaProgressBar::methods[] = {
|
||||
method(LuaProgressBar, visible),
|
||||
method(LuaProgressBar, progress),
|
||||
method(LuaProgressBar, status),
|
||||
{0, 0}
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
||||
LuaProgressBar::LuaProgressBar(lua_State *L) :
|
||||
|
@ -248,10 +248,10 @@ void LuaRenderer::Open(lua_State *L)
|
||||
LFUNC(useDisplayPreset),
|
||||
LFUNC(separateThread),
|
||||
#undef LFUNC
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, reg);
|
||||
luaL_register(L, nullptr, reg);
|
||||
#define LCONST(v) lua_pushinteger(L, int(v)); lua_setfield(L, -2, #v)
|
||||
LCONST(PMODE);
|
||||
LCONST(PMODE_NONE);
|
||||
|
@ -568,7 +568,7 @@ static int createWalls(lua_State *L)
|
||||
return luaL_error(L, "Unrecognised wall id '%d'", c);
|
||||
|
||||
auto *lsi = GetLSI();
|
||||
int ret = lsi->sim->CreateWalls(x, y, rx, ry, c, NULL);
|
||||
int ret = lsi->sim->CreateWalls(x, y, rx, ry, c, nullptr);
|
||||
lua_pushinteger(L, ret);
|
||||
return 1;
|
||||
}
|
||||
@ -589,7 +589,7 @@ static int createWallLine(lua_State *L)
|
||||
return luaL_error(L, "Unrecognised wall id '%d'", c);
|
||||
|
||||
auto *lsi = GetLSI();
|
||||
lsi->sim->CreateWallLine(x1, y1, x2, y2, rx, ry, c, NULL);
|
||||
lsi->sim->CreateWallLine(x1, y1, x2, y2, rx, ry, c, nullptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1942,10 +1942,10 @@ void LuaSimulation::Open(lua_State *L)
|
||||
LFUNC(fanVelocityY),
|
||||
LFUNC(listDefaultGol),
|
||||
#undef LFUNC
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, reg);
|
||||
luaL_register(L, nullptr, reg);
|
||||
|
||||
#define LCONST(v) lua_pushinteger(L, int(v)); lua_setfield(L, -2, #v)
|
||||
#define LCONSTF(v) lua_pushnumber(L, float(v)); lua_setfield(L, -2, #v)
|
||||
|
@ -12,7 +12,7 @@ Luna<LuaSlider>::RegType LuaSlider::methods[] = {
|
||||
method(LuaSlider, visible),
|
||||
method(LuaSlider, value),
|
||||
method(LuaSlider, steps),
|
||||
{0, 0}
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
||||
LuaSlider::LuaSlider(lua_State *L) :
|
||||
|
@ -18,10 +18,10 @@ void LuaSocket::Open(lua_State *L)
|
||||
static const luaL_Reg reg[] = {
|
||||
{ "sleep", LuaSocket::Sleep },
|
||||
{ "getTime", LuaSocket::GetTime },
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, reg);
|
||||
luaL_register(L, nullptr, reg);
|
||||
lua_setglobal(L, "socket");
|
||||
OpenTCP(L);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace LuaSocket
|
||||
double Now()
|
||||
{
|
||||
struct timeval rt;
|
||||
gettimeofday(&rt, (struct timezone *)NULL);
|
||||
gettimeofday(&rt, (struct timezone *)nullptr);
|
||||
return rt.tv_sec + rt.tv_usec / 1e6;
|
||||
}
|
||||
|
||||
|
@ -622,9 +622,9 @@ namespace LuaSocket
|
||||
{ "settimeout", LuaSocket::SetTimeout },
|
||||
{ "setoption", LuaSocket::SetOption },
|
||||
{ "shutdown", LuaSocket::Shutdown },
|
||||
{ NULL, NULL },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
luaL_register(L, NULL, tcpSocketIndexMethods);
|
||||
luaL_register(L, nullptr, tcpSocketIndexMethods);
|
||||
lua_setfield(L, -2, "__index");
|
||||
lua_pop(L, 1);
|
||||
lua_getglobal(L, "socket");
|
||||
|
@ -12,7 +12,7 @@ Luna<LuaTextbox>::RegType LuaTextbox::methods[] = {
|
||||
method(LuaTextbox, position),
|
||||
method(LuaTextbox, size),
|
||||
method(LuaTextbox, visible),
|
||||
{0, 0}
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
||||
LuaTextbox::LuaTextbox(lua_State *L) :
|
||||
|
@ -413,10 +413,10 @@ void LuaTools::Open(lua_State *L)
|
||||
LFUNC(isCustom),
|
||||
#undef LFUNC
|
||||
{ "free", ffree },
|
||||
{ NULL, NULL }
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, reg);
|
||||
luaL_register(L, nullptr, reg);
|
||||
lua_newtable(L);
|
||||
lua_setfield(L, -2, "index");
|
||||
lua_setglobal(L, "tools");
|
||||
|
@ -32,7 +32,7 @@ Luna<LuaWindow>::RegType LuaWindow::methods[] = {
|
||||
method(LuaWindow, onMouseWheel),
|
||||
method(LuaWindow, onKeyPress),
|
||||
method(LuaWindow, onKeyRelease),
|
||||
{0, 0}
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
||||
LuaWindow::LuaWindow(lua_State *L)
|
||||
|
@ -116,6 +116,8 @@ powder_files = files(
|
||||
'lua/CommandInterface.cpp',
|
||||
'lua/TPTSTypes.cpp',
|
||||
)
|
||||
powder_external_files = []
|
||||
|
||||
if host_platform == 'emscripten'
|
||||
powder_files += files(
|
||||
'PowderToySDLEmscripten.cpp',
|
||||
|
@ -449,14 +449,14 @@ Resampler::Contrib_List* Resampler::make_clist(
|
||||
Contrib* Pcpool_next;
|
||||
Contrib_Bounds* Pcontrib_bounds;
|
||||
|
||||
if ((Pcontrib = (Contrib_List*)calloc(dst_x, sizeof(Contrib_List))) == NULL)
|
||||
return NULL;
|
||||
if ((Pcontrib = (Contrib_List*)calloc(dst_x, sizeof(Contrib_List))) == nullptr)
|
||||
return nullptr;
|
||||
|
||||
Pcontrib_bounds = (Contrib_Bounds*)calloc(dst_x, sizeof(Contrib_Bounds));
|
||||
if (!Pcontrib_bounds)
|
||||
{
|
||||
free(Pcontrib);
|
||||
return (NULL);
|
||||
return (nullptr);
|
||||
}
|
||||
|
||||
const Resample_Real oo_filter_scale = 1.0f / filter_scale;
|
||||
@ -496,11 +496,11 @@ Resampler::Contrib_List* Resampler::make_clist(
|
||||
|
||||
/* Allocate memory for contributors. */
|
||||
|
||||
if ((n == 0) || ((Pcpool = (Contrib*)calloc(n, sizeof(Contrib))) == NULL))
|
||||
if ((n == 0) || ((Pcpool = (Contrib*)calloc(n, sizeof(Contrib))) == nullptr))
|
||||
{
|
||||
free(Pcontrib);
|
||||
free(Pcontrib_bounds);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
total = n;
|
||||
|
||||
@ -578,7 +578,7 @@ Resampler::Contrib_List* Resampler::make_clist(
|
||||
free(Pcpool);
|
||||
free(Pcontrib);
|
||||
free(Pcontrib_bounds);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (total_weight != 1.0f)
|
||||
@ -616,11 +616,11 @@ Resampler::Contrib_List* Resampler::make_clist(
|
||||
/* Allocate memory for contributors. */
|
||||
|
||||
int total = n;
|
||||
if ((total == 0) || ((Pcpool = (Contrib*)calloc(total, sizeof(Contrib))) == NULL))
|
||||
if ((total == 0) || ((Pcpool = (Contrib*)calloc(total, sizeof(Contrib))) == nullptr))
|
||||
{
|
||||
free(Pcontrib);
|
||||
free(Pcontrib_bounds);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Pcpool_next = Pcpool;
|
||||
@ -698,7 +698,7 @@ Resampler::Contrib_List* Resampler::make_clist(
|
||||
free(Pcpool);
|
||||
free(Pcontrib);
|
||||
free(Pcontrib_bounds);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (total_weight != 1.0f)
|
||||
@ -870,7 +870,7 @@ bool Resampler::put_line(const Sample* Psrc)
|
||||
|
||||
if (!m_Pscan_buf->scan_buf_l[i])
|
||||
{
|
||||
if ((m_Pscan_buf->scan_buf_l[i] = (Sample*)malloc(m_intermediate_x * sizeof(Sample))) == NULL)
|
||||
if ((m_Pscan_buf->scan_buf_l[i] = (Sample*)malloc(m_intermediate_x * sizeof(Sample))) == nullptr)
|
||||
{
|
||||
m_status = STATUS_OUT_OF_MEMORY;
|
||||
return false;
|
||||
@ -907,7 +907,7 @@ const Resampler::Sample* Resampler::get_line()
|
||||
*/
|
||||
|
||||
if (m_cur_dst_y == m_resample_dst_y)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
/* Check to see if all the required
|
||||
* contributors are present, if not,
|
||||
@ -916,7 +916,7 @@ const Resampler::Sample* Resampler::get_line()
|
||||
|
||||
for (i = 0; i < m_Pclist_y[m_cur_dst_y].n; i++)
|
||||
if (!m_Psrc_y_flag[resampler_range_check(m_Pclist_y[m_cur_dst_y].p[i].pixel, m_resample_src_y)])
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
resample_y(m_Pdst_buf);
|
||||
|
||||
@ -934,12 +934,12 @@ Resampler::~Resampler()
|
||||
#endif
|
||||
|
||||
free(m_Pdst_buf);
|
||||
m_Pdst_buf = NULL;
|
||||
m_Pdst_buf = nullptr;
|
||||
|
||||
if (m_Ptmp_buf)
|
||||
{
|
||||
free(m_Ptmp_buf);
|
||||
m_Ptmp_buf = NULL;
|
||||
m_Ptmp_buf = nullptr;
|
||||
}
|
||||
|
||||
/* Don't deallocate a contibutor list
|
||||
@ -950,21 +950,21 @@ Resampler::~Resampler()
|
||||
{
|
||||
free(m_Pclist_x->p);
|
||||
free(m_Pclist_x);
|
||||
m_Pclist_x = NULL;
|
||||
m_Pclist_x = nullptr;
|
||||
}
|
||||
|
||||
if ((m_Pclist_y) && (!m_clist_y_forced))
|
||||
{
|
||||
free(m_Pclist_y->p);
|
||||
free(m_Pclist_y);
|
||||
m_Pclist_y = NULL;
|
||||
m_Pclist_y = nullptr;
|
||||
}
|
||||
|
||||
free(m_Psrc_y_count);
|
||||
m_Psrc_y_count = NULL;
|
||||
m_Psrc_y_count = nullptr;
|
||||
|
||||
free(m_Psrc_y_flag);
|
||||
m_Psrc_y_flag = NULL;
|
||||
m_Psrc_y_flag = nullptr;
|
||||
|
||||
if (m_Pscan_buf)
|
||||
{
|
||||
@ -972,7 +972,7 @@ Resampler::~Resampler()
|
||||
free(m_Pscan_buf->scan_buf_l[i]);
|
||||
|
||||
free(m_Pscan_buf);
|
||||
m_Pscan_buf = NULL;
|
||||
m_Pscan_buf = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1001,7 +1001,7 @@ void Resampler::restart()
|
||||
m_Pscan_buf->scan_buf_y[i] = -1;
|
||||
|
||||
free(m_Pscan_buf->scan_buf_l[i]);
|
||||
m_Pscan_buf->scan_buf_l[i] = NULL;
|
||||
m_Pscan_buf->scan_buf_l[i] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1034,15 +1034,15 @@ Resampler::Resampler(int src_x, int src_y,
|
||||
|
||||
m_delay_x_resample = false;
|
||||
m_intermediate_x = 0;
|
||||
m_Pdst_buf = NULL;
|
||||
m_Ptmp_buf = NULL;
|
||||
m_Pdst_buf = nullptr;
|
||||
m_Ptmp_buf = nullptr;
|
||||
m_clist_x_forced = false;
|
||||
m_Pclist_x = NULL;
|
||||
m_Pclist_x = nullptr;
|
||||
m_clist_y_forced = false;
|
||||
m_Pclist_y = NULL;
|
||||
m_Psrc_y_count = NULL;
|
||||
m_Psrc_y_flag = NULL;
|
||||
m_Pscan_buf = NULL;
|
||||
m_Pclist_y = nullptr;
|
||||
m_Psrc_y_count = nullptr;
|
||||
m_Psrc_y_flag = nullptr;
|
||||
m_Pscan_buf = nullptr;
|
||||
m_status = STATUS_OKAY;
|
||||
|
||||
m_resample_src_x = src_x;
|
||||
@ -1052,7 +1052,7 @@ Resampler::Resampler(int src_x, int src_y,
|
||||
|
||||
m_boundary_op = boundary_op;
|
||||
|
||||
if ((m_Pdst_buf = (Sample*)malloc(m_resample_dst_x * sizeof(Sample))) == NULL)
|
||||
if ((m_Pdst_buf = (Sample*)malloc(m_resample_dst_x * sizeof(Sample))) == nullptr)
|
||||
{
|
||||
m_status = STATUS_OUT_OF_MEMORY;
|
||||
return;
|
||||
@ -1060,7 +1060,7 @@ Resampler::Resampler(int src_x, int src_y,
|
||||
|
||||
// Find the specified filter.
|
||||
|
||||
if (Pfilter_name == NULL)
|
||||
if (Pfilter_name == nullptr)
|
||||
Pfilter_name = RESAMPLER_DEFAULT_FILTER;
|
||||
|
||||
for (i = 0; i < NUM_FILTERS; i++)
|
||||
@ -1108,13 +1108,13 @@ Resampler::Resampler(int src_x, int src_y,
|
||||
m_clist_y_forced = true;
|
||||
}
|
||||
|
||||
if ((m_Psrc_y_count = (int*)calloc(m_resample_src_y, sizeof(int))) == NULL)
|
||||
if ((m_Psrc_y_count = (int*)calloc(m_resample_src_y, sizeof(int))) == nullptr)
|
||||
{
|
||||
m_status = STATUS_OUT_OF_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((m_Psrc_y_flag = (unsigned char*)calloc(m_resample_src_y, sizeof(unsigned char))) == NULL)
|
||||
if ((m_Psrc_y_flag = (unsigned char*)calloc(m_resample_src_y, sizeof(unsigned char))) == nullptr)
|
||||
{
|
||||
m_status = STATUS_OUT_OF_MEMORY;
|
||||
return;
|
||||
@ -1128,7 +1128,7 @@ Resampler::Resampler(int src_x, int src_y,
|
||||
for (j = 0; j < m_Pclist_y[i].n; j++)
|
||||
m_Psrc_y_count[resampler_range_check(m_Pclist_y[i].p[j].pixel, m_resample_src_y)]++;
|
||||
|
||||
if ((m_Pscan_buf = (Scan_Buf*)malloc(sizeof(Scan_Buf))) == NULL)
|
||||
if ((m_Pscan_buf = (Scan_Buf*)malloc(sizeof(Scan_Buf))) == nullptr)
|
||||
{
|
||||
m_status = STATUS_OUT_OF_MEMORY;
|
||||
return;
|
||||
@ -1137,7 +1137,7 @@ Resampler::Resampler(int src_x, int src_y,
|
||||
for (i = 0; i < MAX_SCAN_BUF_SIZE; i++)
|
||||
{
|
||||
m_Pscan_buf->scan_buf_y[i] = -1;
|
||||
m_Pscan_buf->scan_buf_l[i] = NULL;
|
||||
m_Pscan_buf->scan_buf_l[i] = nullptr;
|
||||
}
|
||||
|
||||
m_cur_src_y = m_cur_dst_y = 0;
|
||||
@ -1185,7 +1185,7 @@ Resampler::Resampler(int src_x, int src_y,
|
||||
|
||||
if (m_delay_x_resample)
|
||||
{
|
||||
if ((m_Ptmp_buf = (Sample*)malloc(m_intermediate_x * sizeof(Sample))) == NULL)
|
||||
if ((m_Ptmp_buf = (Sample*)malloc(m_intermediate_x * sizeof(Sample))) == nullptr)
|
||||
{
|
||||
m_status = STATUS_OUT_OF_MEMORY;
|
||||
return;
|
||||
@ -1210,7 +1210,7 @@ int Resampler::get_filter_num()
|
||||
char* Resampler::get_filter_name(int filter_num)
|
||||
{
|
||||
if ((filter_num < 0) || (filter_num >= NUM_FILTERS))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
else
|
||||
return g_filters[filter_num].name;
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ void Simulation::CreateWallBox(int x1, int y1, int x2, int y2, int wall)
|
||||
}
|
||||
for (j=y1; j<=y2; j++)
|
||||
for (i=x1; i<=x2; i++)
|
||||
CreateWalls(i, j, 0, 0, wall, NULL);
|
||||
CreateWalls(i, j, 0, 0, wall, nullptr);
|
||||
}
|
||||
|
||||
int Simulation::FloodWalls(int x, int y, int wall, int bm)
|
||||
@ -335,7 +335,7 @@ int Simulation::FloodWalls(int x, int y, int wall, int bm)
|
||||
// fill span
|
||||
for (x=x1; x<=x2; x++)
|
||||
{
|
||||
if (!CreateWalls(x, y, 0, 0, wall, NULL))
|
||||
if (!CreateWalls(x, y, 0, 0, wall, nullptr))
|
||||
return 0;
|
||||
}
|
||||
// fill children
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
void SimTool::CallPerform(Simulation *sim, ui::Point position, ui::Point brushOffset)
|
||||
{
|
||||
Particle * cpart = NULL;
|
||||
Particle * cpart = nullptr;
|
||||
int r;
|
||||
if ((r = sim->pmap[position.Y][position.X]))
|
||||
cpart = &(sim->parts[ID(r)]);
|
||||
|
@ -1568,7 +1568,7 @@ int Simulation::is_blocking(int t, int x, int y) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
return !eval_move(t, x, y, NULL);
|
||||
return !eval_move(t, x, y, nullptr);
|
||||
}
|
||||
|
||||
int Simulation::is_boundary(int pt, int x, int y) const
|
||||
@ -1860,7 +1860,7 @@ int Simulation::create_part(int p, int x, int y, int t, int v)
|
||||
// If there isn't a particle but there is a wall, check whether the new particle is allowed to be in it
|
||||
// (not "!=2" for wall check because eval_move returns 1 for moving into empty space)
|
||||
// If there's no particle and no wall, assume creation is allowed
|
||||
if (pmap[y][x] ? (eval_move(t, x, y, NULL) != 2) : (bmap[y/CELL][x/CELL] && eval_move(t, x, y, NULL) == 0))
|
||||
if (pmap[y][x] ? (eval_move(t, x, y, nullptr) != 2) : (bmap[y/CELL][x/CELL] && eval_move(t, x, y, nullptr) == 0))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@ -2175,7 +2175,7 @@ Simulation::PlanMoveResult Simulation::PlanMove(Sim &sim, int i, int x, int y)
|
||||
}
|
||||
//block if particle can't move (0), or some special cases where it returns 1 (can_move = 3 but returns 1 meaning particle will be eaten)
|
||||
//also photons are still blocked (slowed down) by any particle (even ones it can move through), and absorb wall also blocks particles
|
||||
int eval = sim.eval_move(t, fin_x, fin_y, NULL);
|
||||
int eval = sim.eval_move(t, fin_x, fin_y, nullptr);
|
||||
if (!eval || (can_move[t][TYP(pmap[fin_y][fin_x])] == 3 && eval == 1) || (t == PT_PHOT && pmap[fin_y][fin_x]) || bmap[fin_y/CELL][fin_x/CELL]==WL_DESTROYALL || closedEholeStart!=(bmap[fin_y/CELL][fin_x/CELL] == WL_EHOLE && !emap[fin_y/CELL][fin_x/CELL]))
|
||||
{
|
||||
// found an obstacle
|
||||
@ -2917,7 +2917,7 @@ killed:
|
||||
if (!x_ok || !y_ok) //when moving from left to right stickmen might be able to fall through solid things, fix with "eval_move(t, nx+diffx, ny+diffy, NULL)" but then they die instead
|
||||
{
|
||||
//adjust stickmen legs
|
||||
playerst* stickman = NULL;
|
||||
playerst* stickman = nullptr;
|
||||
int t = parts[i].type;
|
||||
if (t == PT_STKM)
|
||||
stickman = &player;
|
||||
@ -2964,7 +2964,7 @@ killed:
|
||||
continue;
|
||||
}
|
||||
|
||||
if (eval_move(PT_PHOT, fin_x, fin_y, NULL))
|
||||
if (eval_move(PT_PHOT, fin_x, fin_y, nullptr))
|
||||
{
|
||||
int rt = TYP(pmap[fin_y][fin_x]);
|
||||
int lt = TYP(pmap[y][x]);
|
||||
|
@ -41,5 +41,5 @@ void Element::Element_DUST()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Graphics = NULL; // it this needed?
|
||||
Graphics = nullptr; // it this needed?
|
||||
}
|
||||
|
@ -107,8 +107,8 @@ static int update(UPDATE_FUNC_ARGS)
|
||||
}
|
||||
else if (tarx<x)
|
||||
{
|
||||
if(figh->rocketBoots || !(sim->eval_move(PT_FIGH, int(figh->legs[4])-10, int(figh->legs[5])+6, NULL)
|
||||
&& sim->eval_move(PT_FIGH, int(figh->legs[4])-10, int(figh->legs[5])+3, NULL)))
|
||||
if(figh->rocketBoots || !(sim->eval_move(PT_FIGH, int(figh->legs[4])-10, int(figh->legs[5])+6, nullptr)
|
||||
&& sim->eval_move(PT_FIGH, int(figh->legs[4])-10, int(figh->legs[5])+3, nullptr)))
|
||||
figh->comm = 0x01;
|
||||
else
|
||||
figh->comm = 0x02;
|
||||
@ -118,15 +118,15 @@ static int update(UPDATE_FUNC_ARGS)
|
||||
if (tary<y)
|
||||
figh->comm = (int)figh->comm | 0x04;
|
||||
}
|
||||
else if (!sim->eval_move(PT_FIGH, int(figh->legs[4])-4, int(figh->legs[5])-1, NULL)
|
||||
|| !sim->eval_move(PT_FIGH, int(figh->legs[12])-4, int(figh->legs[13])-1, NULL)
|
||||
|| sim->eval_move(PT_FIGH, 2*int(figh->legs[4])-int(figh->legs[6]), int(figh->legs[5])+5, NULL))
|
||||
else if (!sim->eval_move(PT_FIGH, int(figh->legs[4])-4, int(figh->legs[5])-1, nullptr)
|
||||
|| !sim->eval_move(PT_FIGH, int(figh->legs[12])-4, int(figh->legs[13])-1, nullptr)
|
||||
|| sim->eval_move(PT_FIGH, 2*int(figh->legs[4])-int(figh->legs[6]), int(figh->legs[5])+5, nullptr))
|
||||
figh->comm = (int)figh->comm | 0x04;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (figh->rocketBoots || !(sim->eval_move(PT_FIGH, int(figh->legs[12])+10, int(figh->legs[13])+6, NULL)
|
||||
&& sim->eval_move(PT_FIGH, int(figh->legs[12])+10, int(figh->legs[13])+3, NULL)))
|
||||
if (figh->rocketBoots || !(sim->eval_move(PT_FIGH, int(figh->legs[12])+10, int(figh->legs[13])+6, nullptr)
|
||||
&& sim->eval_move(PT_FIGH, int(figh->legs[12])+10, int(figh->legs[13])+3, nullptr)))
|
||||
figh->comm = 0x02;
|
||||
else
|
||||
figh->comm = 0x01;
|
||||
@ -136,9 +136,9 @@ static int update(UPDATE_FUNC_ARGS)
|
||||
if (tary<y)
|
||||
figh->comm = (int)figh->comm | 0x04;
|
||||
}
|
||||
else if (!sim->eval_move(PT_FIGH, int(figh->legs[4])+4, int(figh->legs[5])-1, NULL)
|
||||
|| !sim->eval_move(PT_FIGH, int(figh->legs[4])+4, int(figh->legs[5])-1, NULL)
|
||||
|| sim->eval_move(PT_FIGH, 2*int(figh->legs[12])-int(figh->legs[14]), int(figh->legs[13])+5, NULL))
|
||||
else if (!sim->eval_move(PT_FIGH, int(figh->legs[4])+4, int(figh->legs[5])-1, nullptr)
|
||||
|| !sim->eval_move(PT_FIGH, int(figh->legs[4])+4, int(figh->legs[5])-1, nullptr)
|
||||
|| sim->eval_move(PT_FIGH, 2*int(figh->legs[12])-int(figh->legs[14]), int(figh->legs[13])+5, nullptr))
|
||||
figh->comm = (int)figh->comm | 0x04;
|
||||
}
|
||||
break;
|
||||
|
@ -62,7 +62,7 @@ static int update(UPDATE_FUNC_ARGS)
|
||||
gy += cosf(angle)*elements[PT_FWRK].Gravity*0.5f;
|
||||
}
|
||||
gmax = std::max(fabsf(gx), fabsf(gy));
|
||||
if (sim->eval_move(PT_FWRK, (int)(x-(gx/gmax)+0.5f), (int)(y-(gy/gmax)+0.5f), NULL))
|
||||
if (sim->eval_move(PT_FWRK, (int)(x-(gx/gmax)+0.5f), (int)(y-(gy/gmax)+0.5f), nullptr))
|
||||
{
|
||||
multiplier = 15.0f/sqrtf(gx*gx+gy*gy);
|
||||
|
||||
|
@ -40,5 +40,5 @@ void Element::Element_SAWD()
|
||||
HighTemperature = ITH;
|
||||
HighTemperatureTransition = NT;
|
||||
|
||||
Graphics = NULL; // is this needed?
|
||||
Graphics = nullptr; // is this needed?
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ int Element_STKM_run_stickman(playerst *playerp, UPDATE_FUNC_ARGS)
|
||||
bool moved = false;
|
||||
if (dl>dr)
|
||||
{
|
||||
if (InBounds(int(playerp->legs[4]), int(playerp->legs[5])) && !sim->eval_move(t, int(playerp->legs[4]), int(playerp->legs[5]), NULL))
|
||||
if (InBounds(int(playerp->legs[4]), int(playerp->legs[5])) && !sim->eval_move(t, int(playerp->legs[4]), int(playerp->legs[5]), nullptr))
|
||||
{
|
||||
playerp->accs[2] = -3*mvy-3*mvx;
|
||||
playerp->accs[3] = 3*mvx-3*mvy;
|
||||
@ -262,7 +262,7 @@ int Element_STKM_run_stickman(playerst *playerp, UPDATE_FUNC_ARGS)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (InBounds(int(playerp->legs[12]), int(playerp->legs[13])) && !sim->eval_move(t, int(playerp->legs[12]), int(playerp->legs[13]), NULL))
|
||||
if (InBounds(int(playerp->legs[12]), int(playerp->legs[13])) && !sim->eval_move(t, int(playerp->legs[12]), int(playerp->legs[13]), nullptr))
|
||||
{
|
||||
playerp->accs[6] = -3*mvy-3*mvx;
|
||||
playerp->accs[7] = 3*mvx-3*mvy;
|
||||
@ -301,7 +301,7 @@ int Element_STKM_run_stickman(playerst *playerp, UPDATE_FUNC_ARGS)
|
||||
bool moved = false;
|
||||
if (dl<dr)
|
||||
{
|
||||
if (InBounds(int(playerp->legs[4]), int(playerp->legs[5])) && !sim->eval_move(t, int(playerp->legs[4]), int(playerp->legs[5]), NULL))
|
||||
if (InBounds(int(playerp->legs[4]), int(playerp->legs[5])) && !sim->eval_move(t, int(playerp->legs[4]), int(playerp->legs[5]), nullptr))
|
||||
{
|
||||
playerp->accs[2] = 3*mvy-3*mvx;
|
||||
playerp->accs[3] = -3*mvx-3*mvy;
|
||||
@ -312,7 +312,7 @@ int Element_STKM_run_stickman(playerst *playerp, UPDATE_FUNC_ARGS)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (InBounds(int(playerp->legs[12]), int(playerp->legs[13])) && !sim->eval_move(t, int(playerp->legs[12]), int(playerp->legs[13]), NULL))
|
||||
if (InBounds(int(playerp->legs[12]), int(playerp->legs[13])) && !sim->eval_move(t, int(playerp->legs[12]), int(playerp->legs[13]), nullptr))
|
||||
{
|
||||
playerp->accs[6] = 3*mvy-3*mvx;
|
||||
playerp->accs[7] = -3*mvx-3*mvy;
|
||||
@ -378,8 +378,8 @@ int Element_STKM_run_stickman(playerst *playerp, UPDATE_FUNC_ARGS)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((InBounds(int(playerp->legs[4]), int(playerp->legs[5])) && !sim->eval_move(t, int(playerp->legs[4]), int(playerp->legs[5]), NULL)) ||
|
||||
(InBounds(int(playerp->legs[12]), int(playerp->legs[13])) && !sim->eval_move(t, int(playerp->legs[12]), int(playerp->legs[13]), NULL)))
|
||||
else if ((InBounds(int(playerp->legs[4]), int(playerp->legs[5])) && !sim->eval_move(t, int(playerp->legs[4]), int(playerp->legs[5]), nullptr)) ||
|
||||
(InBounds(int(playerp->legs[12]), int(playerp->legs[13])) && !sim->eval_move(t, int(playerp->legs[12]), int(playerp->legs[13]), nullptr)))
|
||||
{
|
||||
parts[i].vx -= 4*mvx;
|
||||
parts[i].vy -= 4*mvy;
|
||||
@ -551,27 +551,27 @@ int Element_STKM_run_stickman(playerst *playerp, UPDATE_FUNC_ARGS)
|
||||
playerp->legs[8] += (playerp->legs[8]-parts[i].x)*d;
|
||||
playerp->legs[9] += (playerp->legs[9]-parts[i].y)*d;
|
||||
|
||||
if (InBounds(int(playerp->legs[4]), int(playerp->legs[5])) && !sim->eval_move(t, int(playerp->legs[4]), int(playerp->legs[5]), NULL))
|
||||
if (InBounds(int(playerp->legs[4]), int(playerp->legs[5])) && !sim->eval_move(t, int(playerp->legs[4]), int(playerp->legs[5]), nullptr))
|
||||
{
|
||||
playerp->legs[4] = playerp->legs[6];
|
||||
playerp->legs[5] = playerp->legs[7];
|
||||
}
|
||||
|
||||
if (InBounds(int(playerp->legs[12]), int(playerp->legs[13])) && !sim->eval_move(t, int(playerp->legs[12]), int(playerp->legs[13]), NULL))
|
||||
if (InBounds(int(playerp->legs[12]), int(playerp->legs[13])) && !sim->eval_move(t, int(playerp->legs[12]), int(playerp->legs[13]), nullptr))
|
||||
{
|
||||
playerp->legs[12] = playerp->legs[14];
|
||||
playerp->legs[13] = playerp->legs[15];
|
||||
}
|
||||
|
||||
//This makes stick man "pop" from obstacles
|
||||
if (InBounds(int(playerp->legs[4]), int(playerp->legs[5])) && !sim->eval_move(t, int(playerp->legs[4]), int(playerp->legs[5]), NULL))
|
||||
if (InBounds(int(playerp->legs[4]), int(playerp->legs[5])) && !sim->eval_move(t, int(playerp->legs[4]), int(playerp->legs[5]), nullptr))
|
||||
{
|
||||
float t;
|
||||
t = playerp->legs[4]; playerp->legs[4] = playerp->legs[6]; playerp->legs[6] = t;
|
||||
t = playerp->legs[5]; playerp->legs[5] = playerp->legs[7]; playerp->legs[7] = t;
|
||||
}
|
||||
|
||||
if (InBounds(int(playerp->legs[12]), int(playerp->legs[13])) && !sim->eval_move(t, int(playerp->legs[12]), int(playerp->legs[13]), NULL))
|
||||
if (InBounds(int(playerp->legs[12]), int(playerp->legs[13])) && !sim->eval_move(t, int(playerp->legs[12]), int(playerp->legs[13]), nullptr))
|
||||
{
|
||||
float t;
|
||||
t = playerp->legs[12]; playerp->legs[12] = playerp->legs[14]; playerp->legs[14] = t;
|
||||
|
@ -89,7 +89,7 @@ Task::Task() :
|
||||
done(false),
|
||||
thProgress(0),
|
||||
thDone(false),
|
||||
listener(NULL)
|
||||
listener(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user