-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Memorize memory duration once a turn. #27441
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11602,14 +11602,22 @@ long player::get_memorized_symbol( const tripoint &p ) const | |
|
||
size_t player::max_memorized_tiles() const | ||
{ | ||
if( has_active_bionic( bio_memory ) ) { | ||
return SEEX * SEEY * 20000; // 5000 overmap tiles | ||
} else if( has_trait( trait_FORGETFUL ) ) { | ||
return SEEX * SEEY * 200; // 50 overmap tiles | ||
} else if( has_trait( trait_GOODMEMORY ) ) { | ||
return SEEX * SEEY * 800; // 200 overmap tiles | ||
// Only check traits once a turn since this is called a huge number of times. | ||
static time_point current_turn = calendar::before_time_starts; | ||
static size_t current_max = 0; | ||
if( current_turn != calendar::turn ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand the idea behind, but I don't get how it would work with current implementation as this conditional expression would always be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it because of the static? It's kind of magical how it works. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this is like: initialize |
||
current_turn = calendar::turn; | ||
if( has_active_bionic( bio_memory ) ) { | ||
current_max = SEEX * SEEY * 20000; // 5000 overmap tiles | ||
} else if( has_trait( trait_FORGETFUL ) ) { | ||
current_max = SEEX * SEEY * 200; // 50 overmap tiles | ||
} else if( has_trait( trait_GOODMEMORY ) ) { | ||
current_max = SEEX * SEEY * 800; // 200 overmap tiles | ||
} else { | ||
current_max = SEEX * SEEY * 400; // 100 overmap tiles | ||
} | ||
} | ||
return SEEX * SEEY * 400; // 100 overmap tiles | ||
return current_max; | ||
} | ||
|
||
bool player::sees( const tripoint &t, bool ) const | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that it's unnecessary to make these static, and they would more logically be member variables. For example, when you save a game and load a different one, it's still using the state from the previous game. Which could (if you got very unlucky) cause that new game's player to forget a bunch of map memory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh you're right, there is a tiny collision risk.