示例#1
0
void CRoomFlags::changeClass(PassengerClass newClassNum) {
	uint floorNum = getFloorNum();
	uint roomNum = getRoomNum();
	uint elevatorNum = getElevatorNum();
	PassengerClass classNum = getPassengerClassNum();
	uint v10, v11, v12, v13;

	switch (classNum) {
	case FIRST_CLASS:
		v10 = 2;
		v11 = 19;
		v12 = 1;
		v13 = 3;
		break;

	case SECOND_CLASS:
		v10 = 20;
		v11 = 27;
		v12 = 1;
		v13 = (elevatorNum & 1) ? 3 : 4;
		break;

	case THIRD_CLASS:
		v10 = 28;
		v11 = 38;
		v12 = 1;
		v13 = 18;
		break;

	default:
		v10 = 0;
		v11 = 0;
		v12 = 0;
		v13 = 0;
		break;
	}

	// Perform action to change room or floor
	switch (newClassNum) {
	case FIRST_CLASS:
		if (--roomNum < v12)
			roomNum = v12;
		break;

	case SECOND_CLASS:
		if (++roomNum > v13)
			roomNum = v13;
		break;

	case THIRD_CLASS:
		if (--floorNum < v10)
			floorNum = v10;
		break;

	case UNCHECKED:
		if (++floorNum > v11)
			floorNum = v11;

	default:
		break;
	}

	// Set new floor and room
	setFloorNum(floorNum);
	setRoomBits(roomNum);
}
示例#2
0
void CRoomFlags::changeLocation(int action) {
	uint floorNum = getFloorNum();
	uint roomNum = getRoomNum();
	uint elevatorNum = getElevatorNum();
	uint classNum = getPassengerClassNum();
	uint v10, v11, v12, v13;

	switch (classNum) {
	case 1:
		v10 = 2;
		v11 = 19;
		v12 = 1;
		v13 = 3;
		break;

	case 2:
		v10 = 20;
		v11 = 27;
		v12 = 1;
		v13 = (elevatorNum & 1) ? 3 : 4;
		break;

	case 3:
		v10 = 28;
		v11 = 38;
		v12 = 1;
		v13 = 18;
		break;

	default:
		v10 = 0;
		v11 = 0;
		v12 = 0;
		v13 = 0;
		break;
	}

	// Perform action to change room or floor
	switch (action) {
	case 1:
		if (--roomNum < v12)
			roomNum = v12;
		break;

	case 2:
		if (++roomNum > v13)
			roomNum = v13;
		break;

	case 3:
		if (--floorNum < v10)
			floorNum = v10;
		break;

	case 4:
		if (++floorNum > v11)
			floorNum = v11;
	}

	// Set new floor and room
	setFloorNum(floorNum);
	setRoomBits(roomNum);
}