From 195997eacf6b3809dd660a464e3490be1f64c9af Mon Sep 17 00:00:00 2001 From: ketmar Date: Wed, 30 May 2012 06:55:54 +0300 Subject: [PATCH] fixed some bugs in new 'g'o system --- src/game/actions/action_go.cpp | 2 +- src/game/char.cpp | 29 +++++++++++++++++++---------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/game/actions/action_go.cpp b/src/game/actions/action_go.cpp index 25a6f13..d2cc9d9 100644 --- a/src/game/actions/action_go.cpp +++ b/src/game/actions/action_go.cpp @@ -15,7 +15,7 @@ public: virtual cchar *GetDescription () const; virtual truth ShowEnvironment () const { return false; } - inline truth prevWasTurn () const { return mPrevWasTurn; } + inline truth GetPrevWasTurn () const { return mPrevWasTurn; } inline void SetPrevWasTurn (truth v) { mPrevWasTurn = v; } protected: diff --git a/src/game/char.cpp b/src/game/char.cpp index da71c62..66294d6 100644 --- a/src/game/char.cpp +++ b/src/game/char.cpp @@ -2716,7 +2716,7 @@ void character::GoOn (go *Go, truth FirstStep) { } // if (!FirstStep) { - if (Go->IsWalkingInOpen() != !IsInCorridor(GetPos()+MoveVector, moveDir)) { + if (!Go->GetPrevWasTurn() && Go->IsWalkingInOpen() != !IsInCorridor(GetPos(), moveDir)) { dirlogf("moved to/from open place\n"); Go->Terminate(false); return; @@ -2754,6 +2754,8 @@ void character::GoOn (go *Go, truth FirstStep) { return; } // + truth doStop = false; + // if (!FirstStep) { // continuous walking if (Go->IsWalkingInOpen() || !orthoDir[moveDir]) { @@ -2776,8 +2778,9 @@ void character::GoOn (go *Go, truth FirstStep) { if (ood != ond || nod != nnd) { // # of directions to walk to changed, stop right here dirlogf("# of directions changed from (%d:%d) to (%d%d)\n", ood, ond, nod, nnd); - Go->Terminate(false); - return; + //Go->Terminate(false); + //return; + doStop = true; } // ok, we can do this move } else { @@ -2809,21 +2812,22 @@ void character::GoOn (go *Go, truth FirstStep) { // } // - truth doStop = false; square *BeginSquare = GetSquareUnder(); uInt OldRoomIndex = GetLSquareUnder()->GetRoomIndex(); uInt CurrentRoomIndex = MoveToSquare[0]->GetRoomIndex(); // // stop on the square with something interesting - for (int c = 0; c < Squares; ++c) { - if (MoveToSquare[c]->GetStack()->HasSomethingFunny(this, ivanconfig::GetStopOnCorpses(), ivanconfig::GetStopOnSeenItems())) { - dirlogf(" stepped on something interesting\n"); - doStop = true; - break; + if (!doStop) { + for (int c = 0; c < Squares; ++c) { + if (MoveToSquare[c]->GetStack()->HasSomethingFunny(this, ivanconfig::GetStopOnCorpses(), ivanconfig::GetStopOnSeenItems())) { + dirlogf(" stepped on something interesting\n"); + doStop = true; + break; + } } } // - //Go->SetPrevWasTurn(false); + Go->SetPrevWasTurn(MoveVector.X && MoveVector.Y); // diagonal move? // truth moveOk = TryMove(MoveVector, true, game::PlayerIsRunning()); // @@ -2837,6 +2841,11 @@ void character::GoOn (go *Go, truth FirstStep) { return; } // + if (FirstStep) { + mPrevMoveDir = Go->GetDirection(); + Go->SetIsWalkingInOpen(!IsInCorridor(moveDir)); + } + // if (ivanconfig::GetGoingDelay()) DELAY(ivanconfig::GetGoingDelay()); game::DrawEverything(); if (doStop) Go->Terminate(false); -- 2.11.4.GIT