Esempio n. 1
0
Centaur*
Centaur::_clone() {
  return new Centaur(
      start_position(),
      end_position(),
      this->m_labyrinth_path);
}
Esempio n. 2
0
File: bcc.c Progetto: AlanDrake/ags
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;
}
Esempio n. 3
0
File: bcc.c Progetto: AlanDrake/ags
int cd_play(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 = end_position(track);
    return (!play(startpos, endpos)) ? -1 : 0;
}
Esempio n. 4
0
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;
}