Skip to content

Commit

Permalink
Added monitoring for text layouter bad indices
Browse files Browse the repository at this point in the history
  • Loading branch information
DudeMcDude committed May 13, 2016
1 parent 708d7e1 commit 19759d8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion TemplePlus/fonts/fonts_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ void TextLayouter::LayoutAndDraw(gsl::cstring_span<> text, const TigFont& font,
if (style.flags & 0x10) {
x += (extentsWidth - lineWidth) / 2;
}
if(lastIdx >= wordInfo.firstIdx)
if ((int)wordInfo.firstIdx < 0 || (int)lastIdx < 0){
int dummy = 1;
logger->error("Bad firstIdx at LayoutAndDraw! {}, {}", (int)wordInfo.firstIdx, (int)lastIdx);
}
else if(lastIdx >= wordInfo.firstIdx)
mRenderer.RenderRun(
text.subspan(wordInfo.firstIdx, lastIdx - wordInfo.firstIdx),
x,
Expand Down
Binary file modified tpdata/co8fixes.dat
Binary file not shown.
Binary file modified tpdata/tpgamefiles.dat
Binary file not shown.
5 changes: 2 additions & 3 deletions tpdata/tpmes/combat.mes
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
{208}{Shaken}
{209}{Frightened}
{210}{Ethereal}
{211}{You are already dead.}
{212}{You have 3 seconds to live.}
{211}{You have 3 seconds to live.}
{212}{3.}
{213}{2.}
{214}{1.}
{215}{Your death is at hand!}

{216}{You are already dead.}

{5105}{Disable Attacks of Opportunity}
{5106}{Divine Might}
Expand Down

0 comments on commit 19759d8

Please sign in to comment.