//****************************************************************************
//Copyright (C) 2005-2006 Beijing BlueDJ Technology Co.,Ltd. All rights reserved.

//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or (at your option) any later version.

//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.

//You should have received a copy of the GNU General Public License
//along with this program (in the file LICENSE.GPL); if not, write to the Free Software
//Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

//Please visit http://www.bluedj.com for more infomation about us.
//Contact us at ggwizard@gmail.com or darkdong@gmail.com.
//****************************************************************************/

#include <iostream>
#include "chessmap.h"
#include "4country.h"
#include "jdebug.h"

void Insert1Board(char *pchessmap,unsigned short board);
void CreatPinFor2Stop(char * pchessmap,unsigned short board1,unsigned short id1,unsigned char pin,
						unsigned short board2,unsigned short id2,unsigned short pintype);
void InitJunQiNodeXY(char *pchessmap,unsigned char chCountrys,unsigned char chFirstSite);

void InitChips()
{
}

void SetChip(char * pchessmap,unsigned char chArea,unsigned char id,PJunQiChip pchip)
{
	PMapNode pnode;
	NODEID			nodeid;
	nodeid.district = 0;
	nodeid.id = GET_NODEID(chArea,0,id);
	pnode = SearchNode(pchessmap,&nodeid);
	if(pnode == NULL)
		return;
	pnode->chip.id = pchip->id;
	pnode->chip.power.power = pchip->power;
	pnode->chip.f.f = MAP_MAX_F;
	pnode->chip.owner = pchip->owner;
}

bool MoveChip(char * pchessmap,unsigned char chAreaSrc,unsigned char idsrc,
								unsigned char chAreaDis,unsigned char iddis,
								unsigned char **pppath)
{
	PMapNode pstart,pend;
	NODEID			nodeid;
	int 			iTotalF;
	bool 			bRet;
	PChessMapHead phead  = (PChessMapHead)GetChessmapHead(pchessmap);
	
	nodeid.district = 0;
	nodeid.id = GET_NODEID(chAreaSrc,0,idsrc);
	pstart = SearchNode(pchessmap,&nodeid);
	if(pstart == NULL || pstart->chip.id == 0 || pstart->chip.power.power == 0)
		return false;
	nodeid.district = 0;
	nodeid.id = GET_NODEID(chAreaDis,0,iddis);
	pend = SearchNode(pchessmap,&nodeid);
	if(pend == NULL)
		return false;
	if(pend->id.type.type == DJGAME_JUNQI_NODETYPE_STATION && pend->chip.id != 0)
		return false;
	bRet = SearchPath(pchessmap,&(pstart->chip.power),pstart,pend,pppath,&iTotalF);
	if(bRet)
	{
		DEBUG_BUFFER(((char *)*pppath,phead->shMaxNodes-1));
	}
	return bRet;
	
}

unsigned char CheckNodesMovable(PMapNode *pnodes,unsigned char chNodes,unsigned char *unions,unsigned char chUnions)
{
	if(chNodes == 0 || chNodes > 110)
		return 0;
	PMapNode pcopynodes[110],pnextnode;
	memcpy(pcopynodes,pnodes,sizeof(PMapNode)*chNodes);
	int i,j;
	unsigned char chMovableNodes = 0;
	for(i=0;i<chNodes;i++)
	{
		if(pcopynodes[i]->chip.id != 0)
		{
			for(j=1;j<=DJGAME_CHESSMAP_MAX_PINS;j++)
			{
				if(pcopynodes[i]->pin[j].pnode != NULL && pcopynodes[i]->pin[j].type != 0)
				{
					pnextnode = GetRealNode(pcopynodes[i]->pin[j].pnode);
					if(pnextnode != NULL && pcopynodes[i]->path[0][j].f.f <= pcopynodes[i]->chip.power.power && 
							(pnextnode->chip.id == 0 || (!IsFriendlyChip(unions,chUnions,pcopynodes[i],pnextnode) && !IsStation(GET_NodeX(pnextnode->id.id),GET_NodeY(pnextnode->id.id) ) )) )
					{//该子可移动
						pnodes[chMovableNodes] = pcopynodes[i];
						chMovableNodes ++;
						break;
					}
				}
			}//for(j=1;j<=DJGAME_CHESSMAP_MAX_PINS;j++)
		}//if(pcopynodes[i]->chip.id != 0)
	}//i
	return chMovableNodes;
}

bool JunqiCheckArrange(PJunqiTraceInitChip pori,PJunqiTraceInitChip parrange)
{
	char buffer[200];
	int i,j;
	int iDilei=0,iHighDilei=0;
	PJunqiTraceInitChip	pcopy;
	if( pori == NULL || parrange == NULL)
		return false;
	if(pori->chChips != parrange->chChips)
		return false;
	memcpy(buffer,pori,sizeof(JunqiTraceInitChip) + (pori->chChips) * sizeof(JunqiTraceChip));
	pcopy = (PJunqiTraceInitChip)buffer;
	for(i=0;i<pcopy->chChips;i++)
	{
		for(j=0;j<pcopy->chChips;j++)
		{
			if(pcopy->chip[j].chip.id == 0)
				continue;
			if(IsStation( (parrange->chip[i].xy >> 4),(parrange->chip[i].xy&0x0F)) )
				return false;
			if(parrange->chip[i].chip.id == DJGAME_JUNQI_RANK_JUNQI &&
					!IsCamp( (parrange->chip[i].xy >> 4),(parrange->chip[i].xy&0x0F)) )
				return false;
			if(parrange->chip[i].chip.id == DJGAME_JUNQI_RANK_DILEI)
			{
				iDilei ++;
				if( (parrange->chip[i].xy >> 4) > 2)
					iHighDilei ++;
			}
			if(parrange->chip[i].chip.id == pcopy->chip[j].chip.id)
			{
				parrange->chip[i].chip.owner = pcopy->chip[j].chip.owner;
				parrange->chip[i].chip.power = pcopy->chip[j].chip.power;
				pcopy->chip[j].chip.id = 0;
				break;
			}
		}
		if(j>= pcopy->chChips)
			return false;
	}
	if(iHighDilei > 0 && iDilei <=5)
		return false;
	return true;
}
bool IsFriendlyChip(unsigned char *unions,unsigned char chUnions,PMapNode pstart,PMapNode pend)
{
	return IsFriendlyPlayer(unions,chUnions,pstart->chip.owner,pend->chip.owner);
}
bool IsFriendlyPlayer(unsigned char *unions,unsigned char chUnions,unsigned char chP1,unsigned char chP2)
{
	unsigned char ch1,ch2;
	int i;
	if(chP1 == chP2)
		return true;
	if(unions != NULL && chUnions > 0)
	{
		ch1 = (chP1 << 4) + chP2;
		ch2 = (chP2 << 4) + chP1;
		for(i=0;i<chUnions;i++)
		{
			if(unions[i] == ch1 || unions[i] == ch2)
				return true;
		}
	}
	return false;
}

