Insomniumm / bwsal

Automatically exported from code.google.com/p/bwsal
0 stars 0 forks source link

ProductionManager - Improper Map Element Handling #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Load the BasicAI module.
2. Create a game with any race at Astral Balance.
3. Wait for the first worker to build.

What is the expected output? What do you see instead?
1. After building the first worker the game crashes. Expected - game continues.

What version of the product are you using? On what operating system?
1. BWSAL rev. 94 from the SVN (Aug 20-th, 2009). OS Win XP.

Additional information:

SOLUTION
See in ProductionManager, lines 93-111.
In line 98 the current item is removed from a map and used afterwards,
causing invalid memory access.
Before line 93 introduce the following variables:

  BWAPI::Unit *key = i->first;
  Unit &value = i->second;

And then replace i->first and i->second to line 111.
This worked for me.

BR,
V.

Original issue reported on code.google.com by vasil...@gmail.com on 3 Sep 2009 at 9:43

Attachments:

GoogleCodeExporter commented 8 years ago
P.S. I used VC Express 2008.

Original comment by vasil...@gmail.com on 3 Sep 2009 at 9:47

GoogleCodeExporter commented 8 years ago
Better patch committed by lowerlogic.
Issue resolved.

Original comment by vasil...@gmail.com on 7 Sep 2009 at 6:32

Attachments: