Skip to content

Commit

Permalink
Merge pull request #15 from CleverRaven/master
Browse files Browse the repository at this point in the history
merge upstream
  • Loading branch information
I-am-Erk authored Jun 27, 2019
2 parents f477339 + 5d8dcd3 commit 610aadc
Show file tree
Hide file tree
Showing 646 changed files with 34,861 additions and 17,000 deletions.
25 changes: 24 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# Enable some categories of checks and then disable individual ones.
# The disabled checks that appear as part of the initial alphabetical section
# enabling categories (e.g. cert-err58-cpp) are ones that do not make sense for
# this codebase and we do not intend to fix. The disabled checks appearing
# thereafter in a separate alphabetical list have yet to be triaged. We may
# fix their errors or recategorise them as checks we don't care about.
Checks: "\
bugprone-*,\
cata-*,\
cert-*,\
-cert-err58-cpp,\
clang-diagnostic-*,\
cppcoreguidelines-slicing,\
llvm-namespace-comment,\
misc-*,\
modernize-*,\
performance-*,\
readability-*,\
-bugprone-forwarding-reference-overload,\
-bugprone-inaccurate-erase,\
-bugprone-incorrect-roundings,\
-bugprone-integer-division,\
Expand All @@ -17,6 +27,19 @@ readability-*,\
-bugprone-undefined-memory-manipulation,\
-bugprone-unused-return-value,\
-bugprone-use-after-move,\
-cert-dcl03-c,\
-cert-dcl16-c,\
-cert-dcl21-cpp,\
-cert-dcl50-cpp,\
-cert-dcl58-cpp,\
-cert-dcl59-cpp,\
-cert-env33-c,\
-cert-err34-c,\
-cert-flp30-c,\
-cert-msc30-c,\
-cert-msc32-c,\
-cert-msc50-cpp,\
-cert-msc51-cpp,\
-misc-definitions-in-headers,\
-misc-non-private-member-variables-in-classes,\
-misc-redundant-expression,\
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ jobs:
osx_image: xcode10.1
compiler: clang

- env: CLANG=clang++-8 TILES=1 SOUND=1 CXXFLAGS=-Wno-unused-command-line-argument CMAKE=1 CATA_CLANG_TIDY=clang-tidy-8
- env: CLANG=clang++-8 TILES=1 SOUND=1 CXXFLAGS=-Wno-unused-command-line-argument CMAKE=1 CATA_CLANG_TIDY=plugin
name: "Clang-tidy CMake build with Tiles and Sound"
compiler: clang
addons: &clang8
apt:
packages: ["clang-8", "clang-tidy-8", "libsdl2-dev", "libsdl2-ttf-dev", "libsdl2-image-dev", "libsdl2-mixer-dev"]
packages: ["clang-8", "libclang-8-dev", "llvm-8-dev", "llvm-8-tools", "libsdl2-dev", "libsdl2-ttf-dev", "libsdl2-image-dev", "libsdl2-mixer-dev"]
sources: [*apt_sources, llvm-toolchain-xenial-8]

# Finally check the compiler variants
Expand Down
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ SET(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/CMakeModules
)

SET(CMAKE_TLS_VERIFY ON)

# Build options
option(TILES "Build graphical tileset version." "OFF")
option(CURSES "Build curses version." "ON" )
Expand All @@ -17,8 +19,11 @@ option(USE_HOME_DIR "Use user's home directory for save files." "ON" )
option(LOCALIZE "Support for language localizations. Also enable UTF support." "ON" )
option(LANGUAGES "Compile localization files for specified languages." "" )
option(DYNAMIC_LINKING "Use dynamic linking. Or use static to remove MinGW dependency instead." "ON")
option(GIT_BINARY "Git binary name or path." "")
OPTION(PREFIX "Location of Data & GFX directories" "")
option(CATA_CLANG_TIDY_PLUGIN "Build Cata's custom clang-tidy plugin" "OFF")
set(CATA_CLANG_TIDY_INCLUDE_DIR "" CACHE STRING "Path to internal clang-tidy headers required for plugin (e.g. ClangTidy.h)")
set(CATA_CHECK_CLANG_TIDY "" CACHE STRING "Path to check_clang_tidy.py for plugin tests")
set(GIT_BINARY "" CACHE STRING "Git binary name or path.")
set(PREFIX "" CACHE STRING "Location of Data & GFX directories")

include(CTest)

Expand Down Expand Up @@ -341,6 +346,9 @@ if (NOT MSVC)
add_subdirectory(src/chkjson)
endif()
add_subdirectory(tests)
if (CATA_CLANG_TIDY_PLUGIN)
add_subdirectory(tools/clang-tidy-plugin)
endif()

CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
Expand Down
6 changes: 4 additions & 2 deletions COMPILING.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,13 +575,15 @@ Open Terminal's preferences, turn on "Use bright colors for bold text" in "Prefe

## Visual Studio Guide