bool IsStation(unsigned char x,unsigned char y)
{
	if( (x==3 || x==5) && (y==2 || y== 4) )
		return true;
	if( x== 4 && y== 3)
		return true;
	return false;
}

bool IsCamp(unsigned char x,unsigned char y)
{
	if(x==1 && (y==2 || y==4) )
		return true;
	return false;
}

void Init2CountryChessmap(char *pchessmap,unsigned int iMaxSize,unsigned char chFirstSite)
{
	NODEID			nodeid,nodeid2;
	InitChessMap(pchessmap,iMaxSize,70);
	PChessMapHead phead  = (PChessMapHead)GetChessmapHead(pchessmap);
	phead->iContext = 2;
	Insert1Board(pchessmap,1);
	Insert1Board(pchessmap,2);
	InitJunQiNodeXY(pchessmap,2,chFirstSite);
	//利用虚节点连接2个棋盘
	nodeid.district = 0;
	nodeid2.district = 0;
	nodeid.id = GET_NODEID(1,6,1);
	nodeid2.id = GET_NODEID(2,6,5);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,1,DJGAME_JUNQI_PINTYPE_RAIL);
	
	nodeid.id = GET_NODEID(1,6,5);
	nodeid2.id = GET_NODEID(2,6,1);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,1,DJGAME_JUNQI_PINTYPE_RAIL);
	
	nodeid.id = GET_NODEID(1,6,3);
	nodeid2.id = GET_NODEID(2,6,3);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,1,DJGAME_JUNQI_PINTYPE_RAIL);
}

void Init3CountryChessmap(char *pchessmap,unsigned int iMaxSize,unsigned char chFirstSite)
{
	MapNode node;
	NODEID			nodeid,nodeid2;
	InitChessMap(pchessmap,iMaxSize,106);
	PChessMapHead phead  = (PChessMapHead)GetChessmapHead(pchessmap);
	phead->iContext = 3;
	Insert1Board(pchessmap,1);
	Insert1Board(pchessmap,2);
	Insert1Board(pchessmap,3);
	
	//创建中心节点
	memset(&node,0,sizeof(MapNode));
	node.id.district = 0;
	node.id.id		 = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,DJGAME_JUNQI_CONNECTER_AREA_CENTER);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][2].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[1][2].f.f  = 15;
	node.path[1][3].f.f  = 15;
	node.path[2][1].f.f  = 15;
	node.path[2][3].f.f  = 15;
	node.path[3][1].f.f  = 15;
	node.path[3][2].f.f  = 15;
	InsertNode(pchessmap,&node,true);
	
	InitJunQiNodeXY(pchessmap,3,chFirstSite);
	//利用虚节点连接3个棋盘
	nodeid.district = 0;
	nodeid2.district = 0;
	nodeid.id = GET_NODEID(1,6,1);
	nodeid2.id = GET_NODEID(2,6,5);
	Connect2NodeByVoidNode(pchessmap,&nodeid,8,&nodeid2,2,DJGAME_JUNQI_PINTYPE_RAIL);
	
	nodeid.id = GET_NODEID(2,6,1);
	nodeid2.id = GET_NODEID(3,6,5);
	Connect2NodeByVoidNode(pchessmap,&nodeid,8,&nodeid2,2,DJGAME_JUNQI_PINTYPE_RAIL);
	
	nodeid.id = GET_NODEID(3,6,1);
	nodeid2.id = GET_NODEID(1,6,5);
	Connect2NodeByVoidNode(pchessmap,&nodeid,8,&nodeid2,2,DJGAME_JUNQI_PINTYPE_RAIL);
	
	//使用虚节点将三个棋盘和中心节点连接
	nodeid.id = GET_NODEID(1,6,3);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&node.id,1,DJGAME_JUNQI_PINTYPE_RAIL);
	nodeid.id = GET_NODEID(2,6,3);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&node.id,2,DJGAME_JUNQI_PINTYPE_RAIL);
	nodeid.id = GET_NODEID(3,6,3);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&node.id,3,DJGAME_JUNQI_PINTYPE_RAIL);
}

