Skip to content

Commit

Permalink
Merge pull request #69233 from CleverRaven/readability-static-accesse…
Browse files Browse the repository at this point in the history
…d-through-instance
  • Loading branch information
akrieger authored Nov 10, 2023
2 parents bdec4c2 + 3f72be4 commit 3a04c3f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ void draw_sct_curses( const game &g )
continue;
}

const bool is_old = text.getStep() >= SCT.iMaxSteps / 2;
const bool is_old = text.getStep() >= scrollingcombattext::iMaxSteps / 2;

nc_color const col1 = msgtype_to_color( text.getMsgType( "first" ), is_old );
nc_color const col2 = msgtype_to_color( text.getMsgType( "second" ), is_old );
Expand Down
14 changes: 7 additions & 7 deletions src/cata_tiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4812,19 +4812,19 @@ void cata_tiles::draw_sct_frame( std::multimap<point, formatted_text> &overlay_s
const bool use_font = get_option<bool>( "ANIMATION_SCT_USE_FONT" );
tripoint player_pos = get_player_character().pos();

for( auto iter = SCT.vSCT.begin(); iter != SCT.vSCT.end(); ++iter ) {
const point iD( iter->getPosX(), iter->getPosY() );
const int full_text_length = utf8_width( iter->getText() );
for( const scrollingcombattext::cSCT &sct : SCT.vSCT ) {
const point iD( sct.getPosX(), sct.getPosY() );
const int full_text_length = utf8_width( sct.getText() );

point iOffset;

for( int j = 0; j < 2; ++j ) {
std::string sText = iter->getText( ( j == 0 ) ? "first" : "second" );
int FG = msgtype_to_tilecolor( iter->getMsgType( ( j == 0 ) ? "first" : "second" ),
iter->getStep() >= SCT.iMaxSteps / 2 );
std::string sText = sct.getText( ( j == 0 ) ? "first" : "second" );
int FG = msgtype_to_tilecolor( sct.getMsgType( ( j == 0 ) ? "first" : "second" ),
sct.getStep() >= scrollingcombattext::iMaxSteps / 2 );

if( use_font ) {
const direction direction = iter->getDirection();
const direction direction = sct.getDirection();
// Compensate for string length offset added at SCT creation
// (it will be readded using font size and proper encoding later).
const int direction_offset = ( -displace_XY( direction ).x + 1 ) *
Expand Down
2 changes: 1 addition & 1 deletion src/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3113,7 +3113,7 @@ void scrollingcombattext::advanceAllSteps()
std::vector<cSCT>::iterator iter = vSCT.begin();

while( iter != vSCT.end() ) {
if( iter->advanceStep() > this->iMaxSteps ) {
if( iter->advanceStep() > iMaxSteps ) {
iter = vSCT.erase( iter );
} else {
++iter;
Expand Down
2 changes: 1 addition & 1 deletion src/output.h
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ class scrolling_text_view
class scrollingcombattext
{
public:
enum : int { iMaxSteps = 8 };
static constexpr int iMaxSteps = 8;

scrollingcombattext() = default;

Expand Down

0 comments on commit 3a04c3f

Please sign in to comment.