More Cleanup from Code Analysis

This commit is contained in:
hondacrx
2017-06-24 18:41:58 -04:00
parent ad5ee77680
commit bfe5de0cfb
6 changed files with 13 additions and 11 deletions
@@ -14,9 +14,11 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
using System;
namespace Framework.Constants namespace Framework.Constants
{ {
[Flags]
public enum RealmFlags public enum RealmFlags
{ {
None = 0x00, None = 0x00,
-1
View File
@@ -126,7 +126,6 @@ namespace System.Collections.Generic
list = listCopy; list = listCopy;
} }
public static T SelectRandom<T>(this IEnumerable<T> source) public static T SelectRandom<T>(this IEnumerable<T> source)
{ {
return source.SelectRandom(1).Single(); return source.SelectRandom(1).Single();
+1 -1
View File
@@ -359,7 +359,7 @@ namespace Game.Combat
public void update() public void update()
{ {
if (iDirty && threatList.Count > 1) if (iDirty && threatList.Count > 1)
threatList.OrderByDescending(p => p.getThreat()); threatList = threatList.OrderByDescending(p => p.getThreat()).ToList();
iDirty = false; iDirty = false;
} }
+2 -2
View File
@@ -149,8 +149,8 @@ namespace Game.DataStorage
_curvePoints[curvePoint.CurveID].Add(curvePoint); _curvePoints[curvePoint.CurveID].Add(curvePoint);
} }
foreach (var key in _curvePoints.Keys) foreach (var key in _curvePoints.Keys.ToList())
_curvePoints[key].OrderBy(point => point.Index); _curvePoints[key] = _curvePoints[key].OrderBy(point => point.Index).ToList();
foreach (EmotesTextSoundRecord emoteTextSound in CliDB.EmotesTextSoundStorage.Values) foreach (EmotesTextSoundRecord emoteTextSound in CliDB.EmotesTextSoundStorage.Values)
_emoteTextSounds[Tuple.Create((uint)emoteTextSound.EmotesTextId, emoteTextSound.RaceId, emoteTextSound.SexId, emoteTextSound.ClassId)] = emoteTextSound; _emoteTextSounds[Tuple.Create((uint)emoteTextSound.EmotesTextId, emoteTextSound.RaceId, emoteTextSound.SexId, emoteTextSound.ClassId)] = emoteTextSound;
+6 -6
View File
@@ -124,19 +124,19 @@ namespace Game.Entities
angle += 2 * MathFunctions.PI; angle += 2 * MathFunctions.PI;
// Look for position around 2 second ahead of us. // Look for position around 2 second ahead of us.
uint workDiff = m_cinematicDiff; int workDiff = (int)m_cinematicDiff;
// Modify result based on camera direction (Humans for example, have the camera point behind) // Modify result based on camera direction (Humans for example, have the camera point behind)
workDiff += (uint)((2 * Time.InMilliseconds) * Math.Cos(angle)); workDiff += (int)((2 * Time.InMilliseconds) * Math.Cos(angle));
// Get an iterator to the last entry in the cameras, to make sure we don't go beyond the end // Get an iterator to the last entry in the cameras, to make sure we don't go beyond the end
var endItr = m_cinematicCamera.LastOrDefault(); var endItr = m_cinematicCamera.LastOrDefault();
if (endItr != null && workDiff > endItr.timeStamp) if (endItr != null && workDiff > endItr.timeStamp)
workDiff = endItr.timeStamp; workDiff = (int)endItr.timeStamp;
// Never try to go back in time before the start of cinematic! // Never try to go back in time before the start of cinematic!
if (workDiff < 0) if (workDiff < 0)
workDiff = m_cinematicDiff; workDiff = (int)m_cinematicDiff;
// Obtain the previous and next waypoint based on timestamp // Obtain the previous and next waypoint based on timestamp
foreach (FlyByCamera cam in m_cinematicCamera) foreach (FlyByCamera cam in m_cinematicCamera)
@@ -153,11 +153,11 @@ namespace Game.Entities
// Never try to go beyond the end of the cinematic // Never try to go beyond the end of the cinematic
if (workDiff > nextTimestamp) if (workDiff > nextTimestamp)
workDiff = nextTimestamp; workDiff = (int)nextTimestamp;
// Interpolate the position for this moment in time (or the adjusted moment in time) // Interpolate the position for this moment in time (or the adjusted moment in time)
uint timeDiff = nextTimestamp - lastTimestamp; uint timeDiff = nextTimestamp - lastTimestamp;
uint interDiff = workDiff - lastTimestamp; uint interDiff = (uint)(workDiff - lastTimestamp);
float xDiff = nextPosition.posX - lastPosition.posX; float xDiff = nextPosition.posX - lastPosition.posX;
float yDiff = nextPosition.posY - lastPosition.posY; float yDiff = nextPosition.posY - lastPosition.posY;
float zDiff = nextPosition.posZ - lastPosition.posZ; float zDiff = nextPosition.posZ - lastPosition.posZ;
+2 -1
View File
@@ -89,8 +89,9 @@ namespace Game.Spells
if (visuals != null) if (visuals != null)
_visuals = visuals; _visuals = visuals;
// sort all visuals so that the ones without a condition requirement are last on the list // sort all visuals so that the ones without a condition requirement are last on the list
foreach (var key in _visuals.Keys) foreach (var key in _visuals.Keys.ToList())
_visuals[key] = _visuals[key].OrderByDescending(x => x.PlayerConditionID).ToList(); _visuals[key] = _visuals[key].OrderByDescending(x => x.PlayerConditionID).ToList();
// SpellScalingEntry // SpellScalingEntry