I recently had similar troubles with C++ and integer math. C++ platforms generally round toward zero when doing an integer division, and I believe it's now part of the standard (and has been for C for a while). This isn't always what is desired, especially for negatives as it suddenly goes from always rounding down to always rounding up. If you ever need to do integer divisions and want to always round down (toward negative infinity), up (toward positive infinity), round away from zero, or round n.5 to the nearest even (to avoid bias), then check out my blog post that offers functions for all of those operations: http://experilous.com/1/blog/post/the-trickiness-of-integer-division. It's not particularly pretty, but it avoids branches which could matter in a hefty simulation situation. Though I never profiled it or examined the generated assembly, so that's a theoretical quality.
um... just something i thought of, might not be reading this, but i got this idea right now kind of. ever play borderlands 2? Yes... I'm thnking of something like erdium, but not like borderlands 2, when it upgrades ur ammo and such, but you can choose to make it upgrade ur inventory, but back to my thought. Something like that, i dont know how u would get it. Maybe mining, fighting, trading, whatever, but i noticed this in the game. The Glitch race has a farm, "a farm?" you may ask, but its a robot, wtf. So i was thinking that at this place, you could sell this "erdium" or special currency to them, and they do something for you. What i thought is like weapon mods and weapon upgrades, in case you cant find ur next tier. Like if u really, really, REALLY like your weapon, you can upgrade it for a price of this special currency or if you want to upgrade with a flashlight or laser sight, heck, even make a brand new weapon! (for a high price i suppose) so ya, i dont no if u see this, but if i see an post like this, ill send it again, just so u got it love the game
You know you can edit posts, right? Also, I don't think this ides quite fits into the game in the way you've described it.
I means that in the item class there used to be a function called fuelAmount Why does a general item need such a class? The answer is it doesn't. So I removed it. Items store information in parameters that are accessible, which means that you can access a parameter named "fuelAmount" in a different fashion, and have it serve the same function but without an explicit function just for it and nothing else. It's like, let's say you have a kitchen counter, and on this kitchen counter you can do many different tasks, such as: chop vegetables, store plasticwear, boil water in an electric tea kettle, etc. For all of these things in our hypothetical scenario, you'd access them by one way: setting things that do stuff on the counter. But let's say that for some reason, you had an apple peeling lathe on your kitchen counter, and it was permanently affixed right to the center of it for no good reason. Sure it's convenient to use if you want to peel an apple, but why? fuelAmount was the apple peeler, so I removed it.
Well, it's very vague. But beyond that, why do we need another currency, and why would only Glitches perform the tasks you listed and why would they want this other currency? Plus, the Glitch lore is already set out, how would you explain it?
Lol, you posted the idea in the public forum, on a news post instead of the suggestions forum. You should have had *some* expectation that people would read and maybe comment on it. So I did and you asked why I didn't think it would fit and so i answered your question, never claimed it was my decision.
what about case a=1 and b=-1 ? Code: Int maxInt; if ((a < 0) != (b < 0)) { maxInt = std::numeric_limits<Int>::min(); } else { maxInt = std::numeric_limits<Int>::max(); } if (abs(maxInt / a) < abs(b)) return maxInt; return a*b; maxInt = std::numeric_limits<Int>::min(); and we calculate abs(std::numeric_limits<Int>::min() / 1) which wrong because for example 4 byte int INT_MAX=2147483647 and INT_MIN=–2147483648 -> overflow happening while calculating abs(–2147483648). abs(INT_MIN)=INT_MIN in MSVC -> function return std::numeric_limits<Int>::min(). Even if this somewhat work for now it's gonna cause bugs in future for sure (porting, using different compilers, etc) tbh i think it's better use exceptions for such arithmetic.
90% of the people in this thread: "What did he just say? Oh well, I'll get along with it. GOOD WORK!" I also find it funny how those who knew a thing or two about coding instantly jumped on it to see if they could find a problem with it, just because Omni left it in the open that there could still be a problem in it, despite his best to create a "bulletproof" code. What is it that mere players / fans could find that a professional can't? But oh well, maybe we'll have a "lucky" one among us who'll get praised for it and get a boost increase of 20% to his or her ego