Add FRandomPick
- This is RandomPick but for floats. Considering what RandomPick translates into in the scripting branch, I hope I don't regret not using type inference on RandomPick instead of creating a new keyword.
This commit is contained in:
parent
173dbd6bce
commit
8e0151b4c1
5 changed files with 30 additions and 10 deletions
|
|
@ -371,8 +371,9 @@ static FxExpression *ParseExpression0 (FScanner &sc, const PClass *cls)
|
|||
|
||||
return new FxRandom(rng, min, max, sc);
|
||||
}
|
||||
else if (sc.CheckToken(TK_RandomPick))
|
||||
else if (sc.CheckToken(TK_RandomPick) || sc.CheckToken(TK_FRandomPick))
|
||||
{
|
||||
bool floaty = sc.TokenType == TK_FRandomPick;
|
||||
FRandom *rng;
|
||||
TArray<FxExpression*> list;
|
||||
list.Clear();
|
||||
|
|
@ -398,7 +399,7 @@ static FxExpression *ParseExpression0 (FScanner &sc, const PClass *cls)
|
|||
break;
|
||||
sc.MustGetToken(',');
|
||||
}
|
||||
return new FxRandomPick(rng, list, sc);
|
||||
return new FxRandomPick(rng, list, floaty, sc);
|
||||
}
|
||||
else if (sc.CheckToken(TK_FRandom))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue