fixed undefined end of list behavior of iterators

Also fixed a few warnings
This commit is contained in:
Christoph Oelckers 2020-10-16 07:12:35 +02:00
parent f4c79161ad
commit c2828fe2e3
3 changed files with 10 additions and 5 deletions

View file

@ -1567,10 +1567,10 @@ void trPlayerCtrlGiveStuff(XSPRITE* pXSource, PLAYER* pPlayer, TRPLAYERCTRL* pCt
case 1: // give N weapon and default ammo for it case 1: // give N weapon and default ammo for it
case 2: // give just N ammo for selected weapon case 2: // give just N ammo for selected weapon
if (weapon <= 0 || weapon > 13) { if (weapon <= 0 || weapon > 13) {
Printf(PRINT_HIGH, "Weapon #%d is out of a weapons range!"); Printf(PRINT_HIGH, "Weapon #%d is out of a weapons range!", weapon);
break; break;
} else if (pXSource->data2 == 2 && pXSource->data4 == 0) { } else if (pXSource->data2 == 2 && pXSource->data4 == 0) {
Printf(PRINT_HIGH, "Zero ammo for weapon #%d is specified!"); Printf(PRINT_HIGH, "Zero ammo for weapon #%d is specified!", weapon);
break; break;
} }
switch (weapon) { switch (weapon) {

View file

@ -529,7 +529,7 @@ bool FScanner::ScanString (bool tokens)
LastGotLine = Line; LastGotLine = Line;
// In case the generated scanner does not use marker, avoid compiler warnings. // In case the generated scanner does not use marker, avoid compiler warnings.
marker; // marker;
#include "sc_man_scanner.h" #include "sc_man_scanner.h"
LastGotToken = tokens; LastGotToken = tokens;
return return_val; return return_val;

View file

@ -20,7 +20,7 @@ public:
int NextIndex() int NextIndex()
{ {
int n = next; int n = next;
next = nextspritestat[next]; if (n >= 0) next = nextspritestat[next];
return n; return n;
} }
@ -61,7 +61,12 @@ public:
int NextIndex() int NextIndex()
{ {
int n = next; int n = next;
next = nextspritesect[next]; if (n >= 0) next = nextspritesect[next];
return n; return n;
} }
int PeekIndex()
{
return next;
}
}; };