Dwarves/Sappers Cause Game to Lock Up

Bug #1041837 reported by Enker-Zan on 2012-08-26
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Stratagus
Fix Released
Undecided
cybermind

Bug Description

Ordering a demo squad to self detonate on trees or mountains causes the game freeze. This makes certain campaign levels/maps unbeatable and makes this unit completely unusable till a hotfix comes out. I had to ctrl+alt+del to get out of the game, that's a pretty bad bug and should fixed ASAP. :-(

- Original WarCraft 2+ Expansion DOS CD
- stratagus version 2.2.7 (latest)
- Wargus version 2.2.7 (latest)
- Windows XP SP3

Related branches

Enker-Zan (enkerzan) wrote :

Update:

Sending Dwarves/Sappers to demolish terrain at certain angles will cause the game to lock up.

Sending Dwarves/Sappers to demolish an enemy unit will cause the game to crash to desktop.

talas (talas777) wrote :

Tested and still present in latest version.

Seems the game locks up depending on the sapper/dwarf angle.

Interestingly it seems the angles are different for sappers and dwarves.

If the dwarf is facing: north-west or west the game doesnt crash.

If the sapper is facing: west, south, north or north-east the game doesnt crash.

Any other direction and the game will freeze, then crash.

Note:
if you set the damage of the suicide spell to less than 40 so that the sapper/dwarf doesnt die, the game doesnt crash either. (unless you use it several time to make the unit die).

from gdb
Program received signal SIGSEGV, Segmentation fault.
0x08097de5 in COrder_SpellCast::CheckForDeadGoal(CUnit&) ()

talas (talas777) wrote :

Not sure if this is any help, but:

(gdb) frame 0
#0 COrder_SpellCast::CheckForDeadGoal (this=0x8c89f40, unit=...)
    at /build/buildd/stratagus-2.2.7/src/action/action_spellcast.cpp:233
233 in /build/buildd/stratagus-2.2.7/src/action/action_spellcast.cpp

(gdb) print unit
$1 = (CUnit &) @0x8f14008: {Refs = 1, ReleaseCycle = 0, UnitManagerData = {slot = 8, unitSlot = 8},
  PlayerSlot = 4294967295, InsideCount = 0, BoardCount = 0, UnitInside = 0x0, Container = 0x0,
  NextContained = 0x0, PrevContained = 0x0, NextWorker = 0x0, Resource = {Workers = 0x0, Assigned = 0,
    Active = 0}, tilePos = {x = 97, y = 15}, Offset = 2017, Type = 0x8a04d88, Player = 0x82f44a0,
  Stats = 0x8a053a4, CurrentSightRange = 0, pathFinderData = 0x8f14128, Frame = 33, Colors = 0x82f6600,
  IX = 0 '\000', IY = 0 '\000', Direction = 96 '`', CurrentResource = 0 '\000', ResourcesHeld = 0,
  DamagedType = 0 '\000', Attacked = 312, Blink = 0, Moving = 0, ReCast = 0, AutoRepair = 0, Burning = 0,
  Destroyed = 0, Removed = 0, Selected = 0, Constructed = 0, Active = 1, Boarded = 0, CacheLock = 0, Rs = 62,
  TeamSelected = 0, RescuedFrom = 0x0, VisCount = {1, 0 <repeats 15 times>}, Seen = {CFrame = 0x0,
    Frame = 2147483647, Type = 0x0, tilePos = {x = 0, y = 0}, IX = 0 '\000', IY = 0 '\000', Constructed = 0,
    State = 0, Destroyed = 0, ByPlayer = 0}, Variable = 0x8bd88e0, TTL = 0, GroupId = 0, LastGroup = 0, Wait = 0,
  Threshold = 0, Anim = {Anim = 0x89c5068, CurrAnim = 0x89c4e88, Wait = 4, Unbreakable = 0},
  Orders = {<std::_Vector_base<COrder*, std::allocator<COrder*> >> = {
      _M_impl = {<std::allocator<COrder*>> = {<__gnu_cxx::new_allocator<COrder*>> = {<No data fields>}, <No data fields>}, _M_start = 0x8c85610, _M_finish = 0x8c85614, _M_end_of_storage = 0x8c85618}}, <No data fields>},
  SavedOrder = 0x0, NewOrder = 0x0, CriticalOrder = 0x0, AutoCastSpell = 0x8bd8a88 "", Goal = 0x0}

Changed in wargus:
assignee: nobody → Joris Dauphin (joris-dauphin)
Joris Dauphin (joris-dauphin) wrote :

Cannot reproduce it with trunk version (stratagus rev.8689, wargus rev. 1679).

talas (talas777) wrote :

Hi, retested on latest stratagus trunk (just built it now from bzr sources trunk 8609), seems sappers crash less frequently now.

To reproduce the issue easily:

1. Take a dwarf demo team, and stand directly to the west of another unit you own.
 ( the other unit is standing still, also works with buildings)

2. then use demolish on the other unit. (the dwarf should look to the east when exploding).

Crashes every time on my machine.

talas (talas777) wrote :

Hi again,
I played with gdb some more and found that the following will fix the issue on my machine:

=== modified file 'src/action/action_spellcast.cpp'
--- src/action/action_spellcast.cpp 2013-02-11 10:09:26 +0000
+++ src/action/action_spellcast.cpp 2013-02-13 18:34:09 +0000
@@ -231,7 +231,7 @@
        const CUnit *goal = this->GetGoal();

        // Position or valid target, it is ok.
- if (!goal || goal->IsVisibleAsGoal(*unit.Player)) {
+ if (!unit.IsAlive() || !goal || goal->IsVisibleAsGoal(*unit.Player)) {
                return false;
        }

Hope the reporter can verify that it fixes the problem on his machine also ;)

talas (talas777) on 2013-02-21
affects: wargus → stratagus
EliCoten (launchpad-elicoten) wrote :

I am having this problem. How do I apply this patch and test? (And how long after that will the next version containing the patch be released?)

cybermind (iddqd-mail) wrote :

Fixed in rev.8881

Changed in stratagus:
status: New → Fix Committed
assignee: Joris Dauphin (joris-dauphin) → cybermind (iddqd-mail)
cybermind (iddqd-mail) on 2015-03-19
Changed in stratagus:
status: Fix Committed → Fix Released
milestone: none → 2.3
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers