Boole ExtendedTimer::CheckHours(const ExtendedTimer::TimeStruct Struct) { if(GetStruct(Struct).Hours > 24) { Integer GoesInto = GetStruct(Struct).Hours / 24; Integer Remainder = GetStruct(Struct).Hours - GoesInto * 24; GetStruct(Struct).Hours = Remainder; GetStruct(Struct).Days+=GoesInto; return true; }else{ return false; } }
Boole ExtendedTimer::CheckMinutes(const ExtendedTimer::TimeStruct Struct) { if(GetStruct(Struct).Minutes > 60) { Integer GoesInto = GetStruct(Struct).Minutes / 60; Integer Remainder = GetStruct(Struct).Minutes - GoesInto * 60; GetStruct(Struct).Minutes = Remainder; GetStruct(Struct).Hours+=GoesInto; return true; }else{ return false; } }
Boole ExtendedTimer::CheckMilliSeconds(const ExtendedTimer::TimeStruct Struct) { if(GetStruct(Struct).Milliseconds > 1000) { Integer GoesInto = GetStruct(Struct).Milliseconds * 0.001; Integer Remainder = GetStruct(Struct).Milliseconds - GoesInto * 1000; GetStruct(Struct).Milliseconds = Remainder; GetStruct(Struct).Seconds+=GoesInto; return true; }else{ return false; } }
ExtendedTimer& ExtendedTimer::SetMinutes(Integer Min, const ExtendedTimer::TimeStruct Struct) { GetStruct(Struct).Minutes = Min; CheckMinutes(Struct); CheckHours(Struct); return *this; }
ExtendedTimer& ExtendedTimer::SetSeconds(Integer Sec, const ExtendedTimer::TimeStruct Struct) { GetStruct(Struct).Seconds = Sec; CheckSeconds(Struct); CheckMinutes(Struct); CheckHours(Struct); return *this; }
void VirtualMachine::RegisterPrimStruct(const ChelaType *primitive, const std::string &name) { // Get the associated class. Structure* assoc = GetStruct(runtimeModule, name); // Register it. primitiveMap.insert(std::make_pair(primitive, assoc)); primitiveReverseMap.insert(std::make_pair(assoc, primitive)); }
void SetAlsaVolume(long volume) { const char *card = "default"; const char *selem_name = "Master"; // snd_mixer_selem_set_playback_volume_all(elem, volume * max / 100); struct alsa_control_struct c_struct = GetStruct(card,selem_name); snd_mixer_selem_set_playback_volume_all(c_struct.elem, volume); snd_mixer_close(c_struct.handle); }
void GetAlsaVolume(long* volume) { const char *card = "default"; const char *selem_name = "Master"; // snd_mixer_selem_get_playback_volume_range(elem, &min, &max); struct alsa_control_struct c_struct = GetStruct(card,selem_name); snd_mixer_selem_get_playback_volume(c_struct.elem,0,volume); snd_mixer_close(c_struct.handle); }
ExtendedTimer& ExtendedTimer::SetMilliseconds(Integer MS, const ExtendedTimer::TimeStruct Struct) { GetStruct(Struct).Milliseconds = MS; CheckMilliSeconds(Struct); CheckSeconds(Struct); CheckMinutes(Struct); CheckHours(Struct); return *this; }
HRESULT BiffReader::GetVector3Padded(Vertex3Ds* vec) { float data[4]; HRESULT hr = GetStruct(data, 4 * sizeof(float)); if (SUCCEEDED(hr)) { vec->x = data[0]; vec->y = data[1]; vec->z = data[2]; } return hr; }
HRESULT BiffReader::Load() { int tag = 0; while (tag != FID(ENDB)) { if (m_version > 30) { GetIntNoHash(&m_bytesinrecordremaining); } const HRESULT hr = GetInt(&tag); BOOL fContinue = fFalse; if (hr == S_OK) { fContinue = m_piloadable->LoadToken(tag, this); } if (!fContinue) { return E_FAIL; } if (m_version > 30) { if (m_bytesinrecordremaining > 0) { BYTE * const szT = new BYTE[m_bytesinrecordremaining]; GetStruct(szT, m_bytesinrecordremaining); delete [] szT; } } } return S_OK; }
ExtendedTimer& ExtendedTimer::SetMicroseconds(Integer MS, const ExtendedTimer::TimeStruct Struct) { GetStruct(Struct).Microseconds = MS; CheckAll(Struct); return *this; }
Integer ExtendedTimer::GetMinutes(const ExtendedTimer::TimeStruct Struct) { return GetStruct(Struct).Minutes; }
ExtendedTimer& ExtendedTimer::SetHours(Integer Hr, const ExtendedTimer::TimeStruct Struct) { GetStruct(Struct).Hours = Hr; CheckHours(Struct); return *this; }
HRESULT BiffReader::GetVector3(Vertex3Ds* vec) { assert(sizeof(Vertex3Ds) == 3 * sizeof(float)); // fields need to be contiguous return GetStruct(&vec->x, 3 * sizeof(float)); }
ExtendedTimer& ExtendedTimer::SetDays(Integer Day, const ExtendedTimer::TimeStruct Struct) { GetStruct(Struct).Days = Day; return *this; }
Integer ExtendedTimer::GetSeconds(const ExtendedTimer::TimeStruct Struct) { return GetStruct(Struct).Seconds; }
//--------------------------------------------------------------------------- UEProperty::Info UEStructProperty::GetInfo() const { return Info::Create(PropertyType::CustomStruct, GetElementSize(), true, "struct " + MakeUniqueCppName(GetStruct())); }
Integer ExtendedTimer::GetDays(const ExtendedTimer::TimeStruct Struct) { return GetStruct(Struct).Days; }
Integer ExtendedTimer::GetHours(const ExtendedTimer::TimeStruct Struct) { return GetStruct(Struct).Hours; }