Fixed more MSVC 2013 warnings.

celladd
dteviot 10 years ago
parent 2ef7fc4e2c
commit 1d7f3474fa

@ -290,7 +290,7 @@ public:
std::streamsize write(const char *str, std::streamsize size) std::streamsize write(const char *str, std::streamsize size)
{ {
// Make a copy for null termination // Make a copy for null termination
std::string tmp (str, size); std::string tmp (str, static_cast<unsigned int>(size));
// Write string to Visual Studio Debug output // Write string to Visual Studio Debug output
OutputDebugString (tmp.c_str ()); OutputDebugString (tmp.c_str ());
return size; return size;

@ -343,7 +343,7 @@ namespace MWGui
else else
d = int(100 * (b - a) / a); d = int(100 * (b - a) / a);
float clampedDisposition = std::max<float>(0,std::min<float>(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr) int clampedDisposition = std::max(0, std::min(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr)
+ MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange(),100)); + MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange(),100));
const MWMechanics::CreatureStats &sellerStats = mPtr.getClass().getCreatureStats(mPtr); const MWMechanics::CreatureStats &sellerStats = mPtr.getClass().getCreatureStats(mPtr);

@ -524,9 +524,9 @@ namespace MWMechanics
for(int i = 0;i < ESM::Attribute::Length;++i) for(int i = 0;i < ESM::Attribute::Length;++i)
{ {
AttributeValue stat = creatureStats.getAttribute(i); AttributeValue stat = creatureStats.getAttribute(i);
stat.setModifier(effects.get(EffectKey(ESM::MagicEffect::FortifyAttribute, i)).getMagnitude() - stat.setModifier(static_cast<int>(effects.get(EffectKey(ESM::MagicEffect::FortifyAttribute, i)).getMagnitude() -
effects.get(EffectKey(ESM::MagicEffect::DrainAttribute, i)).getMagnitude() - effects.get(EffectKey(ESM::MagicEffect::DrainAttribute, i)).getMagnitude() -
effects.get(EffectKey(ESM::MagicEffect::AbsorbAttribute, i)).getMagnitude()); effects.get(EffectKey(ESM::MagicEffect::AbsorbAttribute, i)).getMagnitude()));
stat.damage(effects.get(EffectKey(ESM::MagicEffect::DamageAttribute, i)).getMagnitude() * duration); stat.damage(effects.get(EffectKey(ESM::MagicEffect::DamageAttribute, i)).getMagnitude() * duration);
stat.restore(effects.get(EffectKey(ESM::MagicEffect::RestoreAttribute, i)).getMagnitude() * duration); stat.restore(effects.get(EffectKey(ESM::MagicEffect::RestoreAttribute, i)).getMagnitude() * duration);
@ -793,9 +793,9 @@ namespace MWMechanics
for(int i = 0;i < ESM::Skill::Length;++i) for(int i = 0;i < ESM::Skill::Length;++i)
{ {
SkillValue& skill = npcStats.getSkill(i); SkillValue& skill = npcStats.getSkill(i);
skill.setModifier(effects.get(EffectKey(ESM::MagicEffect::FortifySkill, i)).getMagnitude() - skill.setModifier(static_cast<int>(effects.get(EffectKey(ESM::MagicEffect::FortifySkill, i)).getMagnitude() -
effects.get(EffectKey(ESM::MagicEffect::DrainSkill, i)).getMagnitude() - effects.get(EffectKey(ESM::MagicEffect::DrainSkill, i)).getMagnitude() -
effects.get(EffectKey(ESM::MagicEffect::AbsorbSkill, i)).getMagnitude()); effects.get(EffectKey(ESM::MagicEffect::AbsorbSkill, i)).getMagnitude()));
skill.damage(effects.get(EffectKey(ESM::MagicEffect::DamageSkill, i)).getMagnitude() * duration); skill.damage(effects.get(EffectKey(ESM::MagicEffect::DamageSkill, i)).getMagnitude() * duration);
skill.restore(effects.get(EffectKey(ESM::MagicEffect::RestoreSkill, i)).getMagnitude() * duration); skill.restore(effects.get(EffectKey(ESM::MagicEffect::RestoreSkill, i)).getMagnitude() * duration);

@ -267,7 +267,7 @@ namespace MWMechanics
attackTerm += mageffects.get(ESM::MagicEffect::FortifyAttack).getMagnitude() - attackTerm += mageffects.get(ESM::MagicEffect::FortifyAttack).getMagnitude() -
mageffects.get(ESM::MagicEffect::Blind).getMagnitude(); mageffects.get(ESM::MagicEffect::Blind).getMagnitude();
return static_cast<int>((attackTerm - defenseTerm) + 0.5f); return round(attackTerm - defenseTerm);
} }
void applyElementalShields(const MWWorld::Ptr &attacker, const MWWorld::Ptr &victim) void applyElementalShields(const MWWorld::Ptr &attacker, const MWWorld::Ptr &victim)

@ -30,7 +30,7 @@ int FFmpeg_Decoder::readPacket(void *user_data, uint8_t *buf, int buf_size)
Ogre::DataStreamPtr stream = static_cast<FFmpeg_Decoder*>(user_data)->mDataStream; Ogre::DataStreamPtr stream = static_cast<FFmpeg_Decoder*>(user_data)->mDataStream;
return stream->read(buf, buf_size); return stream->read(buf, buf_size);
} }
catch (std::exception& e) catch (std::exception& )
{ {
return 0; return 0;
} }
@ -43,7 +43,7 @@ int FFmpeg_Decoder::writePacket(void *user_data, uint8_t *buf, int buf_size)
Ogre::DataStreamPtr stream = static_cast<FFmpeg_Decoder*>(user_data)->mDataStream; Ogre::DataStreamPtr stream = static_cast<FFmpeg_Decoder*>(user_data)->mDataStream;
return stream->write(buf, buf_size); return stream->write(buf, buf_size);
} }
catch (std::exception& e) catch (std::exception& )
{ {
return 0; return 0;
} }
@ -57,11 +57,11 @@ int64_t FFmpeg_Decoder::seek(void *user_data, int64_t offset, int whence)
if(whence == AVSEEK_SIZE) if(whence == AVSEEK_SIZE)
return stream->size(); return stream->size();
if(whence == SEEK_SET) if(whence == SEEK_SET)
stream->seek(offset); stream->seek(static_cast<size_t>(offset));
else if(whence == SEEK_CUR) else if(whence == SEEK_CUR)
stream->seek(stream->tell()+offset); stream->seek(static_cast<size_t>(stream->tell()+offset));
else if(whence == SEEK_END) else if(whence == SEEK_END)
stream->seek(stream->size()+offset); stream->seek(static_cast<size_t>(stream->size()+offset));
else else
return -1; return -1;

@ -79,7 +79,7 @@ void BSAFile::readHeader()
bfs::ifstream input(bfs::path(filename), std::ios_base::binary); bfs::ifstream input(bfs::path(filename), std::ios_base::binary);
// Total archive size // Total archive size
size_t fsize = 0; std::streamoff fsize = 0;
if(input.seekg(0, std::ios_base::end)) if(input.seekg(0, std::ios_base::end))
{ {
fsize = input.tellg(); fsize = input.tellg();

@ -324,7 +324,7 @@ namespace Compiler
mNextOperand = false; mNextOperand = false;
mOperands.push_back ('l'); mOperands.push_back ('l');
return 2; return true;
} }
} }

@ -179,7 +179,7 @@ int VideoState::OgreResource_Read(void *user_data, uint8_t *buf, int buf_size)
{ {
return stream->read(buf, buf_size); return stream->read(buf, buf_size);
} }
catch (std::exception& e) catch (std::exception& )
{ {
return 0; return 0;
} }
@ -192,7 +192,7 @@ int VideoState::OgreResource_Write(void *user_data, uint8_t *buf, int buf_size)
{ {
return stream->write(buf, buf_size); return stream->write(buf, buf_size);
} }
catch (std::exception& e) catch (std::exception& )
{ {
return 0; return 0;
} }
@ -206,11 +206,11 @@ int64_t VideoState::OgreResource_Seek(void *user_data, int64_t offset, int whenc
if(whence == AVSEEK_SIZE) if(whence == AVSEEK_SIZE)
return stream->size(); return stream->size();
if(whence == SEEK_SET) if(whence == SEEK_SET)
stream->seek(offset); stream->seek(static_cast<size_t>(offset));
else if(whence == SEEK_CUR) else if(whence == SEEK_CUR)
stream->seek(stream->tell()+offset); stream->seek(static_cast<size_t>(stream->tell()+offset));
else if(whence == SEEK_END) else if(whence == SEEK_END)
stream->seek(stream->size()+offset); stream->seek(static_cast<size_t>(stream->size() + offset));
else else
return -1; return -1;
@ -400,7 +400,7 @@ void VideoState::video_thread_loop(VideoState *self)
self->pictq_mutex.unlock(); self->pictq_mutex.unlock();
self->frame_last_pts = packet->pts * av_q2d((*self->video_st)->time_base); self->frame_last_pts = packet->pts * av_q2d((*self->video_st)->time_base);
global_video_pkt_pts = self->frame_last_pts; global_video_pkt_pts = static_cast<int64_t>(self->frame_last_pts);
continue; continue;
} }
@ -412,9 +412,9 @@ void VideoState::video_thread_loop(VideoState *self)
double pts = 0; double pts = 0;
if(packet->dts != AV_NOPTS_VALUE) if(packet->dts != AV_NOPTS_VALUE)
pts = packet->dts; pts = static_cast<double>(packet->dts);
else if(pFrame->opaque && *(int64_t*)pFrame->opaque != AV_NOPTS_VALUE) else if(pFrame->opaque && *(int64_t*)pFrame->opaque != AV_NOPTS_VALUE)
pts = *(int64_t*)pFrame->opaque; pts = static_cast<double>(*(int64_t*)pFrame->opaque);
pts *= av_q2d((*self->video_st)->time_base); pts *= av_q2d((*self->video_st)->time_base);
av_free_packet(packet); av_free_packet(packet);

@ -109,7 +109,7 @@ namespace sh
{ {
params->addSharedParameters (name); params->addSharedParameters (name);
} }
catch (Ogre::Exception& e) catch (Ogre::Exception& )
{ {
std::stringstream msg; std::stringstream msg;
msg << "Could not create a shared parameter instance for '" msg << "Could not create a shared parameter instance for '"

@ -150,7 +150,7 @@ namespace BtOgre {
if (i == mBoneIndex->end()) if (i == mBoneIndex->end())
{ {
l = new Vector3Array; l = new Vector3Array;
mBoneIndex->insert(BoneKeyIndex(currBone, l)); mBoneIndex->insert(std::make_pair(currBone, l));
} }
else else
{ {

@ -27,7 +27,6 @@
namespace BtOgre { namespace BtOgre {
typedef std::map<unsigned char, Vector3Array*> BoneIndex; typedef std::map<unsigned char, Vector3Array*> BoneIndex;
typedef std::pair<unsigned short, Vector3Array*> BoneKeyIndex;
class VertexIndexToShape class VertexIndexToShape
{ {

Loading…
Cancel
Save