Reverted to ssupplied file
This commit is contained in:
parent
cca5e34ca2
commit
6a07f42304
@ -131,8 +131,8 @@ void get_into_lift(lift_info *lift, int direction) {
|
|||||||
// Wait for person to get into lift
|
// Wait for person to get into lift
|
||||||
Sleep(GETINSPEED);
|
Sleep(GETINSPEED);
|
||||||
|
|
||||||
// Set lift to enter
|
--- // Set lift to enter
|
||||||
// Signal passenger to enter
|
--- // Signal passenger to enter
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ void* lift_thread(void *p) {
|
|||||||
Sleep(rnd(1000));
|
Sleep(rnd(1000));
|
||||||
|
|
||||||
// Loop forever
|
// Loop forever
|
||||||
while(TRUE) {
|
while(1 == 1) {
|
||||||
// Print current position of the lift
|
// Print current position of the lift
|
||||||
print_at_xy(no*4+1, NFLOORS-lift.position, lf);
|
print_at_xy(no*4+1, NFLOORS-lift.position, lf);
|
||||||
|
|
||||||
@ -183,7 +183,8 @@ void* lift_thread(void *p) {
|
|||||||
|
|
||||||
// Wait for exit lift delay
|
// Wait for exit lift delay
|
||||||
Sleep(GETOUTSPEED);
|
Sleep(GETOUTSPEED);
|
||||||
// Signal passenger to leave lift
|
|
||||||
|
--- // Signal passenger to leave lift
|
||||||
|
|
||||||
// Check if that was the last passenger waiting for this floor
|
// Check if that was the last passenger waiting for this floor
|
||||||
if(!lift.stops[lift.position]) {
|
if(!lift.stops[lift.position]) {
|
||||||
@ -246,7 +247,7 @@ void* person_thread(void *p) {
|
|||||||
// Print person waiting
|
// Print person waiting
|
||||||
print_at_xy(NLIFTS*4+ floors[from].waitingtogoup +floors[from].waitingtogodown,NFLOORS-from, pr);
|
print_at_xy(NLIFTS*4+ floors[from].waitingtogoup +floors[from].waitingtogodown,NFLOORS-from, pr);
|
||||||
|
|
||||||
// Wait for a lift to arrive (going up)
|
--- // Wait for a lift to arrive (going up)
|
||||||
} else {
|
} else {
|
||||||
// One more person waiting to go down
|
// One more person waiting to go down
|
||||||
floors[from].waitingtogodown++;
|
floors[from].waitingtogodown++;
|
||||||
@ -254,11 +255,11 @@ void* person_thread(void *p) {
|
|||||||
// Print person waiting
|
// Print person waiting
|
||||||
print_at_xy(NLIFTS*4+floors[from].waitingtogodown+floors[from].waitingtogoup,NFLOORS-from, pr);
|
print_at_xy(NLIFTS*4+floors[from].waitingtogodown+floors[from].waitingtogoup,NFLOORS-from, pr);
|
||||||
|
|
||||||
// Wait for a lift to arrive (going down)
|
--- // Wait for a lift to arrive (going down)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Which lift we are getting into
|
// Which lift we are getting into
|
||||||
lift = 0;
|
--- lift = ;
|
||||||
|
|
||||||
// Add one to passengers waiting for floor
|
// Add one to passengers waiting for floor
|
||||||
lift->stops[to]++;
|
lift->stops[to]++;
|
||||||
@ -269,7 +270,7 @@ void* person_thread(void *p) {
|
|||||||
print_at_xy(lift->no*4+1+2, NFLOORS-to, "-");
|
print_at_xy(lift->no*4+1+2, NFLOORS-to, "-");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait until we are at the right floor
|
--- // Wait until we are at the right floor
|
||||||
|
|
||||||
// Exit the lift
|
// Exit the lift
|
||||||
from = to;
|
from = to;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user