Although, disjoint else-if statements are actually faster in some programming languages.
Yes, that's right, and that's why it's absolutely correct to use them.« previous next » |
searching java code (Read 135277 times)
July 24, 2010, 01:46:22 pm
#17
Blahian
Posts: 41
Logged
Re: searching java code
...programming on holidays
I don't want to blame anyone here...
Ähm...but: Using 4-5 time the charAt(0) method in an if-else structure isn't really fast.
a switch would only once evaluate this method and then jump in the current cases; and a switch has also a deflaut-case...
...going to correct code...
Ähm...but: Using 4-5 time the charAt(0) method in an if-else structure isn't really fast.
a switch would only once evaluate this method and then jump in the current cases; and a switch has also a deflaut-case...
...going to correct code...
...programming on holidays
July 24, 2010, 03:27:15 pm
#18
Blahian
Posts: 41
Logged
Re: searching java code
...programming on holidays
my Code correction is for example like this.
Open the code in a java editor (like eclipse) to see the differences:
I know its big, but I haven't any email adresses...
Open the code in a java editor (like eclipse) to see the differences:
Code:
public void targetExecutionCode() {
/** A.I. targeting execution code!!! */
/** join the if-s
if(Buffer.Player().ai == true && mode == Constant.selectYourTarget) {
if(animationIterator == animationDelay-1) {
contentPane.remove(screen);
*/
if((Buffer.Player().ai == true) && (mode == Constant.selectYourTarget)
&& (animationIterator == animationDelay-1)) {
contentPane.remove(screen);
/**
* a switch replacing the commented if-else structures
*/
switch(attackType) {
case Constant.normalAttack :
if (Buffer.Player().range > 2) {
attackType = Constant.rangedAttack;
}
battleAnimation = new MeleeSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
battleAnimation.setBounds(0,0,maxX,maxY);
/* TODO: Stop local animation loop? */
contentPane.add(battleAnimation);
break;
case Constant.rangedAttack :
rangedAnimation = new RangedSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
rangedAnimation.setBounds(0,0,maxX,maxY);
/* TODO: Stop local animation loop? */
contentPane.add(rangedAnimation);
break;
}// switch
} // combined if
} // end of targetExecutionCode()
/**
* Replaced if-else structure in targetExecutionCode()
*
* case constant.normalAttack
*
* if(Buffer.Player().range > 2 && attackType == Constant.normalAttack) {
attackType = Constant.rangedAttack;
}
if(attackType == Constant.normalAttack) {
battleAnimation = new MeleeSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
battleAnimation.setBounds(0,0,maxX,maxY);
TODO: Stop local animation loop?
contentPane.add(battleAnimation);
}
else if(attackType == Constant.rangedAttack) {
rangedAnimation = new RangedSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
rangedAnimation.setBounds(0,0,maxX,maxY);
TODO: Stop local animation loop?
contentPane.add(rangedAnimation);
}
a complicated way to call repaint()
this.paint(this.getGraphics());
mode = Constant.modeAttack;
changing the sound
JukeBox.PlayBattleTune(); */
I know its big, but I haven't any email adresses...
...programming on holidays
July 24, 2010, 03:29:19 pm
#19
Blahian
Posts: 41
Logged
Re: searching java code
...programming on holidays
maxY maxY and some other new variables are calculated before or are Object-Variables (see this. Operator in a Java tutorial)
The Constant.xxx values are the same as they are in the orginal-code:
The Constant.xxx values are the same as they are in the orginal-code:
Code:
public static final int overlandWalking = 0;
public static final int standardMenuActive = 1;
public static final int selectYourTarget = 2;
public static final int modeAttack = 5;
public static final int statusCheck = 6;
public static final int endOfTurn = 7;
[/code}
etc...
...programming on holidays
July 24, 2010, 03:31:07 pm
#20
Administrator
Shining Sideburns
Posts: 837
Logged
Re: searching java code
If you have any experience with Subversion, I could host the current babs code.
July 24, 2010, 03:32:27 pm
#21
Blahian
Posts: 41
Logged
Re: searching java code
...programming on holidays
I am more likely with zip versions, or tell me more about it I'll look after subversion later...
...programming on holidays
July 24, 2010, 03:36:59 pm
#22
Administrator
Shining Sideburns
Posts: 837
Logged
Re: searching java code
The official subversion site doesn't really give much info, but if you're using Windows I'd advise looking at TortoiseSVN. It makes checking things in and out much easier.
If you're happier with zip files, you can just post them here as attachments (maybe in their own thread to make them easier to find).
If you're happier with zip files, you can just post them here as attachments (maybe in their own thread to make them easier to find).
July 24, 2010, 04:53:48 pm
#23
Administrator
Shining Spammer
Posts: 1,208
Logged
Re: searching java code
Hmm... BABS on Subversion would be awesome! It would also make it much easier for me to check the code from anywhere and help people working on it whenever they get stuck .
July 24, 2010, 05:21:51 pm
#24
Administrator
Shining Sideburns
Posts: 837
Logged
Re: searching java code
Okey doke, I'll set it up today. If anyone would like access to it, just pm your desired username / password and I'll add your account & pm you the access details.
July 24, 2010, 09:39:28 pm
#25
Blahian
Posts: 41
Logged
Re: searching java code
...programming on holidays
can anyone explain me waht these variables mean
and which values they takes and what does these values mean.
Sometimes they take the value 3 - I can't imagine what that should mean?
Code:
private int up = 0;
private int down = 0;
private int left = 0;
private int right = 0;
/**equals 1 if particular button was once pressed and not released yet.*/
private int opup = 0;
private int opdown = 0;
private int opleft = 0;
private int opright = 0;
and which values they takes and what does these values mean.
Sometimes they take the value 3 - I can't imagine what that should mean?
...programming on holidays
July 24, 2010, 10:31:11 pm
#26
Blahian
Posts: 41
Logged
Re: searching java code
...programming on holidays
under
http://www.informatik.uni-freiburg.de/~marquard/
in the very last line you find a the partially corrected [BattleFrame.java] sourcefile
http://www.informatik.uni-freiburg.de/~marquard/
in the very last line you find a the partially corrected [BattleFrame.java] sourcefile
...programming on holidays
July 25, 2010, 03:15:07 am
#27
Administrator
Shining Spammer
Posts: 1,129
Logged
Re: searching java code
~Elvenfyre
Thanks for this christian, I really appreciate all of your efforts.
I have probably also corrupted the code with my style as well, so don't blame all the issues on Devlyn.
However unfortunately in my case you won't have reasonable explanations, since my method at the time simply required the end result to work in general, rather than being fast, efficient, or bug free
I have probably also corrupted the code with my style as well, so don't blame all the issues on Devlyn.
However unfortunately in my case you won't have reasonable explanations, since my method at the time simply required the end result to work in general, rather than being fast, efficient, or bug free
~Elvenfyre
July 25, 2010, 12:35:14 pm
#28
Blahian
Posts: 41
Logged
Re: searching java code
...programming on holidays
I don't blame anyone - I'm just reorganizing the code.
the newest code can be found at
http://www.informatik.uni-freiburg.de/~marquard/
please have a look at it, if it works how you expected it
the newest code can be found at
http://www.informatik.uni-freiburg.de/~marquard/
please have a look at it, if it works how you expected it
...programming on holidays
July 25, 2010, 09:18:57 pm
#30
Blahian
Posts: 41
Logged
Re: searching java code
...programming on holidays
hello,
anyone out there ?
I would be happy if didn't have to work alone.... !
anyone out there ?
I would be happy if didn't have to work alone.... !
...programming on holidays