コード例 #1
0
ファイル: Map.cpp プロジェクト: RichardMarks/LWC
	void Map::MakeNormalWall(Position* position, int wallID)
	{
		walls_[position->y_][position->x_][position->facing_] = wallID;
		passibility_[position->y_][position->x_][position->facing_] = false;
		
		Position positionAhead;
		positionAhead.Copy(position->GetPositionAheadOfThis(1));
		if (positionAhead.InBounds(0, 0, width_, height_))
		{
			int newFacing = (position->facing_ + 2) % 4;
			walls_[positionAhead.y_][positionAhead.x_][newFacing] = wallID;
			passibility_[positionAhead.y_][positionAhead.x_][newFacing] = false;
		}
		
		# if 0
		Position* positionAhead = position->GetPositionAheadOfThis(1);
		
		if (
			(positionAhead->x_ >= 0x0 && positionAhead->x_ < width_) &&
			(positionAhead->y_ >= 0x0 && positionAhead->y_ < height_))
		{
			int newFacing = (position->facing_ + 2) % 4;
			walls_[positionAhead->y_][positionAhead->x_][newFacing] = wallID;
			passibility_[positionAhead->y_][positionAhead->x_][newFacing] = false;
		}
		#endif
	}
コード例 #2
0
ファイル: Map.cpp プロジェクト: RichardMarks/LWC
	void Map::RemoveWall(Position* position)
	{
		walls_[position->y_][position->x_][position->facing_] = 0;
		passibility_[position->y_][position->x_][position->facing_] = true;
		
		Position positionAhead;
		positionAhead.Copy(position->GetPositionAheadOfThis(1));
		if (positionAhead.InBounds(0, 0, width_, height_))
		{
			int newFacing = (position->facing_ + 2) % 4;
			walls_[positionAhead.y_][positionAhead.x_][newFacing] = 0;
			passibility_[positionAhead.y_][positionAhead.x_][newFacing] = true;
		}
	}