48 Commits

Author SHA1 Message Date
dobbry-vechur 8375b6aa9c Zone tasks fetch what they lack and clear what they mark
- a fetch takes only what its requirements lack, counted with what is already there
- a fetch that cannot bring or hold what the task needs ends the task
- fetch marks clear at task end and on pickup by a picker with no backlog or destination activity
2026-10-28 01:44:53 +04:00
dobbry-vechur 6cdf4b5ddf A started construction leaves one task to come back to
- a construction step queues the zone task that started it once, with its state
- the backlog gains no empty construction entry per step
2026-10-26 23:00:21 +04:00
ehughsbaird e612f50ccc Move constructions to generic_factory
To enable supporting all the JSON features other types support, move
loading constructions to generic_factory.
2026-05-06 23:01:20 +00:00
ShnitzelX2 84a3f3b2b2 multi-activity part 8 CI 2026-02-14 13:22:01 -05:00
ShnitzelX2 d1aa8c13d2 remove most of activity_handlers::resume_for_multi_activities()
activity loop for NPC cancels for destination activity; multi-activity no longer sets to null and restarts per-turn
2026-02-14 13:21:59 -05:00
ShnitzelX2 3b0948e542 remove "can_resume": false for most multi-activities 2026-02-10 15:21:47 -05:00
Andrew Krieger 0215b26cce Rewrite all tests to clear map without touching character map memory, for performance. 2026-02-08 23:05:55 -08:00
ShnitzelX2 9978377d3c multi-activity CI 2026-02-05 19:36:49 -05:00
ShnitzelX2 fab651af31 infinite loop checks for multi-activities 2026-02-05 11:46:58 -05:00
ShnitzelX2 11b47fe88d move ACT_FETCH_REQUIRED to activity_actor 2026-02-04 16:35:09 -05:00
ShnitzelX2 3ee43ddf24 move ACT_MULTIPLE_CONSTRUCTION to activity_actor 2026-02-04 16:35:07 -05:00
Holli 3dbab0f9ed Recontextualize atomic powered tools (#83244)
* Remove atomic stuff

* lint

* lint2

* fix tests (hopefully)

* fix tests more

* fix tests

* fix tests

* fix afs
2025-10-10 23:29:16 -05:00
ehughsbaird b81b780afc terrain/furniture/field bashing can respond to more than bash damage (#81838)
* map/avatar bash return if they can smash

The skill/resistance are only used for this, so just simplify it.

* Use damage/hp for bashed objects

Add functions for bash data to generate damage/hp values, and use those
instead of directly querying str_{min,max}. This allows expanding how
furniture responds to damage in the future.

The bool arguments could be improved, but work well enough.

Sound shouldn't care about the supported/blocked strength, so just
ignore that, it won't be that different.

* Character/map bash respond to all damage types

Pass in a map of damage types and the amount, instead of just a strength
number.

Add a member to damage types that allows specifying how they convert
into bash damage. Right now, this is zero for all types but bash.

There are rough edges right now where this interacts with pathfinding
and monster bashing: those have a strength integer that they just
convert to {bash: strength}

For simplicity, keep a map::bash overload that takes integer strength,
and just converts it bash damage for the real bash function.

Special mention to the {{{}}} constructor, which is
pair{} -> initializer_list{pair{}} -> map{initializer_list{pair{}}}

* Monsters & pathfinding do bash by damage type

Instead of only bash damage.

This enables NPCs to properly pathfind based on their bash damage.

Enable specifying bash skill as more than just an amount of bash damage
for monsters. Not that anyone uses this in repo anyways. Update the
docs, including adding documentation for this feature.

* Allow specifying damage profile for bashing

Not everything will respond the same to attempting to break it in
different ways. Add infrastructure to allow specifying different
"profiles" for damage on bash data. Because there will be a fairly
limited set of these, and many objects will have the same, make a new
type for it, and just refer to it by id.

* Make bashing terrain/furniture deterministic

Because damage is stored, there's no reason to add a bunch of randomness
to this. Just directly apply damage, and update tests.

The "hp" for bash data can be updated to achieve the desired effect,
instead of rng.

* Add fireaxe test for bashing chances

Now that bashing can do multiple damage types, add a test case that uses
a weapon with a large non-bash damage component.

Because only bash is counted now, this doesn't look much different from
discarding the cut damage.

* Add bashing profile for wooden doors

As is seen in the famous documentary _The Shining_, fire axes are
relatively effective at breaking through doors. Add a bash profile that
favors cut damage, and apply it to wooden doors.

Adjust the tests to account for this.
2025-09-27 23:39:42 -05:00
SurFlurer 66744fab59 Fix camp blueprint autocalc (#81658)
* Use BFS to determine the shortest route to construct a certain terrain

* Unit test for blueprint requirement autocalc

* As IWYU said

* Clang tidy

* clang tidy 2

* clang tidy 3

* clang tidy 4
2025-07-10 01:06:11 -05:00
PatrikLundell 586cf5f1ce Mapify: character etc. sees + sundry others (#79699)
* Mapify: character etc. sees + sundry others

* demanded changes

* Corrected correction
2025-02-18 09:29:22 -06:00
moxian c44d65a8ae Run IWYU again to pick up the changes 2025-02-11 13:02:19 -08:00
moxian 2ee44002fd Mechanically IWYU the tests
python3 ~/github/include-what-you-use/iwyu_tool.py -j5 -p build $( find
src/ tests/ -maxdepth 1 -name '*.cpp' | grep -v -f
tools/iwyu/bad_files.txt )  --  -Xiwyu --comment_style=long -Xiwyu -
-max_line_length=1000 -Xiwyu --cxx17ns -Xiwyu
--mapping_file=../tools/iwyu/cata.imp   | tee out/iwyu/f-a-01.txt >
/dev/null

followed by

cat out/iwyu/f-a-02.txt | python3
~/github/include-what-you-use/fix_includes.py --reorder --nosafe_headers

followed by manual fixups of <stddef.h> -> <cstddef> and similar.

tests/generic_factory_test.cpp gets mangled very badly (IWYU bug) so
it's excluded from the list.

Code size:
includes:
$ cat obj/tiles/*.inc | wc
 288068  576136 17898260
$ cat tests/obj/tiles/*.inc | wc
 167044  334088 10465766

post-processed source (clang -E):
./make_preproc.sh src/
68567896 177775140 2134075721
./make_preproc.sh tests/
39341957 102891720 1243323710
2025-02-10 00:46:57 -08:00
PatrikLundell f14346c5db Rename map:: get_global->get_abs, bub_from_abs->get_bub, omt_from_abs->get_omt (#79167)
* Renamed map:: getglobal->get_abs, bub_from_abs->get_bub, omt_from_abs->get_omt

* astyle
2025-01-16 09:15:04 +01:00
Procyonae 40f0b39e62 Merge branch 'master' into RemoveStringInitialisingItems 2025-01-10 17:00:48 +00:00
Procyonae 982df19d0f Change /tests remaining uses of raw string item initialisation to use itype_id s
"remaining uses" being somewhat of an understatement -_-
2025-01-10 15:31:15 +00:00
PatrikLundell befd4486d1 sundry typification (#78985)
* sundry typification

* demanded work around
2025-01-06 22:26:26 -06:00
Anton Simakov 58210e4986 Merge branch 'master' into map_scale_constants 2024-12-24 09:32:05 +01:00
GuardianDll 98fe6e6856 Merge branch 'master' of https://github.com/CleverRaven/Cataclysm-DDA into map_scale_constants 2024-12-21 22:17:23 +01:00
PatrikLundell 1bdfcd014e made zones typed 2024-12-20 11:35:56 +01:00
PatrikLundell 26eb173d36 typified character.h + npc.h (#78623)
* typified character.h + npc.h

* demanded collateral change

* demanded collateral change
2024-12-18 20:03:41 -06:00
PatrikLundell c380147ab2 typified creature.h and monster.h (#78565)
* typified creature.h and monster.h

* Update src/monmove.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/monster.h

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-12-16 22:16:00 -06:00
Clarence "Sparr" Risher 8b27b967ae Replace point constants with static class members 2024-11-26 10:14:26 -05:00
Zhilkin Serg ed0ec411a1 Merge branch 'master' into map_scale_constants 2024-11-15 13:41:16 +03:00
Clarence "Sparr" Risher 42c12625c0 Fix clang-tidy complaints, refactor require_names 2024-10-24 10:26:06 -04:00
Clarence "Sparr" Risher 6c5c83b6df Update tests for new pre_terrain lists 2024-10-24 10:26:06 -04:00
PatrikLundell 128e94132b typified a bit of map.h/cpp + dependencies (#76795)
* typified a bit of map.h/cpp + dependencies

* demanded changes

* sorted out merge mess
2024-10-06 22:42:35 -05:00
Anton Simakov 7126340eab Merge branch 'master' into map_scale_constants 2024-09-10 09:41:05 +02:00
PatrikLundell 4c6b91838c Removed one getlocal (#73940)
Co-authored-by: RenechCDDA <84619419+RenechCDDA@users.noreply.github.com>
2024-05-25 16:18:25 -05:00
eso 330dd87745 migrate ACTIVITY_SEARCH_DISTANCE to MAX_VIEW_DISTANCE 2024-04-25 11:23:01 -07:00
Brambor 2e783998d2 iwyu: snowball changes 2024-04-15 23:32:46 +02:00
Procyonae e9f4fbd110 Remove extern ter ids (#72766) 2024-04-04 07:08:37 -07:00
Zhilkin Serg 50733fc0e1 Removed excessive whitespaces 2023-08-20 16:47:58 +03:00
Dillon Matchett dbd8cd966a Incremental skills (#65004)
* Down to construction.cpp

* finished crafting

* crafting gui

* Update faction.cpp

* Update faction_camp.cpp

* Update game.cpp

* down to handle action

* Update iexamine.cpp

* Update item.cpp

* Update iuse.cpp

* Update iuse_actor.cpp

* down to mattack

* Update melee.cpp

* Update mission_companion.cpp

* Update monattack.cpp

* up to npcmove

* Update npctalk.cpp

* Update npctrade.cpp

* Update ranged.cpp

* Update recipe.cpp

* Update trap.cpp

* Update trapfunc.cpp

* Update vehicle_use.cpp

* Update veh_type.cpp

* Update veh_utils.cpp

* tests

* was too big

* test fixes

* clang
2023-04-18 00:39:49 -04:00
andrei 8569abcbfe tests/constr: update act_build_test and add test data 2023-01-11 03:10:35 +02:00
Hirmuolio 4ee9085113 Rewrite bionic fuel system (#61049)
* energy_consumption as energy

* units::energy fuel

* units::energy material

* item fuel adjustments

* bionuc reload window

* bionic reload window

* typo

* bionic power from pedaling

* adjust electric vehicle tests

* mods

* mods

* rename some variables

* cleanup

* temp fix bionic

* temp fix treshold

* fuel tests

* adjust mod

* adjust mod

* adjust mod

* rename variable

* gasoline json

* flags

* get fuels

* remote ups

* veh and solar

* auto toggle

* testing

* fueled bionic

* cable vehicle

* cable solar

* metaboilism

* solar

* cleanup

* metaboilism messages

* remove old

* rename

* combine with passive

* fuel in bionic window

* remove fuel eating

* more tanks

* fix restriction

* fix restriction

* base test pocket

* material limit

* doc

* more items

* fuel from container pockets

* lint

* flat_set

* remove unused get_fuel_available

* remove unused

* remove unused

* remove unused

* remove unused

* astyle and tests

* migration

* mods

* broken npc code

* remove autostart

* treshold improvements

* treshold for muscle

* improved treshold

* add only missing

* remnants of fuel eating

* applies only to fueled

* fuel consumption display

* unused

* itype

* rename

* carble connection fixes

* sort

* tests

* muscle check

* astyle

* comment

* cable test

* cable solar

* better test

* sort

* better cables

* test empty battery

* fix corpses being made out of "

* name typo

Co-authored-by: Fris0uman <41293484+Fris0uman@users.noreply.github.com>

* name typo

Co-authored-by: Fris0uman <41293484+Fris0uman@users.noreply.github.com>

* not npc usable now

* fuel saving ui

* astyle

* get fuels only when necessary

* reorganize bionic functions

* fuel saving for cable

* test for running out of fuel

* fix running out of fuel

* fix test

* may not count by charges

* avoid warning

* test mod fix

* clang

* cleanup test

* fuel_energy per unit

* unnecessary comment

* outdated vehicle code

* maybe fixes test

Co-authored-by: Fris0uman <41293484+Fris0uman@users.noreply.github.com>
2022-09-21 13:33:23 +02:00
John Bytheway 9ed64bcbb8 Port activity code to type-safe points
This work involved converting player_activity::placement to a
tripoint_abs_ms and then dealing with the fallout elsewhere.

For most activities, placement was already a global tripoint.  In a few
cases it was a local tripoint, so conversions needed to be added at each
side.

In one case (ACT_START_ENGINE) it was a position relative to the avatar.
That's because the player might be starting the engine in a moving
vehicle, so using a fixed location isn't reliable.  To support that use
case I added an additional relative_placement member to player_activity.

If and when ACT_START_ENGINE is migrated to activity_actor, that member
can be removed.

Also, added some documentation for the reality bubble coordinate system
and the conversion functions between global and local coordinates.
2022-08-01 08:26:22 -04:00
John Bytheway 2320732f3a Start porting map point types
Continuing the effort to move the game towards type-safe points.  The
last commit added coordinate systems relative to the reality bubble.
This origin gets the abbreviation bub, and four aliases point_bub_ms,
point_bub_sm, tripoint_bub_ms, and tripoint_bub_sm represent these
points.

As a starting point, I have converted all or most of the
construction-related code to these new point types.  This started in
construction.cpp and I followed the compiler errors and continues to
port code so long as it seemed construction related.

One big change is that lots of the map functions are getting extra
overloads taking these new point types.  During the period where we are
still porting code these overloads will exist in parallel with those
taking raw points.  However, the long term plan is to remove the old
overloads, and I've marked each with a TODO comment to that effect.

I didn't discover any bugs in the process of these changes and there
should not be any behavioural changes.
2022-07-11 20:13:09 -04:00
John Bytheway 53a6cd9050 Apply auto transformations
Use the new clang-tidy check to replace all the auto variable types with
explicit types (where it makes sense to do so).
2022-07-01 07:11:27 -04:00
John Bytheway e72c65197d Replace alternative tokens with traditional ones 2022-06-26 06:38:43 -04:00
andrei e732220fe0 activity/constr: fix building with prereq from a diff. group
and recursively
2022-05-11 19:38:01 +03:00
andrei 7d599faf8d activity/constr: check if route is not empty first (#57402)
tests/activity: add test for visible but unreachable construction
2022-05-04 15:53:00 -07:00
andrei 262de91aa7 Partially revert #56231 (#57235)
This reverts commit 52d991bb44.
2022-05-04 10:45:44 -07:00
andrei 3d72a701ab tests/activities: add tests for ACT_MULTIPLE_CONSTRUCTION 2022-05-03 16:12:47 +03:00