Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: morale bonus for items eaten cold #3394

Closed
wants to merge 171 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
171 commits
Select commit Hold shift + click to select a range
a12b47e
Temp commit, now with compiling
joveeater Dec 3, 2022
ad0ef91
More refactoring
joveeater Feb 23, 2023
454ca13
vehicles fix
joveeater Mar 10, 2023
24b3ddd
More bugfixes and the start of the test suite
joveeater Mar 20, 2023
16e53ef
Merge branch 'upload' into spring-refactor
joveeater Mar 29, 2023
2380410
Merge branch 'upload' into spring-refactor
joveeater Mar 29, 2023
944cc0f
More bugfixes
joveeater Mar 30, 2023
a2b39d7
More bugfixes
joveeater Mar 30, 2023
d60311c
Beginning of better types
joveeater Apr 4, 2023
6b70aa5
More new stuff, no compiling
joveeater Apr 7, 2023
7510577
More moving to smart pointers
joveeater Apr 10, 2023
713af91
Bit more
joveeater Apr 10, 2023
0da8198
More more more
joveeater Apr 23, 2023
1110027
MOAR
joveeater Apr 25, 2023
5d5897a
More
joveeater Apr 25, 2023
6bcf8eb
even more
joveeater Apr 27, 2023
60c2393
style: typo `item_spawn` -> `item::spawn`
scarf005 Apr 27, 2023
50518b2
style: remove unnecessary `std::move`, use `->` for activity
scarf005 Apr 27, 2023
3553401
fix: legacy null item reference
scarf005 Apr 27, 2023
0b12953
docs: return type of reduce_charges
scarf005 Apr 27, 2023
18112e1
style: astyle
scarf005 Apr 27, 2023
bcfe831
Merge pull request #1 from scarf005/copy-elision
joveeater Apr 27, 2023
767c545
Now with compiling
joveeater May 5, 2023
189100b
More fixes
joveeater May 5, 2023
0209ed3
More fixes
joveeater May 6, 2023
6d6a28f
Pre-merge commit, fairly stable now
joveeater May 7, 2023
4bd3a36
Round out interfaces
joveeater May 7, 2023
c82307f
All merged up
joveeater May 7, 2023
8c1c36a
Better vehicles and cleanup
joveeater May 7, 2023
cd3aa3d
Remove traces and better destruction
joveeater May 7, 2023
c5ea05a
Attempt to appease gcc with vectors
joveeater May 7, 2023
4b624a5
Pretty sure this wasn't me but ok
joveeater May 7, 2023
b9c775c
ty clang tidy
joveeater May 7, 2023
a40f45f
Oh yeah sounds exist
joveeater May 7, 2023
f0b724c
bug fix
joveeater May 8, 2023
74a2366
More merging
joveeater May 8, 2023
7138c39
Remove unused overmap constructors as they fail on some compilers
joveeater May 8, 2023
0fe91b6
Backwards compat
joveeater May 8, 2023
23d1af1
Test suite compiles now
joveeater May 9, 2023
1567f4a
MOAR
joveeater May 15, 2023
2225190
More more more
joveeater May 16, 2023
e9f6c96
Test suite passes
joveeater May 18, 2023
075d984
Merge branch 'upload' into spring-refactor
joveeater May 18, 2023
0a196b6
Bad move
joveeater May 18, 2023
9514ef2
Fix missing super character constructors
joveeater May 18, 2023
0e55826
Update init.cpp
joveeater May 18, 2023
5490d6c
Update src/init.cpp
joveeater May 18, 2023
a3018d2
Update src/init.cpp
joveeater May 18, 2023
a1d4fdc
Update init.cpp
joveeater May 18, 2023
f6fef39
Merge remote-tracking branch 'upstream/deferred-loading-ub' into spri…
joveeater May 18, 2023
94efd3b
Remove unused stuff
joveeater May 18, 2023
a1a6935
And the missed use
joveeater May 18, 2023
23c81f8
Remove execinfo.h
joveeater May 18, 2023
c320530
Bugs
joveeater May 19, 2023
4c6c5f2
Fix map rotation
joveeater May 19, 2023
d6f27b0
Fix failed wrecks
joveeater May 19, 2023
582bf36
More bugfixes
joveeater May 20, 2023
964b03b
Various bugs
joveeater May 20, 2023
5cf4e29
Merge branch 'upload' into spring-refactor
joveeater May 20, 2023
3b1678f
More bugfixes
joveeater May 20, 2023
312d122
Fix disassembly
joveeater May 20, 2023
ae159f1
Fix dead removals
joveeater May 21, 2023
d42f9c5
Back to late delete for now
joveeater May 21, 2023
7775c98
Missing property in constructor
joveeater May 21, 2023
4ed4d17
Activity fix
joveeater May 21, 2023
a05a51c
More safety
joveeater May 21, 2023
fe65d83
style: format with code blocks
scarf005 May 22, 2023
e2708b5
ups
joveeater May 22, 2023
d2017f1
Merge branch 'upload' into spring-refactor
joveeater May 22, 2023
d7ce52f
Update crafting.cpp
joveeater May 22, 2023
72dcc85
More fixes
joveeater May 22, 2023
a57239f
More fixes
joveeater May 23, 2023
b319e78
Forgot to add a file
joveeater May 23, 2023
3e5ccaa
Fix rotation offsets
joveeater May 23, 2023
6fcf9f8
Merge pull request #3 from scarf005/game-objects-docs
joveeater May 24, 2023
64bccc0
Appease gcc
joveeater May 24, 2023
f856c69
Fixup android
joveeater May 24, 2023
7b8782f
minor fixes
joveeater May 24, 2023
eb44b19
weapon charges fix
joveeater May 25, 2023
bddeec4
Fix monsters
joveeater May 26, 2023
fe9fe2f
Remove old rotation offsets
joveeater May 26, 2023
fc8daca
Fixes
joveeater May 26, 2023
d222b27
minor safety, needs investigating
joveeater Jun 3, 2023
3292b58
Merge branch 'upload' into spring-refactor
joveeater Jun 20, 2023
6689a63
Merge branch 'upload' into spring-refactor, not done yet
joveeater Jul 14, 2023
cbb5bfd
Merge branch 'upload' into spring-refactor
joveeater Jul 15, 2023
c107a27
Fixes
joveeater Jul 18, 2023
7fd408d
Merge branch 'upload' into spring-refactor
joveeater Jul 19, 2023
cc3137b
cleanup
joveeater Jul 19, 2023
daaffe1
pch fix and more cleanup
joveeater Jul 19, 2023
10d1eeb
Merge branch 'upload' into spring-refactor
scarf005 Jul 20, 2023
1dc2409
Merge branch 'upload' into spring-refactor
joveeater Jul 20, 2023
867f96e
merge
joveeater Jul 21, 2023
152c389
Fix msvc
joveeater Jul 21, 2023
b26ea16
Fix spacing, remove unused includes
olanti-p Jul 23, 2023
a4e599f
Remove npc.h include from locations.h
olanti-p Jul 23, 2023
fc35e9a
Remove leftovers from item_location
olanti-p Jul 23, 2023
b5c73b7
Remove old commented code
olanti-p Jul 23, 2023
2d07409
Remove player_activity.h from json.h
olanti-p Jul 23, 2023
97054bb
Split off activity_ptr into its own header
olanti-p Jul 23, 2023
8bf8a5d
Fix typos
olanti-p Jul 23, 2023
cf2510f
Remove commented out or dead code
olanti-p Jul 23, 2023
8edf510
Fix tidy warnings
olanti-p Jul 23, 2023
1e92947
Remove colony from update-pch.sh
joveeater Jul 24, 2023
2f1bc14
Merge pull request #4 from olanti-p/item-identity-23-07-2023
joveeater Jul 24, 2023
c2f88d3
Merge remote-tracking branch 'origin/spring-refactor' into spring-ref…
joveeater Jul 24, 2023
fddf2c5
Hopefully this fixes the compile
joveeater Jul 24, 2023
945a5fe
build fixes
joveeater Jul 25, 2023
1c9190d
Wrap long comments
olanti-p Jul 25, 2023
1ada61e
Fix typo
olanti-p Jul 25, 2023
29acbc7
Delete submodule
olanti-p Jul 25, 2023
1d0205f
Alternative build fix
olanti-p Jul 25, 2023
8118233
Fix dereferencing nullptr
olanti-p Jul 25, 2023
05249cf
Remove extra space
olanti-p Jul 25, 2023
3e7373d
Remove dead code
olanti-p Jul 25, 2023
277c068
Update src/detached_ptr.cpp
joveeater Jul 25, 2023
1f3dbe1
Update src/activity_actor.cpp
joveeater Jul 25, 2023
000c5a0
Update src/active_tile_data.cpp
joveeater Jul 25, 2023
afc06ac
Update src/handle_liquid.h
joveeater Jul 25, 2023
cb6ee3a
Merge pull request #5 from olanti-p/item-identity-25-07-2023
joveeater Jul 25, 2023
82fbdab
Update src/active_tile_data.cpp
joveeater Jul 25, 2023
b1075e7
Fix takeoff deleting items
joveeater Jul 25, 2023
f76b178
Fixes
joveeater Jul 25, 2023
1f67b88
Liquid fix
joveeater Jul 26, 2023
a1e2bdd
Fix book crash
joveeater Jul 26, 2023
7c0f646
fix holsters
joveeater Jul 26, 2023
ba4e860
Merge branch 'upload' into spring-refactor
joveeater Aug 10, 2023
91d2a78
missed a spot
joveeater Aug 10, 2023
360d121
Merge branch 'upload' into spring-refactor
joveeater Aug 16, 2023
5c371ed
Merge remote-tracking branch 'upstream/upload' into spring-refactor
scarf005 Aug 29, 2023
8b574d4
fix: make it compile
scarf005 Aug 29, 2023
0f04a09
Merge branch 'upload' into spring-refactor
joveeater Sep 11, 2023
1e4f856
Merge branch 'spring-lua' into spring-refactor
joveeater Sep 11, 2023
b06506d
Mess with lua iterators
joveeater Sep 12, 2023
2d1b37f
Merge remote-tracking branch 'upstream/upload' into spring-refactor
scarf005 Sep 23, 2023
09d3f4d
Fixes
joveeater Sep 23, 2023
5531a5a
Merge branch 'spring-refactor' into spring-0.4
scarf005 Sep 23, 2023
3a344ae
fix: iexamine_elevator
scarf005 Sep 23, 2023
6fc592a
fix: `vehicle_part.h` headers
scarf005 Sep 23, 2023
7d94ff7
fix: salvage by weight PR
scarf005 Sep 23, 2023
6d85c7a
docs: game objects
scarf005 Sep 23, 2023
0aee3c8
fix: salvage test
scarf005 Sep 23, 2023
a3b3b47
Merge remote-tracking branch 'upstream/upload' into spring-0.4
scarf005 Sep 23, 2023
d1d29c4
Merge pull request #7 from scarf005/spring-0.4
joveeater Sep 23, 2023
f87a168
style(autofix.ci): automated formatting
autofix-ci[bot] Sep 23, 2023
e6eb11a
submap rotate fixes
joveeater Sep 26, 2023
e5110a6
Merge remote-tracking branch 'origin/spring-refactor' into spring-ref…
joveeater Sep 26, 2023
e9a4cc5
Shouldn't use uint
joveeater Sep 27, 2023
bee0ad4
Merge branch 'upload' into spring-refactor
joveeater Sep 27, 2023
f6d0256
And the rest
joveeater Sep 27, 2023
59afa89
Merge branch 'upload' into spring-refactor
joveeater Sep 28, 2023
c25aa04
Merge branch 'upload' into spring-refactor
joveeater Sep 29, 2023
30cd47a
Fix destroyed things being processed
joveeater Sep 30, 2023
9dfd4c8
Fix armor relayering
joveeater Sep 30, 2023
76b1b4f
Merge branch 'upload' into spring-refactor
joveeater Sep 30, 2023
e519498
Merge branch 'upload' into spring-refactor
joveeater Oct 6, 2023
e0dc0bb
Merge branch 'upload' into spring-refactor
joveeater Oct 7, 2023
0b4b6a5
Merge branch 'upload' into spring-refactor
joveeater Oct 8, 2023
b360544
fix gcc
joveeater Oct 8, 2023
c3fc753
style(autofix.ci): automated formatting
autofix-ci[bot] Oct 8, 2023
edbf095
Fix filthy clothes
joveeater Oct 8, 2023
283f7b4
Merge branch 'upload' into spring-refactor
joveeater Oct 8, 2023
9ef4863
refactor: trailing return goes brrrrr
scarf005 Oct 4, 2023
5a173ee
refactor: apply clang-tidy suggestions
scarf005 Oct 4, 2023
afe72e5
perf: remove obsoleted colony tests
scarf005 Oct 5, 2023
2401cf2
perf: remove flag usage for temperature display
scarf005 Oct 8, 2023
2586412
perf: apply all clang-tidy performance fixes
scarf005 Oct 8, 2023
0d48dd8
perf: use `emplace_back`
scarf005 Oct 8, 2023
a108281
fix: position loopback segfaulting
scarf005 Oct 4, 2023
5f18e01
fix: keep location info on `attempt_detach`
scarf005 Oct 8, 2023
027234c
feat: give morale bonus for items `EATEN_COLD`
scarf005 Oct 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 0 additions & 2 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Terminus Font (data/font/terminus.ttf) is licensed under the SIL Open Font Licen