Visual Studio 2015 (or later) is required to build Cataclysm. If you use a later version of Visual Studio, you will need to [enable the Visual Studio 2015 (v140) platform toolset](https://developercommunity.visualstudio.com/content/problem/48806/cant-find-v140-in-visual-studio-2017.html). We created solution and project files in directory `msvc-full-features`. Because of the complexity and how troublesome defining every combination of build feature options are, in Visual Studio project we added all build features, including tiles, sound and localization.
Visual Studio 2017 (or later) is required to build Cataclysm: Dark Days Ahead. Solutions and project files are located in directory `msvc-full-features`. Because of the complexity and how troublesome defining every combination of build feature options are, Visual Studio projects have all build features enabled, including tiles, sound and localization.

### Dependencies

We've prepared an archive containing all the headers and libraries required to build Cataclysm: [http://dev.narc.ro/cataclysm/WinDepend-MSVC.zip](http://dev.narc.ro/cataclysm/WinDepend-MSVC.zip) or [http://dev.narc.ro/cataclysm/WinDepend-MSVC.7z](http://dev.narc.ro/cataclysm/WinDepend-MSVC.7z). The latter is smaller, but if you don't have a 7-zip archive extracter, the former one is easier to deal with.

Extract the 'WinDepend' folder and put it in the root folder of Cataclysm project. Run the "copy_dll_to_bin" batch file and then move the dll files from the bin folder into the root folder the Cataclysm project.
Extract the 'WinDepend' folder from the zip and put the 'WinDepend' folder in the root folder of Cataclysm project. Your folder structure should look like this: `.../Cataclysm-DDA/WinDepend/...`

Run the "copy_dll_to_bin" batch file and then move the dll files from the bin folder inside 'WinDepend' into the root folder the Cataclysm project. You'll probably want to use the dlls that are in `WinDepend/bin/x64/`.

### Building

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,8 @@ TESTSRC := $(wildcard tests/*.cpp)
TESTHDR := $(wildcard tests/*.h)
JSON_FORMATTER_SOURCES := tools/format/format.cpp src/json.cpp
CHKJSON_SOURCES := src/chkjson/chkjson.cpp src/json.cpp
CLANG_TIDY_PLUGIN_SOURCES := \
$(wildcard tools/clang-tidy-plugin/*.cpp tools/clang-tidy-plugin/*/*.cpp)
TOOLHDR := $(wildcard tools/*/*.h)
# Using sort here because it has the side-effect of deduplicating the list
ASTYLE_SOURCES := $(sort \
Expand All @@ -694,6 +696,7 @@ ASTYLE_SOURCES := $(sort \
$(TESTHDR) \
$(JSON_FORMATTER_SOURCES) \
$(CHKJSON_SOURCES) \
$(CLANG_TIDY_PLUGIN_SOURCES) \
$(TOOLHDR))

_OBJS = $(SOURCES:$(SRC_DIR)/%.cpp=%.o)
Expand Down
32 changes: 31 additions & 1 deletion build-scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ then
build-scripts/lint-json.sh
make -j "$num_jobs" style-json

tools/dialogue_validator.py data/json/npcs/* data/json/npcs/*/* data/json/npcs/*/*/*
# Also build chkjson (even though we're not using it), to catch any
# compile errors there
make -j "$num_jobs" chkjson
Expand All @@ -40,6 +41,17 @@ then
build_type=Debug
fi

cmake_extra_opts=

if [ "$CATA_CLANG_TIDY" = "plugin" ]
then
cmake_extra_opts="$cmake_extra_opts -DCATA_CLANG_TIDY_PLUGIN=ON"
# Need to specify the particular LLVM / Clang versions to use, lest it
# use the llvm-7 that comes by default on the Travis Xenial image.
cmake_extra_opts="$cmake_extra_opts -DLLVM_DIR=/usr/lib/llvm-8/lib/cmake/llvm"
cmake_extra_opts="$cmake_extra_opts -DClang_DIR=/usr/lib/llvm-8/lib/cmake/clang"
fi

mkdir build
cd build
cmake \
Expand All @@ -48,9 +60,25 @@ then
-DCMAKE_BUILD_TYPE="$build_type" \
-DTILES=${TILES:-0} \
-DSOUND=${SOUND:-0} \
$cmake_extra_opts \
..
if [ -n "$CATA_CLANG_TIDY" ]
then
if [ "$CATA_CLANG_TIDY" = "plugin" ]
then
make -j$num_jobs CataAnalyzerPlugin
export PATH=$PWD/tools/clang-tidy-plugin/clang-tidy-plugin-support/bin:$PATH
if ! which FileCheck
then
ls -l tools/clang-tidy-plugin/clang-tidy-plugin-support/bin
ls -l /usr/bin
echo "Missing FileCheck"
exit 1
fi
CATA_CLANG_TIDY=clang-tidy
lit -v tools/clang-tidy-plugin/test
fi

"$CATA_CLANG_TIDY" --version

# Run clang-tidy analysis instead of regular build & test
Expand Down Expand Up @@ -94,7 +122,7 @@ then
analyze_files_in_random_order "$remaining_cpp_files"
else
# Regular build
make -j3
make -j$num_jobs
cd ..
# Run regular tests
[ -f "${bin_path}cata_test" ] && run_tests "${bin_path}cata_test"
Expand All @@ -117,3 +145,5 @@ else
fi
fi
ccache --show-stats

# vim:tw=0
9 changes: 8 additions & 1 deletion build-scripts/clang-tidy-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,12 @@ then
exit 0
fi

plugin=build/tools/clang-tidy-plugin/libCataAnalyzerPlugin.so

set -x
"$CATA_CLANG_TIDY" "$@"
if [ -f "$plugin" ]
then
LD_PRELOAD=$plugin "$CATA_CLANG_TIDY" "$@"
else
"$CATA_CLANG_TIDY" "$@"
fi
2 changes: 1 addition & 1 deletion build-scripts/requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if [ -n "${CODE_COVERAGE}" ]; then
fi

if [ -n "$CATA_CLANG_TIDY" ]; then
travis_retry pip install --user compiledb
travis_retry pip install --user compiledb lit
fi

# Influenced by https://github.com/zer0main/battleship/blob/master/build/windows/requirements.sh
Expand Down
2 changes: 1 addition & 1 deletion data/help/texts.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
"It's a good idea to pull the handbrake - \"s\" - when parking, just to be safe. If you want to get out, hit the lights, toggle cruise control, turn the engine on or off, or otherwise use the vehicle controls, press <press_control_vehicle> to bring up the \"Vehicle Controls\" menu, which has options for things you'd do from the driver's seat.",
"Examining (<press_examine>) a vehicle brings up the vehicle interaction window. The left pane shows a top-down view of your vehicle and each part of it. The middle pane shows a summmary of the vehicle's engines, batteries, storage tanks, weapons, and seating. The right panel is context sensitive, but normally has descriptions of the vehicle parts in the tile highlighted in the vehicle view on the left.",
"Across the bottom are a summary of the most important parameters of your vehicle. Safe speed is how fast you can drive without damaging the engine and maximum speed is how fast you can drive at the engine's maximum output. Acceleration is how fast your vehicle can increase speed each turn. Cargo volume is how much cargo you can store and how much stuff you have in your vehicle, mass is how much the vehicle weighs, and the Status and Wheels give a summary of the vehicle condition and wheel condition. There are also fuel indicators on the lower right that give an estimate of how quickly your fuel will run out.",
"Air drag, water drag, rolling drag, and static drag are all values that influence your vehicle's safe and maximum speed. The interaction of drag and engine power is complicated, but generally speaking, more powerful engines will make your vehicle go faster but aslo consume fuel faster.",
"Air drag, water drag, rolling drag, and static drag are all values that influence your vehicle's safe and maximum speed. The interaction of drag and engine power is complicated, but generally speaking, more powerful engines will make your vehicle go faster but also consume fuel faster.",
"Air drag increases as your vehicle gets wider or has more parts that increase the vehicle's height like full boards, aisles, or turrets. It also increases as the vehicle has a less aerodynamic profile, such as having exposed passengers or full boards at the front of the vehicle. Air drag strongly influences vehicle speed, especially at high speeds.",
"Rolling drag increases with vehicle weight and wheel count. Rigid wheels have less rolling drag per wheel than inflatable wheels, but weigh more so rolling drag may still increase when moving from inflatable wheels to rigid wheels. Tank treads have enormous rolling resistance and are very heavy, so tanks have a lot of rolling resistance. Rolling drag influences vehicle speed, but less than air drag does, especially at high speeds.",
"Vehicles that can move in water have a water drag. Water drag increases with vehicle width and draft, and draft increases with vehicle weight but is reduced by adding more boat boards and by widening or lengthening the vehicle. Water drag has enormous effect on vehicle speed in the water. See the section on water vehicles for more about draft and water drag.",
Expand Down
4 changes: 4 additions & 0 deletions data/json/bionics.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"type": "bionic",
"name": "Optical Dampers",
"description": "The lenses surgically installed over your eyes can be tinted to block out incoming light.",
"included": true,
"flags": [ "BIONIC_TOGGLED" ]
},
{
Expand Down Expand Up @@ -305,6 +306,7 @@
"type": "bionic",
"name": "Sound Dampeners",
"description": "When this bionic is active, you can block hearing completely (with Enhanced Hearing deactivated) or dampen sound slightly (with Enhanced Hearing activated).",
"included": true,
"flags": [ "BIONIC_TOGGLED" ]
},
{
Expand Down Expand Up @@ -713,6 +715,7 @@
"id": "bio_plutdump",
"type": "bionic",
"name": "Plutonium Purger",
"included": true,
"description": "Emergency reactor fuel purge ejects all fuel from your reactor.",
"act_cost": 1
},
Expand Down Expand Up @@ -1033,6 +1036,7 @@
"name": "Extended Toolset",
"description": "Extend or withdraw your integrated toolset to cut metal, pry things, or other stuff. This takes up your hand.",
"fake_item": "toolset_extended",
"included": true,
"flags": [ "BIONIC_TOGGLED", "BIONIC_WEAPON" ]
},
{
Expand Down
Loading

0 comments on commit 610aadc

Please sign in to comment.