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