| 224 | } |
| 225 | |
| 226 | bool CEditor::CallbackCustomEntities(const char *pFilename, int StorageType, void *pUser) |
| 227 | { |
| 228 | CEditor *pEditor = (CEditor *)pUser; |
| 229 | |
| 230 | char aBuf[IO_MAX_PATH_LENGTH]; |
| 231 | IStorage::StripPathAndExtension(pFilename, aBuf, sizeof(aBuf)); |
| 232 | |
| 233 | if(std::find(pEditor->m_vSelectEntitiesFiles.begin(), pEditor->m_vSelectEntitiesFiles.end(), std::string(aBuf)) != pEditor->m_vSelectEntitiesFiles.end()) |
| 234 | { |
| 235 | pEditor->ShowFileDialogError("Custom entities cannot have the same name as default entities."); |
| 236 | return false; |
| 237 | } |
| 238 | |
| 239 | CImageInfo ImgInfo; |
| 240 | if(!pEditor->Graphics()->LoadPng(ImgInfo, pFilename, StorageType)) |
| 241 | { |
| 242 | pEditor->ShowFileDialogError("Failed to load image from file '%s'.", pFilename); |
| 243 | return false; |
| 244 | } |
| 245 | |
| 246 | pEditor->m_SelectEntitiesImage = aBuf; |
| 247 | pEditor->m_AllowPlaceUnusedTiles = EUnusedEntities::ALLOWED_IMPLICIT; |
| 248 | pEditor->m_PreventUnusedTilesWasWarned = false; |
| 249 | |
| 250 | pEditor->Graphics()->UnloadTexture(&pEditor->m_EntitiesTexture); |
| 251 | pEditor->m_EntitiesTexture = pEditor->Graphics()->LoadTextureRawMove(ImgInfo, pEditor->GetTextureUsageFlag()); |
| 252 | |
| 253 | pEditor->OnDialogClose(); |
| 254 | return true; |
| 255 | } |
| 256 | |
| 257 | void CEditor::DoAudioPreview(CUIRect View, const void *pPlayPauseButtonId, const void *pStopButtonId, const void *pSeekBarId, int SampleId) |
| 258 | { |
nothing calls this directly
no test coverage detected