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)
This commit is contained in:
+15
-13
@@ -32,6 +32,8 @@
|
||||
#include "OptionsList.h"
|
||||
#include "RageFileManager.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
static const char *SelectionStateNames[] = {
|
||||
"SelectingSong",
|
||||
"SelectingSteps",
|
||||
@@ -413,7 +415,7 @@ bool ScreenSelectMusic::Input( const InputEventPlus &input )
|
||||
if (input.DeviceI == DeviceInput( DEVICE_MOUSE, (DeviceButton)i ))
|
||||
mouse_evt = true;
|
||||
}
|
||||
if (mouse_evt)
|
||||
if (mouse_evt)
|
||||
{
|
||||
return ScreenWithMenuElements::Input(input);
|
||||
}
|
||||
@@ -426,7 +428,7 @@ bool ScreenSelectMusic::Input( const InputEventPlus &input )
|
||||
// I just like being able to see untransliterated titles occasionally.
|
||||
if( input.DeviceI.device == DEVICE_KEYBOARD && input.DeviceI.button == KEY_F9 )
|
||||
{
|
||||
if( input.type != IET_FIRST_PRESS )
|
||||
if( input.type != IET_FIRST_PRESS )
|
||||
return false;
|
||||
PREFSMAN->m_bShowNativeLanguage.Set( !PREFSMAN->m_bShowNativeLanguage );
|
||||
MESSAGEMAN->Broadcast( "DisplayLanguageChanged" );
|
||||
@@ -436,7 +438,7 @@ bool ScreenSelectMusic::Input( const InputEventPlus &input )
|
||||
|
||||
if( !IsTransitioning() && m_SelectionState != SelectionState_Finalized )
|
||||
{
|
||||
bool bHoldingCtrl =
|
||||
bool bHoldingCtrl =
|
||||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL)) ||
|
||||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RCTRL));
|
||||
|
||||
@@ -488,7 +490,7 @@ bool ScreenSelectMusic::Input( const InputEventPlus &input )
|
||||
{
|
||||
// Keyboard shortcut to delete a song from disk (ctrl + backspace)
|
||||
Song* songToDelete = m_MusicWheel.GetSelectedSong();
|
||||
if ( songToDelete && PREFSMAN->m_bAllowSongDeletion.Get() )
|
||||
if ( songToDelete && PREFSMAN->m_bAllowSongDeletion.Get() )
|
||||
{
|
||||
m_pSongAwaitingDeletionConfirmation = songToDelete;
|
||||
ScreenPrompt::Prompt(SM_ConfirmDeleteSong, ssprintf(PERMANENTLY_DELETE.GetValue(), songToDelete->m_sMainTitle.c_str(), songToDelete->GetSongDir().c_str()), PROMPT_YES_NO);
|
||||
@@ -695,7 +697,7 @@ bool ScreenSelectMusic::Input( const InputEventPlus &input )
|
||||
}
|
||||
|
||||
// Reset the repeat timer when the button is released.
|
||||
// This fixes jumping when you release Left and Right after entering the sort
|
||||
// This fixes jumping when you release Left and Right after entering the sort
|
||||
// code at the same if L & R aren't released at the exact same time.
|
||||
if( input.type == IET_RELEASE )
|
||||
{
|
||||
@@ -1290,7 +1292,7 @@ bool ScreenSelectMusic::MenuStart( const InputEventPlus &input )
|
||||
else
|
||||
SOUND->PlayOnceFromAnnouncer( "select music comment general" );
|
||||
|
||||
/* If we're in event mode, we may have just played a course (putting
|
||||
/* If we're in event mode, we may have just played a course (putting
|
||||
* us in course mode). Make sure we're in a single song mode. */
|
||||
if( GAMESTATE->IsCourseMode() )
|
||||
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
|
||||
@@ -1644,10 +1646,10 @@ void ScreenSelectMusic::SwitchToPreferredDifficulty()
|
||||
|
||||
if( GAMESTATE->m_PreferredDifficulty[pn] != Difficulty_Invalid )
|
||||
{
|
||||
int iDifficultyDifference = abs( s->GetDifficulty() - GAMESTATE->m_PreferredDifficulty[pn] );
|
||||
int iDifficultyDifference = std::abs( s->GetDifficulty() - GAMESTATE->m_PreferredDifficulty[pn] );
|
||||
int iStepsTypeDifference = 0;
|
||||
if( GAMESTATE->m_PreferredStepsType != StepsType_Invalid )
|
||||
iStepsTypeDifference = abs( s->m_StepsType - GAMESTATE->m_PreferredStepsType );
|
||||
iStepsTypeDifference = std::abs( s->m_StepsType - GAMESTATE->m_PreferredStepsType );
|
||||
int iTotalDifference = iStepsTypeDifference * NUM_Difficulty + iDifficultyDifference;
|
||||
|
||||
if( iCurDifference == -1 || iTotalDifference < iCurDifference )
|
||||
@@ -1681,8 +1683,8 @@ void ScreenSelectMusic::SwitchToPreferredDifficulty()
|
||||
|
||||
if( GAMESTATE->m_PreferredCourseDifficulty[pn] != Difficulty_Invalid && GAMESTATE->m_PreferredStepsType != StepsType_Invalid )
|
||||
{
|
||||
int iDifficultyDifference = abs( t->m_CourseDifficulty - GAMESTATE->m_PreferredCourseDifficulty[pn] );
|
||||
int iStepsTypeDifference = abs( t->m_StepsType - GAMESTATE->m_PreferredStepsType );
|
||||
int iDifficultyDifference = std::abs( t->m_CourseDifficulty - GAMESTATE->m_PreferredCourseDifficulty[pn] );
|
||||
int iStepsTypeDifference = std::abs( t->m_StepsType - GAMESTATE->m_PreferredStepsType );
|
||||
int iTotalDifference = iStepsTypeDifference * NUM_CourseDifficulty + iDifficultyDifference;
|
||||
|
||||
if( iCurDifference == -1 || iTotalDifference < iCurDifference )
|
||||
@@ -2042,7 +2044,7 @@ bool ScreenSelectMusic::can_open_options_list(PlayerNumber pn)
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
/** @brief Allow Lua to have access to the ScreenSelectMusic. */
|
||||
/** @brief Allow Lua to have access to the ScreenSelectMusic. */
|
||||
class LunaScreenSelectMusic: public Luna<ScreenSelectMusic>
|
||||
{
|
||||
public:
|
||||
@@ -2082,7 +2084,7 @@ LUA_REGISTER_DERIVED_CLASS( ScreenSelectMusic, ScreenWithMenuElements )
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
@@ -2092,7 +2094,7 @@ LUA_REGISTER_DERIVED_CLASS( ScreenSelectMusic, ScreenWithMenuElements )
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
|
||||
Reference in New Issue
Block a user