They don't do the same thing, not nearly. The packet that initializes your character and other characters are different, plus there are more fields in my character (such as thread controllers), that aren't needed in other players. Remember - this is for a proxy. In a server, yeah, all characters should have the same specifications.
No, this is extremely inefficient.
No need to sort the list to get the max battle power (that's a lot more (n/logn times as many comparisons needed)) even if you do it that way.
No, this is extremely inefficient.
No need to sort the list to get the max battle power (that's a lot more (n/logn times as many comparisons needed)) even if you do it that way.
He needs to put a loop with try/catch blocks in its scope, throw the exception inside, and do a bubblesort on the list in the catch block. That's just how I'd do it.
Seriously though, to add on what other people's advice - if you're going to do thread-safe adds in a dictionary and using .NET framework 4.0, may I suggest using the ConcurrentDictionary type?
He needs to put a loop with try/catch blocks in its scope, throw the exception inside, and do a bubblesort on the list in the catch block. That's just how I'd do it.
Seriously though, to add on what other people's advice - if you're going to do thread-safe adds in a dictionary and using .NET framework 4.0, may I suggest using the ConcurrentDictionary type?
He needs to put a loop with try/catch blocks in its scope, throw the exception inside, and do a bubblesort on the list in the catch block. That's just how I'd do it.
Seriously though, to add on what other people's advice - if you're going to do thread-safe adds in a dictionary and using .NET framework 4.0, may I suggest using the ConcurrentDictionary type?
why do you need a try/catch blocks as long as there is no way the void well throw an exception ?
Quote:
if (Client.Team == null) { return 0;} int bp = 0;
foreach (Character C in ThreadSafeDictionary(Client.Team).values)
if (C.BattlePower > bp) { bp = C.BattlePower; }
return bp;
i know you said thats how (YOU) do it but... i wold like to know how is it gonna return any errors and why does it need a try/catch blocks and how can it be easier than that and why do you need to sort such dictionary that contains less than 6 items ?
//shall use it when a new mem is added
public void NewMate_CHK(MemberInfo Mem)
{
//check the clan
//if he/she belongs to the same clan then
if(BP < Mem.Info.BP)
BP = Mem.Info.BP * 0.xxxx; //or w/e the calc is
//them send to the team membs the new potency value...
}
//shall use this when a player logout or just leave the team...
public void CHK_WholeLogOut()
{
BP = 0;
foreach(MemberInfo m in members.values)
//check if he/she belongs to clan... if not ... then just pass it with continue;... else
if(BP < Mem.Info.BP)
BP = Mem.Info.BP * 0.xxxx; //or w/e the calc is
//them send to the team membs the new potency value...
}
//shall use it when a new mem is added
public void NewMate_CHK(MemberInfo Mem)
{
//check the clan
//if he/she belongs to the same clan then
if(BP < Mem.Info.BP)
BP = Mem.Info.BP * 0.xxxx; //or w/e the calc is
//them send to the team membs the new potency value...
}
//shall use this when a player logout or just leave the team...
public void CHK_WholeLogOut()
{
BP = 0;
foreach(MemberInfo m in members.values)
//check if he/she belongs to clan... if not ... then just pass it with continue;... else
if(BP < Mem.Info.BP)
BP = Mem.Info.BP * 0.xxxx; //or w/e the calc is
//them send to the team membs the new potency value...
}
Inside the team? is it inside the team packet?
or when creating the team, team leader BP is the base for sharing to the team.member with appropriate calculation of BP sharing. Or searching the Highest BP within the Team.Leader and Team.Member and make it as the base for sharing BP. is it correct?
why do you need a try/catch blocks as long as there is no way the void well throw an exception ?
i know you said thats how (YOU) do it but... i wold like to know how is it gonna return any errors and why does it need a try/catch blocks and how can it be easier than that and why do you need to sort such dictionary that contains less than 6 items ?
I'm just kidding man. That would be ridiculously inefficient.