Мелкие исправления
This commit is contained in:
20
robot.cpp
20
robot.cpp
@@ -9,15 +9,6 @@ bool robot1_offset_pos = false;
|
||||
bool robot2_offset_pos = false;
|
||||
|
||||
|
||||
static short get_barrel(char robot_id) {
|
||||
for (short i = 0; i < BARRELS_COUNT; i++) {
|
||||
if (barrels[i].flags.robot == robot_id) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// true означает что движение закончено
|
||||
static bool robot_move(robot_regs& r, short target, char robot_id) {
|
||||
// после перемещения мы явно в точной позиции
|
||||
@@ -44,6 +35,12 @@ static void emulate_robot(robot_code &code, robot_regs& r, char robot_id) {
|
||||
if (code.PC < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// приватизируем бочку
|
||||
if (code.barrel_id >= 0) {
|
||||
barrels[code.barrel_id].flags.robot = robot_id;
|
||||
}
|
||||
|
||||
const short cmd_arg = code.code[code.PC] & (~ROBOT_CMD_MASK);
|
||||
|
||||
switch (code.code[code.PC] & ROBOT_CMD_MASK) {
|
||||
@@ -127,6 +124,7 @@ static void emulate_robot(robot_code &code, robot_regs& r, char robot_id) {
|
||||
break;
|
||||
|
||||
case ROBOT_CMD_INC_ZONE:
|
||||
// TODO сделать так, чтобы зоны переключались с учетом отключенных зон
|
||||
if (cmd_arg == ROBOT_ZONE_ETCH) {
|
||||
std::cout << "robot " << robot_id << " increment etching..." << std::endl;
|
||||
etching_zone = (etching_zone + 1) & 1;
|
||||
@@ -142,6 +140,10 @@ static void emulate_robot(robot_code &code, robot_regs& r, char robot_id) {
|
||||
case ROBOT_CMD_END:
|
||||
default:
|
||||
code.PC = -1;
|
||||
// де-приватизируем бочку
|
||||
if (code.barrel_id >= 0) {
|
||||
barrels[code.barrel_id].flags.robot = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user