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.Quote:
Why have 2 classes that do the same thing?
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.Quote:
On fucking topic:
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.
Very much agreed, been using them for a while :DQuote:
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:
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?
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 ?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;
Inside the team? is it inside the team packet?Quote:
why not simply do inside the team ...
public ushort BP = 0;
//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...
}
Quote:
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 ?