Skip to content

Commit

Permalink
Avoid using loops to compute messageBox size
Browse files Browse the repository at this point in the history
  • Loading branch information
magiblot committed May 20, 2023
1 parent a357e7d commit bf995a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/tvision/msgbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ static TRect makeRect(TStringView text)
TRect r( 0, 0, 40, 9 );

int width = strwidth(text);
while (width > (r.b.x - 7)*(r.b.y - 6))
++r.b.y;
if (width > (r.b.x - 7)*(r.b.y - 6))
r.b.y = width/(r.b.x - 7) + 6 + 1;

r.move((TProgram::deskTop->size.x - r.b.x) / 2,
(TProgram::deskTop->size.y - r.b.y) / 2);
Expand Down

0 comments on commit bf995a4

Please sign in to comment.