CATCH unit-test framework (tests/catch/catch.hpp) is licensed under the Boost Software License. Visit https://github.com/philsquared/Catch/blob/master/LICENSE.txt to read the license.

PLF List and PLF Colony (src/list.h, src/colony.h) are licensed under the zLib license (https://www.zlib.net/zlib_license.html).

getpost (tools/json_tools/format/getpost.h) is licensed under the MIT license, see file for text of license.

Lua (src/lua/*) is licensed under the MIT license, see src_lua/LICENSE.md for text of license.
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/comestibles/frozen.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"//": "not technically a drink, but is quasi-liquid enough that it'd get all over everything if you carried it",
"charges": 2,
"vitamins": [ [ "vitA", 9 ], [ "calcium", 9 ], [ "vitB", 11 ] ],
"flags": [ "MELTS" ]
"flags": [ "MELTS", "EATEN_COLD" ]
},
{
"type": "COMESTIBLE",
Expand Down
10 changes: 10 additions & 0 deletions data/json/morale_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
"type": "morale_type",
"text": "Enjoyed a hot meal"
},
{
"id": "morale_food_cold",
"type": "morale_type",
"text": "Enjoyed a cold treat"
},
{
"id": "morale_food_very_cold",
"type": "morale_type",
"text": "Enjoyed an icy treat"
},
{
"id": "morale_chat",
"type": "morale_type",
Expand Down
70 changes: 70 additions & 0 deletions doc/GAME_OBJECTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Game Objects

Many of the things that physically exist within the game world are **game objects(GO)**. Currently
this only covers items, but creatures and vehicles are coming soon and then probably furniture at
some point. GOs have a small common interface with methods like name and position that you can find
in [`game_object.h`](../src/game_object.h). GOs use private constructors, this means **your
variables must always be references or pointers**. Trying to assign a variable without a layer of
indirection like that will cause a compile error. Likewise trying to copy one object over another
will cause a similar error.

```c++
item& it_ref = ...; // Good
item* it_pointer; // Good

item it = ...; // Compile error
it_ref = other; // Compile error
*it_pointer = other; // Compile error
```

New GOs can be created via `::spawn` static methods that return a `detached_ptr` to the newly
created game object. A `detached_ptr` represents an object that does not currently exist in the game
world. There can only be one `detached_ptr` to an object at a time (those who know
[`std::unique_ptr`](https://en.cppreference.com/w/cpp/memory/unique_ptr) will be familiar with this
behavior). Functions that add an object to the world will require that you `std::move` in a
`detached_ptr`. In general `detached_ptr`s must be `std::move`'d when they're passed into a
function. Note that you should never use any variable after it has been moved. Likewise functions
that remove an object from the world will return a `detached_ptr`. This ensures that you can't add
the same thing to the world twice.

Functions that don't add things to the world just accept normal pointers. You can turn a
`detached_ptr` into a normal pointer by doing this. Note that you can use this to keep a valid
pointer to something even after you `std::move` it, but you must do this before the `std::move`
happens.

```c++
&*detached
```

And you can go the other way using this. Though note that it removes the object from the game world
in the process and will cause errors if called on an object that isn't in the game world.

```c++
detached_ptr<item> as_detached=normal_ptr->detach();
```

Trying to access an invalid `detached_ptr` (for instance one that has been `std::move`'d from) will
cause a debugmsg and give you the null version of that object.

## Safe References

Game objects support safe references. `safe_reference<item>` will refuse access to an object that
has been destroyed or is outside of the reality bubble without losing track of it, and they can be
saved and loaded. You must check them as a boolean (e.g. `if( ref )`) to see if they're valid.
Trying to access them when they're not will cause debugmsgs and give you a null object instead. They
have a small interface that lets you check if they're destroyed or unloaded etc. If they were
destroyed or unloaded this turn, they have a method that will allow you to access the object in a
const fashion, for instance to display an error message.

If you're moving objects around you need to use `detached_ptr`s, but otherwise when choosing which
reference to use the most important thing to consider is how long you want to hold onto it. If
you're just using something temporarily, for instance most arguments and variables, you should use a
normal reference or pointer. If you need to store it for longer you should use a safe reference and
this means it can be easily stored in the save file. In the rare case that you do want to save it
across turns but don't want to store it in the save file, which means caches, there's also a fast
`cache_reference<item>`, which does last across turns but can't be saved.

Game objects can sometimes be split into pieces or merged together. Item stacks are the main example
of this but there are others like vehicles being split or dissoluted devourers merging. When a stack
of items is split, the stack that stays in place is the one that safe references will follow. When
they are merged safe references to either half of the merge will now point to the merge result.
71 changes: 71 additions & 0 deletions doc/src/content/docs/en/dev/explanation/game_objects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: Game Objects
---

Many of the things that physically exist within the game world are **game objects(GO)**. Currently
this only covers items, but creatures and vehicles are coming soon and then probably furniture at
some point. GOs have a small common interface with methods like name and position that you can find
in `game_object.h`. GOs use private constructors, this means **your variables must always be
references or pointers**. Trying to assign a variable without a layer of indirection like that will
cause a compile error. Likewise trying to copy one object over another will cause a similar error.

```cpp
item& it_ref = ...; // Good
item* it_pointer; // Good

item it = ...; // Compile error
it_ref = other; // Compile error
*it_pointer = other; // Compile error
```

New GOs can be created via `::spawn` static methods that return a `detached_ptr` to the newly
created game object. A `detached_ptr` represents an object that does not currently exist in the game
world. There can only be one `detached_ptr` to an object at a time (those who know
[`std::unique_ptr`](https://en.cppreference.com/w/cpp/memory/unique_ptr) will be familiar with this
behavior). Functions that add an object to the world will require that you `std::move` in a
`detached_ptr`. In general `detached_ptr`s must be `std::move`'d when they're passed into a
function. Note that you should never use any variable after it has been moved. Likewise functions
that remove an object from the world will return a `detached_ptr`. This ensures that you can't add
the same thing to the world twice.

Functions that don't add things to the world just accept normal pointers. You can turn a
`detached_ptr` into a normal pointer by doing this. Note that you can use this to keep a valid
pointer to something even after you `std::move` it, but you must do this before the `std::move`
happens.

```cpp
&*detached
```

And you can go the other way using this. Though note that it removes the object from the game world
in the process and will cause errors if called on an object that isn't in the game world.

```cpp
detached_ptr<item> as_detached = normal_ptr->detach();
```

Trying to access an invalid `detached_ptr` (for instance one that has been `std::move`'d from) will
cause a debugmsg and give you the null version of that object.

## Safe References

Game objects support safe references. `safe_reference<item>` will refuse access to an object that
has been destroyed or is outside of the reality bubble without losing track of it, and they can be
saved and loaded. You must check them as a boolean (e.g. `if( ref )`) to see if they're valid.
Trying to access them when they're not will cause debugmsgs and give you a null object instead. They
have a small interface that lets you check if they're destroyed or unloaded etc. If they were
destroyed or unloaded this turn, they have a method that will allow you to access the object in a
const fashion, for instance to display an error message.

If you're moving objects around you need to use `detached_ptr`s, but otherwise when choosing which
reference to use the most important thing to consider is how long you want to hold onto it. If
you're just using something temporarily, for instance most arguments and variables, you should use a
normal reference or pointer. If you need to store it for longer you should use a safe reference and
this means it can be easily stored in the save file. In the rare case that you do want to save it
across turns but don't want to store it in the save file, which means caches, there's also a fast
`cache_reference<item>`, which does last across turns but can't be saved.

Game objects can sometimes be split into pieces or merged together. Item stacks are the main example
of this but there are others like vehicles being split or dissoluted devourers merging. When a stack
of items is split, the stack that stays in place is the one that safe references will follow. When
they are merged safe references to either half of the merge will now point to the merge result.
18 changes: 18 additions & 0 deletions doc/src/content/docs/en/dev/guides/items.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: Items Cookbook
---

Here are some common tasks that you might want to do with items.
[For more on item(game objects), check here.](../explanation/game_objects.md)

## Moving items from one tripoint to another

```cpp
auto move_item( map &here, const tripoint &src, const tripoint &dest ) -> void
{
map_stack items_src = here.i_at( src );
map_stack items_dest = here.i_at( dest );

items_src.move_all_to( &items_dest );
}
```
1 change: 0 additions & 1 deletion msvc-full-features/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
#include <vector>

#include "../src/platform_win.h"
#include "../src/colony.h"

#if defined(TILES)
# if defined(_MSC_VER) && defined(USE_VCPKG)
Expand Down
1 change: 0 additions & 1 deletion pch/main-pch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,3 @@
#include <unordered_set>
#include <utility>
#include <vector>
#include "../src/colony.h"
4 changes: 2 additions & 2 deletions src/achievement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ void achievement::add_kill_requirements( const JsonObject &jo, const std::string
}
}

void achievement::add_kill_requirement( const JsonObject inner, const std::string & )
void achievement::add_kill_requirement( const JsonObject &inner, const std::string & )
{
if( inner.has_string( "monster" ) && inner.has_string( "species" ) ) {
inner.throw_error( "Cannot have both id and species identifiers" );
Expand Down Expand Up @@ -268,7 +268,7 @@ void achievement::add_skill_requirements( const JsonObject &jo, const std::strin
}
}

void achievement::add_skill_requirement( const JsonObject inner, const std::string & )
void achievement::add_skill_requirement( const JsonObject &inner, const std::string & )
{
const skill_id skill = static_cast<skill_id>( inner.get_string( "skill" ) );
const achievement_comparison compare = inner.get_enum_value<achievement_comparison>( "is" );
Expand Down
4 changes: 2 additions & 2 deletions src/achievement.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ class achievement
/** Retrieves kill requirement JsonObjects and feeds it to add_skill_requirement*/
void add_kill_requirements( const JsonObject &jo, const std::string &src );
/** Organizes variables provided and adds kill_requirements to achievements*/
void add_kill_requirement( const JsonObject inner, const std::string &src );
void add_kill_requirement( const JsonObject &inner, const std::string &src );
/** Retrieves skill requirement JsonObjects and feeds it to add_skill_requirement*/
void add_skill_requirements( const JsonObject &jo, const std::string &src );
/** Organizes variables provided and adds skill_requirements to achievements*/
void add_skill_requirement( const JsonObject inner, const std::string &src );
void add_skill_requirement( const JsonObject &inner, const std::string &src );
};

template<>
Expand Down
6 changes: 3 additions & 3 deletions src/action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,12 +562,12 @@ bool can_butcher_at( const tripoint &p )
bool has_corpse = false;

const inventory &crafting_inv = you.crafting_inventory();
for( item &items_it : items ) {
if( items_it.is_corpse() ) {
for( item *&items_it : items ) {
if( items_it->is_corpse() ) {
if( factor != INT_MIN || factorD != INT_MIN ) {
has_corpse = true;
}
} else if( crafting::can_disassemble( you, items_it, crafting_inv ).success() ) {
} else if( crafting::can_disassemble( you, *items_it, crafting_inv ).success() ) {
has_item = true;
}
}
Expand Down
Loading
Loading