00001
00002
00003 #include "osl/effect/numSimpleEffect.h"
00004
00005 void osl::effect::
00006 NumSimpleEffectTable::init(const SimpleState& state)
00007 {
00008 std::fill(effects.begin(), effects.end(),NumBitmapEffect());
00009 for(int num=0;num<40;num++){
00010 if (state.isOnBoard(num)){
00011 Piece p=state.getPieceOf(num);
00012 #if 0
00013 doEffect<NumBitmapEffect::Add,false>(state,p);
00014 #else
00015 doEffect<NumBitmapEffect::Add,true>(state,p);
00016 #endif
00017 }
00018 }
00019 }
00020
00021 bool osl::effect::operator==(const NumSimpleEffectTable& et1,const NumSimpleEffectTable& et2)
00022 {
00023 for(int y=1;y<=9;y++)
00024 for(int x=9;x>0;x--){
00025 Position pos(x,y);
00026 if (!(et1.getEffect(pos)==et2.getEffect(pos))) return false;
00027 }
00028 if (! (et1.effected_mask == et2.effected_mask))
00029 return false;
00030 if(!(et1.mobilityTable==et2.mobilityTable)) return false;
00031 if(!(et1.effectedNumTable==et2.effectedNumTable)) return false;
00032
00033 return true;
00034 }
00035
00036 #ifndef MINIMAL
00037 std::ostream& osl::effect::operator<<(std::ostream& os,const NumSimpleEffectTable& effectTable)
00038 {
00039 os << "Effect" << std::endl;
00040 for(int y=1;y<=9;y++){
00041 for(int x=9;x>0;x--){
00042 Position pos(x,y);
00043 os << effectTable.getEffect(pos) << " ";
00044 }
00045 os << std::endl;
00046 }
00047 os << "Effect" << std::endl;
00048 for(int y=1;y<=9;y++){
00049 for(int x=9;x>0;x--){
00050 Position pos(x,y);
00051 os << effectTable.getEffect(pos) << " ";
00052 }
00053 os << std::endl;
00054 }
00055 return os;
00056 }
00057 #endif
00058
00059
00060
00061