Hi!
Is it possible source code auto-format to be done in Android Studio for all Java files in the project?
All the best,
Todor
We have a new Beta: v0.8.13 ("Troubling Times") !
Useful links
Source code of the game - Contribution guide - ATCS Editor - Translate the game on Weblate - Example walkthrough - Andor's Trail Directory - Join the Discord
Get the game (v0.8.12.1) from Google, F-Droid, our server, or itch.io
Useful links
Source code of the game - Contribution guide - ATCS Editor - Translate the game on Weblate - Example walkthrough - Andor's Trail Directory - Join the Discord
Get the game (v0.8.12.1) from Google, F-Droid, our server, or itch.io
Source Code Autoformat
-
- Posts: 5
- Joined: Mon Nov 18, 2013 11:06 am
- android_version: 4.0
- Zukero
- Lead Developer
- Posts: 2028
- Joined: Thu Jul 21, 2011 9:56 am
- android_version: 8.0
- Location: Eclipse
Re: Source Code Autoformat
Hello and welcome to the forums !
I don't know about Android Studio. You can search for "IntelliJ Idea" in google. Android Studio is based on this software (a non-free Java IDE).
I use the Eclipse ADT bundle, as IMHO, android studio is not mature enough yet, and I'm more familiar with eclipse. In eclipse, you can use Ctrl+Shift+F to reformat a source file, or a whole project, or Ctrl+I to only redo the indentation of a selected piece of code.
However, if you intend to contribute some source code, I would advise against reformatting the files, as GIT would think you have changed all the lines of all the files.
Good luck !
I don't know about Android Studio. You can search for "IntelliJ Idea" in google. Android Studio is based on this software (a non-free Java IDE).
I use the Eclipse ADT bundle, as IMHO, android studio is not mature enough yet, and I'm more familiar with eclipse. In eclipse, you can use Ctrl+Shift+F to reformat a source file, or a whole project, or Ctrl+I to only redo the indentation of a selected piece of code.
However, if you intend to contribute some source code, I would advise against reformatting the files, as GIT would think you have changed all the lines of all the files.
Good luck !
Lvl: 78, XP: 8622632, Gold: 271542, RoLS: 1, ElyR: -, RoL: -, ChaR: 1, GoLF: 1, ShaF: 1, SRoV: 1, VSH: 1, WMC: 1, GoW: 1
HP: 71, AC: 301%, AD: 38-47, AP: 3, ECC: 50%, CM: 3.75, BC: 101%, DR: 2
HP: 71, AC: 301%, AD: 38-47, AP: 3, ECC: 50%, CM: 3.75, BC: 101%, DR: 2
-
- Posts: 5
- Joined: Mon Nov 18, 2013 11:06 am
- android_version: 4.0
Re: Source Code Autoformat
Thanks.
At the moment it is pretty difficult to read the code. I have better experience with Eclipse, but the tutorial says that Android Studio should be used and that is why I have asked for it.
May be the better question is why the source code is not auto-formated already?
Is there any chance project admins to take decision for source code auto-format?
I would like to contribute, but I think it is too early for me to offer something useful.
Todor
At the moment it is pretty difficult to read the code. I have better experience with Eclipse, but the tutorial says that Android Studio should be used and that is why I have asked for it.
May be the better question is why the source code is not auto-formated already?
Is there any chance project admins to take decision for source code auto-format?
I would like to contribute, but I think it is too early for me to offer something useful.
Todor
- Zukero
- Lead Developer
- Posts: 2028
- Joined: Thu Jul 21, 2011 9:56 am
- android_version: 8.0
- Location: Eclipse
Re: Source Code Autoformat
Where did you get the source ?
I get it from Oskar's github repo, and it looks well formatted to me. Indent uses tab, opening brackets not on a new line, and methods parameters on a new line when numerous are the choices made.
I get it from Oskar's github repo, and it looks well formatted to me. Indent uses tab, opening brackets not on a new line, and methods parameters on a new line when numerous are the choices made.
Lvl: 78, XP: 8622632, Gold: 271542, RoLS: 1, ElyR: -, RoL: -, ChaR: 1, GoLF: 1, ShaF: 1, SRoV: 1, VSH: 1, WMC: 1, GoW: 1
HP: 71, AC: 301%, AD: 38-47, AP: 3, ECC: 50%, CM: 3.75, BC: 101%, DR: 2
HP: 71, AC: 301%, AD: 38-47, AP: 3, ECC: 50%, CM: 3.75, BC: 101%, DR: 2
-
- Posts: 5
- Joined: Mon Nov 18, 2013 11:06 am
- android_version: 4.0
Re: Source Code Autoformat
I see it seams it is my mistake. I am taking it from here: https://code.google.com/p/andors-trail/ ... ndorsTrail
-
- Posts: 5
- Joined: Mon Nov 18, 2013 11:06 am
- android_version: 4.0
I see some interesting functions.
Do you thik that it will be useful to rewrite some of them?
Code: Select all
private static int getRandomConditionForRejuvenate(Player player) {
ArrayList<Integer> potentialConditions = new ArrayList<Integer>();
for (int i = 0; i < player.conditions.size(); ++i) {
ActorCondition c = player.conditions.get(i);
if (!c.isTemporaryEffect())
continue;
if (c.conditionType.isPositive)
continue;
if (c.conditionType.conditionCategory == ActorConditionType.ConditionCategory.spiritual)
continue;
potentialConditions.add(i);
}
if (potentialConditions.isEmpty())
return -1;
return potentialConditions.get(Constants.rnd
.nextInt(potentialConditions.size()));
}
Code: Select all
private static int getRandomConditionForRejuvenate2(Player player) {
int i = -1;
int count = 0;
int potentialConditions[] = new int[player.conditions.size()];
for (ActorCondition c : player.conditions) {
i++;
if (!c.isTemporaryEffect())
continue;
if (c.conditionType.isPositive)
continue;
if (c.conditionType.conditionCategory == ActorConditionType.ConditionCategory.spiritual)
continue;
potentialConditions[count++] = i;
}
if (count == 0)
return -1;
return potentialConditions[Constants.rnd.nextInt(count)];
}