Angband Forums

Angband Forums (http://angband.oook.cz/forum/index.php)
-   Vanilla (http://angband.oook.cz/forum/forumdisplay.php?f=3)
-   -   Bug 4.0.5, Target Cursor (http://angband.oook.cz/forum/showthread.php?t=7877)

Tibarius June 16, 2016 10:26

Bug 4.0.5, Target Cursor
 
Just tried to use 4.0.5 windows version.

Bug: The target cursor does not highlight the actual targetted monster but instead is somewhere located on the bottom section of the main window.

Correct Behavior: The target cursor should highlight the actual targetted monster.

Ocurrence: Always (so it should be easy to re-produce the bug). I switched two birth options (sell for gold and no usefull starting kit). UI-Options: Use old target by default and highlight target with cursor.

This leaves 4.0.5 unplayable for me ... *sigh*.

Nick June 16, 2016 12:56

Yeah, this is a known bug - x and y mixed up in cursor position, I believe :rolleyes:

mrfy June 17, 2016 05:37

Same bug in the macos version, but it's definitely not unplayable. it's just a display bug, doesn't affect game play.

bart9h July 20, 2016 19:57

Same bug on Linux, using either the SDL or the X11 frontend. Seems like it's not system-dependent. It's annoying, but definitely not unplayable. The actual cursor is on the right place, it's just displayed on the wrong place. I tried the latest git version, and it's still there. Please fix this! k tx by

t4nk July 21, 2016 00:36

line 369 of ui-game.c:
Code:

        move_cursor_relative(player->px, player->py);
Looks pretty innocent, right? But someone - who that was? - decided to use backwards order for coordinates (y, x) throughout the whole textui. Besides, pre_turn_refresh() should check for OPT(show_target)... I think... I sent a patch, it seems to work :) I didn't do a lot of testing.
Anyway, whose idea was to use y, x order? It's just super annoying. Was it Ben Harrison? I remember in school we always used x, y coordinates - in this particular order; x first, y second. Is this different in different countries or what? Now Angband sometimes uses x, y, sometimes y, x, which is very error prone. I considered normalizing all that (to x, y) in new textui... I'll probably have to do it.

Derakon July 21, 2016 01:16

Quote:

Originally Posted by t4nk (Post 111924)
Anyway, whose idea was to use y, x order? It's just super annoying. Was it Ben Harrison? I remember in school we always used x, y coordinates - in this particular order; x first, y second. Is this different in different countries or what? Now Angband sometimes uses x, y, sometimes y, x, which is very error prone. I considered normalizing all that (to x, y) in new textui... I'll probably have to do it.

It is unfortunately semi-common (not just in Angband) to specify coordinates as (row, column), which works out to (y, x). I agree with you that it's super annoying, and if I knew who introduced it to Angband I'd probably want to chew them out (or at least ask why), but it's been like that for ages. Ben Harrison or earlier, I think.

Pete Mack July 21, 2016 01:31

(y,x) goes all the way back to rogue, and primitive green-screen terminals, where (col, row) was a common form.

t4nk July 21, 2016 08:51

Funny stuff... consider ui-target.c. Why does pathfinder work (press 't', navigate to a square, press 'g' and go there) when targeter does:
Code:

    case 'g':
        cmd_set_arg_point(cmdq_peek(), "point", y, x);

How does that work when cmd_set_arg_point() takes x, y? Because do_cmd_pathfind() does:
Code:

    /* XXX-AS Add better arg checking */
    cmd_get_arg_point(cmd, "point", &x, &y);
    ...
    if (findpath(x, y)) {
    ....

and, of course, findpath()...
Code:

bool findpath(int y, int x)
I guess I'll have to leave the y, x stuff as it is, "fixing" it will just wreck the game at this point :)

AnonymousHero July 21, 2016 13:33

Quote:

Originally Posted by t4nk (Post 111924)
Now Angband sometimes uses x, y, sometimes y, x, which is very error prone. I considered normalizing all that (to x, y) in new textui... I'll probably have to do it.

If you're going to do anything about this, might I suggest introducing a "struct point { int x, int y}" instead? In most places, coordinates (x,y) aren't actually plucked out of thin air, but rather come from somewhere else, e.g. monster coordinates, object coordinates, player coordinates. In those cases, the relevant structs should just have a "point" embedded in them instead of separate (x, y) coordinates.

EDIT: If you want a less "noisy" method than struct-initialization for creating coordinates out of thin air you could always introduce a function: "point make_point(int x, int y)".

kandrc July 21, 2016 16:11

It's older than Rogue. It's part of curses (which Rogue used). And curses does in that way because terminals do it that way. And terminals do it that way because Indo-European languages (and specifically English) do it that way (i.e., of course indexing characters is not part of English, but when we need to refer to letters in text, it's far more sensible to talk about a line before an offset).

Long argument short, long historical precedent suggests that if you're using (x,y) when dealing with text or text-based stuff, you're doing it wrong.


All times are GMT +1. The time now is 11:08.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.