#318

Solved

set/getcounter action tags for mult. counters don't work properly

Reported by Manu on OCTGN · 09/11/2010 15:31:58

Assigned to:
jods
Priority:
Normal
Status:
Solved
Category:
Game scripts
Version:
0.7.*
Issue type:
Bug

Hi, I encoutered another small bug. I’m creating the o8g file for a game where every player has 2 counters. In addition to the +/- modifier per click, I created shortcuts for in- and decreasing the counters. But only the first counter is ever modified, even when using the shortcut for the second counter.

The bug is reproducable. Take e.g. magic o8g file and add the following code after the shortcut definition for gaining 1 life (line 307):


In the game, pressing ctrl+w for gaining 1 life works, but pressing ctrl+M results only in increasing life, too.

I think the reason is in ScriptAction.cs in Script.GetCounter.LoadFromXml: When the game is started (just being created) Program.Game is null, so all counters get the same index 0.

I’m not sure how this can be solved neatly, perhaps by reloading the TableDefinition again (like in GameDef.cs GameDef.LoadFromXml: TableDefinition = …) and overwriting the old TableDefinition, of course after the game c’tor has finished and Program.Game != null.

After writing the above lines, I found that this bug is a duplicate/derivate of bug 235 (see brine’s comment) ;-) But that’s been marked as solved, so I decided to create this ticket.
Because the +/- do work, I would consider this as a lower priority bug.

Attachments

No attachment has been uploaded, yet.


Loading comments...