Merge remote-tracking branch 'dteviot/FixWarnings'

celladd
Marc Zinnschlag 10 years ago
commit ba482fa41f

@ -16,7 +16,7 @@ void printAIPackage(ESM::AIPackage p)
std::cout << " Duration: " << p.mWander.mDuration << std::endl;
std::cout << " Time of Day: " << (int)p.mWander.mTimeOfDay << std::endl;
if (p.mWander.mShouldRepeat != 1)
std::cout << " Should repeat: " << (bool)p.mWander.mShouldRepeat << std::endl;
std::cout << " Should repeat: " << (bool)(p.mWander.mShouldRepeat != 0) << std::endl;
std::cout << " Idle: ";
for (int i = 0; i != 8; i++)

@ -28,13 +28,13 @@ namespace ESSImport
cStats.mAttributes[i].mCurrent = acdt.mAttributes[i][0];
}
cStats.mGoldPool = acdt.mGoldPool;
cStats.mTalkedTo = acdt.mFlags & TalkedToPlayer;
cStats.mAttacked = acdt.mFlags & Attacked;
cStats.mTalkedTo = (acdt.mFlags & TalkedToPlayer) != 0;
cStats.mAttacked = (acdt.mFlags & Attacked) != 0;
}
void convertACSC (const ACSC& acsc, ESM::CreatureStats& cStats)
{
cStats.mDead = acsc.mFlags & Dead;
cStats.mDead = (acsc.mFlags & Dead) != 0;
}
void convertNpcData (const ActorData& actorData, ESM::NpcStats& npcStats)

@ -43,7 +43,7 @@ namespace ESSImport
{
unsigned int deleted;
esm.getHT(deleted);
mDeleted = (deleted >> 24) & 0x2; // the other 3 bytes seem to be uninitialized garbage
mDeleted = ((deleted >> 24) & 0x2) != 0; // the other 3 bytes seem to be uninitialized garbage
}
if (esm.isNextSub("MVRF"))

@ -110,7 +110,7 @@ int wmain(int argc, wchar_t *wargv[]) {
std::cerr << "cfg file does not exist" << std::endl;
MwIniImporter importer;
importer.setVerbose(vm.count("verbose"));
importer.setVerbose(vm.count("verbose") != 0);
// Font encoding settings
std::string encoding(vm["encoding"].as<std::string>());

@ -20,7 +20,7 @@ namespace MWWorld
namespace MWSound
{
class Sound;
class Sound_Decoder;
struct Sound_Decoder;
typedef boost::shared_ptr<Sound_Decoder> DecoderPtr;
}

@ -49,7 +49,7 @@ namespace MWRender
namespace MWMechanics
{
class Movement;
struct Movement;
}
namespace MWWorld

@ -155,7 +155,7 @@ namespace MWClass
bool Apparatus::canSell (const MWWorld::Ptr& item, int npcServices) const
{
return npcServices & ESM::NPC::Apparatus;
return (npcServices & ESM::NPC::Apparatus) != 0;
}
float Apparatus::getWeight(const MWWorld::Ptr &ptr) const

@ -164,7 +164,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
MWRender::Actors& actors = renderingInterface.getActors();
actors.insertCreature(ptr, model, ref->mBase->mFlags & ESM::Creature::Weapon);
actors.insertCreature(ptr, model, (ref->mBase->mFlags & ESM::Creature::Weapon) != 0);
}
void Creature::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
@ -493,7 +493,7 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
return (ref->mBase->mFlags & ESM::Creature::Weapon);
return (ref->mBase->mFlags & ESM::Creature::Weapon) != 0;
}
std::string Creature::getScript (const MWWorld::Ptr& ptr) const
@ -508,7 +508,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
return ref->mBase->mFlags & ESM::Creature::Essential;
return (ref->mBase->mFlags & ESM::Creature::Essential) != 0;
}
void Creature::registerSelf()
@ -713,7 +713,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
return ref->mBase->mFlags & ESM::Creature::Flies;
return (ref->mBase->mFlags & ESM::Creature::Flies) != 0;
}
bool Creature::canSwim(const MWWorld::Ptr &ptr) const

@ -192,7 +192,7 @@ namespace MWClass
bool Ingredient::canSell (const MWWorld::Ptr& item, int npcServices) const
{
return npcServices & ESM::NPC::Ingredients;
return (npcServices & ESM::NPC::Ingredients) != 0;
}

@ -50,7 +50,7 @@ namespace MWClass
assert (ref->mBase != NULL);
if(!model.empty())
physics.addObject(ptr, model, ref->mBase->mData.mFlags & ESM::Light::Carry);
physics.addObject(ptr, model, (ref->mBase->mData.mFlags & ESM::Light::Carry) != 0);
if (!ref->mBase->mSound.empty() && !(ref->mBase->mData.mFlags & ESM::Light::OffDefault))
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0,
@ -221,7 +221,7 @@ namespace MWClass
bool Light::canSell (const MWWorld::Ptr& item, int npcServices) const
{
return npcServices & ESM::NPC::Lights;
return (npcServices & ESM::NPC::Lights) != 0;
}
float Light::getWeight(const MWWorld::Ptr &ptr) const

@ -173,7 +173,7 @@ namespace MWClass
bool Lockpick::canSell (const MWWorld::Ptr& item, int npcServices) const
{
return npcServices & ESM::NPC::Picks;
return (npcServices & ESM::NPC::Picks) != 0;
}
int Lockpick::getItemMaxHealth (const MWWorld::Ptr& ptr) const

@ -259,7 +259,7 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return ref->mBase->mData.mIsKey;
return ref->mBase->mData.mIsKey != 0;
}
}

@ -993,7 +993,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::NPC> *ref =
ptr.get<ESM::NPC>();
return ref->mBase->mFlags & ESM::NPC::Essential;
return (ref->mBase->mFlags & ESM::NPC::Essential) != 0;
}
void Npc::registerSelf()

@ -5,7 +5,7 @@
namespace ESM
{
class GameSetting;
struct GameSetting;
}
namespace MWClass

@ -185,7 +185,7 @@ namespace MWClass
bool Potion::canSell (const MWWorld::Ptr& item, int npcServices) const
{
return npcServices & ESM::NPC::Potions;
return (npcServices & ESM::NPC::Potions) != 0;
}
float Potion::getWeight(const MWWorld::Ptr &ptr) const

@ -172,7 +172,7 @@ namespace MWClass
bool Probe::canSell (const MWWorld::Ptr& item, int npcServices) const
{
return npcServices & ESM::NPC::Probes;
return (npcServices & ESM::NPC::Probes) != 0;
}
int Probe::getItemMaxHealth (const MWWorld::Ptr& ptr) const

@ -172,7 +172,7 @@ namespace MWClass
bool Repair::canSell (const MWWorld::Ptr& item, int npcServices) const
{
return npcServices & ESM::NPC::RepairItem;
return (npcServices & ESM::NPC::RepairItem) != 0;
}
float Repair::getWeight(const MWWorld::Ptr &ptr) const

@ -16,8 +16,8 @@
namespace MWGui
{
struct TypesetBookImpl;
struct PageDisplay;
struct BookPageImpl;
class PageDisplay;
class BookPageImpl;
static bool ucsSpace (int codePoint);
static bool ucsLineBreak (int codePoint);

@ -6,7 +6,7 @@
namespace MWState
{
class Character;
class Slot;
struct Slot;
}
namespace MWGui

@ -114,7 +114,7 @@ namespace MWGui
void EditEffectDialog::newEffect (const ESM::MagicEffect *effect)
{
bool allowSelf = effect->mData.mFlags & ESM::MagicEffect::CastSelf;
bool allowSelf = (effect->mData.mFlags & ESM::MagicEffect::CastSelf) != 0;
bool allowTouch = (effect->mData.mFlags & ESM::MagicEffect::CastTouch) && !mConstantEffect;
bool allowTarget = (effect->mData.mFlags & ESM::MagicEffect::CastTarget) && !mConstantEffect;
@ -226,7 +226,7 @@ namespace MWGui
// cycle through range types until we find something that's allowed
// does not handle the case where nothing is allowed (this should be prevented before opening the Add Effect dialog)
bool allowSelf = mMagicEffect->mData.mFlags & ESM::MagicEffect::CastSelf;
bool allowSelf = (mMagicEffect->mData.mFlags & ESM::MagicEffect::CastSelf) != 0;
bool allowTouch = (mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTouch) && !mConstantEffect;
bool allowTarget = (mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTarget) && !mConstantEffect;
if (mEffect.mRange == ESM::RT_Self && !allowSelf)

@ -9,7 +9,7 @@
namespace ESM
{
class Class;
struct Class;
struct Race;
}

@ -239,7 +239,7 @@ namespace MWGui
params.mMagnMin = it->mMagnMin;
params.mMagnMax = it->mMagnMax;
params.mRange = it->mRange;
params.mIsConstant = (flags & MWEffectList::EF_Constant);
params.mIsConstant = (flags & MWEffectList::EF_Constant) != 0;
params.mNoTarget = (flags & MWEffectList::EF_NoTarget);
effect->setSpellEffect(params);
effects.push_back(effect);

@ -565,11 +565,11 @@ namespace MWGui
int eff = mShown & mAllowed & ~mForceHidden;
// Show the windows we want
mMap ->setVisible(eff & GW_Map);
mStatsWindow ->setVisible(eff & GW_Stats);
mInventoryWindow->setVisible(eff & GW_Inventory);
mMap ->setVisible((eff & GW_Map) != 0);
mStatsWindow ->setVisible((eff & GW_Stats) != 0);
mInventoryWindow->setVisible((eff & GW_Inventory) != 0);
mInventoryWindow->setGuiMode(mode);
mSpellWindow ->setVisible(eff & GW_Magic);
mSpellWindow ->setVisible((eff & GW_Magic) != 0);
break;
}
case GM_Container:
@ -1301,7 +1301,7 @@ namespace MWGui
bool WindowManager::isAllowed (GuiWindow wnd) const
{
return mAllowed & wnd;
return (mAllowed & wnd) != 0;
}
void WindowManager::allow (GuiWindow wnd)

@ -65,7 +65,7 @@ namespace MWGui
class MainMenu;
class StatsWindow;
class InventoryWindow;
class JournalWindow;
struct JournalWindow;
class CharacterCreation;
class DragAndDrop;
class ToolTips;
@ -277,7 +277,7 @@ namespace MWGui
virtual void enableRest() { mRestAllowed = true; }
virtual bool getRestEnabled();
virtual bool getJournalAllowed() { return (mAllowed & GW_Magic); }
virtual bool getJournalAllowed() { return (mAllowed & GW_Magic) != 0; }
virtual bool getPlayerSleeping();
virtual void wakeUpPlayer();

@ -250,7 +250,7 @@ namespace MWInput
if (mControlSwitch["playercontrols"])
{
if (action == A_Use)
mPlayer->getPlayer().getClass().getCreatureStats(mPlayer->getPlayer()).setAttackingOrSpell(currentValue);
mPlayer->getPlayer().getClass().getCreatureStats(mPlayer->getPlayer()).setAttackingOrSpell(currentValue != 0);
else if (action == A_Jump)
mAttemptJump = (currentValue == 1.0 && previousValue == 0.0);
}

@ -39,7 +39,7 @@ namespace ICS
namespace MyGUI
{
class MouseButton;
struct MouseButton;
}
namespace Files

@ -16,7 +16,7 @@ namespace ESM
{
namespace AiSequence
{
class AiSequence;
struct AiSequence;
}
}

@ -294,7 +294,7 @@ void AiSequence::fill(const ESM::AIPackageList &list)
idles.reserve(8);
for (int i=0; i<8; ++i)
idles.push_back(data.mIdle[i]);
package = new MWMechanics::AiWander(data.mDistance, data.mDuration, data.mTimeOfDay, idles, data.mShouldRepeat);
package = new MWMechanics::AiWander(data.mDistance, data.mDuration, data.mTimeOfDay, idles, data.mShouldRepeat != 0);
}
else if (it->mType == ESM::AI_Escort)
{

@ -15,7 +15,7 @@ namespace ESM
{
namespace AiSequence
{
class AiSequence;
struct AiSequence;
}
}

@ -785,7 +785,7 @@ namespace MWMechanics
, mDuration(wander->mData.mDuration)
, mStartTime(MWWorld::TimeStamp(wander->mStartTime))
, mTimeOfDay(wander->mData.mTimeOfDay)
, mRepeat(wander->mData.mShouldRepeat)
, mRepeat(wander->mData.mShouldRepeat != 0)
, mStoredInitialActorPosition(wander->mStoredInitialActorPosition)
{
if (mStoredInitialActorPosition)

@ -17,7 +17,7 @@
namespace ESM
{
class Cell;
struct Cell;
namespace AiSequence
{
struct AiWander;

@ -67,7 +67,7 @@ void MWMechanics::Alchemy::applyTools (int flags, float& value) const
{
bool magnitude = !(flags & ESM::MagicEffect::NoMagnitude);
bool duration = !(flags & ESM::MagicEffect::NoDuration);
bool negative = flags & (ESM::MagicEffect::Harmful);
bool negative = (flags & ESM::MagicEffect::Harmful) != 0;
int tool = negative ? ESM::Apparatus::Retort : ESM::Apparatus::Albemic;

@ -21,7 +21,7 @@ namespace MWRender
namespace MWMechanics
{
class Movement;
struct Movement;
class CreatureStats;
enum Priority {

@ -439,7 +439,7 @@ namespace MWMechanics
bool CreatureStats::getMovementFlag (Flag flag) const
{
return mMovementFlags & flag;
return (mMovementFlags & flag) != 0;
}
void CreatureStats::setMovementFlag (Flag flag, bool state)

@ -35,7 +35,7 @@ namespace MWMechanics
}
// For levelled creatures, the flags are swapped. This file format just makes so much sense.
bool allLevels = levItem->mFlags & ESM::ItemLevList::AllLevels;
bool allLevels = (levItem->mFlags & ESM::ItemLevList::AllLevels) != 0;
if (creature)
allLevels = levItem->mFlags & ESM::CreatureLevList::AllLevels;

@ -6,7 +6,7 @@
namespace ESM
{
class Cell;
struct Cell;
}
namespace MWWorld

@ -573,7 +573,7 @@ namespace MWMechanics
castStatic = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find ("VFX_DefaultHit");
// TODO: VFX are no longer active after saving/reloading the game
bool loop = magicEffect->mData.mFlags & ESM::MagicEffect::ContinuousVfx;
bool loop = (magicEffect->mData.mFlags & ESM::MagicEffect::ContinuousVfx) != 0;
// Note: in case of non actor, a free effect should be fine as well
MWRender::Animation* anim = MWBase::Environment::get().getWorld()->getAnimation(target);
if (anim)

@ -17,7 +17,7 @@ namespace ESM
namespace MWMechanics
{
class EffectKey;
struct EffectKey;
class MagicEffects;
ESM::Skill::SkillEnum spellSchoolToSkill(int school);

@ -12,7 +12,7 @@ namespace Loading
namespace ESM
{
class GlobalMap;
struct GlobalMap;
}
namespace MWRender

@ -14,7 +14,7 @@ namespace MWWorld
namespace ESM
{
class FogTexture;
struct FogTexture;
}
namespace MWRender

@ -377,7 +377,7 @@ void NpcAnimation::updateParts()
};
static const size_t slotlistsize = sizeof(slotlist)/sizeof(slotlist[0]);
bool wasArrowAttached = (mAmmunition.get());
bool wasArrowAttached = (mAmmunition.get() != NULL);
MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
for(size_t i = 0;i < slotlistsize && mViewMode != VM_HeadOnly;i++)
@ -941,7 +941,7 @@ void NpcAnimation::permanentEffectAdded(const ESM::MagicEffect *magicEffect, boo
if (!magicEffect->mHit.empty())
{
const ESM::Static* castStatic = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find (magicEffect->mHit);
bool loop = magicEffect->mData.mFlags & ESM::MagicEffect::ContinuousVfx;
bool loop = (magicEffect->mData.mFlags & ESM::MagicEffect::ContinuousVfx) != 0;
// Don't play particle VFX unless the effect is new or it should be looping.
if (isNew || loop)
addEffect("meshes\\" + castStatic->mModel, magicEffect->mIndex, loop, "");

@ -21,7 +21,7 @@ namespace Loading
namespace MWWorld
{
struct ESMStore;
class ESMStore;
}
namespace MWScript

@ -20,7 +20,7 @@ namespace MWInput
namespace MWScript
{
struct Locals;
class Locals;
class InterpreterContext : public Interpreter::Context
{

@ -7,7 +7,7 @@
namespace ESM
{
struct Script;
class Script;
struct Locals;
}

@ -81,7 +81,7 @@ namespace MWScript
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
runtime.pop();
bool allowSkipping = runtime[0].mInteger;
bool allowSkipping = runtime[0].mInteger != 0;
runtime.pop();
MWBase::Environment::get().getWindowManager()->playVideo (name, allowSkipping);

@ -16,7 +16,7 @@
namespace MWWorld
{
struct ESMStore;
class ESMStore;
}
namespace Compiler

@ -69,7 +69,7 @@ namespace MWSound
OpenAL_Output(SoundManager &mgr);
virtual ~OpenAL_Output();
class StreamThread;
struct StreamThread;
std::auto_ptr<StreamThread> mStreamThread;
friend class OpenAL_Sound;

@ -13,7 +13,7 @@
namespace MWSound
{
class SoundManager;
class Sound_Decoder;
struct Sound_Decoder;
class Sound;
class Sound_Output

@ -8,7 +8,7 @@
namespace MWWorld
{
struct ESMStore;
class ESMStore;
class CellStore;
class RefData;

@ -12,7 +12,7 @@ namespace MWWorld
{
class ContainerStore;
class CellStore;
class LiveCellRefBase;
struct LiveCellRefBase;
/// \brief Pointer to a LiveCellRef

@ -59,7 +59,7 @@ namespace MWWorld
}
RefData::RefData (const ESM::ObjectState& objectState)
: mBaseNode (0), mHasLocals (false), mEnabled (objectState.mEnabled),
: mBaseNode (0), mHasLocals (false), mEnabled (objectState.mEnabled != 0),
mCount (objectState.mCount), mPosition (objectState.mPosition), mCustomData (0),
mChanged(true), // Loading from a savegame -> assume changed
mDeleted(false)

@ -3,7 +3,7 @@
namespace ESM
{
class TimeStamp;
struct TimeStamp;
}
namespace MWWorld

@ -10,7 +10,7 @@ namespace ESM {
void Creature::load(ESMReader &esm)
{
mPersistent = esm.getRecordFlags() & 0x0400;
mPersistent = (esm.getRecordFlags() & 0x0400) != 0;
mAiPackage.mList.clear();
mInventory.mList.clear();

@ -10,7 +10,7 @@ namespace ESM
void NPC::load(ESMReader &esm)
{
mPersistent = esm.getRecordFlags() & 0x0400;
mPersistent = (esm.getRecordFlags() & 0x0400) != 0;
mSpells.mList.clear();
mInventory.mList.clear();

@ -10,7 +10,7 @@ namespace ESM
void Static::load(ESMReader &esm)
{
mPersistent = esm.getRecordFlags() & 0x0400;
mPersistent = (esm.getRecordFlags() & 0x0400) != 0;
mModel = esm.getHNString("MODL");
}

@ -234,7 +234,7 @@ class NiVisData : public Record
public:
struct VisData {
float time;
char isSet;
bool isSet;
};
std::vector<VisData> mVis;
@ -245,7 +245,7 @@ public:
for(size_t i = 0;i < mVis.size();i++)
{
mVis[i].time = nif->getFloat();
mVis[i].isSet = nif->getChar();
mVis[i].isSet = nif->getChar() != 0;
}
}
};

@ -14,7 +14,7 @@
namespace Nif
{
class NiNode;
struct NiNode;
/** A Node is an object that's part of the main NIF tree. It has
parent node (unless it's the root), and transformation (location

@ -122,10 +122,10 @@ class Controller;
class Controlled;
class NiSkinData;
class NiFloatData;
class NiMorphData;
struct NiMorphData;
class NiPixelData;
class NiColorData;
class NiKeyframeData;
struct NiKeyframeData;
class NiTriShapeData;
class NiSkinInstance;
class NiSourceTexture;

@ -38,8 +38,8 @@
namespace Nif
{
class Node;
class Transformation;
class NiTriShape;
struct Transformation;
struct NiTriShape;
}
namespace NifBullet

@ -10,7 +10,7 @@
namespace Nif
{
class NiTriShape;
struct NiTriShape;
}
namespace NifOgre

@ -379,7 +379,7 @@ public:
return mData.back().isSet;
}
static void setVisible(Ogre::Node *node, int vis)
static void setVisible(Ogre::Node *node, bool vis)
{
// Skinned meshes are attached to the scene node, not the bone.
// We use the Node's user data to connect it with the mesh.
@ -746,16 +746,17 @@ private:
{
if (ctrl->flags & Nif::NiNode::ControllerFlag_Active)
{
bool isAnimationAutoPlay = (animflags & Nif::NiNode::AnimFlag_AutoPlay) != 0;
if(ctrl->recType == Nif::RC_NiUVController)
{
const Nif::NiUVController *uv = static_cast<const Nif::NiUVController*>(ctrl.getPtr());
Ogre::ControllerValueRealPtr srcval((animflags&Nif::NiNode::AnimFlag_AutoPlay) ?
Ogre::ControllerValueRealPtr srcval(isAnimationAutoPlay ?
Ogre::ControllerManager::getSingleton().getFrameTimeSource() :
Ogre::ControllerValueRealPtr());
Ogre::ControllerValueRealPtr dstval(OGRE_NEW UVController::Value(entity, uv->data.getPtr(), &scene->mMaterialControllerMgr));
UVController::Function* function = OGRE_NEW UVController::Function(uv, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
UVController::Function* function = OGRE_NEW UVController::Function(uv, isAnimationAutoPlay);
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
Ogre::ControllerFunctionRealPtr func(function);
@ -765,13 +766,13 @@ private:
{
const Nif::NiGeomMorpherController *geom = static_cast<const Nif::NiGeomMorpherController*>(ctrl.getPtr());
Ogre::ControllerValueRealPtr srcval((animflags&Nif::NiNode::AnimFlag_AutoPlay) ?
Ogre::ControllerValueRealPtr srcval(isAnimationAutoPlay ?
Ogre::ControllerManager::getSingleton().getFrameTimeSource() :
Ogre::ControllerValueRealPtr());
Ogre::ControllerValueRealPtr dstval(OGRE_NEW GeomMorpherController::Value(
entity, geom->data.getPtr(), geom->recIndex));
GeomMorpherController::Function* function = OGRE_NEW GeomMorpherController::Function(geom, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
GeomMorpherController::Function* function = OGRE_NEW GeomMorpherController::Function(geom, isAnimationAutoPlay);
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
Ogre::ControllerFunctionRealPtr func(function);
@ -796,7 +797,8 @@ private:
const Nif::NiStencilProperty *stencilprop = NULL;
node->getProperties(texprop, matprop, alphaprop, vertprop, zprop, specprop, wireprop, stencilprop);
Ogre::ControllerValueRealPtr srcval((animflags&Nif::NiNode::AnimFlag_AutoPlay) ?
bool isAnimationAutoPlay = (animflags & Nif::NiNode::AnimFlag_AutoPlay) != 0;
Ogre::ControllerValueRealPtr srcval(isAnimationAutoPlay ?
Ogre::ControllerManager::getSingleton().getFrameTimeSource() :
Ogre::ControllerValueRealPtr());
@ -809,7 +811,7 @@ private:
{
const Nif::NiAlphaController *alphaCtrl = static_cast<const Nif::NiAlphaController*>(ctrls.getPtr());
Ogre::ControllerValueRealPtr dstval(OGRE_NEW AlphaController::Value(movable, alphaCtrl->data.getPtr(), &scene->mMaterialControllerMgr));
AlphaController::Function* function = OGRE_NEW AlphaController::Function(alphaCtrl, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
AlphaController::Function* function = OGRE_NEW AlphaController::Function(alphaCtrl, isAnimationAutoPlay);
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
Ogre::ControllerFunctionRealPtr func(function);
scene->mControllers.push_back(Ogre::Controller<Ogre::Real>(srcval, dstval, func));
@ -818,7 +820,7 @@ private:
{
const Nif::NiMaterialColorController *matCtrl = static_cast<const Nif::NiMaterialColorController*>(ctrls.getPtr());
Ogre::ControllerValueRealPtr dstval(OGRE_NEW MaterialColorController::Value(movable, matCtrl->data.getPtr(), &scene->mMaterialControllerMgr));
MaterialColorController::Function* function = OGRE_NEW MaterialColorController::Function(matCtrl, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
MaterialColorController::Function* function = OGRE_NEW MaterialColorController::Function(matCtrl, isAnimationAutoPlay);
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
Ogre::ControllerFunctionRealPtr func(function);
scene->mControllers.push_back(Ogre::Controller<Ogre::Real>(srcval, dstval, func));
@ -839,7 +841,7 @@ private:
Ogre::ControllerValueRealPtr dstval(OGRE_NEW FlipController::Value(
movable, flipCtrl, &scene->mMaterialControllerMgr));
FlipController::Function* function = OGRE_NEW FlipController::Function(flipCtrl, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
FlipController::Function* function = OGRE_NEW FlipController::Function(flipCtrl, isAnimationAutoPlay);
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
Ogre::ControllerFunctionRealPtr func(function);
scene->mControllers.push_back(Ogre::Controller<Ogre::Real>(srcval, dstval, func));
@ -967,7 +969,7 @@ private:
partsys->setCullIndividually(false);
partsys->setParticleQuota(particledata->numParticles);
partsys->setKeepParticlesInLocalSpace(partflags & (Nif::NiNode::ParticleFlag_LocalSpace));
partsys->setKeepParticlesInLocalSpace((partflags & Nif::NiNode::ParticleFlag_LocalSpace) != 0);
int trgtid = NIFSkeletonLoader::lookupOgreBoneHandle(name, partnode->recIndex);
Ogre::Bone *trgtbone = scene->mSkelBase->getSkeleton()->getBone(trgtid);
@ -1017,13 +1019,14 @@ private:
createParticleInitialState(partsys, particledata, partctrl);
Ogre::ControllerValueRealPtr srcval((partflags&Nif::NiNode::ParticleFlag_AutoPlay) ?
bool isParticleAutoPlay = (partflags&Nif::NiNode::ParticleFlag_AutoPlay) != 0;
Ogre::ControllerValueRealPtr srcval(isParticleAutoPlay ?
Ogre::ControllerManager::getSingleton().getFrameTimeSource() :
Ogre::ControllerValueRealPtr());
Ogre::ControllerValueRealPtr dstval(OGRE_NEW ParticleSystemController::Value(partsys, partctrl));
ParticleSystemController::Function* function =
OGRE_NEW ParticleSystemController::Function(partctrl, (partflags&Nif::NiNode::ParticleFlag_AutoPlay));
OGRE_NEW ParticleSystemController::Function(partctrl, isParticleAutoPlay);
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
Ogre::ControllerFunctionRealPtr func(function);
@ -1032,7 +1035,7 @@ private:
// Emitting state will be overwritten on frame update by the ParticleSystemController,
// but set up an initial value anyway so the user can fast-forward particle systems
// immediately after creation if desired.
partsys->setEmitting(partflags&Nif::NiNode::ParticleFlag_AutoPlay);
partsys->setEmitting(isParticleAutoPlay);
}
ctrl = ctrl->next;
}
@ -1094,18 +1097,19 @@ private:
do {
if (ctrl->flags & Nif::NiNode::ControllerFlag_Active)
{
bool isAnimationAutoPlay = (animflags & Nif::NiNode::AnimFlag_AutoPlay) != 0;
if(ctrl->recType == Nif::RC_NiVisController)
{
const Nif::NiVisController *vis = static_cast<const Nif::NiVisController*>(ctrl.getPtr());
int trgtid = NIFSkeletonLoader::lookupOgreBoneHandle(name, ctrl->target->recIndex);
Ogre::Bone *trgtbone = scene->mSkelBase->getSkeleton()->getBone(trgtid);
Ogre::ControllerValueRealPtr srcval((animflags&Nif::NiNode::AnimFlag_AutoPlay) ?
Ogre::ControllerValueRealPtr srcval(isAnimationAutoPlay ?
Ogre::ControllerManager::getSingleton().getFrameTimeSource() :
Ogre::ControllerValueRealPtr());
Ogre::ControllerValueRealPtr dstval(OGRE_NEW VisController::Value(trgtbone, vis->data.getPtr()));
VisController::Function* function = OGRE_NEW VisController::Function(vis, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
VisController::Function* function = OGRE_NEW VisController::Function(vis, isAnimationAutoPlay);
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
Ogre::ControllerFunctionRealPtr func(function);
@ -1120,11 +1124,11 @@ private:
Ogre::Bone *trgtbone = scene->mSkelBase->getSkeleton()->getBone(trgtid);
// The keyframe controller will control this bone manually
trgtbone->setManuallyControlled(true);
Ogre::ControllerValueRealPtr srcval((animflags&Nif::NiNode::AnimFlag_AutoPlay) ?
Ogre::ControllerValueRealPtr srcval(isAnimationAutoPlay ?
Ogre::ControllerManager::getSingleton().getFrameTimeSource() :
Ogre::ControllerValueRealPtr());
Ogre::ControllerValueRealPtr dstval(OGRE_NEW KeyframeController::Value(trgtbone, nif, key->data.getPtr()));
KeyframeController::Function* function = OGRE_NEW KeyframeController::Function(key, (animflags&Nif::NiNode::AnimFlag_AutoPlay));
KeyframeController::Function* function = OGRE_NEW KeyframeController::Function(key, isAnimationAutoPlay);
scene->mMaxControllerLength = std::max(function->mStopTime, scene->mMaxControllerLength);
Ogre::ControllerFunctionRealPtr func(function);

@ -35,7 +35,7 @@ namespace Terrain
MaterialGenerator ();
void setLayerList (const std::vector<LayerInfo>& layerList) { mLayerList = layerList; }
bool hasLayers() { return mLayerList.size(); }
bool hasLayers() { return mLayerList.size() > 0; }
void setBlendmapList (const std::vector<Ogre::TexturePtr>& blendmapList) { mBlendmapList = blendmapList; }
const std::vector<Ogre::TexturePtr>& getBlendmapList() { return mBlendmapList; }
void setCompositeMap (const std::string& name) { mCompositeMap = name; }

@ -201,12 +201,12 @@ namespace SFO
bool InputWrapper::isModifierHeld(SDL_Keymod mod)
{
return SDL_GetModState() & mod;
return (SDL_GetModState() & mod) != 0;
}
bool InputWrapper::isKeyDown(SDL_Scancode key)
{
return SDL_GetKeyboardState(NULL)[key];
return (SDL_GetKeyboardState(NULL)[key]) != 0;
}
/// \brief Moves the mouse to the specified point within the viewport

@ -283,14 +283,14 @@ namespace Physic
}
}
void PhysicEngine::setDebugRenderingMode(int mode)
void PhysicEngine::setDebugRenderingMode(bool isDebug)
{
if(!isDebugCreated)
{
createDebugRendering();
}
mDebugDrawer->setDebugMode(mode);
mDebugActive = mode;
mDebugDrawer->setDebugMode(isDebug);
mDebugActive = isDebug;
}
bool PhysicEngine::toggleDebugRendering()

@ -283,7 +283,7 @@ namespace Physic
* Set the debug rendering mode. 0 to turn it off.
* Important Note: this will crash if the Render is not yet initialise!
*/
void setDebugRenderingMode(int mode);
void setDebugRenderingMode(bool isDebug);
bool toggleDebugRendering();

Loading…
Cancel
Save