Dugy / Legend_of_the_Invincibles

An add-on campaign for the Battle for Wesnoth game
GNU General Public License v3.0
40 stars 22 forks source link

With 1.13.11 : "alter advancement" does not work anymore ? #77

Closed alain-bkr closed 6 years ago

alain-bkr commented 6 years ago

Wesnoth version : latest commit from "git log" (edited : try to clarifiy the version used ) commit 0bc03e14c749699b7dfee5e8921b8ac34cf49d58 Date: Tue Feb 13 16:19:22 2018 +1100

Loti : latest commit from git : commit b2019140e9ee3b034c230a133c6600c4ff1cc8ae Author: Dugy Date: Wed Jan 31 22:19:15 2018 +0100

I tried with various units, and it always gives the same messge (on screen and in logs) Invalid WML found: Attempt to store nonexistent unit type 'Advancing Efraim_lich'. Invalid WML found: Attempt to store nonexistent unit type 'Advancing Lethalia_lich'. Invalid WML found: Attempt to store nonexistent unit type 'Advancing Dwarvish Hero'. Invalid WML found: Attempt to store nonexistent unit type 'Advancing Delly_lich'.

LotI1-First Confrontation Tour 9-cannot-alter-advancement.gz

I am pretty sure that it did work recently (1.13.10+ january).

Dugy commented 6 years ago

I am pretty sure that the commit from Charles Dang didn't break it.

The Invalid WML found errors look relevant and disturbing weird. I will check it out.

alain-bkr commented 6 years ago

I tried to reduce the search scope, but it is too complicted for me :

20180214 16:29:07 info wml: helper.set_wml_tag_metatable has been deprecated indefinitely. (Note: You should use wml.tag instead in new code) 20180214 16:29:17 info wml: helper.shallow_literal has been deprecated indefinitely. (Note: You should use wml.shallow_literal instead in new code) 20180214 16:29:17 info wml: helper.get_child has been deprecated indefinitely. (Note: You should use wml.get_child instead in new code) 20180214 16:29:17 info wml: wesnoth.set_variable has been deprecated indefinitely. (Note: You should use wml.variable.set instead in new code) Invalid WML found: Attempt to store nonexistent unit type 'Advancing Efraim_lich'.

Dugy commented 6 years ago

Those other reports are irrelevant. The problem is that some unit types are not loaded. It's lucky that the game doesn't outright throw you back to main menu with an exception. It seems it is somehow unable to read the {GENERIC_AMLA} and similar macros in some unit type files.

alain-bkr commented 6 years ago

A similar message occured , when one unit should have levelup during opponent's turn betwenn turn 14 and 15 .

20180215 17:47:41 error scripting/lua: game_error: unknown unit type: Advancing Elvish Juggernaut stack traceback: [C]: in local 'cmd' lua/wml-utils.lua:145: in field 'handle_event_commands' lua/wml-flow.lua:52: in local 'cmd' lua/wml-utils.lua:145: in field 'handle_event_commands' lua/wml-flow.lua:38: in local 'cmd' lua/wml-utils.lua:145: in field 'handle_event_commands' lua/wml-flow.lua:6: in function <lua/wml-flow.lua:5> [C]: in field 'fire_event' lua/wml-tags.lua:164: in local 'cmd' lua/wml-utils.lua:145: in field 'handle_event_commands' lua/wml-flow.lua:52: in local 'cmd' lua/wml-utils.lua:145: in field 'handle_event_commands' lua/wml-flow.lua:20: in local 'cmd' lua/wml-utils.lua:145: in field 'handle_event_commands' lua/wml-flow.lua:6: in function <lua/wml-flow.lua:5>

LotI1-Chasing Dragons-Sauvegarde automatique14.gz

LotI1-Chasing Dragons-Sauvegarde automatique15.gz

Dugy commented 6 years ago

It just confirms that some unit types are not loaded.

alain-bkr commented 6 years ago

OK, thanks for the explanations.

All the messages on screen are really annoying. Is there a way to only have them only in the console output and not on screen ?

2018-02-15_23-28-48__advancing_juggernaut

Dugy commented 6 years ago

You can hide them with Ctrl+X if I recall correctly, they shouldn't pop out too often. I have not studied it yet, but it seems to me more like a bug in wesnoth.

alain-bkr commented 6 years ago

Comment from the wesnoth issue ### https://github.com/wesnoth/wesnoth/issues/2514 :

This was likely broken by 13a4822 but actually this should really be fixed in the addons code

Dugy commented 6 years ago

I see. Now the unit types are referenced somewhere as Advancing Something, elsewhere as AdvancingSomething and it doesn't fit together.

Dugy commented 6 years ago

It should be fixed now with 661223b, but I could not test it - current revision of wesnoth 1.13 does not compile because of some inconsistencies while porting to C++11.

Vultraz commented 6 years ago

You were relying on buggy behavior in the WML parser before, where WML key values with variable substitution would lose the space before the variable name. I fixed that. You're seeing the error as a result of the key being parsed properly and not losing its space.

As for compilation, if you have a build issue, please report it on the Wesnoth issues page.

Dugy commented 6 years ago

No, it would not have fixed it. It was creating unit types without the break (it was macro substitution) and using them in a variable substitution with a break (the break was ignored because there were no quotation marks), so it was adapted to the 'bugged' version.

Vultraz commented 6 years ago

I edited my comment after I spotted my error. Sorry, just woke up.

The gist of it is you were relying on the string with a space being parsed as having no spaces. You can either solve it as you did, by manually deleting the space, or by ensuring there is a space in the unit type ID. Though perhaps a better fix would be to use underscores in both cases. Ie, Advancing_Lich_Efriem.

Dugy commented 6 years ago

I have tested that the bug is gone now.

I have not inserted those underscores because it would cause this bug to manifest in all mid-scenario save files. Also, the type has such an odd name because it's only a way to store data outside save files, the unit is never played with (unless there's an error) and needs to have an odd name to make it visible.

As for the wesnoth compilation error, it's fixed already. I was lazy to write a bug report because it would be spotted very fast anyway.