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

Use clear_npcs in clear_map #30051

Merged
merged 2 commits into from
Apr 30, 2019

Conversation

jbytheway
Copy link
Contributor

Summary

SUMMARY: None

Purpose of change

clear_map had a similar flaw to the one fixed in #30031 affecting npc_can_target_player.

Describe the solution

Fix it in the same way, using clear_npcs added in #30031. Having done so, stop calling unload_npcs in clear_creatures.

Additional context

This wasn't obviously affecting any tests, but it makes sense to fix it pre-emptively while I'm thinking about this subject.

clear_map had a similar flaw to the one fixed in CleverRaven#30031 affecting
npc_can_target_player.  Fix it in the same way.

This wasn't obviously affecting any tests, but it makes sense to fix it
pre-emptively.
@ifreund ifreund added <Bugfix> This is a fix for a bug (or closes open issue) Code: Tests Measurement, self-control, statistics, balancing. NPC / Factions NPCs, AI, Speech, Factions, Ownership labels Apr 29, 2019
@jbytheway jbytheway changed the title Use clear_npcs in clear_map [WIP] Use clear_npcs in clear_map Apr 29, 2019
@jbytheway
Copy link
Contributor Author

Marking this WIP because the Travis error looks problematic.

Some tests
(default_overmap_generation_has_non_mandatory_specials_at_origin)
overwrite overmaps, which leads to orphaned NPCs.  Unloading and
reloading the NPCs ensures that all the active NPCs are known to the
overmap.
@jbytheway jbytheway changed the title [WIP] Use clear_npcs in clear_map Use clear_npcs in clear_map Apr 29, 2019
@jbytheway
Copy link
Contributor Author

Hopefully now better.

@kevingranade kevingranade merged commit 79448f9 into CleverRaven:master Apr 30, 2019
jbytheway added a commit to jbytheway/Cataclysm-DDA that referenced this pull request Apr 30, 2019
After CleverRaven#30051 clear_creatures no longer clears NPCs.  Add a call to do
that in this test where it is needed.
jbytheway added a commit to jbytheway/Cataclysm-DDA that referenced this pull request Apr 30, 2019
After CleverRaven#30051 clear_creatures no longer clears NPCs.  Add a call to do
that in this test where it is needed.
jbytheway added a commit to jbytheway/Cataclysm-DDA that referenced this pull request Apr 30, 2019
After CleverRaven#30051 clear_creatures no longer clears NPCs.  Add a call to do
that in these tests where it is needed.
jbytheway added a commit to jbytheway/Cataclysm-DDA that referenced this pull request Apr 30, 2019
After CleverRaven#30051 clear_creatures no longer clears NPCs.  Add a call to do
that in these tests where it is needed.
jbytheway added a commit to jbytheway/Cataclysm-DDA that referenced this pull request May 1, 2019
After CleverRaven#30051 clear_creatures no longer clears NPCs.  Add a call to do
that in these tests where it is needed.

Also, in clear_map, remove NPCs before vehicles to avoid unboarding
errors (as already hinted at in npc_test.cpp).

Simplify npc_test to use the new improved clear_map.

Ultimately, this is all a workaround for the fact that vehicle detaching
does not properly mark NPCs as not in the vehicle.  That should also be
fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) Code: Tests Measurement, self-control, statistics, balancing. NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants