Skip to content

Commit

Permalink
Cleanup: Code style update
Browse files Browse the repository at this point in the history
Consistent use of const.
  • Loading branch information
skyjake committed Sep 7, 2019
1 parent cbaed3c commit cec1a79
Show file tree
Hide file tree
Showing 432 changed files with 1,950 additions and 1,950 deletions.
2 changes: 1 addition & 1 deletion doomsday/apps/client/include/render/shadowedge.h
Expand Up @@ -26,7 +26,7 @@

namespace de {

static coord_t const SHADOWEDGE_OPEN_THRESHOLD = 8; ///< World units (Z axis).
static const coord_t SHADOWEDGE_OPEN_THRESHOLD = 8; ///< World units (Z axis).

class HEdge;

Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/include/resource/abstractfont.h
Expand Up @@ -53,7 +53,7 @@ class AbstractFont
Shadowed = 0x2 ///< A shadow is embedded in the font.
};

static int const MAX_CHARS = 256; // Normal 256 ANSI characters.
static const int MAX_CHARS = 256; // Normal 256 ANSI characters.

public:
/// Resource manifest for the font.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/include/resource/fontscheme.h
Expand Up @@ -51,7 +51,7 @@ class FontScheme
DE_DEFINE_AUDIENCE(ManifestDefined, void fontSchemeManifestDefined(FontScheme &scheme, Manifest &manifest))

/// Minimum length of a symbolic name.
static int const min_name_length = DE_URI_MIN_SCHEME_LENGTH;
static const int min_name_length = DE_URI_MIN_SCHEME_LENGTH;

/// Manifests in the scheme are placed into a tree.
typedef PathTreeT<Manifest> Index;
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/client/include/world/bsp/partitioner.h
Expand Up @@ -38,10 +38,10 @@ namespace world {
namespace bsp {

/// Minimum length of a half-edge post partitioning. Used in cost evaluation.
static de::ddouble const SHORT_HEDGE_EPSILON = 4.0;
static const de::ddouble SHORT_HEDGE_EPSILON = 4.0;

/// Smallest distance between two points before being considered equal.
static de::ddouble const DIST_EPSILON = 1.0 / 128.0;
static const de::ddouble DIST_EPSILON = 1.0 / 128.0;

/**
* World map binary space partitioner (BSP).
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/client/include/world/map.h
Expand Up @@ -129,10 +129,10 @@ class Map : public world::BaseMap
* Constants:
*/
#ifdef __CLIENT__
static de::dint const MAX_BIAS_SOURCES = 8 * 32; // Hard limit due to change tracking.
static const de::dint MAX_BIAS_SOURCES = 8 * 32; // Hard limit due to change tracking.

/// Maximum number of generators per map.
static de::dint const MAX_GENERATORS = 512;
static const de::dint MAX_GENERATORS = 512;

typedef Set<Plane *> PlaneSet;
typedef Set<Surface *> SurfaceSet;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/include/world/plane.h
Expand Up @@ -68,7 +68,7 @@ class Plane : public world::MapElement
#endif

/// Maximum speed for a smoothed plane.
static de::dint const MAX_SMOOTH_MOVE = 64;
static const de::dint MAX_SMOOTH_MOVE = 64;

public:
/**
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/include/world/surface.h
Expand Up @@ -233,7 +233,7 @@ class Surface : public world::MapElement
DE_AUDIENCE(OriginSmoothedChange, void surfaceOriginSmoothedChanged(Surface &surface))

/// Maximum speed for a smoothed material offset.
static de::dint const MAX_SMOOTH_MATERIAL_MOVE = 8;
static const de::dint MAX_SMOOTH_MATERIAL_MOVE = 8;

/**
* Returns the current smoothed (interpolated) material origin for the
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/libs/fmod/src/driver_fmod.cpp
Expand Up @@ -152,7 +152,7 @@ static int DS_Init(void)
}

#if 0
de::String const speakerMode = de::Config::get().gets("audio.fmod.speakerMode", "");
const de::String speakerMode = de::Config::get().gets("audio.fmod.speakerMode", "");
if (speakerMode == "5.1")
{
FMOD_System_SetSpeakerMode(fmodSystem, FMOD_SPEAKERMODE_5POINT1);
Expand Down
16 changes: 8 additions & 8 deletions doomsday/apps/client/libs/fmod/src/fmod_sfx.cpp
Expand Up @@ -649,12 +649,12 @@ static void updateListenerEnvironmentSettings(float *reverb)
return;
}

static FMOD_REVERB_PROPERTIES const presetPlain = FMOD_PRESET_PLAIN;
static FMOD_REVERB_PROPERTIES const presetConcertHall = FMOD_PRESET_CONCERTHALL;
static FMOD_REVERB_PROPERTIES const presetAuditorium = FMOD_PRESET_AUDITORIUM;
static FMOD_REVERB_PROPERTIES const presetCave = FMOD_PRESET_CAVE;
static FMOD_REVERB_PROPERTIES const presetGeneric = FMOD_PRESET_GENERIC;
static FMOD_REVERB_PROPERTIES const presetRoom = FMOD_PRESET_ROOM;
static const FMOD_REVERB_PROPERTIES presetPlain = FMOD_PRESET_PLAIN;
static const FMOD_REVERB_PROPERTIES presetConcertHall = FMOD_PRESET_CONCERTHALL;
static const FMOD_REVERB_PROPERTIES presetAuditorium = FMOD_PRESET_AUDITORIUM;
static const FMOD_REVERB_PROPERTIES presetCave = FMOD_PRESET_CAVE;
static const FMOD_REVERB_PROPERTIES presetGeneric = FMOD_PRESET_GENERIC;
static const FMOD_REVERB_PROPERTIES presetRoom = FMOD_PRESET_ROOM;

float space = reverb[SFXLP_REVERB_SPACE];
if (reverb[SFXLP_REVERB_DECAY] > .5)
Expand Down Expand Up @@ -685,14 +685,14 @@ static void updateListenerEnvironmentSettings(float *reverb)
//setEAXdw(DSPROPERTY_EAXLISTENER_ROOM, volLinearToLog(rev[SFXLP_REVERB_VOLUME]));

// Reverb decay.
float const decayFactor = 1.f + (reverb[SFXLP_REVERB_DECAY] - .5f) * 1.5f;
const float decayFactor = 1.f + (reverb[SFXLP_REVERB_DECAY] - .5f) * 1.5f;
props.DecayTime = std::min(std::max(100.f, props.DecayTime * decayFactor), 20000.f);
//mulEAXf(DSPROPERTY_EAXLISTENER_DECAYTIME, val, EAXLISTENER_MINDECAYTIME, EAXLISTENER_MAXDECAYTIME);

// Damping.
//props.HighCut = de::Rangef(20, 20000).clamp(20000 * std::pow(1.f - reverb[SFXLP_REVERB_DAMPING], 2.f));
props.HighCut = de::Rangef(20, 20000).clamp(props.HighCut * std::pow(1.f - reverb[SFXLP_REVERB_DAMPING], 2.f));
//float const damping = std::max(.1f, 1.1f * (1.2f - reverb[SFXLP_REVERB_DAMPING]));
//const float damping = std::max(.1f, 1.1f * (1.2f - reverb[SFXLP_REVERB_DAMPING]));
//props.RoomHF = linearToLog(std::pow(10.f, props.RoomHF / 2000.f) * damping);
//mulEAXdw(DSPROPERTY_EAXLISTENER_ROOMHF, val);

Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/src/api_map.cpp
Expand Up @@ -1585,7 +1585,7 @@ DE_EXTERN_C int Subspace_BoxIterator(const AABoxd *box,
DE_ASSERT(box && callback);
if (!App_World().hasMap()) return LoopContinue;

dint const localValidCount = validCount;
const dint localValidCount = validCount;

return App_World().map().subspaceBlockmap()
.forAllInBox(*box, [&box, &callback, &context, &localValidCount] (void *object)
Expand Down
58 changes: 29 additions & 29 deletions doomsday/apps/client/src/audio/base/audiosystem.cpp
Expand Up @@ -88,11 +88,11 @@ DE_EXTERN_C audiointerface_music_t audiodQuickTimeMusic;

static AudioSystem *theAudioSystem;

static duint const SOUND_LOGICAL_PURGEINTERVAL = 2000; ///< 2 seconds
static const duint SOUND_LOGICAL_PURGEINTERVAL = 2000; ///< 2 seconds
#ifdef __CLIENT__
static dint const SOUND_CHANNEL_COUNT_DEFAULT = 16;
static dint const SOUND_CHANNEL_COUNT_MAX = 256;
static dint const SOUND_CHANNEL_2DCOUNT = 4;
static const dint SOUND_CHANNEL_COUNT_DEFAULT = 16;
static const dint SOUND_CHANNEL_COUNT_MAX = 256;
static const dint SOUND_CHANNEL_2DCOUNT = 4;
static const char *MUSIC_BUFFEREDFILE = "/tmp/dd-buffered-song";

static thread_t refreshHandle;
Expand Down Expand Up @@ -253,7 +253,7 @@ DE_PIMPL(AudioSystem)
LOG_AS("AudioSystem");
try
{
String const idStr = driverIdentifier[driverId];
const String idStr = driverIdentifier[driverId];
if (!AudioDriver::isAvailable(idStr))
{
return false;
Expand Down Expand Up @@ -594,7 +594,7 @@ DE_PIMPL(AudioSystem)
{
for (const AudioDriver &driver : drivers)
{
String const name = driver.interfaceName(anyAudioInterface);
const String name = driver.interfaceName(anyAudioInterface);
if (!name.isEmpty()) return name;
}
}
Expand Down Expand Up @@ -716,7 +716,7 @@ DE_PIMPL(AudioSystem)
return 0;

// Relative paths are relative to the native working directory.
String const path = (NativePath::workPath() / NativePath(virtualOrNativePath).expand()).withSeparators('/');
const String path = (NativePath::workPath() / NativePath(virtualOrNativePath).expand()).withSeparators('/');
LOG_AUDIO_VERBOSE("Attempting to play music file \"%s\"")
<< NativePath(virtualOrNativePath).pretty();

Expand All @@ -743,7 +743,7 @@ DE_PIMPL(AudioSystem)
else if (iMusic->Play && iMusic->SongBuffer)
{
// Buffer the data using the driver's own facility.
dsize const len = hndl->length();
const dsize len = hndl->length();
hndl->read((duint8 *) iMusic->SongBuffer(len), len);

return iMusic->Play(looped);
Expand Down Expand Up @@ -810,7 +810,7 @@ DE_PIMPL(AudioSystem)
{
// Buffer the data using the driver's own facility.
std::unique_ptr<FileHandle> hndl(&App_FileSystem().openLump(lump));
dsize const length = hndl->length();
const dsize length = hndl->length();
hndl->read((duint8 *) iMusic->SongBuffer(length), length);
App_FileSystem().releaseFile(hndl->file());

Expand Down Expand Up @@ -1167,7 +1167,7 @@ DE_PIMPL(AudioSystem)
void sfxPurgeLogical()
{
// Too soon?
duint const nowTime = Timer_RealMilliseconds();
const duint nowTime = Timer_RealMilliseconds();
if (nowTime - sfxLogicLastPurge < SOUND_LOGICAL_PURGEINTERVAL) return;

// Peform the purge now.
Expand Down Expand Up @@ -1242,13 +1242,13 @@ DE_PIMPL(AudioSystem)
{
if (soundIdAndFlags <= 0) return;

dint const soundId = (soundIdAndFlags & ~DDSF_FLAG_MASK);
const dint soundId = (soundIdAndFlags & ~DDSF_FLAG_MASK);

// Cache the sound sample associated with @a soundId (if necessary)
// so that we can determine it's length.
if (sfxsample_t *sample = sfxSampleCache.cache(soundId))
{
bool const isRepeating = (soundIdAndFlags & DDSF_REPEAT) ||
const bool isRepeating = (soundIdAndFlags & DDSF_REPEAT) ||
Def_SoundIsRepeating(soundId);

duint length = (1000 * sample->numSamples) / sample->rate;
Expand Down Expand Up @@ -1345,7 +1345,7 @@ DE_PIMPL(AudioSystem)
{
{
// Origin. At eye-level.
auto const origin = Vec4f(getSfxListenerOrigin().toVec3f(), 0);
const auto origin = Vec4f(getSfxListenerOrigin().toVec3f(), 0);
dfloat vec[4];
origin.decompose(vec);
self().sfx()->Listenerv(SFXLP_POSITION, vec);
Expand All @@ -1360,7 +1360,7 @@ DE_PIMPL(AudioSystem)
}
{
// Velocity. The unit is world distance units per second
auto const velocity = Vec4f(Vec3d(sfxListener->mom).toVec3f(), 0) * TICSPERSEC;
const auto velocity = Vec4f(Vec3d(sfxListener->mom).toVec3f(), 0) * TICSPERSEC;
dfloat vec[4];
velocity.decompose(vec);
self().sfx()->Listenerv(SFXLP_VELOCITY, vec);
Expand Down Expand Up @@ -1424,8 +1424,8 @@ DE_PIMPL(AudioSystem)
// Do we need to change the sample format?
if (old16Bit != sfx16Bit || oldRate != sfxSampleRate)
{
dint const newBits = sfx16Bit ? 16 : 8;
dint const newRate = sfxSampleRate;
const dint newBits = sfx16Bit ? 16 : 8;
const dint newRate = sfxSampleRate;
if (::sfxBits != newBits || ::sfxRate != newRate)
{
LOG_AUDIO_VERBOSE("Switching sound rate to %iHz (%i-bit)..") << newRate << newBits;
Expand Down Expand Up @@ -1931,7 +1931,7 @@ bool AudioSystem::soundIsPlaying(dint soundId, mobj_t *emitter) const

// Use the logic sound hash to determine whether the referenced sound is being
// played currently. We don't care whether its audible or not.
duint const nowTime = Timer_RealMilliseconds();
const duint nowTime = Timer_RealMilliseconds();
if (soundId)
{
const auto sounds = d->sfxLogicHash.equal_range(soundId);
Expand Down Expand Up @@ -2108,7 +2108,7 @@ dint AudioSystem::playSound(sfxsample_t *sample, dfloat volume, dfloat freq, con
DE_ASSERT(sample);
if (!d->sfxAvail) return false;

bool const play3D = sfx3D && (emitter || fixedOrigin);
const bool play3D = sfx3D && (emitter || fixedOrigin);

LOG_AS("AudioSystem");
if (sample->id < 1 || sample->id >= DED_Definitions()->sounds.size()) return false;
Expand All @@ -2129,8 +2129,8 @@ dint AudioSystem::playSound(sfxsample_t *sample, dfloat volume, dfloat freq, con
}

// Calculate the new sound's priority.
dint const nowTime = Timer_Ticks();
dfloat const myPrio = rateSoundPriority(emitter, fixedOrigin, volume, nowTime);
const dint nowTime = Timer_Ticks();
const dfloat myPrio = rateSoundPriority(emitter, fixedOrigin, volume, nowTime);

bool haveChannelPrios = false;
dfloat channelPrios[256/*MAX_CHANNEL_COUNT*/];
Expand All @@ -2154,7 +2154,7 @@ dint AudioSystem::playSound(sfxsample_t *sample, dfloat volume, dfloat freq, con
d->sfxChannels->forAll([&sample, &myPrio, &channelPrios,
&selCh, &lowPrio, &idx] (audio::SfxChannel &ch)
{
dfloat const chPriority = channelPrios[idx++];
const dfloat chPriority = channelPrios[idx++];

if (ch.hasBuffer())
{
Expand Down Expand Up @@ -2235,7 +2235,7 @@ dint AudioSystem::playSound(sfxsample_t *sample, dfloat volume, dfloat freq, con
d->sfxChannels->forAll([&play3D, &myPrio, &channelPrios,
&selCh, &prioCh, &lowPrio, &idx] (audio::SfxChannel &ch)
{
dfloat const chPriority = channelPrios[idx++];
const dfloat chPriority = channelPrios[idx++];

if (ch.hasBuffer())
{
Expand Down Expand Up @@ -2341,8 +2341,8 @@ dint AudioSystem::playSound(sfxsample_t *sample, dfloat volume, dfloat freq, con
{
// Init the buffer's min/max distances.
// This is only done once, when the sound is started (i.e., here).
dfloat const minDist = (selCh->flags() & SFXCF_NO_ATTENUATION) ? 10000 : ::soundMinDist;
dfloat const maxDist = (selCh->flags() & SFXCF_NO_ATTENUATION) ? 20000 : ::soundMaxDist;
const dfloat minDist = (selCh->flags() & SFXCF_NO_ATTENUATION) ? 10000 : ::soundMinDist;
const dfloat maxDist = (selCh->flags() & SFXCF_NO_ATTENUATION) ? 20000 : ::soundMaxDist;

sfx()->Set(&sbuf, SFXBP_MIN_DISTANCE, minDist);
sfx()->Set(&sbuf, SFXBP_MAX_DISTANCE, maxDist);
Expand All @@ -2367,7 +2367,7 @@ dfloat AudioSystem::rateSoundPriority(const mobj_t *emitter, const coord_t *poin
dint startTic)
{
// In five seconds all priority of a sound is gone.
dfloat const timeoff = 1000 * (Timer_Ticks() - startTic) / (5.0f * TICSPERSEC);
const dfloat timeoff = 1000 * (Timer_Ticks() - startTic) / (5.0f * TICSPERSEC);

if (!d->sfxListener || (!emitter && !point))
{
Expand Down Expand Up @@ -2524,7 +2524,7 @@ D_CMD(PlaySound)
dint p = 0;

// The sound ID is always first.
dint const id = DED_Definitions()->getSoundNum(argv[1]);
const dint id = DED_Definitions()->getSoundNum(argv[1]);

// The second argument may be a volume.
dfloat volume = 1;
Expand Down Expand Up @@ -2581,7 +2581,7 @@ D_CMD(PlayMusic)
return false;
}

bool const looped = true;
const bool looped = true;

if (argc == 2)
{
Expand Down Expand Up @@ -2831,7 +2831,7 @@ dint S_LocalSoundAtVolumeFrom(dint soundIdAndFlags, const mobj_t *origin, coord_
if (DoomsdayApp::app().busyMode().isActive())
return false;

dint const soundId = (soundIdAndFlags & ~DDSF_FLAG_MASK);
const dint soundId = (soundIdAndFlags & ~DDSF_FLAG_MASK);
if (soundId <= 0 || soundId >= DED_Definitions()->sounds.size())
return false;

Expand All @@ -2849,7 +2849,7 @@ dint S_LocalSoundAtVolumeFrom(dint soundIdAndFlags, const mobj_t *origin, coord_
sfxinfo_t *info = Def_GetSoundInfo(soundId, &freq, &volume);
if (!info) return false; // Hmm? This ID is not defined.

bool const isRepeating = (soundIdAndFlags & DDSF_REPEAT) || Def_SoundIsRepeating(soundId);
const bool isRepeating = (soundIdAndFlags & DDSF_REPEAT) || Def_SoundIsRepeating(soundId);

// Check the distance (if applicable).
if (!(info->flags & SF_NO_ATTENUATION) && !(soundIdAndFlags & DDSF_NO_ATTENUATION))
Expand Down

0 comments on commit cec1a79

Please sign in to comment.