OpenClonk Bugtracker - OpenClonk
View Issue Details
0001906OpenClonkObjectspublic2017-04-18 12:022017-10-27 16:54
ReporterArmin 
Assigned ToK-Pone 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version8.0Fixed in Version8.0 
Summary0001906: Last man standing keeps creating new Rule_Relaunch objects
DescriptionIf you place the Last man standing rule in your scenario, it will also create Rule_Relaunch if it didnt exist already. But if you save the scenario and load it again, it will create a new one so after a few sessions you have like 10 Rule_Relaunchs in your Objects.c which makes it impossible to edit the settings of the relaunch rule since the new one is one that seems to have impact on the game.
Additional InformationMaybe relevant:

snapshot/Objects.ocd/Rules.ocd/Relaunch.ocd/Script.c:374:
return FindObject(Find_ID(Rule_Relaunch)) || CreateObject(Rule_Relaunch);
TagsNo tags attached.
Attached Files

Notes
(0005656)
Fulgen   
2017-04-18 14:04   
The LastManStanding rule itself only creates Rule_Relaunch if it isn't present and the player wins a relaunch by killing other players. But even then the condition to create the rule shouldn't fail...
(0005670)
Maikel   
2017-04-30 14:24   
There is no last man standing rule.

The goal does not seem to involve the relaunch rule. So where is the problem exactly?
(0005709)
Maikel   
2017-08-05 14:26   
Okay, I see the problem now. Scenario saving of the relaunch rule should check if it is not already created and also some of the properties do not seem to be saved at the moment.
(0005831)
Clonkonaut   
2017-10-26 12:54   
Can someone explain to me, why Rule_Relaunch gets created when I place the last man standing goal in the editor? I don't get how that works.
(0005875)
K-Pone   
2017-10-27 14:24   
@Clonkonaut Rule_Relaunch is created because Scoreboard_Relaunch calls it in its Initialize() function.

As stated in the Additional Information field, the function GetRelaunchRule() creates the relaunch rule when being called and it has not been created yet.

I just found this out by adding a LogCallStack() to Rule_Relaunch's Initialize().

Came up with this:
 by: Object(19)->Initialize() (ot.ocs\System.ocg\rl.c:6)
 by: Object(18)->GetRelaunchRule() (Objects.ocd\Rules.ocd\Relaunch.ocd\Script.c:405)
 by: Object(18)->Initialize() (Objects.ocd\Libraries.ocd\Scoreboard.ocd\Relaunch.ocd\Script.c:19)
 by: Object(18)->Initialize() (Objects.ocd\Goals.ocd\LastManStanding.ocd\Script.c:28)
(0005876)
K-Pone   
2017-10-27 14:27   
Anyhow, I cannot reproduce this savegame creating relaunch objects thing. I tested by creating the Goal_LastManStanding object, saving, and then loading the saved game and see how many Rule_Relaunch objects are there. Only one was there, as expected.
(0005877)
Clonkonaut   
2017-10-27 14:45   
It probably depends on the order in which the objects are saved in Objects.c
If Last Man Standing comes first, then Relaunch won't be present upon creation.
(0005878)
K-Pone   
2017-10-27 14:57   
I think this doesn't necessarily needs to be present when Goal_LastManStanding doesn't call its Initialize() function. Or are objects calling Initialize() on savegames and only the scenario script is not doing this?
(0005879)
Clonkonaut   
2017-10-27 15:05   
If I understand this bug report correctly, this isn't about savegames but about scenario creation. In a saved scenario, objects will of course call Initialize.
(0005880)
K-Pone   
2017-10-27 15:14   
Well, then I understood that wrong. Just tested, and yes, when saving the scenario and reloading it, Rule_Relaunch is created twice. One by Goal_LastManStanding and another one by the Objects.c afterwards.
(0005881)
occ   
2017-10-27 16:51   
Hi! There's been a check-in that references this bug. For more information you can visit the repository browser at this address:
https://git.openclonk.org/openclonk.git/commitdiff/4d1a000ed8d5a05f54ad8183481eced718f2afa2

Changeset 4d1a000 by Martin Strohmeier <k-pone@gmx.de>
Fix 0001906: Rule_Relaunch is saved properly in Objects.c by using GetRelaunchRule() instead of CreateObject()

(0005882)
K-Pone   
2017-10-27 16:54   
Rule_Relaunch is saved properly now. Instead of CreateObject the Rule_Relaunch object is now properly referenced by using GetRelaunchRule(). The other properties are being applied as usual in Objects.c.

Issue History
2017-04-18 12:02ArminNew Issue
2017-04-18 14:04FulgenNote Added: 0005656
2017-04-30 14:24MaikelNote Added: 0005670
2017-08-05 13:58MaikelTarget Version => 8.0
2017-08-05 14:26MaikelNote Added: 0005709
2017-10-26 12:54ClonkonautNote Added: 0005831
2017-10-27 14:24K-PoneNote Added: 0005875
2017-10-27 14:27K-PoneNote Added: 0005876
2017-10-27 14:45ClonkonautNote Added: 0005877
2017-10-27 14:57K-PoneNote Added: 0005878
2017-10-27 15:05ClonkonautNote Added: 0005879
2017-10-27 15:14K-PoneNote Added: 0005880
2017-10-27 15:15K-PoneAssigned To => K-Pone
2017-10-27 15:15K-PoneStatusnew => confirmed
2017-10-27 16:51occNote Added: 0005881
2017-10-27 16:54K-PoneStatusconfirmed => resolved
2017-10-27 16:54K-PoneResolutionopen => fixed
2017-10-27 16:54K-PoneFixed in Version => 8.0
2017-10-27 16:54K-PoneNote Added: 0005882