Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect json path causes error at server join #80

Open
ChimiChumi opened this issue Oct 9, 2023 · 0 comments
Open

Incorrect json path causes error at server join #80

ChimiChumi opened this issue Oct 9, 2023 · 0 comments

Comments

@ChimiChumi
Copy link

ChimiChumi commented Oct 9, 2023

In the java version of the game, trying to join the multiplayer session throws error referring to incorrect json path. This happens, because an incorrect path was set by the developer. After correcting it, the java version can be launched and played.

In order to fix this and make the game runnable, remove the data from the path's string in the listed location below:

It should look like this:

  • /server/src/main/java/me/rhin/openciv/server/game/ai/AIType.java
public enum AIType {
	BARBARIAN_MELEE_UNIT("ai/barbarian_melee_unit.json", Unit.class),
	LAND_MELEE_UNIT("ai/land_melee_unit.json", Unit.class),
	LAND_RANGED_UNIT("ai/land_ranged_unit.json", Unit.class),
	SETTLER_UNIT("ai/settler_unit.json", Unit.class),
	BUILDER_UNIT("ai/builder_unit.json", Unit.class),
	BARBARIAN_PLAYER("ai/barbarian_player.json", AbstractPlayer.class),
	CITY_STATE_PLAYER("ai/city_state_player.json", AbstractPlayer.class),
	CITY("ai/city.json", City.class);
  • /server/src/main/java/me/rhin/openciv/server/game/city/City.java
...
...
private String getUnorderedGeographyName(String landmassType) {
		ArrayList<String> names = new ArrayList<>();
		BufferedReader reader;

		try {
			reader = new BufferedReader(new FileReader("landmass_names/" + landmassType + ".txt"));
			String line = reader.readLine();
			while (line != null) {
				names.add(line);
				line = reader.readLine();
			}
			reader.close();
		}
...
  • /server/src/main/java/me/rhin/openciv/server/game/city/City.java
...
...
private String getUnorderedGeographyName(String landmassType) {
   	ArrayList<String> names = new ArrayList<>();
   	BufferedReader reader;

   	try {
   		reader = new BufferedReader(new FileReader("landmass_names/" + landmassType + ".txt"));
   		String line = reader.readLine();
   		while (line != null) {
   			names.add(line);
   			line = reader.readLine();
   		}
   		reader.close();
   	}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant