Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

GoBoardRestorer.cpp

Go to the documentation of this file.
00001 //----------------------------------------------------------------------------
00002 /** @file GoBoardRestorer.cpp
00003     See GoBoardRestorer.h */
00004 //----------------------------------------------------------------------------
00005 
00006 #include "SgSystem.h"
00007 #include "GoBoardRestorer.h"
00008 
00009 #include "GoBoardUtil.h"
00010 
00011 using namespace std;
00012 
00013 //----------------------------------------------------------------------------
00014 
00015 GoBoardRestorer::GoBoardRestorer(GoBoard& bd)
00016     : m_bd(bd),
00017       m_size(bd.Size()),
00018       m_rules(bd.Rules())
00019 {
00020     for (int i = 0; i < bd.MoveNumber(); ++i)
00021         m_moves.PushBack(bd.Move(i));
00022 }
00023 
00024 GoBoardRestorer::~GoBoardRestorer()
00025 {
00026     GoBoardUtil::UndoAll(m_bd);
00027     if (m_bd.Size() != m_size)
00028         m_bd.Init(m_size);
00029     for (MoveList::Iterator it(m_moves); it; ++it)
00030         m_bd.Play(*it);
00031 }
00032 
00033 //----------------------------------------------------------------------------


Sun Mar 13 2011 Doxygen 1.7.1