Commit 18ac9db1 authored by  tawada's avatar tawada

Update

parent e9b9174c
......@@ -9,7 +9,6 @@
extern Board* board;
bool routing(int trgt_line_id){
Line* trgt_line = board->line(trgt_line_id);
trgt_line->clearTrack();
......@@ -255,6 +254,8 @@ bool routing(int trgt_line_id){
}
if(!update) continue;
// コストマップの更新があった場合
if(trgt_box->isTypeNumber()){
if(trgt_box->getIndex() == trgt_line_id){
if(trgt_ibox->cost < goal_cost) goal_cost = trgt_ibox->cost;
......@@ -295,7 +296,8 @@ bool routing(int trgt_line_id){
qu.push(next);
}
}
//コストマップは完成したのでバックトラック
int now_x = trgt_line->getSinkX();
int now_y = trgt_line->getSinkY();
int now_z = trgt_line->getSinkZ();
......@@ -330,15 +332,15 @@ bool routing(int trgt_line_id){
case DOWN: // 下へ
now_z = now_z - 1; next_id = trgt_d.c_d; break;
}
while(1){
Point p = {now_x, now_y, now_z};
trgt_line->pushPointToTrack(p);
if(now_x==trgt_line->getSourceX() && now_y==trgt_line->getSourceY() && now_z==trgt_line->getSourceZ()) break;
trgt_d = my_board[now_z][now_y][now_x].d;
switch(next_id){
case NORTH:
......@@ -399,28 +401,28 @@ bool isInserted(int x,int y,int z){
int cost_parallel(int trgt_line_id, int x, int y, int z){
//同Z平面上で隣接する(延べ)配線数をカウント
Box* neibour_box;
int cost=0;
int p_cost=0;
if(x-1>=0){
neibour_box = board->box(x-1,y,z);
if(neibour_box->checkLine() && neibour_box->getIndex() != trgt_line_id)
cost++;
if(neibour_box->isTypeNumber() && neibour_box->getIndex() != trgt_line_id)
p_cost++;
}
if(x+1<board->getSizeX()){
neibour_box = board->box(x+1,y,z);
if(neibour_box->checkLine() && neibour_box->getIndex() != trgt_line_id)
cost++;
if(neibour_box->isTypeNumber() && neibour_box->getIndex() != trgt_line_id)
p_cost++;
}
if(y-1>=0){
neibour_box = board->box(x,y-1,z);
if(neibour_box->checkLine() && neibour_box->getIndex() != trgt_line_id)
cost++;
if(neibour_box->isTypeNumber() && neibour_box->getIndex() != trgt_line_id)
p_cost++;
}
if(y+1<board->getSizeY()){
neibour_box = board->box(x,y+1,z);
if(neibour_box->checkLine() && neibour_box->getIndex() != trgt_line_id)
cost++;
if(neibour_box->isTypeNumber() && neibour_box->getIndex() != trgt_line_id)
p_cost++;
}
return cost;
return p_cost;
}
void recordLine(int trgt_line_id){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment