Follow-up Comment #1, bug #13174 (project wesnoth):

We talked about this in IRC yesterday. We came to no final conclusion beside
that in the [side] definition you musn't add a position. This has to come
from the map. Still this report is not invalid, since this mistake *should*
not cause an assertion ingame and has to be fixed.

Here is the respective part of the log:

20090311 12:46:11< Ivanovic> wtf?!?
http://www.wesnoth.org/forum/viewtopic.php?f=4&t=24444&start=0&st=0&sk=t&sd=a
20090311 12:46:49< silene> Ivanovic: i took a look, but this is a part of the
code that i don't know at all, so i was quickly confused; so while i
understand why it could happen, i have just no clue where to look at to fix
it
20090311 12:47:01< Ivanovic> silene: okay
20090311 12:47:03< Ivanovic> :(
20090311 12:47:24< Shadow_Master> Ivanovic: ouch.
20090311 12:48:50< Shadow_Master> testing
20090311 12:49:55< Shadow_Master> Ivanovic: reproduced.
20090311 12:50:02< Shadow_Master> silene: perhaps you could take a look at
that thread?
20090311 12:50:08< silene> being able to fail three assertions in the
pathfinder in a row, this guy is good ;-)
20090311 12:50:14< Ivanovic> yeah
20090311 12:51:07< silene> unfortunately, i don't have time right now; i will
keep it in mind though and look at it later
20090311 12:51:07< Shadow_Master> the involved units have no special stats.
20090311 12:51:13< Ivanovic> anything special in teh campaign he is working
on?
20090311 12:51:18< Shadow_Master> Ivanovic: nope.
20090311 12:51:31< Ivanovic> then it is *really* a case of *UGH*
20090311 12:51:57< Shadow_Master> it has an empty (_"") translatable string
though :->
20090311 12:52:35< Shadow_Master> otherwise, it is a really simple test case
and I don't understand why I haven't experienced a similar issue while
playtesting my campaign
20090311 12:52:39< silene> i already fixed a similar bug a few weeks ago; it
is quite easy to mess the ai so that it calls the pathfinder incorrectly
20090311 12:52:39< Soliton> can't the gettext tools simply ignore those?
20090311 12:53:13< Shadow_Master> (I used HEAD)
20090311 12:53:14< silene> Soliton: no, they are meaningful, they map to the
explanatory section of the translation (authors, dates, and so on)
20090311 12:53:28< Ivanovic> Soliton: no
20090311 12:53:59< Shadow_Master> well, there's something special if you try
to load from a saved game of tat scenario
20090311 12:54:06< Shadow_Master> 20090311 08:54:32 error general: The game
could not be loaded: load_game_failed: Invalid starting position (-999,-999)
for a unit on side 2.
20090311 12:54:40< silene> that's a unit that should be on the recall list
20090311 12:54:56< Shadow_Master> yeah, it may be the side 2 leader that is
declared with a explict X,Y location
20090311 12:55:35< Shadow_Master> the pathfinding problem may occur when the
game tries to locate the leader or something. If you start that scenario and
disable fog and shroud you'll notice the side 2 leader is not on map.
20090311 12:56:03< Shadow_Master> ... don't tell me the unit_map is holding a
unit with a invalid location as key ?
20090311 12:57:32< Ivanovic> hmm, the 3rd scenario of legend of wesmere also
has the "invalid position" stuff
20090311 12:57:59< Ivanovic> though there it is in a scrollto thingie
20090311 12:58:02< Shadow_Master> I think in Livor's test case, the game is
effectively spawning the side 2 leader by adding it to the unit map
20090311 12:58:17< Shadow_Master> however, since the map doesn't have a
starting location for that side ...
20090311 12:58:40< Ivanovic> 20090311 12:58:27 error display: Tile at
-999,-999 isn't on the map, can't scroll to the tile.
20090311 12:58:42< Ivanovic> 20090311 12:58:27 error display: Tile at
-999,-999 isn't on the map, can't scroll to the tile.
20090311 13:00:18< Shadow_Master> Ivanovic: the dude (Livor) is using invalid
WML.
20090311 13:00:36< Shadow_Master> [side] doesn't accept the X,Y coordinates
for leader declarations.
20090311 13:00:40< Ivanovic> Shadow_Master: okay
20090311 13:00:52< Shadow_Master> so, the unit has x,y="-999","-999" in the
saved game
20090311 13:01:02< Ivanovic> there should be some "fix" for it to not make
the pathifinder crash anyway
20090311 13:01:12< Shadow_Master> for some weird reason the pathfinding code
gets to stumble upon that unit
20090311 13:01:23-!- ilor_ [n=u...@wesnoth/developer/ilor] has quit [Read
error: 110 (Connection timed out)]
20090311 13:01:40< Shadow_Master> silene: does the pathfinder use unit_map ?
20090311 13:02:00< Ivanovic> maybe a check for the position in pathfinding
and not considering units at the position -999 ?
20090311 13:02:01< silene> it can, but i don't think it's relevant there
20090311 13:02:19< silene> it may just be the AI calling the pathfinder to
know how far the leader is from a keep
20090311 13:02:23< Shadow_Master> Ivanovic: rather convert the assert into a
"ignore"
20090311 13:02:31< Shadow_Master> or a "get me outta here"
20090311 13:02:42< Shadow_Master> (also known as C++ exception)
20090311 13:03:14< silene> nah, i think what it's important should have been
to never allow a unit with invalid coordinate in the unit_map
20090311 13:03:41< Shadow_Master> I indeed thought the unit_map forbids that
case
20090311 13:04:36< silene> here it's the pathfinder complaining, but there
are probably a lot more places that will badly break if some units are
"alive" while not on the map
20090311 13:06:08< Shadow_Master> uummm, indeed unit_map::add() seems not to
do any validation whatsoever
20090311 13:07:18< Shadow_Master> there are other member methods that are
supposed to do stuff like "removing invalid entries in map_"
20090311 13:07:36< Shadow_Master> "Called automatically when safe and
needed."
20090311 13:08:27< Shadow_Master> sounds like unit_map _is_ supposed to
accept invalid locations as keys for some purpose
20090311 13:10:23< Shadow_Master> and nobody in particular maintains that
code so... uh? :-|
20090311 13:10:25< silene> no, it doesn't seem like it, clean_invalid doesn't
look at the location; so i don't know what "invalid", but it is something
else
20090311 13:10:59< silene> perhaps some kind of garbage collector
20090311 13:11:00< Shadow_Master> if (!iter->second.first) {
20090311 13:11:26< Shadow_Master> let me figure out what is the second
element for that iterator and what is the first element of that second
element...
20090311 13:12:39< Shadow_Master> it is a map_location object
20090311 13:13:16< Shadow_Master> there's a operator overload involved
somewhere
20090311 13:13:16< silene> you sure? it looks like a boolean: i->second.first
= false
20090311 13:13:47< silene> (look at the validate and invalidate functions)
20090311 13:13:54< Shadow_Master> in umap::iterator, first would be a bool
value.
20090311 13:14:04< Shadow_Master> er, size_t
20090311 13:14:32< Shadow_Master> uh right, the second.first is a bool
20090311 13:15:10< Shadow_Master> argh, reading that typedef isn't good for
my health:
20090311 13:15:11< Shadow_Master> typedef std::map<size_t,std::pair<bool,
std::pair<map_location,unit>*> > umap;
20090311 13:15:27< silene> yes, first is size_t, second.first is bool,
second.second.first is location, and second.second.second is unit (what kind
of crap is that?!)
20090311 13:15:33-!- Shadow_Master
[n=imore...@wesnoth/developer/shadowmaster] has quit ["no battery"]
20090311 13:16:51< loonycyborg> std::pair<bool, std::pair<map_location,unit>
>? AFAIK there are some tuple types in boost..
20090311 13:19:06< silene> yes, and even without boost, there is a thing
called "struct" that is just fine and allows to give meaningful names to
fields...


    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?13174>

_______________________________________________
  Nachricht geschickt von/durch Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to