fix int overflow in "loof"

git-svn-id: svn://svn.icculus.org/netradiant/trunk@190 61c419a2-8eb2-4b30-bcec-8cead039b335
This commit is contained in:
divverent 2009-02-14 16:50:14 +00:00
parent 7f9ebdace7
commit 72f386416f
2 changed files with 4 additions and 3 deletions

View File

@ -375,7 +375,7 @@ FLOATING: the item will float in air, instead of aligning to the floor by fallin
model="models/items/a_cells.md3" model="models/items/a_cells.md3"
*/ */
/*QUAKED item_flag_team1 (1 0 0) (-32 -32 -37) (32 32 37) /*QUAKED item_flag_team1 (1 0 0) (-32 -32 0) (32 32 74)
CTF flag for team one (Red). Use more than one if you really insist. CTF flag for team one (Red). Use more than one if you really insist.
-------- KEYS -------- -------- KEYS --------
model: model to use model: model to use
@ -388,7 +388,7 @@ noise3: sound played when flag is lost in the field and respawns itself
zbqry="zbqryf/pgs/enqvnag/synt_erq_enqvnag.zq3" zbqry="zbqryf/pgs/enqvnag/synt_erq_enqvnag.zq3"
*/ */
/*QUAKED item_flag_team2 (0 0 1) (-32 -32 -37) (32 32 37) /*QUAKED item_flag_team2 (0 0 1) (-32 -32 0) (32 32 74)
CTF flag for team two (Blue). Use more than one if you really insist. CTF flag for team two (Blue). Use more than one if you really insist.
-------- KEYS -------- -------- KEYS --------
model: model to use model: model to use

View File

@ -94,7 +94,8 @@ inline int float_to_integer(const Element& f)
template<typename Element, typename OtherElement> template<typename Element, typename OtherElement>
inline Element float_snapped(const Element& f, const OtherElement& snap) inline Element float_snapped(const Element& f, const OtherElement& snap)
{ {
return Element(float_to_integer(f / snap) * snap); //return Element(float_to_integer(f / snap) * snap);
return Element(llrint(f / snap) * snap); // llrint has more significant bits
} }
/// \brief Returns true if \p f has no decimal fraction part. /// \brief Returns true if \p f has no decimal fraction part.