Crash starting Legend of the Invincibles

Having trouble with the game? Report issues and get help here. Read this first!

Moderators: Forum Moderators, Developers

Forum rules
Before reporting issues in this section, you must read the following topic:
Battlecruiser_Venca
Posts: 196
Joined: June 3rd, 2009, 11:37 am
Contact:

Re: Crash starting Legend of the Invincibles

Post by Battlecruiser_Venca »

just started LotI part 2

Either way it looks that such unit crashes wesnoth

User avatar
Dugi
Posts: 4955
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Crash starting Legend of the Invincibles

Post by Dugi »

It doesn't happen if I load an autosave. Starting part 2 causes the error to happen, I can replicate it. I'll have a look at it.

User avatar
Dugi
Posts: 4955
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Crash starting Legend of the Invincibles

Post by Dugi »

Line 807 in src/units/unit.cpp must be edited from:

Code: Select all

	name_ = race_->generate_name(gender_);
to:

Code: Select all

	if (race_ != &(unit_race::null_race)) name_ = race_->generate_name(gender_);
When I do it, the error no longer appears. Can someone with commit rights push it, please?

User avatar
Iris
Site Administrator
Posts: 6678
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: Crash starting Legend of the Invincibles

Post by Iris »

I suspect, from a cursory glance at the code, that the proper fix would actually be to make unit_race::generator() avoid dereferencing name_generator_ items that are actually null pointers, or make the default unit_race constructor initialize the contents of name_generator_ to valid pointers instead of leaving it default-constructed.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm (now available for Wesnoth 1.14).

User avatar
Celtic_Minstrel
Developer
Posts: 1654
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Crash starting Legend of the Invincibles

Post by Celtic_Minstrel »

There's a pull request currently pending that touches the name generators (I think it's 661). I think it might fix the issue if this is caused by dereferencing a null name generator like shadowm suggests. And if it doesn't fix it I think I'd prefer to resolve that PR before looking at this issue.
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

User avatar
Dugi
Posts: 4955
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Crash starting Legend of the Invincibles

Post by Dugi »

Wouldn't a temporary solution be better? All fake units have null race, which means that any WML that uses fake units will cause assertion failures. The fix is trivial.

User avatar
Celtic_Minstrel
Developer
Posts: 1654
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Crash starting Legend of the Invincibles

Post by Celtic_Minstrel »

Hmm. Thinking more on it, the fix you mentioned won't conflict with said pull request, at least. What shadowm said about possible better ways to fix this still applies, though; skipping name generation if the generator is a null pointer makes the most sense to me. Is it really so urgent that a temporary solution is needed? If people want to play Legend of the Invincibles before this is fixed, they can use 1.12.6 or 1.13.4 instead of master, after all. I can implement what I said (or what you said) if there's lots of demand for it, but I just don't see the urgency when it's most likely going to be fixed by PR661 (which eliminates null name generators).
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

User avatar
Dugi
Posts: 4955
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Crash starting Legend of the Invincibles

Post by Dugi »

It's an error that can happen only for those who compile it themselves, so I guess these people are skilled enough to find this topic and the proposed fix.

That PR661 appears like something that's going to be merged soon, so I guess that there's no point in pushing this fix when it will be pointless in a few days anyway.

Post Reply