hitting someone with armed bear trap does nothing interesting, tho: it simply deactivates. the same happens if it hits a wall (naturally .
const std::list<squarescript> Square = RoomScript->GetSquare(); for (std::list<squarescript>::const_iterator i = Square.begin(); i != Square.end(); ++i) { game::BusyAnimation(); const squarescript *Script = &*i; const interval *ScriptTimes = Script->GetTimes(); const int Times = (ScriptTimes ? ScriptTimes->Randomize() : 1); for (int t = 0; t < Times; ++t) { v2 SquarePos; if (Script->GetPosition()->GetRandom()) { const rect *ScriptBorders = Script->GetPosition()->GetBorders(); rect Borders = ScriptBorders ? *ScriptBorders+Pos : rect(Pos, Pos+Size-v2(1, 1)); SquarePos = GetRandomSquare(0, Script->GetPosition()->GetFlags(), &Borders); } else { SquarePos = Pos+Script->GetPosition()->GetVector(); } if (SquarePos == ERROR_V2) { ABORT("KABOOM!"); } else { Map[SquarePos.X][SquarePos.Y]->ApplyScript(Script, RoomClass); } } }
for(const squarescript& Script : RoomScript->GetSquare()) { game::BusyAnimation(); const interval* ScriptTimes = Script.GetTimes(); int Times = ScriptTimes ? ScriptTimes->Randomize() : 1; for(int t = 0; t < Times; ++t) { v2 SquarePos; while(true) { if(Script.GetPosition()->GetRandom()) { const rect* ScriptBorders = Script.GetPosition()->GetBorders(); rect Borders = ScriptBorders ? *ScriptBorders + Pos : rect(Pos, Pos + Size - v2(1, 1)); SquarePos = GetRandomSquare(0, Script.GetPosition()->GetFlags(), &Borders); } else SquarePos = Pos + Script.GetPosition()->GetVector(); Map[SquarePos.X][SquarePos.Y]->ApplyScript(&Script, RoomClass); if(CheckExpansiveArea(GetLSquare(SquarePos)->GetOLTerrain(), SquarePos.X, SquarePos.Y, !Script.GetPosition()->GetRandom())) break; } } }oops. no checks. that's why k8ivan crashed — it properly detects erorr. and vanilla seems to ignore it, either going haywire shooting random memory, or segfaulting. so i wonder WHY doesn't vanilla segfaulting quite often on GF generation?