void Init4CountryChessmap(char *pchessmap,unsigned int iMaxSize,unsigned char chFirstSite)
{
	MapNode node,*pcenter;
	NODEID			nodeid,nodeid2;
	InitChessMap(pchessmap,iMaxSize,164);
	PChessMapHead phead  = (PChessMapHead)GetChessmapHead(pchessmap);
	phead->iContext = 4;
	Insert1Board(pchessmap,1);
	Insert1Board(pchessmap,2);
	Insert1Board(pchessmap,3);
	Insert1Board(pchessmap,4);
	
	//创建连接区
			//中心点
	memset(&node,0,sizeof(MapNode));
	node.id.district = 0;
	node.id.id		 = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,DJGAME_JUNQI_CONNECTER_AREA_CENTER);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[1][5].f.f  = 1;
	node.path[5][1].f.f  = 1;
	node.path[3][7].f.f  = 1;
	node.path[7][3].f.f  = 1;
	
	node.path[1][3].f.f  = 15;
	node.path[3][1].f.f  = 15;
	node.path[1][7].f.f  = 15;
	node.path[7][1].f.f  = 15;
	node.path[5][3].f.f  = 15;
	node.path[3][5].f.f  = 15;
	node.path[5][7].f.f  = 15;
	node.path[7][5].f.f  = 15;
	pcenter = InsertNode(pchessmap,&node,true);
		//外围
	node.id.id		 = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x03);//0011
	InsertNode(pchessmap,&node,true);
	node.id.id		 = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x01);//0001
	InsertNode(pchessmap,&node,true);
	node.id.id		 = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x09);//1001
	InsertNode(pchessmap,&node,true);
	node.id.id		 = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x02);//0010
	InsertNode(pchessmap,&node,true);
	node.id.id		 = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x08);//1000
	InsertNode(pchessmap,&node,true);
	node.id.id		 = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x06);//0110
	InsertNode(pchessmap,&node,true);
	node.id.id		 = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x04);//0100
	InsertNode(pchessmap,&node,true);
	node.id.id		 = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x0c);//1100
	InsertNode(pchessmap,&node,true);
	
	CreatPinFor2Stop(pchessmap,DJGAME_JUNQI_CONNECTER_AREA,0x03,3,DJGAME_JUNQI_CONNECTER_AREA,0x01,
					DJGAME_JUNQI_PINTYPE_RAIL);
	CreatPinFor2Stop(pchessmap,DJGAME_JUNQI_CONNECTER_AREA,0x03,1,DJGAME_JUNQI_CONNECTER_AREA,0x02,
					DJGAME_JUNQI_PINTYPE_RAIL);
	CreatPinFor2Stop(pchessmap,DJGAME_JUNQI_CONNECTER_AREA,0x01,1,DJGAME_JUNQI_CONNECTER_AREA,0xFF,
					DJGAME_JUNQI_PINTYPE_RAIL);
	CreatPinFor2Stop(pchessmap,DJGAME_JUNQI_CONNECTER_AREA,0x01,3,DJGAME_JUNQI_CONNECTER_AREA,0x09,
					DJGAME_JUNQI_PINTYPE_RAIL);
	CreatPinFor2Stop(pchessmap,DJGAME_JUNQI_CONNECTER_AREA,0x08,7,DJGAME_JUNQI_CONNECTER_AREA,0xFF,
					DJGAME_JUNQI_PINTYPE_RAIL);
	CreatPinFor2Stop(pchessmap,DJGAME_JUNQI_CONNECTER_AREA,0x08,5,DJGAME_JUNQI_CONNECTER_AREA,0x09,
					DJGAME_JUNQI_PINTYPE_RAIL);
	CreatPinFor2Stop(pchessmap,DJGAME_JUNQI_CONNECTER_AREA,0xFF,1,DJGAME_JUNQI_CONNECTER_AREA,0x04,
					DJGAME_JUNQI_PINTYPE_RAIL);
	CreatPinFor2Stop(pchessmap,DJGAME_JUNQI_CONNECTER_AREA,0xFF,7,DJGAME_JUNQI_CONNECTER_AREA,0x02,
					DJGAME_JUNQI_PINTYPE_RAIL);
	CreatPinFor2Stop(pchessmap,DJGAME_JUNQI_CONNECTER_AREA,0x06,3,DJGAME_JUNQI_CONNECTER_AREA,0x04,
					DJGAME_JUNQI_PINTYPE_RAIL);
	CreatPinFor2Stop(pchessmap,DJGAME_JUNQI_CONNECTER_AREA,0x06,5,DJGAME_JUNQI_CONNECTER_AREA,0x02,
					DJGAME_JUNQI_PINTYPE_RAIL);
	CreatPinFor2Stop(pchessmap,DJGAME_JUNQI_CONNECTER_AREA,0x0c,7,DJGAME_JUNQI_CONNECTER_AREA,0x04,
					DJGAME_JUNQI_PINTYPE_RAIL);
	CreatPinFor2Stop(pchessmap,DJGAME_JUNQI_CONNECTER_AREA,0x0c,5,DJGAME_JUNQI_CONNECTER_AREA,0x08,
					DJGAME_JUNQI_PINTYPE_RAIL);
					
	InitJunQiNodeXY(pchessmap,4,chFirstSite);
	//使用虚节点使4个棋盘互相连接
	nodeid.district = 0;
	nodeid2.district = 0;
	nodeid.id = GET_NODEID(1,6,1);
	nodeid2.id = GET_NODEID(2,6,5);
	Connect2NodeByVoidNode(pchessmap,&nodeid,8,&nodeid2,2,DJGAME_JUNQI_PINTYPE_RAIL);
	
	nodeid.id = GET_NODEID(2,6,1);
	nodeid2.id = GET_NODEID(3,6,5);
	Connect2NodeByVoidNode(pchessmap,&nodeid,8,&nodeid2,2,DJGAME_JUNQI_PINTYPE_RAIL);
	
	nodeid.id = GET_NODEID(3,6,1);
	nodeid2.id = GET_NODEID(4,6,5);
	Connect2NodeByVoidNode(pchessmap,&nodeid,8,&nodeid2,2,DJGAME_JUNQI_PINTYPE_RAIL);
	
	nodeid.id = GET_NODEID(4,6,1);
	nodeid2.id = GET_NODEID(1,6,5);
	Connect2NodeByVoidNode(pchessmap,&nodeid,8,&nodeid2,2,DJGAME_JUNQI_PINTYPE_RAIL);
					
	//使用虚节点将4个棋盘连接到中心区
	nodeid.id = GET_NODEID(1,6,1);
	nodeid2.id = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x03);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,5,DJGAME_JUNQI_PINTYPE_RAIL);
	nodeid.id = GET_NODEID(1,6,3);
	nodeid2.id = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x01);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,5,DJGAME_JUNQI_PINTYPE_RAIL);
	nodeid.id = GET_NODEID(1,6,5);
	nodeid2.id = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x09);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,5,DJGAME_JUNQI_PINTYPE_RAIL);
	
	nodeid.id = GET_NODEID(2,6,1);
	nodeid2.id = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x06);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,7,DJGAME_JUNQI_PINTYPE_RAIL);
	nodeid.id = GET_NODEID(2,6,3);
	nodeid2.id = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x02);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,7,DJGAME_JUNQI_PINTYPE_RAIL);
	nodeid.id = GET_NODEID(2,6,5);
	nodeid2.id = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x03);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,7,DJGAME_JUNQI_PINTYPE_RAIL);
	
	nodeid.id = GET_NODEID(3,6,1);
	nodeid2.id = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x0c);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,1,DJGAME_JUNQI_PINTYPE_RAIL);
	nodeid.id = GET_NODEID(3,6,3);
	nodeid2.id = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x04);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,1,DJGAME_JUNQI_PINTYPE_RAIL);
	nodeid.id = GET_NODEID(3,6,5);
	nodeid2.id = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x06);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,1,DJGAME_JUNQI_PINTYPE_RAIL);
	
	nodeid.id = GET_NODEID(4,6,1);
	nodeid2.id = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x09);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,3,DJGAME_JUNQI_PINTYPE_RAIL);
	nodeid.id = GET_NODEID(4,6,3);
	nodeid2.id = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x08);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,3,DJGAME_JUNQI_PINTYPE_RAIL);
	nodeid.id = GET_NODEID(4,6,5);
	nodeid2.id = GET_NODEID(DJGAME_JUNQI_CONNECTER_AREA,0,0x0c);
	Connect2NodeByVoidNode(pchessmap,&nodeid,1,&nodeid2,3,DJGAME_JUNQI_PINTYPE_RAIL);
	
}

void Init4CountryRowChessmap(char *pchessmap,unsigned int iMaxSize,unsigned char chFirstSite)
{
//	NODEID			nodeid,nodeid2;
	InitChessMap(pchessmap,iMaxSize,150);
	PChessMapHead phead  = (PChessMapHead)GetChessmapHead(pchessmap);
	phead->iContext = 0x84;
	Insert1Board(pchessmap,1);
	Insert1Board(pchessmap,2);
	Insert1Board(pchessmap,3);
	Insert1Board(pchessmap,4);
	InitJunQiNodeXY(pchessmap,0x84,chFirstSite);
	//连接友军
	
	//连接敌军
	
}

void CreatPinFor2Stop(char * pchessmap,unsigned short board1,unsigned short id1,unsigned char pin,
						unsigned short board2,unsigned short id2,unsigned short pintype)
{
	NODEID			nodeid1,nodeid2;
	nodeid1.district = 0;
	nodeid2.district = 0;
	nodeid1.id = (board1<<8)+id1;
	nodeid2.id = (board2<<8)+id2;
	SetPin(pchessmap,&nodeid1,pin,pintype,&nodeid2);
}

void Insert1Board(char *pchessmap,unsigned short board)
{
	MapNode node,*pcurnode;
	NODEID			nodeid,nodeid2;
	
	memset(&node,0,sizeof(MapNode));
	node.id.district = 0;
	node.id.id		 = GET_NODEID(board,1,1);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][3].f.f  = 1;
	InsertNode(pchessmap,&node,true);
	
	node.id.id		 = GET_NODEID(board,1,2);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_CAMP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
//	node.path[0][1].f.f  = 1;
//	node.path[0][3].f.f  = 1;
//	node.path[0][7].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.district = 0;
	nodeid.id 		= GET_NODEID(board,1,1);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	
	node.id.id		 = GET_NODEID(board,1,3);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][7].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,1,2);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	
	node.id.id		 = GET_NODEID(board,1,4);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_CAMP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
//	node.path[0][1].f.f  = 1;
//	node.path[0][3].f.f  = 1;
//	node.path[0][7].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,1,3);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	
	node.id.id		 = GET_NODEID(board,1,5);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][7].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,1,4);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	/////////////////////////////////////////////////////////////////////////////////
	//第一行棋盘完成
	//
	// +---+   +---+   +---+   +---+   +---+
	// |1,1|---|1,2|---|1,3|---|1,4|---|1,5|
	// +---+   +---+   +---+   +---+   +---+
	// 兵站     大本营    兵站     大本营    兵站
	//////////////////////////////////////////////////////////////////////////////////
	
	node.id.id		 = GET_NODEID(board,2,1);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][2].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[1][3].f.f  = 15;
	node.path[3][1].f.f  = 15;
	InsertNode(pchessmap,&node,true);
	
	node.id.id		 = GET_NODEID(board,2,2);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_CAMP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[3][7].f.f  = 1;
	node.path[7][3].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,2,1);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_RAIL,&(node.id));
	
	node.id.id		 = GET_NODEID(board,2,3);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][2].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[0][8].f.f  = 1;
	node.path[3][7].f.f  = 1;
	node.path[7][3].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,2,2);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_RAIL,&(node.id));
	
	node.id.id		 = GET_NODEID(board,2,4);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_CAMP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[3][7].f.f  = 1;
	node.path[7][3].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,2,3);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_RAIL,&(node.id));
	
	node.id.id		 = GET_NODEID(board,2,5);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[0][8].f.f  = 1;
	node.path[1][7].f.f  = 15;
	node.path[7][1].f.f  = 15;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,2,4);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_RAIL,&(node.id));
	/////////////////////////////////////////////////////////////////////////////////
	//第二行棋盘完成
	//
	// +---+   +---+   +---+   +---+   +---+
	// |2,1|===|2,2|===|2,3|===|2,4|===|2,5|
	// +---+   +---+   +---+   +---+   +---+
	// 兵站     兵站      兵站     兵站     兵站
	//////////////////////////////////////////////////////////////////////////////////
	
	//连接1,2行
	nodeid2.district = 0;
	nodeid.id 		= GET_NODEID(board,2,1);
	nodeid2.id 		= GET_NODEID(board,1,1);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id 		= GET_NODEID(board,2,2);
	nodeid2.id 		= GET_NODEID(board,1,2);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id 		= GET_NODEID(board,2,3);
	nodeid2.id 		= GET_NODEID(board,1,3);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id 		= GET_NODEID(board,2,4);
	nodeid2.id 		= GET_NODEID(board,1,4);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id 		= GET_NODEID(board,2,5);
	nodeid2.id 		= GET_NODEID(board,1,5);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	//////////////////////////////////////////////////////////
	
	node.id.id		 = GET_NODEID(board,3,1);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[1][5].f.f  = 1;
	node.path[5][1].f.f  = 1;
	InsertNode(pchessmap,&node,true);
	
	node.id.id		 = GET_NODEID(board,3,2);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STATION;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][2].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][4].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][6].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[0][8].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,3,1);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	
	node.id.id		 = GET_NODEID(board,3,3);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][7].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,3,2);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	
	node.id.id		 = GET_NODEID(board,3,4);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STATION;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][2].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][4].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][6].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[0][8].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,3,3);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	
	node.id.id		 = GET_NODEID(board,3,5);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[1][5].f.f  = 1;
	node.path[5][1].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,3,4);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	/////////////////////////////////////////////////////////////////////////////////
	//第三行棋盘完成
	//
	// +---+   +---+   +---+   +---+   +---+
	// |3,1|---|3,2|---|3,3|---|3,4|---|3,5|
	// +---+   +---+   +---+   +---+   +---+
	// 兵站     行营      兵站     行营     兵站
	//////////////////////////////////////////////////////////////////////////////////
	//
	//连接2,3行
	nodeid.id	= GET_NODEID(board,3,1);
	nodeid2.id	= GET_NODEID(board,2,1);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_RAIL,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,3,2);
	SetPin(pchessmap,&nodeid,6,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	nodeid2.id	= GET_NODEID(board,2,2);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	nodeid2.id	= GET_NODEID(board,2,3);
	SetPin(pchessmap,&nodeid,4,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,3,3);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,3,4);
	SetPin(pchessmap,&nodeid,6,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	nodeid2.id	= GET_NODEID(board,2,4);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	nodeid2.id	= GET_NODEID(board,2,5);
	SetPin(pchessmap,&nodeid,4,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,3,5);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_RAIL,&nodeid2);
	
	/////////////////////////////////////////////////////////////////////////////
	
	node.id.id		 = GET_NODEID(board,4,1);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][2].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][4].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[1][5].f.f  = 1;
	node.path[5][1].f.f  = 1;
	InsertNode(pchessmap,&node,true);
	
	node.id.id		 = GET_NODEID(board,4,2);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][7].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,4,1);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	
	node.id.id		 = GET_NODEID(board,4,3);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STATION;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][2].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][4].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][6].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[0][8].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,4,2);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	
	node.id.id		 = GET_NODEID(board,4,4);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][7].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,4,3);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	
	node.id.id		 = GET_NODEID(board,4,5);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][6].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[0][8].f.f  = 1;
	node.path[1][5].f.f  = 1;
	node.path[5][1].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,4,4);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	/////////////////////////////////////////////////////////////////////////////////
	//第四行棋盘完成
	//
	// +---+   +---+   +---+   +---+   +---+
	// |4,1|---|4,2|---|4,3|---|4,4|---|4,5|
	// +---+   +---+   +---+   +---+   +---+
	// 兵站     兵站      行营     兵站     兵站
	//////////////////////////////////////////////////////////////////////////////////
	//
	//连接3,4行
	nodeid.id	= GET_NODEID(board,4,1);
	nodeid2.id	= GET_NODEID(board,3,1);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_RAIL,&nodeid2);
	nodeid2.id	= GET_NODEID(board,3,2);
	SetPin(pchessmap,&nodeid,4,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,4,2);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,4,3);
	SetPin(pchessmap,&nodeid,6,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	nodeid2.id	= GET_NODEID(board,3,3);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	nodeid2.id	= GET_NODEID(board,3,4);
	SetPin(pchessmap,&nodeid,4,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,4,4);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,4,5);
	SetPin(pchessmap,&nodeid,6,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	nodeid2.id	= GET_NODEID(board,3,5);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_RAIL,&nodeid2);
	
	/////////////////////////////////////////////////////////////////////
	
	node.id.id		 = GET_NODEID(board,5,1);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[1][5].f.f  = 1;
	node.path[5][1].f.f  = 1;
	InsertNode(pchessmap,&node,true);
	
	node.id.id		 = GET_NODEID(board,5,2);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STATION;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][2].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][4].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][6].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[0][8].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,5,1);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	
	node.id.id		 = GET_NODEID(board,5,3);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][7].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,5,2);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	
	node.id.id		 = GET_NODEID(board,5,4);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STATION;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][2].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][4].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][6].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[0][8].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,5,3);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	
	node.id.id		 = GET_NODEID(board,5,5);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[1][5].f.f  = 1;
	node.path[5][1].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,5,4);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	/////////////////////////////////////////////////////////////////////////////////
	//第五行棋盘完成
	//
	// +---+   +---+   +---+   +---+   +---+
	// |5,1|---|5,2|---|5,3|---|5,4|---|5,5|
	// +---+   +---+   +---+   +---+   +---+
	// 兵站     行营      兵站     行营     兵站
	//////////////////////////////////////////////////////////////////////////////////
	//
	//连接4,5行
	nodeid.id	= GET_NODEID(board,5,1);
	nodeid2.id	= GET_NODEID(board,4,1);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_RAIL,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,5,2);
	SetPin(pchessmap,&nodeid,6,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	nodeid2.id	= GET_NODEID(board,4,2);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	nodeid2.id	= GET_NODEID(board,4,3);
	SetPin(pchessmap,&nodeid,4,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,5,3);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,5,4);
	SetPin(pchessmap,&nodeid,6,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	nodeid2.id	= GET_NODEID(board,4,4);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	nodeid2.id	= GET_NODEID(board,4,5);
	SetPin(pchessmap,&nodeid,4,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,5,5);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_RAIL,&nodeid2);
	
	////////////////////////////////////////////////////////////////////////
	
	node.id.id		 = GET_NODEID(board,6,1);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][4].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][8].f.f  = 1;
	node.path[1][5].f.f  = 1;
	node.path[5][1].f.f  = 1;
	node.path[8][5].f.f  = 1;
	node.path[5][8].f.f  = 1;
	node.path[3][5].f.f  = 15;
	node.path[5][3].f.f  = 15;
	node.path[3][1].f.f  = 15;
	node.path[1][3].f.f  = 15;
	node.path[8][3].f.f  = 15;
	node.path[3][8].f.f  = 15;
	InsertNode(pchessmap,&node,true);
	
	node.id.id		 = GET_NODEID(board,6,2);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][3].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[3][7].f.f  = 1;
	node.path[7][3].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,6,1);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_RAIL,&(node.id));
	
	node.id.id		 = GET_NODEID(board,6,3);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][3].f.f  = 1;
	node.path[0][4].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][6].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[3][7].f.f  = 1;
	node.path[7][3].f.f  = 1;
	node.path[1][3].f.f  = 15;
	node.path[3][1].f.f  = 15;
	node.path[7][1].f.f  = 15;
	node.path[1][7].f.f  = 15;
	
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,6,2);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_RAIL,&(node.id));
	
	node.id.id		 = GET_NODEID(board,6,4);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][3].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[3][7].f.f  = 1;
	node.path[7][3].f.f  = 1;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,6,3);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_RAIL,&(node.id));
	
	node.id.id		 = GET_NODEID(board,6,5);
	node.id.type.type	 = DJGAME_JUNQI_NODETYPE_STOP;
	memset(node.path,0x7F,sizeof(PATHDES)*(DJGAME_CHESSMAP_MAX_PINS+1)*(DJGAME_CHESSMAP_MAX_PINS+1));
	node.path[0][1].f.f  = 1;
	node.path[0][2].f.f  = 1;
	node.path[0][5].f.f  = 1;
	node.path[0][6].f.f  = 1;
	node.path[0][7].f.f  = 1;
	node.path[1][5].f.f  = 1;
	node.path[5][1].f.f  = 1;
	node.path[2][5].f.f  = 1;
	node.path[5][2].f.f  = 1;
	node.path[7][5].f.f  = 15;
	node.path[5][7].f.f  = 15;
	node.path[7][1].f.f  = 15;
	node.path[1][7].f.f  = 15;
	node.path[2][7].f.f  = 15;
	node.path[7][2].f.f  = 15;
	pcurnode = InsertNode(pchessmap,&node,true);
	
	nodeid.id 		= GET_NODEID(board,6,4);
	SetPin(pchessmap,&nodeid,3,DJGAME_JUNQI_PINTYPE_WAY,&(node.id));
	/////////////////////////////////////////////////////////////////////////////////
	//第六行棋盘完成
	//
	// +---+   +---+   +---+   +---+   +---+
	// |6,1|---|6,2|---|6,3|---|6,4|---|6,5|
	// +---+   +---+   +---+   +---+   +---+
	// 兵站     兵站      兵站     兵站     兵站
	//////////////////////////////////////////////////////////////////////////////////
	//
	//连接5,6行
	nodeid.id	= GET_NODEID(board,6,1);
	nodeid2.id	= GET_NODEID(board,5,1);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_RAIL,&nodeid2);
	nodeid2.id	= GET_NODEID(board,5,2);
	SetPin(pchessmap,&nodeid,4,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,6,2);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,6,3);
	SetPin(pchessmap,&nodeid,6,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	nodeid2.id	= GET_NODEID(board,5,3);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	nodeid2.id	= GET_NODEID(board,5,4);
	SetPin(pchessmap,&nodeid,4,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,6,4);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	
	nodeid.id	= GET_NODEID(board,6,5);
	SetPin(pchessmap,&nodeid,6,DJGAME_JUNQI_PINTYPE_WAY,&nodeid2);
	nodeid2.id	= GET_NODEID(board,5,5);
	SetPin(pchessmap,&nodeid,5,DJGAME_JUNQI_PINTYPE_RAIL,&nodeid2);
}

//////////////////////////////////////////////////////////////
short g_jqmapxy_2[][4]=
{
{2,0x15 , 15,8},	{2,0x14 , 58,8},	{2,0x13 , 101,8},	{2,0x12 , 144,8},	{2,0x11 , 187,8},
{2,0x25 , 15,51},	{2,0x24 , 58,51},	{2,0x23 , 101,51},	{2,0x22 , 144,51},	{2,0x21 , 187,51},
{2,0x35 , 15,94},	{2,0x34 , 58,94},	{2,0x33 , 101,94},	{2,0x32 , 144,94},	{2,0x31 , 187,94},
{2,0x45 , 15,137},	{2,0x44 , 58,137},	{2,0x43 , 101,137},	{2,0x42 , 144,137},	{2,0x41 , 187,137},
{2,0x55 , 15,180},	{2,0x54 , 58,180},	{2,0x53 , 101,180},	{2,0x52 , 144,180},	{2,0x51 , 187,180},
{2,0x65 , 15,223},	{2,0x64 , 58,223},	{2,0x63 , 101,223},	{2,0x62 , 144,223},	{2,0x61 , 187,223},

{1,0x61 , 15,309},	{1,0x62 , 58,309},	{1,0x63 , 101,309},	{1,0x64 , 144,309},	{1,0x65 , 187,309},
{1,0x51 , 15,352},	{1,0x52 , 58,352},	{1,0x53 , 101,352},	{1,0x54 , 144,352},	{1,0x55 , 187,352},
{1,0x41 , 15,395},	{1,0x42 , 58,395},	{1,0x43 , 101,395},	{1,0x44 , 144,395},	{1,0x45 , 187,395},
{1,0x31 , 15,438},	{1,0x32 , 58,438},	{1,0x33 , 101,438},	{1,0x34,  144,438},	{1,0x35 , 187,438},
{1,0x21 , 15,481},	{1,0x22 , 58,481},	{1,0x23 , 101,481},	{1,0x24 , 144,481},	{1,0x25 , 187,481},
{1,0x11 , 15,524},	{1,0x12 , 58,524},	{1,0x13 , 101,524},	{1,0x14 , 144,524},	{1,0x15 , 187,524},
{0,0,0,0}
};

short g_jqmapxy_3[][4]=
{
{DJGAME_JUNQI_CONNECTER_AREA,0xFF,243,185},
{1,0x61 , 177,253},{1,0x62 , 210,253},{1,0x63 , 243,253},{1,0x64 , 276,253},{1,0x65 , 309,253},
{1,0x51 , 177,286},{1,0x52 , 210,286},{1,0x53 , 243,286},{1,0x54 , 276,286},{1,0x55 , 309,286},
{1,0x41 , 177,319},{1,0x42 , 210,319},{1,0x43 , 243,319},{1,0x44 , 276,319},{1,0x45 , 309,319},
{1,0x31 , 177,352},{1,0x32 , 210,352},{1,0x33 , 243,352},{1,0x34 , 276,352},{1,0x35 , 309,352},
{1,0x21 , 177,385},{1,0x22 , 210,385},{1,0x23 , 243,385},{1,0x24 , 276,385},{1,0x25 , 309,385},
{1,0x11 , 177,418},{1,0x12 , 210,418},{1,0x13 , 243,418},{1,0x14 , 276,418},{1,0x15 , 309,418},
	
{2,0x61 , 219,95},	{2,0x62 , 202,124},	{2,0x63 , 186,152},	{2,0x64 , 169,181},	{2,0x65 , 153,210},
{2,0x51 , 190,79},	{2,0x52 , 174,107},	{2,0x53 , 157,136},	{2,0x54 , 141,164},	{2,0x55 , 124,194},
{2,0x41 , 162,62},	{2,0x42 , 145,91},	{2,0x43 , 128,119},	{2,0x44 , 112,148},	{2,0x45 , 95,176},
{2,0x31 , 133,46},	{2,0x32 , 117,74},	{2,0x33 , 100,103},	{2,0x34 , 84,131},	{2,0x35 , 67,160},
{2,0x21 , 102,29},	{2,0x22 , 88,58},	{2,0x23 , 72,86},	{2,0x24 , 55,115},	{2,0x25 , 39,144},
{2,0x11 , 77,12},	{2,0x12 , 60,41},	{2,0x13 , 43,70},	{2,0x14 , 26,98},	{2,0x15 , 10,127},

{3,0x61 , 334,209},{3,0x62 , 317,181},{3,0x63 , 301,152},{3,0x64 , 285,124},{3,0x65 , 268,95},
{3,0x51 , 363,193},{3,0x52 , 346,164},{3,0x53 , 329,136},{3,0x54 , 313,107},{3,0x55 , 296,78},
{3,0x41 , 391,176},{3,0x42 , 374,148},{3,0x43 , 358,119},{3,0x44 , 341,91},	{3,0x45 , 325,62},
{3,0x31 , 419,160},{3,0x32 , 403,132},{3,0x33 , 387,102},{3,0x34 , 370,75},	{3,0x35 , 353,45},
{3,0x21 , 448,144},{3,0x22 , 432,115},{3,0x23 , 415,86}, {3,0x24 , 399,58},	{3,0x25 , 382,29},
{3,0x11 , 477,127},{3,0x12 , 460,98}, {3,0x13 , 444,70}, {3,0x14 , 427,41},	{3,0x15 , 411,12},
	{0,0,0,0}
};

short g_jqmapxy_4[][4]=
{
{DJGAME_JUNQI_CONNECTER_AREA,0xFF,269,269},
{DJGAME_JUNQI_CONNECTER_AREA,0x01 , 269,335},
{DJGAME_JUNQI_CONNECTER_AREA,0x02 , 203,269},
{DJGAME_JUNQI_CONNECTER_AREA,0x04 , 269,203},
{DJGAME_JUNQI_CONNECTER_AREA,0x08 , 335,269},
{DJGAME_JUNQI_CONNECTER_AREA,0x03 , 203,335},
{DJGAME_JUNQI_CONNECTER_AREA,0x06 , 203,203},
{DJGAME_JUNQI_CONNECTER_AREA,0x0C , 335,203},
{DJGAME_JUNQI_CONNECTER_AREA,0x09 , 335,335},

{1,0x61 , 203,368},{1,0x62 , 236,368},{1,0x63 , 269,368},{1,0x64 , 302,368},{1,0x65 , 335,368},
{1,0x51 , 203,401},{1,0x52 , 236,401},{1,0x53 , 269,401},{1,0x54 , 302,401},{1,0x55 , 335,401},
{1,0x41 , 203,434},{1,0x42 , 236,434},{1,0x43 , 269,434},{1,0x44 , 302,434},{1,0x45 , 335,434},
{1,0x31 , 203,467},{1,0x32 , 236,467},{1,0x33 , 269,467},{1,0x34 , 302,467},{1,0x35 , 335,467},
{1,0x21 , 203,500},{1,0x22 , 236,500},{1,0x23 , 269,500},{1,0x24 , 302,500},{1,0x25 , 335,500},
{1,0x11 , 203,533},{1,0x12 , 236,533},{1,0x13 , 269,533},{1,0x14 , 302,533},{1,0x15 , 335,533},

{2,0x61 , 170,203},{2,0x62 , 170,236},{2,0x63 , 170,269},{2,0x64 , 170,302},{2,0x65 , 170,335},
{2,0x51 , 137,203},{2,0x52 , 137,236},{2,0x53 , 137,269},{2,0x54 , 137,302},{2,0x55 , 137,335},
{2,0x41 , 104,203},{2,0x42 , 104,236},{2,0x43 , 104,269},{2,0x44 , 104,302},{2,0x45 , 104,335},
{2,0x31 , 71,203}, {2,0x32 , 71,236}, {2,0x33 , 71,269}, {2,0x34 , 71,302},	{2,0x35 , 71,335},
{2,0x21 , 38,203}, {2,0x22 , 38,236}, {2,0x23 , 38,269}, {2,0x24 , 38,302},	{2,0x25 , 38,335},
{2,0x11 , 5,203},  {2,0x12 , 5,236,}, {2,0x13 , 5,269},	 {2,0x14 , 5,302},	{2,0x15 , 5,335},

{3,0x61 , 335,170},{3,0x62 , 302,170},{3,0x63 , 269,170},{3,0x64 , 236,170},{3,0x65 , 203,170},
{3,0x51 , 335,137},{3,0x52 , 302,137},{3,0x53 , 269,137},{3,0x54 , 236,137},{3,0x55 , 203,137},
{3,0x41 , 335,104},{3,0x42 , 302,104},{3,0x43 , 269,104},{3,0x44 , 236,104},{3,0x45 , 203,104},
{3,0x31 , 335,71}, {3,0x32 , 302,71}, {3,0x33 , 269,71}, {3,0x34 , 236,71},	{3,0x35 , 203,71},
{3,0x21 , 335,38}, {3,0x22 , 302,38}, {3,0x23 , 269,38}, {3,0x24 , 236,38},	{3,0x25 , 203,38},
{3,0x11 , 335,5},  {3,0x12 , 302,5},  {3,0x13 , 269,5},	 {3,0x14 , 236,5},	{3,0x15 , 203,5},

{4,0x61 , 368,335},{4,0x62 , 368,302},{4,0x63 , 368,269},{4,0x64 , 368,236},{4,0x65 , 368,203},
{4,0x51 , 401,335},{4,0x52 , 401,302},{4,0x53 , 401,269},{4,0x54 , 401,236},{4,0x55 , 401,203},
{4,0x41 , 434,335},{4,0x42 , 434,302},{4,0x43 , 434,269},{4,0x44 , 434,236},{4,0x45 , 434,203},
{4,0x31 , 467,335},{4,0x32 , 467,302},{4,0x33 , 467,269},{4,0x34 , 467,236},{4,0x35 , 467,203},
{4,0x21 , 500,335},{4,0x22 , 500,302},{4,0x23 , 500,269},{4,0x24 , 500,236},{4,0x25 , 500,203},
{4,0x11 , 533,335},{4,0x12 , 533,302},{4,0x13 , 533,269},{4,0x14 , 533,236},{4,0x15 , 533,203},
	{0,0,0,0}
};

void InitJunQiNodeXY(char *pchessmap,unsigned char chCountrys,unsigned char chFirstSite)
{
	short *xy=NULL;
	short id,area;
	int i;
	PMapNode pnode;
	NODEID	nodeid;
	
	if(chFirstSite < 1 || chFirstSite > chCountrys)
		chFirstSite = 1;
	switch(chCountrys)
	{
		case 2 : 
			xy = &(g_jqmapxy_2[0][0]);
			break;
		case 3 :
			xy = &(g_jqmapxy_3[0][0]);
			break;
		case 4 :
			xy = &(g_jqmapxy_4[0][0]);
			break;
		default :
			xy = NULL;
	}
	if(xy != NULL)
	{
		nodeid.district = 0;
		while(*xy != 0)
		{
			id = *(xy+1);
			area = *xy;
			DEBUG_OUTPUT(("default node : %d-%02x ",area,id));
			if(area != DJGAME_JUNQI_CONNECTER_AREA)
			{
				area = (area+(chFirstSite - 1))%chCountrys;
				if(area == 0)
					area = chCountrys;
			}else if(chFirstSite != 1)
			{
				if(id != 0xFF)
				{
					for(i=0;i<chFirstSite-1;i++)
					{
						id <<= 1;
						if(id & 0x10)
						{
							id |= 0x01;
							id &= 0x0F;
						}
					}
				}
			}
			DEBUG_OUTPUT(("turn to : %d-%02x \n",area,id));
			nodeid.id = GET_NODEID(area,0,id);
			pnode = SearchNode(pchessmap,&nodeid);
			if(pnode != NULL)
			{
				pnode->x = *(xy+2);
				pnode->y = *(xy+3);
			}else
			{
				DEBUG_OUTPUT(("NO SUCH NODE : %d-%02x\n",*xy,*(xy+1)));
			}
			xy += 4;
		}
	}
	
}


/////////////////////////////////////////////
void __debug_junqi_arrange(PGeneralGameTrace2Head ptrace)
{
	int i;
	char *pname[]={"NULL",
					"DJGAME_JUNQI_RANK_BING",
					"DJGAME_JUNQI_RANK_PAI",
					"DJGAME_JUNQI_RANK_LIAN",
					"DJGAME_JUNQI_RANK_YING",
					"DJGAME_JUNQI_RANK_TUAN",
					"DJGAME_JUNQI_RANK_LVE",
					"DJGAME_JUNQI_RANK_SHI",
					"DJGAME_JUNQI_RANK_JUN",
					"DJGAME_JUNQI_RANK_SILING",
					"DJGAME_JUNQI_RANK_DILEI",
					"DJGAME_JUNQI_RANK_JUNQI",
					"DJGAME_JUNQI_RANK_ZHADAN",
					"DJGAME_JUNQI_RANK_WEIZHI"
	};
	PJunqiTraceInitChip psetchips = (PJunqiTraceInitChip)ptrace->chBuf;
	DEBUG_OUTPUT(("JUNQI_ARRANGE : chSite = %02x ,chBufLen =%02x , mapsite=%02x , chips=%d\n",ptrace->chSite,ptrace->chBufLen,psetchips->chMapSite,psetchips->chChips));
	for(i=0;i<psetchips->chChips;i++)
	{
		DEBUG_OUTPUT(("chip%d : pos=%02x id=%s owner=%d power=%d\n",i,psetchips->chip[i].xy,pname[psetchips->chip[i].chip.id],psetchips->chip[i].chip.owner,psetchips->chip[i].chip.power));
	}
}

void __debug_junqi_status(char *pchessmap)
{
	PChessMapHead phead  = (PChessMapHead)GetChessmapHead(pchessmap);
	if(phead == NULL || phead->shCurNodes == 0)
		return ;
	int i;
	char *pname[]={"NULL",
					"DJGAME_JUNQI_RANK_BING",
					"DJGAME_JUNQI_RANK_PAI",
					"DJGAME_JUNQI_RANK_LIAN",
					"DJGAME_JUNQI_RANK_YING",
					"DJGAME_JUNQI_RANK_TUAN",
					"DJGAME_JUNQI_RANK_LVE",
					"DJGAME_JUNQI_RANK_SHI",
					"DJGAME_JUNQI_RANK_JUN",
					"DJGAME_JUNQI_RANK_SILING",
					"DJGAME_JUNQI_RANK_DILEI",
					"DJGAME_JUNQI_RANK_JUNQI",
					"DJGAME_JUNQI_RANK_ZHADAN",
					"DJGAME_JUNQI_RANK_WEIZHI"
	};
	for(i=0;i<phead->shCurNodes;i++)
	{
		if(phead->pnode[i]->chip.id != 0)
		{
			DEBUG_OUTPUT(("%04x = %s\n",phead->pnode[i]->id.id,pname[phead->pnode[i]->chip.id]));
		}
	}
}
