Added GetSourceAt() with code pos

This commit is contained in:
smallmodel 2023-10-27 19:59:15 +02:00
parent dc028b87e4
commit bb97ec8933
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512
2 changed files with 13 additions and 1 deletions

View file

@ -84,6 +84,17 @@ bool AbstractScript::GetSourceAt(size_t sourcePos, str *sourceLine, int& column,
return true;
}
bool AbstractScript::GetSourceAt(const unsigned char *sourcePos, str *sourceLine, int& column, int& line)
{
const sourceinfo_t *codePos = m_ProgToSource->findKeyValue(sourcePos);
if (!codePos) {
return false;
}
return GetSourceAt(codePos->sourcePos, sourceLine, column, line);
}
void AbstractScript::PrintSourcePos(sourceinfo_t *sourcePos, bool dev)
{
int line;