Martin Natano
b68ca517e6
Clean up math functions
...
- Remove checking for standard functions from the build system
- Prefix all invocations with std::
- Replace suffixed functions with unprefixed versions
- Include <cmath> in all files that use it and remove the global include
e.g. floorf(x) -> std::floor(x)
2023-04-19 19:31:40 +02:00
Brian Phlipot
d079940fea
Address PR feedback.
2023-02-02 11:54:17 -08:00
Brian Phlipot
4a6b1a743c
Enable more compiler warnings and treat them as errors.
2023-02-02 11:54:17 -08:00
Brian Phlipot
37aff00d6e
Require C++20 for building Stepmania.
2022-10-03 16:21:19 -07:00
Michael Sundqvist
0cba3579de
Remove global "using namespace std;" declarations, use "std::" prefixes on all std elements
...
Fix whitespace changes
2022-07-31 22:14:38 +02:00
Martin Natano
1b959d6762
Use type switch in JsonEncode
...
lua_isnumber and lua_isstring try to coerce the values to their
respective type, so a type switch is more reliable.
Fixes https://github.com/Simply-Love/Simply-Love-SM5/issues/406
2022-07-04 20:24:22 +02:00
Martin Natano
5f08636ad0
std::binary_function is deprecated and unnecessary in C++11
2022-05-31 12:55:03 +02:00
Martin Natano
9723a67ad7
Upgrade pcre 4.5 -> 8.45
2022-05-30 23:57:33 +02:00
Martin Natano
4c0aef69dd
Remove legacy network code
2022-04-11 14:50:00 -07:00
Martin Natano
e1b5664f21
Update jsoncpp from version 0.5.0 to 1.9.5
...
Aside from including a ton of bug fixes, this should fix an issue in the
CI pipeline when building with system libraries that was caused by a
minor incompatibility between 0.5.0 and less ancient versions.
Also, switch to the amalgamated source, because it makes it easier to
keep it up to date.
https://github.com/open-source-parsers/jsoncpp/wiki/Amalgamated-(Possibly-outdated)
2022-02-19 14:10:55 +01:00
Martin Natano
b4f86a2052
Add json encoding/decoding functions to lua
...
This adds two global functions:
- `JsonEncode()`: Encode data as JSON. Optionally "minify" the result.
- `JsonDecode()`: Decode JSON data.
2021-10-13 19:33:02 +02:00
Martin Natano
8c2f13da2c
Fix BinaryToHex()
...
Previously the function stopped short on nul bytes ("\0") due to usage
of the SArg() macro, which does not retrieve the length of the lua
string.
before the fix: `BinaryToHex("a\0b")` -> `"61"`
after the fix: `BinaryToHex("a\0b")` -> `"610062"`
2021-09-19 22:07:31 +02:00
Gareth Francis
aeb5c7598f
Handle exceptions in int conversions ( #2092 )
...
* RageUtil: Add exception-safe wrappers around std::stoi, stol, stoll
* Replace use of std::stoi with exception-safe StringToInt
2021-02-15 12:36:51 -08:00
quietly turning
fdef606b46
expose RageUtil's BinaryToHex to Lua
...
The hashing functions that CryptManger currently exposes to Lua
return hash strings formatted in binary. Themes using those hash
functions may want to compare hex strings.
RageUtil already had a BinaryToHex utility; this commit exposes it
as a global function, following along with other utility functions
in RageUtil.
2020-09-09 15:16:24 -04:00
teejusb
620ef3609d
Revert to use std::strtof insted of std::stof to make travis happy
2020-04-08 22:41:19 -07:00
teejusb
1d365fbc18
Fix float parsing errors
2020-04-08 22:01:16 -07:00
Prcuvu
de4dc62846
Split Chinese language into Simplified script and Traditional script
...
ArchHooks function modified for Windows.
2020-02-08 15:46:00 +08:00
teejusb
7e3789b131
Integrate C++11 branch into 5_1-new
2019-06-22 12:35:38 -07:00
Kyzentun
2aee27a276
Backport custom song support. Prefs are CustomSongsEnable, CustomSongsMaxCount, CustomSongsLoadTimeout, CustomSongsMaxSeconds, CustomSongsMaxMegabytes. Metrics are NumProfileSongGroupColors and the colors with it. Profile custom load function is passed PlayerNumber now. Stepmania must run as root to save USB profile scores. ( #1470 )
2017-06-06 05:30:06 -07:00
Kyzentun Keeslala
2b6768aed9
Remove UndocumentedFeature lua function. It has no legitimate purpose and just crashes with a message.
2016-05-20 19:02:54 -06:00
Jason Felds
bec18a0d36
Fix minor windows pedantic warnings.
2016-03-27 22:03:15 -04:00
Jason Felds
537af8d866
Remember to fill in new char's.
...
...we seriously need to use a standard <string>.
*glares at Yaniel*
2015-09-26 21:03:46 -04:00
Jason Felds
cf545a3c01
Remove the need for the RString buffer.
...
For most areas, the call to `c_str()` is plenty.
For `RageUtil`, it's just a matter of new and delete.
2015-09-16 22:29:53 -04:00
Prcuvu
5af37530d4
Rewrite power_of_two, using binary search.
2015-09-02 20:05:02 +08:00
Kyzentun Keeslala
5f50a8ea26
Added get_music_file_length and RageSound:get_length lua functions. Updated changelog.
2015-06-10 14:41:28 -06:00
Kyzentun Keeslala
771e24d1ca
Added kludge to shift tex coords for bottom cap by one pixel to get rid of seam. power_of_two rewritten to use math instead of a while loop.
2015-06-07 18:27:35 -06:00
Kyzentun
1c3db82537
Modified StepsID operators to consider 0 equal to all other hash values. See comment in source for details. Changed operator>>(RString&, int&) functions to be based off a template.
2015-04-10 09:10:51 -06:00
Kyzentun
2f1a348565
Commify handles negative numbers now.
2015-04-02 18:02:38 -06:00
Kyzentun
d789ef7c6b
Exposed commify function to lua and made it handle decimal numbers.
2015-04-02 13:36:41 -06:00
Kyzentun
8b09da8e64
Various changes to speed up start up time:
...
Added delay_save_cache to SongCacheIndex so that it doesn't write the entire cache index file after every song is loaded when loading songs.
Added m_SongsByDir to SongManager so that GetSongFromDir doesn't have to walk the entire list of songs.
Minor changes to when LoadEnabledSongsFromPref occurs and how SanityCheckGroupDir works to speed up loading.
Song::ReloadFromSongDir removes cache file to force an actual reload from the song dir instead of reloading from the cache. ReloadFromSongDir exposed to lua.
Reordered Actor::LoadFromNode to put Command first because that case is more common.
Course::GetTrailUnsorted reserves entries before starting to save time reallocating.
join in RageUtil calculates the final size of the concatenated strings reserves it to save time reallocating.
Added time log file to RageLog for profiling.
2015-03-30 17:45:52 -06:00
Kyzentun
a2798e16f4
More aggressive caching. In general, this makes Stepmania avoid looking in the song directory at all if the song is in the cache, in order to load songs faster. All the RadarValue calculations were also rolled into one to reduce the time needed to build the cache.
2015-03-23 11:35:30 -06:00
Andrew Udvare
36a412f6e4
Add --with-system-pcre; allow building against system PCRE library
2015-01-28 16:11:26 -08:00
Kyzentun
ca4eb65b61
Added lerp, lerp_color, approach, and multiapproach lua functions.
2014-10-23 00:13:13 -06:00
Kyzentun
e3f8d272c1
istream::operator bool() is explicit in C++11, use git diff
2014-09-02 14:33:55 -06:00
Kyzentun
d5878da037
Added Arbitrary Remap option to Alter Menu in Edit Mode.
2014-08-30 13:38:16 -06:00
Ben "root" Anderson
263240debc
Apparently MinGW needs this too.
2013-10-27 15:36:05 -05:00
Jason Felds
a8fe2634ca
Do string validation before parsing.
...
...this is NOT the right place for this.
At some point, we need to either use std::stof directly
and/or just accept that we need to use exceptions.
2013-05-04 13:43:54 -04:00
Jason Felds
f5c877cbb6
Replace StringToInt with the std version.
...
Again, RageUtil isn't the right home.
2013-05-04 11:59:25 -04:00
Jason Felds
490327cf55
Remove the IntToString function, use std.
...
...this seriously didn't belong in Rage.
2013-05-04 11:22:10 -04:00
Jason Felds
07b9fb6da5
The big NULL replacement party part 6.
...
...and ', NULL' had even more to replace.
2013-05-03 23:49:23 -04:00
Jason Felds
28e5148dec
The big NULL replacement party part 5.
...
Right. ' = NULL' would get a lot of these.
2013-05-03 23:39:52 -04:00
Jason Felds
a3f37dc2b4
The big NULL replacement party part 3.
...
Getting there I think.
2013-05-03 23:16:39 -04:00
Jason Felds
ba59dd1656
The big NULL replacement party part 2.
...
This may take a bit. Trying to do this by operator/command.
2013-05-03 23:11:42 -04:00
Jason Felds
9f24627bf9
The big NULL replacement party part 1.
...
This is meant to be a safer alternative since
NULL can often be 0. Let's not rely on that.
And yes, I know this is a lot of files. This is
a safer thing to do in big commits vs for loops.
2013-05-03 23:01:54 -04:00
Jason Felds
c67419ecc8
There goes the macro file.
...
This is one of my bigger commits in this branch.
Still, shouldn't cause a problem.
2013-05-01 23:54:39 -04:00
Jason Felds
08218a3a85
Another simplification.
2013-04-27 15:23:31 -04:00
Devin J. Pohly
58aa480016
war on -Werror, part 3: narrowing conversions
2012-12-26 21:12:12 -05:00
Colby Klein
5378173b5a
Fix math.random() never returning > 0.5.
...
All the credit goes to vyhd for both breaking and fixing this.
2012-12-24 15:52:28 -08:00
AJ Kelly
2a2cf23c47
[RageUtil] Add detection of .hg to StripCvsAndSvn.
2012-07-02 21:52:31 -05:00
Mark Cannon
86710c1716
fix compilation for MersenneTwister; generate 2^32 constant with pow(), so it doesn't depend on compiler semantics
2011-08-23 11:39:57 -07:00