📄 chain.cpp
字号:
// chain.cpp: implementation of the chain class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "chess.h"
#include "chain.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
chain::chain()
{
}
chain::~chain()
{
}
int chain::IfInMe(CPoint P,int bw)
{
if(ChainLenth!=0){
if(bw==BorW){
switch( VHState )
{
case 0:
if(P.y==FirstP.y&&P.x==FirstP.x+ChainLenth)return(0);
if(P.y==FirstP.y&&P.x==FirstP.x-1)return(0);
break;
case 1:
if(P.x==FirstP.x&&P.y==FirstP.y+ChainLenth)return(0);
if(P.x==FirstP.x&&P.y==FirstP.y-1)return(0);
break;
case 2:
if(P.x==FirstP.x+ChainLenth&&P.y==FirstP.y+ChainLenth)return(0);
if(P.x==FirstP.x-1&&P.y==FirstP.y-1)return(0);
break;
case 3:
if(P.x==FirstP.x+ChainLenth&&P.y==FirstP.y-ChainLenth)return(0);
if(P.x==FirstP.x-1&&P.y==FirstP.y+1)return(0);
break;
}
}
}
return(1);
}
void chain::AddMember(CPoint p)
{
switch(VHState){
case 0:
switch(p.x){
case 1:
if(EnaAdd==1)EnaAdd=0;
if(EnaAdd==3)EnaAdd=2;
break;
case 15:
if(EnaAdd==2)EnaAdd=0;
if(EnaAdd==3)EnaAdd=1;
}
break;
case 1:
switch(p.y){
case 1:
if(EnaAdd==1)EnaAdd=0;
if(EnaAdd==3)EnaAdd=2;
break;
case 15:
if(EnaAdd==2)EnaAdd=0;
if(EnaAdd==3)EnaAdd=1;
}
break;
case 2:
if(p.x==1||p.y==1){
if(EnaAdd==1)EnaAdd=0;
if(EnaAdd==3)EnaAdd=2;
}
if(p.x==15||p.y==15){
if(EnaAdd==2)EnaAdd=0;
if(EnaAdd==3)EnaAdd=1;
}
break;
case 3:
if(p.x==1||p.y==15){
if(EnaAdd==1)EnaAdd=0;
if(EnaAdd==3)EnaAdd=2;
}
if(p.x==15||p.y==1){
if(EnaAdd==2)EnaAdd=0;
if(EnaAdd==3)EnaAdd=1;
}
break;
}
if(p.x<FirstP.x||(p.x==FirstP.x&&p.y<FirstP.y))FirstP=p;
ChainLenth++;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -