|
You last visited: Today at 11:22
Advertisement
Is this the best way?
Discussion on Is this the best way? within the CO2 Private Server forum part of the Conquer Online 2 category.
07/06/2011, 13:47
|
#16
|
elite*gold: 0
Join Date: Aug 2004
Posts: 26
Received Thanks: 4
|
Quote:
Originally Posted by Lateralus
In my proxy, I use class Hero to describe MY character, and class Player to describe other players. Just saying.
|
Why have 2 classes that do the same thing?
|
|
|
07/06/2011, 14:19
|
#17
|
elite*gold: 0
Join Date: May 2005
Posts: 1,892
Received Thanks: 920
|
Quote:
Originally Posted by Yaksha
Why have 2 classes that do the same thing?
|
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.
|
|
|
07/06/2011, 20:34
|
#18
|
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
|
Quote:
Originally Posted by Kiyono
Or people just like using Hero, really you don't have the right to decide what people call things in their source.
|
owned, and yea i like using Hero, i'm in no way following TQ,
|
|
|
07/06/2011, 21:26
|
#19
|
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
|
I personally use "*****." I only do this so I can go "*****.Money -= XX" xD
|
|
|
07/06/2011, 21:41
|
#20
|
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
|
On ******* 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.
|
|
|
07/06/2011, 21:53
|
#21
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,381
|
Personally I just love whoever wrote the class names for CoEmu ISMA.
It has all sorts of handy class names like the "IMMASOCKET" class.
It brings untold joy to my heart looking through that source finding all the fun class names.
|
|
|
07/06/2011, 23:02
|
#22
|
elite*gold: 0
Join Date: May 2005
Posts: 1,892
Received Thanks: 920
|
Quote:
Originally Posted by _tao4229_
On ******* 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.
|
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?
|
|
|
07/06/2011, 23:33
|
#23
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Quote:
Originally Posted by Lateralus
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?
|
Very much agreed, been using them for a while
|
|
|
07/07/2011, 00:49
|
#24
|
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
|
Quote:
Originally Posted by Lateralus
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 ?
|
|
|
07/07/2011, 01:32
|
#25
|
elite*gold: 0
Join Date: Apr 2009
Posts: 782
Received Thanks: 458
|
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...
}
|
|
|
07/07/2011, 01:49
|
#26
|
elite*gold: 0
Join Date: Aug 2010
Posts: 343
Received Thanks: 21
|
Quote:
Originally Posted by 12tails
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...
}
|
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?
|
|
|
07/07/2011, 06:07
|
#27
|
elite*gold: 0
Join Date: May 2005
Posts: 1,892
Received Thanks: 920
|
Quote:
Originally Posted by { Angelius }
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.
|
|
|
07/07/2011, 21:05
|
#28
|
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
|
thanks for the help, lol i guess ill just do it how, 12talis said.
|
|
|
07/07/2011, 23:18
|
#29
|
elite*gold: 0
Join Date: May 2005
Posts: 1,892
Received Thanks: 920
|
Quote:
Originally Posted by -Shunsui-
thanks for the help, lol i guess ill just do it how, 12talis said.
|
And use concurrent dictionaries.
|
|
|
All times are GMT +1. The time now is 11:22.
|
|