Skip to content

Commit

Permalink
[rend2-sp] Fix G2API_SetNewOrigin incorrect drop error
Browse files Browse the repository at this point in the history
Fixes #54

Co-Authored-By: AntiAnti <17278566+antianti@users.noreply.github.com>
  • Loading branch information
SomaZ and AntiAnti committed Jun 12, 2024
1 parent aac82ec commit 664bab7
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions code/rd-rend2/G2_API.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2201,23 +2201,12 @@ qboolean G2API_SetNewOrigin(CGhoul2Info* ghlInfo, const int boltIndex)
{
if (G2_SetupModelPointers(ghlInfo))
{
if (boltIndex < 0)
// check for valid boltIndex before applying new origin
if (boltIndex >= 0 && boltIndex < (int)ghlInfo->mBltlist.size())
{
char modelName[MAX_QPATH];
if (ghlInfo->currentModel && ghlInfo->currentModel->name[0])
{
strcpy(modelName, ghlInfo->currentModel->name);
}
else
{
strcpy(modelName, "[Unknown - unexpected]");
}

Com_Error(ERR_DROP, "Bad boltindex (%i) trying to SetNewOrigin (naughty naughty!)\nModel %s\n", boltIndex, modelName);
ghlInfo->mNewOrigin = boltIndex;
ghlInfo->mFlags |= GHOUL2_NEWORIGIN;
}

ghlInfo->mNewOrigin = boltIndex;
ghlInfo->mFlags |= GHOUL2_NEWORIGIN;
return qtrue;
}
return qfalse;
Expand Down

0 comments on commit 664bab7

Please sign in to comment.