mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
- fixed uniqueTid logic - patch by Edward-San.
This commit is contained in:
parent
79abe2d4e9
commit
f44dc926e6
1 changed files with 5 additions and 6 deletions
|
@ -2726,16 +2726,15 @@ int P_FindUniqueTID(int start_tid, int limit)
|
|||
|
||||
if (start_tid != 0)
|
||||
{ // Do a linear search.
|
||||
int end_tid = start_tid;
|
||||
if (start_tid > 0 && limit > INT_MAX - start_tid + 1)
|
||||
{ // If 'limit+start_tid-1' overflows, clamp 'end_tid' to INT_MAX
|
||||
end_tid = INT_MAX;
|
||||
if (start_tid > INT_MAX-limit+1)
|
||||
{ // If 'limit+start_tid-1' overflows, clamp 'limit' to INT_MAX
|
||||
limit = INT_MAX;
|
||||
}
|
||||
else
|
||||
{
|
||||
end_tid += limit-1;
|
||||
limit += start_tid-1;
|
||||
}
|
||||
for (tid = start_tid; tid <= end_tid; ++tid)
|
||||
for (tid = start_tid; tid <= limit; ++tid)
|
||||
{
|
||||
if (tid != 0 && !P_IsTIDUsed(tid))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue