- Swap std::set<flag_id> for cata::flat_set<flag_id>
- Update FlagsSetType in item, itype, and pocket_data
- Replace emplace with insert on tag caches
- Adjust bionics_test cast to std::set<json_character_flag>
* Remove unused `plug_in` iuse declaration
* Simplify `has_loose_end` calculation
* Make `get_remote_part` use vpart_reference
* Rename set_link_traits to update_link_traits
* Adds link_to to simplify link initialization
Also reorders many link-related lines for consistency/readability
* Rename "s_vp" to "sel_vp
* Use rl_dist for length check on connection
* Move app connection code into link_to
* Move `has_state` functions out of the link struct
This lets them be used on items without an active link without segfaulting
* Rename t_veh_safe to t_veh & s/t_state to source/target
These names have bothered me for a while. t_abs_pos and s_bub_pos are also wordy but at least provide important distinction.
* Make link a private variable safely accessed via link()
* Add force_reset_link, which ignores the unspooling threshold
* Make the respool threshold a static const
* Clean up extension cable inventory filter
* Use a variable to reduce link() calls in link_up_actor::use
* Add comments to new link functions
* Remove unnecessary checks of both can_link_up and has_link_data
* Move valid connection checks into link_to
* Adds link_name function for getting cable names
Used to reduce code repitition in choosing between, for ex., "cable" and "smart phone's cable". Should make it easy to expand if the link system ever gets used for anything other than an electrical cable in the future.
* Edit process_link's length checks for clarity
* Minor comment change
* Change force_reset_link into a parameter of reset_link
* Fix links breaking in saves from old versions
Sadly this means giving up on the nicely-ordered groups in the link_state enum. Should've given each group a set start value, past-version-of-me!
* Unused lambda
* Fix CBM cable links
* Unused variables
* clang tidy
* Convert integer parsing test to use normal TEST_CASEs
* Rename test name too similar to another
* Test to enforce normalized test names
* Normalize TEST_CASE names (scripted)
* Restore map's abs_sub after map_coordinate_conversion_functions
./tests/cata_test "map_coordinate_conversion_functions","Mattack dialog condition test"
* Rewind time in biometrics tests
./tests/cata_test "basal metabolic rate with various size and metabolism","mutations may affect character metabolic rate"
* Don't place avatar on invalid zlevels
./tests/cata_test "npc_compare_int","npc_can_target_player"
./tests/cata_test "npc_arithmetic","npc_can_target_player"
* Martial art test should clear map
./tests/cata_test "walls should connect to walls as end pieces","Martial art technique conditionals"
* Clear map in turrets test
./tests/cata_test "vehicle_ramp_test_61","vehicle_turret"
* Clear map in gun repair test
./tests/cata_test "cube_direction_add_om_direction","Gun repair with degradation"
* Fix bionic test order dependency
./tests/cata_test "fueled bionics"
* Build light cache in player_activities_test
./tests/cata_test "grenade_lethality_scaling_with_size","activity interruption by distractions"
* Clear map in pockets test
./tests/cata_test "character should lose moves when opening or closing doors or windows","multipocket liquid transfer test"
* Make explicit flag for crafting cache invalidation
* Clear more avatar fields
* Clear time in weary_recovery
./tests/cata_test craft_available_via_vehicle_rig,vision_see_wall_in_moonlight,vision_moncam_basic,weary_recovery
* Move power cord from appliances to cables; rename POWER_CORD flag to AUTO_CABLE
* Add message when attaching extension cord
* Fix shift() calling actualize too early
* Remove unnecessary variable
* Use variable for has_item; spacing
* Change ordering in preparation
* Reel in disconnected cables when picking them up again
* Add CABLE pocket type
* Add device power cord
* Add PLUG_IN action to laptop
* Rewrote process_cable to allow cables to stay active outside player inventory
* Have device plugged into electrical grid gain battery charge
* Revamp finding active cables for processing, instead find via plugged in devices. Much more CPU efficient.
* Reset cable max charges read variable
* Add variables for cable charge inverval and efficiency
* Add a warning when a carried cable is stretched to its limit
* Change plug_in from iuse to an iuse_actor
* Adjust cable messages
* Add const version of cables()
* get_cable_target() use const p to be usable in more places
* Add ammo_sufficient() overload that checks connected electrical grid, use in invoke_item
* ammo_consume draw power from connected grid
* Calculate charge interval by wattage
* astyle
* Make cable length more intuitive
* Lowered plug in movecost
* Fix cable reference
* Add TODO
* Adjust cable CBM message wording
* Change all cable state names to be more descriptive
* Reuse plugged in tag
* Don't collate plugged in items
* Don't spill cable pockets
* Update lit laptop's cable wattage
* Copy EBOOK pocket for CABLE pocket
* Add CABLE_PORTS tag for vehicle parts that should accept cable connections
* Add unplug functionality
* Create cable_link struct for containing information about cable links. Replaces get_cable_target and most of the cable item variables
* Remove cables properly via container processing
* Improve feedback for plug in action, such as highlighting valid tiles
* Remove bracket I missed
* Plug in item before processing it
* Update cable connection points when their connected vehicle moves
* Truncation
* Replace remaining cable variable usage
* Only give loose cable alert once
* If a cable exists already, use it to plug in
* Rename wattage to charge_rate, adjust jo loading
* Move cable reference addition after everything
* Cable link power draw
* Include tool power draw
* Cable debug message
* Reuse variable
* Move cable_link state to top
* Item active power draw
* Add a "check links" bool to ammo_remaining to ensure the inclusion of cabled ammo only affects functions we want it to
* Moved cable_state enum to enums.h/item_factory and adjusted it
* Serialization of cable variables
* Move cable handling from vehicles to the map; made cable loading more robust
* Add vehicle item processing to actualize, so cables inside vehicles don't break when entering the reality bubble
* Add TODO
* Add debug_mode check
* Move max length to cable struct for optimization
* Missing std namespace
* Only process cables when they're fully in bounds
* Serialize max_length
* Make Minimum cable slack 0 instead of 1
* Disable spooling time for now
* Use absolute charge_rate for interval
* Move remaining cable item vars to the struct
* Moved linked battery charging to its own function; improved efficiency by checking interval early; added negative power draw functionality to allow charging vehicles with linked items
* Add warning about cables longer than the reality bubble
* Rename AUTO_CABLE to AUTO_DELETE_CABLE - better name for what it is; replace some uses of it to use CABLE_SPOOL instead
* astyle
* Unified cable language, all cable items are "cable" and connecting them "link"
* Documentation for link up action
* Add some more error messages
* Use label instead of tname to stop incongruous messages like "device (plugged in) has become disconnected!"
* More info
* JSON lint
* Tag rename in tests
* Added smartphone cable again
* Update part function
* Simplify setup link
* Add time processing to battery drain; will now only drain once a turn, and will drain extra for time spent outside reality bubble
* Add safe_reference functionality to vehicle
* Fix charge_linked_batteries to return consistent charge values in spite of staggered charge timing
* BIG rewrite, focused on simplification, optimization, and adding comments to everything.
* More documentation.
* astyle
* Made debug cable even longer, since cables can now be longer than the reality bubble. Added "debug" to name to make it easier to find for testing
* Rebase fixes
* Moved cables.json from \vehicle to \tool
* AUTO_DELETE_CABLE doc
* std::optional update
* nullptr parent_item check
* net_battery_charge_rate always add cable link power
* Use vehicle pointers for cable power transfer
* remove comment
* Update src/iuse_actor.cpp
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Remove prev_state since it's unused
* Make link data use value_ptr
* Set vehicle pointer on load
* Move link debugmsg to reset_cable
* Move turns elapsed into the parent_item section since nothing else uses it
* Only initialize link when needed
* Also exit active cable early with no_attachments
* Unified all cable use functions; split cable state in two for each side of the link; renamed some things
* Made tow cables not disconnect when unrelated parts are removed
* Process solarpacks like the UPS
* Don't allow linking already linked vehicles
* Add valid vp check to cables
* Apply suggestions from code review
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Fix test types
* Separating && statement
* Add reeling activity for long disconnected cables
* Better info for cable action description
* Rebase cleanup
* Refining documentation
* Split vehicle connections between dashboard ports and battery; jumper cables only attach to batteries, other cables only to ports
* Fix compilation errors
* Cable VP unmount now removes remote parts and drops undamaged item
* Disconnect cables when cabled vehicle gets racked
* Tone down loose cable message
* Disable single target autoselection feature for cable linking specifically
* Move parent item disconnect earlier
* Update comments
* Misc fixes
* Change link_up default targets
* Remove rendundant cable_links parameter from ammo_remaining
* Make cabled devices use reeling activity
* Make cable pockets automatically created for non-cable items with link_up actions, to avoid having to add the same exact CABLE pocket to every single device with link_up
* Add link_up action to eink tablet, mp3 player, and portable game
* Add NOLINT(cata-serialize)
* Remove unneeded includes
* NOLINT
* Separate && and ||
* Refine menu collation for cables
* Re-add the cable_links parameter for ammo_remaining
* Remove unneeded parameter
* Update vehicle part functions
* Re-add unlubricated
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* initial commit
* no message
* improve calculations, currently uses test values
* oops
* no message
* no message
* fixing the wrong values, remove debug message
* tests: override weather in tests that need clear vision
* Andrei's fix of vision test
* vision_junction_reciprocity fix
* weather realism test fix
---------
Co-authored-by: andrei <a12l+git@runbox.com>
Our string_id constants were a mixture of temporaries, locals, and
globals. Pull them all out as globals, for consistency and efficiency.
The efficiency comes from the fact that each string_id instance caches
its respective int_id, and sharing one instance means that value need
not be recomputed.
Catch2 provides a customization point for converting our types to
strings by specializing the StringMaker template.
We have some specializations in stringmaker.h, but this feature was only
working intermittently. I finally figured out that was due to an ODR
violation. The test files that didn't include stringmaker.h were
compiling a different specialization than the ones that did.
Re-jig the test includes so that any file including catch.hpp also
includes stringmaker.h, thereby ensuring that the custom
specializations are used everywhere and there is no ODR violation.
I achieved this by adding a new cata_catch.h header and making all
existing headers include catch.hpp via the new header.
* Change _ctype.h and __locale to cctype and clocale
* Change _wctype.h to cwctype in game.cpp
* Change __functional_base to functional
* Remove libcxx internal headers
* Remove UNIX system headers
* Fix clang-tidy error with -nostdinc++
Resolves a TODO on that constructor, and one more TODO elsewhere due to
the resulting refactoring.
time_point was implicitly convertible from int. This led to unclear
code. In particular, the item constructor took a time_point and a
quantity, and these two ints appeared adjacent with no obvious way to
see what they meant at call sites.
Make the constructor explicit, so the conversion is no longer implicit.
Update the rest of the code accordingly.
In most cases switched from 0 to calendar::turn_zero, which is
equivalent. In a couple of places, used start_of_cataclysm instead,
when it seemed more appropriate (such as birthday of toilet water).
It's possible there are more cases which should have been something
other than turn_zero.
* Make Character::stat into a standalone enum class
Enables forward declaration
* Remove player centric overload and unecessary include
* Remove player.h dependency from trap.cpp
* Add singleton-like accessors for avatar, map, weather and event_bus
* use accessors to remove includes of game.h
* Helper script to run IWYU
* Run IWYU
* Update deprecated headers
* Run IWYU again
* Re-suppress cxxabi.h
This pragma got accidentally removed because it was deemed to be a
comment attached to a #include.
* Remove extra SDL header includes
* Fix ime.cpp headers
Some tweaks to help IWYU not break this file by messing with
platform-specific stuff not relevant on Linux.
* Update game.h
* Move new point.h includes inside #ifdef
* Re-add platform_win.h to mapsharing.cpp
* Apply suggestions from code review
Co-authored-by: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>
* Add first draft and TODOs of Character::fun_for
Includes:
- non-food is no fun
- sickness makes food less fun
- rotten food is disgusting (except to saprovore/phage)
* Add tests for cold and melted food
* Add dog/cat food fun tests
Change "avatar" to "character" (although tests use an avatar to make
things easier, it is a Character class method being tested).
Also note a couple TODOs for possible refactoring - although the
`fun_for` method is part of the Character class, a couple of its
calculations do not depend in any way on the character (namely, the COLD
and MELTS modifiers). These could be moved to the base
`get_comestible_fun` method, since they are inherent properties of the
food and its condition/flags, not on the Character.
* Add gourmand test; tidy up names and tags
* Factor out give_and_activate_bionic
Moving to tests/player_helpers.h so other tests can use it
* Add tests for monotony, taste blocker CBM
* Revert "Moved more string consts into single file (#38237)"
This reverts commit 49877426ce.
* Revert "Moved more string consts into single file (#38220)"
This reverts commit d9c6079762.
* Revert "Move string consts into single file (#38195)"
This reverts commit b1b48badff.
* Revert "More string consts into single file (#38189)"
This reverts commit 4fffd96143.
* Revert "More string consts into single file (#38183)"
This reverts commit 05940bfe3a.
* Revert "Move string consts into single file (#38184)"
This reverts commit 19c569826b.
* Revert "Move string consts into single file (#38181)"
This reverts commit 55cabb794c.
* Revert "Move more string consts into single file (#38175)"
This reverts commit 571efb2f8e.
* Revert "Merge pull request #38176 from Ramza13/string_consts_and_more"
This reverts commit 9c9835ff08, reversing
changes made to 07995cdda5.
* Revert "Move more string consts into single file (#38169)"
This reverts commit 07995cdda5.
* Revert "Merge pull request #38168 from Ramza13/even_more_string_consts"
This reverts commit 2bf1c1ea18, reversing
changes made to 24a32c0d1a.
* Revert "Merge pull request #38141 from ZhilkinSerg/sa-2020-02-18"
This reverts commit 142295b1dc, reversing
changes made to f98c67d3c3.
* Revert "Move string consts into single file (#38158)"
This reverts commit 50059c8a24.
* Revert "Merge pull request #38157 from Ramza13/string_consts_more_flags"
This reverts commit 8ec8e78959, reversing
changes made to 72ef0222a0.
* Revert "Move string_consts"
This reverts commit 0a6bf67436.
* Revert "Merge pull request #38146 from Ramza13/battery"
This reverts commit 9286722b74, reversing
changes made to e9f1cd7787.
* Revert "Merge pull request #38134 from AMurkin/rename-blob"
This reverts commit 06f72d2b7d, reversing
changes made to bcfe0741e1.
* Revert "Yet more string consts moved out (#38130)"
This reverts commit b5f18f3574.
* Revert "Merge pull request #38115 from Ramza13/string_consts_game"
This reverts commit 98076577b0, reversing
changes made to 036465f517.
* Fixup to the picked_up
* RE-inline item_location initialization
* Update character.h
* Update item.cpp
* Update item.h
* Update item_action.cpp
* Update item_factory.cpp
* Update point.h
* Update safemode_ui.cpp
* make power_level and max_power_level private
adds setters, getters, and some other helper functions for use as well
* change charge_poewr to mod_poewr_level
* update tests to use power level getters and setters
* reviewer suggestion