Skip to content

Commit

Permalink
Merge pull request #10 from CleverRaven/master
Browse files Browse the repository at this point in the history
BackToRootsJun22
  • Loading branch information
xanderrootslayer authored Jun 22, 2019
2 parents c8711fc + e421845 commit 64b0ae1
Show file tree
Hide file tree
Showing 316 changed files with 22,638 additions and 10,653 deletions.
3 changes: 2 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
# 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 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
2 changes: 1 addition & 1 deletion COMPILING.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ 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

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
31 changes: 30 additions & 1 deletion build-scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,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 @@ -49,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 @@ -95,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 @@ -118,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
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
11 changes: 11 additions & 0 deletions data/json/construction.json
Original file line number Diff line number Diff line change
Expand Up @@ -2759,6 +2759,17 @@
"pre_terrain": "t_fence_post",
"post_terrain": "t_wall_rammed_earth"
},
{
"type": "construction",
"description": "Hang Hanging Meathook",
"category": "CONSTRUCT",
"required_skills": [ [ "fabrication", 1 ] ],
"time": 15,
"qualities": [ [ { "id": "HAMMER", "level": 2 } ], [ { "id": "SCREW", "level": 1 } ] ],
"components": [ [ [ "grip_hook", 1 ] ], [ [ "chain", 1 ] ] ],
"pre_special": "check_support",
"post_terrain": "f_hanging_meathook"
},
{
"type": "construction",
"description": "Build Counter Gate",
Expand Down
54 changes: 54 additions & 0 deletions data/json/construction_category.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[
{
"//": "Should be first in the list",
"type": "construction_category",
"id": "ALL",
"name": "All"
},
{
"type": "construction_category",
"id": "CONSTRUCT",
"name": "Constructions"
},
{
"type": "construction_category",
"id": "FURN",
"name": "Furniture"
},
{
"type": "construction_category",
"id": "DIG",
"name": "Digging and Mining"
},
{
"type": "construction_category",
"id": "REPAIR",
"name": "Repairing"
},
{
"type": "construction_category",
"id": "REINFORCE",
"name": "Reinforcing"
},
{
"type": "construction_category",
"id": "DECORATE",
"name": "Decorative"
},
{
"type": "construction_category",
"id": "FARM_WOOD",
"name": "Farming and Woodcutting"
},
{
"type": "construction_category",
"id": "OTHER",
"name": "Others"
},
{
"//": "Should be last in the list",
"type": "construction_category",
"id": "FILTER",
"name": "Filter"
}
]
2 changes: 1 addition & 1 deletion data/json/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@
],
"max_intensity": 4,
"apply_message": "You feel lightheaded.",
"int_dur_factor": 1000,
"int_dur_factor": 6000,
"miss_messages": [ [ "You feel woozy.", 1 ] ],
"base_mods": { "vomit_chance": [ -43 ], "sleep_chance": [ -1003 ], "sleep_min": [ 2500 ], "sleep_max": [ 3500 ] },
"scaling_mods": { "per_mod": [ -0.5 ], "dex_mod": [ -0.5 ], "int_mod": [ -0.75 ], "vomit_chance": [ 21 ], "sleep_chance": [ 501 ] }
Expand Down
2 changes: 1 addition & 1 deletion data/json/emit.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "emit",
"//": "Intermittent cigarette smoke (example: lit cigarette)",
"field": "fd_cigsmoke",
"density": 2,
"intensity": 2,
"chance": 50
},
{
Expand Down
63 changes: 63 additions & 0 deletions data/json/furniture.json
Original file line number Diff line number Diff line change
Expand Up @@ -6560,6 +6560,18 @@
"examine_action": "workbench",
"workbench": { "multiplier": 1.2, "mass": 500000, "volume": "200L" }
},
{
"id": "f_hanging_meathook",
"type": "furniture",
"name": "hanging meathook",
"description": "A hefty hook suspended from a chain for stringing up corpses.",
"symbol": "g",
"required_str": -1,
"move_cost_mod": 2,
"color": "light_gray",
"deconstruct": { "items": [ { "item": "grip_hook", "count": 1 }, { "item": "chain", "count": 1 } ] },
"flags": [ "TRANSPARENT", "BUTCHER_EQ" ]
},
{
"type": "furniture",
"id": "f_fake_bench_hands",
Expand Down Expand Up @@ -6631,5 +6643,56 @@
"items": [ { "item": "steel_chunk", "count": [ 5, 10 ] } ]
},
"flags": [ "TRANSPARENT", "MOUNTABLE", "SHORT" ]
},
{
"type": "furniture",
"id": "f_speaker_cabinet",
"name": "speaker cabinet",
"description": "A cabinet loaded with 12-inch speakers, intended to help make various things loud. It can't serve its original purpose these days, but it could be disassembled for various electronic parts.",
"symbol": "7",
"color": "blue",
"move_cost_mod": -1,
"coverage": 50,
"max_volume": 15,
"required_str": 7,
"flags": [ "TRANSPARENT", "FLAMMABLE", "PLACE_ITEM" ],
"deconstruct": {
"items": [
{ "item": "scrap", "count": [ 4, 6 ] },
{ "item": "e_scrap", "count": [ 1, 2 ] },
{ "item": "plastic_chunk", "count": [ 0, 2 ] },
{ "item": "wood_panel", "count": 1 },
{ "item": "2x4", "count": 4 },
{ "item": "nail", "charges": [ 8, 10 ] },
{ "item": "cable", "charges": [ 3, 4 ] }
]
},
"bash": {
"str_min": 8,
"str_max": 20,
"sound": "smash!",
"sound_fail": "whump!",
"items": [
{ "item": "splinter", "count": [ 0, 6 ] },
{ "item": "scrap", "count": [ 0, 3 ] },
{ "item": "2x4", "count": [ 1, 2 ] },
{ "item": "nail", "charges": [ 2, 6 ] },
{ "item": "cable", "charges": [ 1, 3 ] },
{ "item": "e_scrap", "prob": 25 },
{ "item": "plastic_chunk", "count": [ 0, 1 ] }
]
}
},
{
"type": "furniture",
"id": "f_no_item",
"//": "This is used in a hack to clear furniture with the keg iexamine of all items execept the stored liquid before usage.",
"name": "seeing this is a bug",
"description": "Seeing this is a bug. If seen, please report and destroy.",
"symbol": "#",
"color": "black",
"move_cost_mod": 2,
"required_str": -1,
"flags": [ "NOITEM" ]
}
]
Loading

0 comments on commit 64b0ae1

Please sign in to comment.