Commit 18ac9db1 authored by  tawada's avatar tawada

Update

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