[go: nahoru, domu]

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

Sending troops ends up with "Coordinates do not exist" error #27

Open
greldinard opened this issue Nov 8, 2021 · 4 comments
Open

Sending troops ends up with "Coordinates do not exist" error #27

greldinard opened this issue Nov 8, 2021 · 4 comments

Comments

@greldinard
Copy link
Contributor
  1. expected behaviour
    Entering Coordinates target fiels will send troops to the corresponding field.

  2. incorrect behaviour
    Message "Coordinates do not exist" appears, troops are not send.
    Probable encoding error? But where? Apache? PHP?

  3. the operating system & version
    Ubuntu 20.04

  4. PHP version on the server
    PHP 7.4.3

  5. MySQL / MariaDB version on the server
    MySQL 8.0.27

@greldinard
Copy link
Contributor Author

Resolved:

Change the function:

public function getBaseID($x, $y){
		return ((WORLD_MAX - $y) * (WORLD_MAX * 2 + 1)) + (WORLD_MAX + $x + 1);
	}

in the file GameEngine/Generator.php to:

public function getBaseID($x, $y){
		return ((WORLD_MAX - $y) * (WORLD_MAX * 2 + 1)) + (WORLD_MAX - $x + 1);
	}

And the coordinated will be calculated correctly.

@xPh03n1x
Copy link
xPh03n1x commented Mar 7, 2022

I just setup a server for me to play around and that '+' to '-' change actually breaks the game for me, making both the map and attack coordinates unusable.
Reverting back the '+' to '-' is actually a fix for me.

@gdinit
Copy link
gdinit commented Mar 10, 2022

Resolved:
...snip...
And the coordinated will be calculated correctly.

Applied this fix locally on my test system and gave it a quick test: appears it fixed my issue of being unable to raid some locations as well. Thank you.

My test system is:

  • Ubuntu 20.04.4 LTS (5.4.0-104-generic) fully patched
  • mysql-server-8.0
  • php7.4

gdinit added a commit to gdinit/TravianZ that referenced this issue Mar 15, 2022
Thanks to greldinard for the fix!

See issue Shadowss#27, Sending troops ends up with "Coordinates do not exist" error. 
Shadowss#27
@aleferri
Copy link
aleferri commented Mar 21, 2022

Guys, i think the fix is:

$a = ( WORLD_MAX - $y );
$b = ( WORLD_MAX - $x );  
if ( $b < 0 ) {
    	$b = -$b;
} 
return ( $a * (WORLD_MAX * 2 + 1) ) + $b + 1;

Tested doing:

SELECT* FROM `s1_wdata` WHERE ( ( 100 - y ) * 201 + ABS( 100 - x ) + 1 ) <> id

the result is empty

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

4 participants