const SoundShaderT* SoundShaderManagerImplT::GetSoundShader(const std::string& Name) { // Ignore empty names and just return NULL. if (Name.empty()) return NULL; // Note that I'm *not* just writing return SoundShaders[Name] here, because that // would implicitly create a NULL entry for every Name that does not actually exist. std::map<std::string, SoundShaderT*>::const_iterator It=m_SoundShaders.find(Name); if (It!=m_SoundShaders.end()) return It->second; // Sound shader not found, try to interpret the name as a filename or a "capture n" string. if (IsFile(Name) || IsCapture(Name)) { SoundShaderT* AutoShader=new SoundShaderT(Name); AutoShader->AudioFile=Name; // Add auto created shader to list of shaders. m_SoundShaders[Name]=AutoShader; return AutoShader; } std::cout << "Error auto creating sound shader: File '" << Name << "' not doesn't exist.\n"; return NULL; }
CRect CNCaptureView::_GetSelectRect(const CPoint& ptLogical) { CRect rcSelect; rcSelect.SetRectEmpty(); //already has select rect DrawObjectList& drawObjList = GetSelection(); if (drawObjList.size() == 1) { CDrawObject* pDrawObj = drawObjList.front(); FTLASSERT(pDrawObj); if (dotSelectRect == pDrawObj->GetDrawObjType()) { rcSelect = pDrawObj->GetPosition(); if (!rcSelect.PtInRect(ptLogical) && !IsCapture()) { rcSelect.SetRectEmpty(); } } } else { if (IsCapture()) { rcSelect.SetRect(GetMouseDownLogicalPoint(), GetMouseLastLogicalPoint()); rcSelect.NormalizeRect(); } } CRect rcImage(0, 0, m_pImage->GetWidth(), m_pImage->GetHeight()); rcSelect.IntersectRect(rcSelect, rcImage); //FTLTRACE(TEXT("ptLogical=[%d,%d], rcSelect=[%d,%d]-[%d,%d]\n"), // ptLogical.x, ptLogical.y , rcSelect.left, rcSelect.top, rcSelect.right, rcSelect.bottom); return rcSelect; }
const char *Move::DetermineNotation(int detailLevel) { // if I already have a notation set, just return that? if (hasCustomNotation) return notation.c_str(); switch (detailLevel) { case 1: notation = piece->pieceType->GetNotation(); if (IsCapture()) notation += "x"; notation += GetEndPos()->GetName(); break; case 2: notation = piece->pieceType->notation; notation += startPos->GetName(); if (IsCapture()) notation += "x"; notation += GetEndPos()->GetName(); break; default: notation = piece->pieceType->GetNotation(); notation += "("; notation += std::to_string(piece->GetID()); notation += ")"; notation += startPos->GetName(); if (IsCapture()) notation += "x"; notation += GetEndPos()->GetName(); break; } notation += appendNotation; return notation.c_str(); }