-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
make the game faster when player sleep near the tree #73590
Conversation
Co-authored-by: RenechCDDA <84619419+RenechCDDA@users.noreply.github.com>
I think the intention with the cache weirdness was to ensure that vision radius changed as soon as the player crouched or went prone next to a piece of cover, as these actions don't take any time. It would be inappropriate for them to only update one second later after the player passed a turn or something. I don't have time to compile your PR to test it but you may want to make sure that's still working as intended. |
Thanks for checking for me. That's a separate issue then, and not something that matters for this PR. I swear it used to happen on the same turn. |
You may have already seen it. The topic offered another solution to the problem. More precisely, they added a condition for checking. |
actually i did miss the second Ren suggestion, i'll check it now |
Per #73552 (comment) my safer suggestion was flawed as the static was never reassigned. Let's try this one more time! index bbe88a5b40..aa07232763 100644
--- a/src/lightmap.cpp
+++ b/src/lightmap.cpp
@@ -212,6 +212,7 @@ bool map::build_vision_transparency_cache( const int zlev )
bool low_profile = player_character.has_effect( effect_quadruped_full ) &&
player_character.is_running();
bool is_prone = player_character.is_prone();
+ static move_mode_id previous_move_mode = player_character.current_movement_mode();
for( const tripoint &loc : points_in_radius( p, 1 ) ) {
if( loc == p ) {
@@ -219,8 +220,12 @@ bool map::build_vision_transparency_cache( const int zlev )
vision_transparency_cache[p.x][p.y] = LIGHT_TRANSPARENCY_OPEN_AIR;
} else if( ( is_crouching || is_prone || low_profile ) && coverage( loc ) >= 30 ) {
// If we're crouching or prone behind an obstacle, we can't see past it.
- vision_transparency_cache[loc.x][loc.y] = LIGHT_TRANSPARENCY_SOLID;
- dirty = true;
+ if( vision_transparency_cache[loc.x][loc.y] != LIGHT_TRANSPARENCY_SOLID ||
+ previous_move_mode != player_character.current_movement_mode() ) {
+ previous_move_mode = player_character.current_movement_mode();
+ vision_transparency_cache[loc.x][loc.y] = LIGHT_TRANSPARENCY_SOLID;
+ dirty = true;
+ }
}
}
|
You update the value |
i'll compile and test it later |
@RenechCDDA nope, third attempt do not resolve the bug either |
|
Do you mean something is wrong with my test method or compiling? |
I would absolutely ask you to double-check what code you compiled, maybe even do a fresh rebuild to be 200% sure there's no compiler junk going on. |
This is the one we discussed on discord right? Kevin didn't seem to think it was a problem, and it's passing the test, so let's see what happen, and if someone set up us the bomb. |
Summary
None
Purpose of change
fix #73552
Describe the solution
Apply suggested fix
Testing
Compiled, slept afar from tree
slept near the tree
booted up unedited version of the game, sleept near the tree, dropped it because it was like 1:1 real time to game time ratio
Additional context
Pure magic to me ngl