Centaur* Centaur::_clone() { return new Centaur( start_position(), end_position(), this->m_labyrinth_path); }
int cd_play_from(int track) { unsigned long startpos, endpos; if (!get_audio_info() || (track < cdrom_data.low_audio) || (track > cdrom_data.high_audio)) return -1; startpos = start_position(track); endpos = cdrom_data.endofdisk; return (!play(startpos, endpos)) ? -1 : 0; }
int cd_play_range(int start, int end) { unsigned long startpos, endpos; if ((!get_audio_info()) || (MIN(start, end) < cdrom_data.low_audio) || (MAX(start, end) > cdrom_data.high_audio)) return -1; startpos = start_position(start); endpos = end_position(end); return (!play(startpos, endpos)) ? -1 : 0; }
static int menu_main_bkg_system (void) { nsave_t *ns; int n; const char *sys; Planet *pnt; double cx, cy; /* Clean pilots. */ pilots_cleanAll(); sys = NULL; /* Refresh saves. */ load_refresh(); /* Get start position. */ ns = load_getList( &n ); if ((n > 0) && (planet_exists( ns[0].planet ))) { pnt = planet_get( ns[0].planet ); if (pnt != NULL) { sys = planet_getSystem( ns[0].planet ); if (sys != NULL) { cx = pnt->pos.x; cy = pnt->pos.y; cx += 300; cy += 200; } } } /* Fallback if necessary. */ if (sys == NULL) { sys = start_system(); start_position( &cx, &cy ); } /* Initialize. */ space_init( sys ); cam_setTargetPos( cx, cy, 0 ); cam_setZoom( conf.zoom_far ); pause_setSpeed( 1. ); sound_setSpeed( 1. ); return 0; }
//start 48500 //down 58000 void main() { set_servo_position(Servo_Back,Servo_Back_Up); set_servo_position(Servo_Left,Servo_Left_Closed); set_servo_position(Servo_Right,Servo_Right_Closed); enable_servos(); calibrate(); //wait for light //printf("wait for light oida"); //set_b_button_text("I am the Twilight"); //while(!b_button()){} wait_for_light(Sensor_Light); //shutdown stuff shut_down_in(115); start=seconds(); //start position for create start_position(); //we see everything camera_open(); //drive in front of the cubes take_position(); //watch for cubes cube_is_near(); ao(); //bring the first cube to the pipes bringback(); //take the 2nd cube and bring them to the pipes bringback2cube(); }
int Script::ConvertResultToJsonValue(const IECommandExecutor& executor, Json::Value* value) { int status_code = SUCCESS; if (this->ResultIsString()) { std::string string_value = ""; if (this->result_.bstrVal) { string_value = CW2A(this->result_.bstrVal, CP_UTF8); } *value = string_value; } else if (this->ResultIsInteger()) { *value = this->result_.lVal; } else if (this->ResultIsDouble()) { *value = this->result_.dblVal; } else if (this->ResultIsBoolean()) { *value = this->result_.boolVal == VARIANT_TRUE; } else if (this->ResultIsEmpty()) { *value = Json::Value::null; } else if (this->result_.vt == VT_NULL) { *value = Json::Value::null; } else if (this->ResultIsIDispatch()) { if (this->ResultIsArray() || this->ResultIsElementCollection()) { Json::Value result_array(Json::arrayValue); long length = 0; status_code = this->GetArrayLength(&length); for (long i = 0; i < length; ++i) { Json::Value array_item_result; int array_item_status = this->GetArrayItem(executor, i, &array_item_result); result_array[i] = array_item_result; } *value = result_array; } else if (this->ResultIsObject()) { Json::Value result_object; std::wstring property_name_list = L""; status_code = this->GetPropertyNameList(&property_name_list); std::vector<std::wstring> property_names; size_t end_position(0); size_t start_position(0); while (true) { std::wstring property_name = L""; end_position = property_name_list.find_first_of(L",", start_position); if(end_position == std::wstring::npos) { property_names.push_back(property_name_list.substr(start_position, property_name_list.size() - start_position)); break; } else { property_names.push_back(property_name_list.substr(start_position, end_position - start_position)); start_position = end_position + 1; } } for (size_t i = 0; i < property_names.size(); ++i) { Json::Value property_value_result; int property_value_status = this->GetPropertyValue(executor, property_names[i], &property_value_result); std::string name(CW2A(property_names[i].c_str(), CP_UTF8)); result_object[name] = property_value_result; } *value = result_object; } else { IECommandExecutor& mutable_executor = const_cast<IECommandExecutor&>(executor); IHTMLElement* node = reinterpret_cast<IHTMLElement*>(this->result_.pdispVal); ElementHandle element_wrapper; mutable_executor.AddManagedElement(node, &element_wrapper); *value = element_wrapper->ConvertToJson(); } } else { status_code = EUNKNOWNSCRIPTRESULT; } return status_code; }