well would some1 tell me why this code gives me an error saying that not all code patterns returns a value while i think all of them do
Code:
public static Game.Location getfreemobcoord(ushort X, ushort Y, ushort Spread)
{
Game.Location loc = new Game.Location();
loc.X = (ushort)Program.Rnd.Next(X, X + Spread);
loc.Y = (ushort)Program.Rnd.Next(Y, Y + Spread);
foreach (Game.NPC npc in Game.World.H_NPCs.Values)
{
if (npc.Loc.Equals(loc))
{
return getfreemobcoord(X, Y, Spread);
}
else
{
foreach (Game.Mob mon in Game.World.H_Mobs.Values)
{
if (mon.Loc.Equals(loc))
{
return getfreemobcoord(X, Y, Spread);
}
else
{
return loc;
}
}
}
}
}