00001 //---------------------------------------------------------------------------- 00002 /** @file GoInit.cpp 00003 */ 00004 //---------------------------------------------------------------------------- 00005 00006 #include "SgSystem.h" 00007 #include "GoInit.h" 00008 00009 #include "GoRegion.h" 00010 #include "SgException.h" 00011 #include "SgInit.h" 00012 #include "SgProp.h" 00013 00014 //---------------------------------------------------------------------------- 00015 00016 namespace { 00017 00018 bool s_isGoInitialized = false; 00019 00020 /** Register Go-game specific properties. */ 00021 void RegisterGoProps() 00022 { 00023 SgProp* moveProp = new SgPropMove(0); 00024 SG_PROP_MOVE_BLACK = 00025 SgProp::Register(moveProp, "B", 00026 SG_PROPCLASS_MOVE + SG_PROPCLASS_BLACK); 00027 SG_PROP_MOVE_WHITE 00028 = SgProp::Register(moveProp, "W", 00029 SG_PROPCLASS_MOVE + SG_PROPCLASS_WHITE); 00030 } 00031 00032 } // namespace 00033 00034 //---------------------------------------------------------------------------- 00035 00036 void GoFini() 00037 { 00038 GoRegion::Fini(); 00039 s_isGoInitialized = false; 00040 } 00041 00042 void GoInit() 00043 { 00044 SgInitCheck(); 00045 RegisterGoProps(); 00046 s_isGoInitialized = true; 00047 } 00048 00049 void GoInitCheck() 00050 { 00051 if (! s_isGoInitialized) 00052 throw SgException("GoInit not called"); 00053 } 00054 00055 //---------------------------------------------------------------------------- 00056