mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 04:01:31 +00:00
warn when fewer returns than expected are given for a function
This commit is contained in:
parent
e2a9208c56
commit
d699ba248e
3 changed files with 10 additions and 4 deletions
|
@ -11330,6 +11330,10 @@ FxExpression *FxReturnStatement::Resolve(FCompileContext &ctx)
|
|||
{
|
||||
mismatchSeverity = MSG_ERROR;
|
||||
}
|
||||
else if (protoRetCount > retCount)
|
||||
{ // also warn when returning less values then the return count
|
||||
mismatchSeverity = MSG_WARNING;
|
||||
}
|
||||
}
|
||||
|
||||
if (mismatchSeverity != -1)
|
||||
|
|
|
@ -210,7 +210,7 @@ class StateProvider : Inventory
|
|||
action Actor, Actor A_FireProjectile(class<Actor> missiletype, double angle = 0, bool useammo = true, double spawnofs_xy = 0, double spawnheight = 0, int flags = 0, double pitch = 0)
|
||||
{
|
||||
let player = self.player;
|
||||
if (!player) return null;
|
||||
if (!player) return null, null;
|
||||
|
||||
let weapon = player.ReadyWeapon;
|
||||
|
||||
|
@ -220,7 +220,7 @@ class StateProvider : Inventory
|
|||
if (useammo && weapon && stateinfo != null && stateinfo.mStateType == STATE_Psprite)
|
||||
{
|
||||
if (!weapon.DepleteAmmo(weapon.bAltFire, true))
|
||||
return null; // out of ammo
|
||||
return null, null; // out of ammo
|
||||
}
|
||||
|
||||
if (missiletype)
|
||||
|
|
|
@ -122,11 +122,13 @@ extend class Object
|
|||
native static double G_SkillPropertyFloat(int p);
|
||||
deprecated("3.8", "Use Level.PickDeathMatchStart() instead") static vector3, int G_PickDeathmatchStart()
|
||||
{
|
||||
return level.PickDeathmatchStart();
|
||||
let [a,b] = level.PickDeathmatchStart();
|
||||
return a, b;
|
||||
}
|
||||
deprecated("3.8", "Use Level.PickPlayerStart() instead") static vector3, int G_PickPlayerStart(int pnum, int flags = 0)
|
||||
{
|
||||
return level.PickPlayerStart(pnum, flags);
|
||||
let [a,b] = level.PickPlayerStart(pnum, flags);
|
||||
return a, b;
|
||||
}
|
||||
deprecated("4.3", "Use S_StartSound() instead") native static void S_Sound (Sound sound_id, int channel, float volume = 1, float attenuation = ATTN_NORM, float pitch = 0.0, float startTime = 0.0);
|
||||
native static void S_StartSound (Sound sound_id, int channel, int flags = 0, float volume = 1, float attenuation = ATTN_NORM, float pitch = 0.0, float startTime = 0.0);
|
||||
|
|
Loading…
Reference in a new issue