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

check emptiness (CleverRaven#36705) #40

Merged
merged 36 commits into from
Jan 5, 2020

Conversation

fengjixuchui
Copy link
Owner

Summary

Purpose of change

Describe the solution

Describe alternatives you've considered

Testing

Additional context

BevapDin and others added 30 commits January 3, 2020 19:32
The problem is within `convert_to_items`. It has code that converts an item pointer to a stack of items in the main inventory (e.g. 100 flyers) into multiple pointers, each to a different item within that stack.

E.g. when the dropping is started, the user has selected the stack of 100 flyers and a count of 100. This is a **single** pair of information added to the activity: the pointer to the first item of the stack and the number 100.

`convert_to_items` converts that into 100 `act_item` instances (each contains a pointer to a different item within that stack of flyers, a move cost, and a count of 1 for each instance).

This is later given to the actual dropping code, which works fine for now, it drops the first item of that stack.

But at the end of the dropping code (after dropping one item), the remaining values used to be converted back into item position and count values (two integers) in order to store them in the activity to resume this upon the next turn.

This was done in `convert_to_locations` (the other overload), which used to look up the item position and merge the multiple instance that all pointed to the same item position (again: **old** code). The new code only compares the `item_location`, which compares the actual item pointers. Those don't match (one points to the first item in the stack, the next one to the second item in the stack and so on).

So the pairs are not merged back into a single item position and count pair.

Now the activity contains 99 instance of items to be dropped.

Upon loading those the next time, they go through `convert_to_items`, which gets their item position and creates **new** `item_location` instances, but because the count for each of those items is 1, they all point to the first item in the stack (caused by the loop over the item stack in `convert_to_items` (the loop there over `p.inv.const_stack` only visits the first one, after visiting that one `obtained` is 1, as is `count`).

Now the code drops the first of those items. But this invalidates all the remaining instances (remember: they all point to the same item!) and so dropping stops and no more items are stored for dropping next time.
* renovate house 04

* add palette, update rows to new symbols

* lint

* review fixes

* update palette name, minor loot adjustments

* Apply suggestions from code review

Co-Authored-By: I-am-Erk <[email protected]>

Co-authored-by: I-am-Erk <[email protected]>
Routine i18n updates on 4 Jan 2019
As it turns out, the check to prevent integer overflow when modifying
bionic power is undefined behaviour. Whoops! Let's avoid that.
Due to the way range of vision was calculated, when the player had high
eye encumbrance, it could become negative and prevent the player from
seeing anything, including their own tile.
The player should never be unable to tell where they are, even if they
cannot see anything else, so prevent range from becoming less than 1.
* Don't excessively clear map

* shift player and chasing monster positions instead of shifting map
Prevent undefined behaviour modifying bionic power
Prevent high eye encumbrance from blinding players
Add an option to start the game window maximized
This was changed in 5c96d39.

This is inconsistent behavior anyway: byproducts are still put onto the crafting spot, only the real result go below the player.
see comment for an explanation.
* Fix monsters not being spawned on the map

* Move some checks back to their place
* Add construction recipe to turn shallow water to dirt.

Apparently, no one has done this before, and I really need to tame those swamps.

As my first project, please do check everything is ok.

* Update data/json/construction.json

thanks

Co-Authored-By: I-am-Erk <[email protected]>

* filling shallow water now requires less materials

* Works with non-salt water now

* Hopefully it will work now

* Divided salt water and shallow water in two projects

Apparently I'm not skilled enough to properly format my pull requests, and the rest of the construction options aren't helping me find out how to do it.

The good thing is that now you'll know which kind of shallow water you are going to refill, thus making them harder to mix up.

* Update construction.json

* Update data/json/construction.json

Co-Authored-By: I-am-Erk <[email protected]>

Co-authored-by: I-am-Erk <[email protected]>
* Cooking with Poison

Cauldron, recipe for the tool, tool quality, recipe book, itemgroup addition and recipes for the Cooking with Poison book.

* Update tools.json

* Update magic_tools.json

* Update magic_tools.json

* Update recipe_books.json

linting

* Update tools.json

* Update tools.json

* fixing travis errors

* linting

* Changes from playtesting

descriptions to reflect that impure meat can be enjoyed while purified meat still seems to taste off.

* Update cooking_components.json

* Update comestibles.json

* reverse skills used cooking primary
Restore crafting results being put on the workbench.
davidpwbrown and others added 6 commits January 5, 2020 00:55
When items did not have a recipe, the difficulty for repairing them was
set to 10. For some items, such as scarves, this made repairing the
activated versions of them much more difficult than repairing the
non-activated versions. Now, they can have a 'repairs_like' specified,
and if they do not have a recipe, they will use the recipe of that item
instead.
…ving staircases (#36702)

* stop ant tunnels stomping over other map terrain underground
* also add check to adjacent loop
Attempting to attack with very large items could lead to move
starvation, where the player would spend several turns doing nothing but
attacking.
Additionally, attacking with large items made of glass could break your
arms because the damage from breaking glass items is due to volume.

Prevent counter-attacking with items made of glass, because this can
break them, where the player may not want this to occur.

Prevent attacking with items than take more than 10 turns to attack
with, to prevent the move starvation bug.
@fengjixuchui fengjixuchui merged commit e880e80 into fengjixuchui:master Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.