changed error system

This commit is contained in:
James Turk 2003-01-13 06:00:38 +00:00
parent 3e6d64a61a
commit a21c3fbdaf
4 changed files with 39 additions and 36 deletions

View File

@ -13,7 +13,7 @@
File: ZE_ZFont.cpp <br>
Description: Implementation source file for core ZEngine Font Object. <br>
Author(s): James Turk <br>
$Id: ZE_ZFont.cpp,v 1.3 2002/12/29 06:52:07 cozman Exp $<br>
$Id: ZE_ZFont.cpp,v 1.4 2003/01/13 06:00:38 cozman Exp $<br>
\file ZE_ZFont.cpp
\brief Source file for ZFont.
@ -100,7 +100,7 @@ void ZFont::SetStyle(bool Bold, bool Italic, bool Underline)
if(rFont)
TTF_SetFontStyle(rFont,flags);
else
LogError("ZFont not initialized in ZFont::SetStyle.");
rEngine->ReportError(ZERR_NOFONT,"SetStyle");
}
void ZFont::Resize(int size)
@ -119,7 +119,7 @@ bool ZFont::IsBold()
return (TTF_GetFontStyle(rFont) & TTF_STYLE_BOLD) > 0;
else
{
LogError("ZFont not initialized in ZFont::IsBold.");
rEngine->ReportError(ZERR_NOFONT, "IsBold");
return false;
}
}
@ -130,7 +130,7 @@ bool ZFont::IsItalic()
return (TTF_GetFontStyle(rFont) & TTF_STYLE_ITALIC) > 0;
else
{
LogError("ZFont not initialized in ZFont::IsItalic.");
rEngine->ReportError(ZERR_NOFONT, "IsItalic");
return false;
}
}
@ -141,7 +141,7 @@ bool ZFont::IsUnderlined()
return (TTF_GetFontStyle(rFont) & TTF_STYLE_UNDERLINE) > 0;
else
{
LogError("ZFont not initialized in ZFont::IsUnderlined.");
rEngine->ReportError(ZERR_NOFONT, "IsUnderlined");
return false;
}
}
@ -152,7 +152,7 @@ int ZFont::Height()
return TTF_FontHeight(rFont);
else
{
LogError("ZFont not initialized in ZFont::GetHeight.");
rEngine->ReportError(ZERR_NOFONT, "GetHeight");
return 0;
}
}
@ -163,7 +163,7 @@ int ZFont::LineSkip()
return TTF_FontLineSkip(rFont);
else
{
LogError("ZFont not initialized in ZFont::GetLineSkip.");
rEngine->ReportError(ZERR_NOFONT, "GetLineSkip");
return 0;
}
}
@ -179,7 +179,7 @@ int ZFont::StringWidth(string text)
}
else
{
LogError("ZFont not initialized in ZFont::GetStringWidth.");
rEngine->ReportError(ZERR_NOFONT, "GetStringWidth");
return 0;
}
}
@ -195,7 +195,7 @@ int ZFont::StringHeight(string text)
}
else
{
LogError("ZFont not initialized in ZFont::GetStringHeight.");
rEngine->ReportError(ZERR_NOFONT, "GetStringHeight");
return 0;
}
}

View File

@ -13,7 +13,7 @@
File: ZE_ZImage.cpp <br>
Description: Implementation source file for core ZEngine Image or Texture Object. <br>
Author(s): James Turk, Gamer Tazar <br>
$Id: ZE_ZImage.cpp,v 1.13 2003/01/08 06:07:06 cozman Exp $<br>
$Id: ZE_ZImage.cpp,v 1.14 2003/01/13 06:00:38 cozman Exp $<br>
\file ZE_ZImage.cpp
\brief Source file for ZImage.
@ -79,13 +79,13 @@ void ZImage::OpenFromImage(SDL_Surface *image, Sint16 x, Sint16 y, Sint16 w, Sin
rect.h = h;
if(!image)
LogError("Invalid Parameter to ZImage::OpenFromImage.");
rEngine->ReportError(ZERR_NOIMAGE,"OpenFromImage");
cutImg = SDL_CreateRGBSurface(0, rect.w, rect.h, rEngine->BPP(),
screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask);
if(!cutImg)
LogError(FormatStr("SDL_CreateRGBSurface failed in ZImage::OpenFromImage."));
rEngine->ReportError(ZERR_SDL_INTERNAL,FormatStr("SDL_CreateRGBSurface failed in ZImage::OpenFromImage: %s.",SDL_GetError()));
SDL_BlitSurface(image,&rect,cutImg,NULL);
Attach(cutImg);
@ -109,7 +109,7 @@ void ZImage::Attach(SDL_Surface *surface)
rImage = surface;
}
else
LogError("Invalid surface passed to ZImage::Attach.");
rEngine->ReportError(ZERR_NOIMAGE,"Attach");
}
void ZImage::Reload()
@ -136,7 +136,7 @@ void ZImage::SetColorKey(Uint8 red, Uint8 green, Uint8 blue)
if(rImage)
{
if(SDL_SetColorKey(rImage, SDL_SRCCOLORKEY, color) < 0)
LogError("Invalid Call to SDL_SetColorKey.");
rEngine->ReportError(ZERR_SDL_INTERNAL,FormatStr("SDL_SetColorKey failed in ZImage::SetColorKey: %s",SDL_GetError()));
else
{
//surface conversion//
@ -151,13 +151,13 @@ void ZImage::SetColorKey(Uint8 red, Uint8 green, Uint8 blue)
}
else //can't convert
{
LogError("Surface conversion failed.");
rEngine->ReportError(ZERR_SDL_INTERNAL,FormatStr("SDL_DisplayFormatAlpha failed in ZImage::SetColorKey: %s",SDL_GetError()));
rImage = temp;
}
}
}
else
LogError("ZImage not initialized in ZImage::SetColorKey.");
rEngine->ReportError(ZERR_NOIMAGE,"SetColorKey.");
}
void ZImage::Flip(bool horizontal, bool vertical)
@ -191,6 +191,9 @@ void ZImage::Resize(unsigned int width, unsigned int height)
void ZImage::Bind()
{
if(!rTexID)
rEngine->ReportError(ZERR_NOIMAGE,"Bind");
else
glBindTexture(GL_TEXTURE_2D, rTexID);
}

View File

@ -13,7 +13,7 @@
File: ZE_ZMusic.cpp <br>
Description: Implementation source file for core ZEngine Music Object. <br>
Author(s): James Turk <br>
$Id: ZE_ZMusic.cpp,v 1.3 2002/12/29 06:52:07 cozman Exp $<br>
$Id: ZE_ZMusic.cpp,v 1.4 2003/01/13 06:00:38 cozman Exp $<br>
\file ZE_ZMusic.cpp
\brief Source file for ZMusic.
@ -71,7 +71,7 @@ void ZMusic::Play(int loopNum, int fadeTime)
Mix_PlayMusic(rMusic, loopNum);
}
else
LogError("ZMusic not initialized in ZMusic::Play.");
rEngine->ReportError(ZERR_NOMUSIC, "Play");
}
void ZMusic::Pause()
@ -79,7 +79,7 @@ void ZMusic::Pause()
if(rMusic)
Mix_PauseMusic();
else
LogError("ZMusic not initialized in ZMusic::Pause.");
rEngine->ReportError(ZERR_NOMUSIC, "Pause");
}
void ZMusic::Unpause()
@ -87,7 +87,7 @@ void ZMusic::Unpause()
if(rMusic)
Mix_ResumeMusic();
else
LogError("ZMusic not initialized in ZMusic::Unpause.");
rEngine->ReportError(ZERR_NOMUSIC, "Unpause");
}
void ZMusic::Rewind()
@ -95,7 +95,7 @@ void ZMusic::Rewind()
if(rMusic)
Mix_RewindMusic();
else
LogError("ZMusic not initialized in ZMusic::Rewind.");
rEngine->ReportError(ZERR_NOMUSIC, "Rewind");
}
void ZMusic::Stop(int fadeTime)
@ -108,7 +108,7 @@ void ZMusic::Stop(int fadeTime)
Mix_HaltMusic();
}
else
LogError("ZMusic not initialized in ZMusic::Stop.");
rEngine->ReportError(ZERR_NOMUSIC, "Stop");
}
void ZMusic::SetVolume(int volume)
@ -116,7 +116,7 @@ void ZMusic::SetVolume(int volume)
if(rMusic)
Mix_VolumeMusic(volume);
else
LogError("ZMusic not initialized in ZMusic::SetVolume.");
rEngine->ReportError(ZERR_NOMUSIC, "SetVolume");
}
bool ZMusic::IsLoaded()
@ -130,7 +130,7 @@ bool ZMusic::IsPlaying()
return Mix_PlayingMusic() > 0;
else
{
LogError("ZMusic not initialized in ZMusic::IsPlaying.");
rEngine->ReportError(ZERR_NOMUSIC, "IsPlaying");
return false;
}
}
@ -141,7 +141,7 @@ bool ZMusic::IsPaused()
return Mix_PausedMusic() > 0;
else
{
LogError("ZMusic not initialized in ZMusic::IsPaused.");
rEngine->ReportError(ZERR_NOMUSIC, "IsPaused");
return false;
}
}
@ -152,7 +152,7 @@ int ZMusic::Volume()
return Mix_VolumeMusic(-1);
else
{
LogError("ZMusic not initialized in ZMusic::GetVolume.");
rEngine->ReportError(ZERR_NOMUSIC, "GetVolume");
return false;
}
}

View File

@ -13,7 +13,7 @@
File: ZE_ZSound.cpp <br>
Description: Implementation source file for core ZEngine Sound Object. <br>
Author(s): James Turk <br>
$Id: ZE_ZSound.cpp,v 1.3 2002/12/29 06:52:07 cozman Exp $<br>
$Id: ZE_ZSound.cpp,v 1.4 2003/01/13 06:00:38 cozman Exp $<br>
\file ZE_ZSound.cpp
\brief Source file for ZSound.
@ -74,7 +74,7 @@ void ZSound::Play(int loopNum, int fadeTime)
rChannelID = Mix_PlayChannel(rChannelID, rSound, loopNum);
}
else if(!rSound)
LogError("ZSound not initialized in ZSound::Play.");
rEngine->ReportError(ZERR_NOSOUND, "Play");
}
void ZSound::Pause()
@ -82,7 +82,7 @@ void ZSound::Pause()
if(rSound && rChannelID >= 0)
Mix_Pause(rChannelID);
else if(!rSound)
LogError("ZSound not initialized in ZSound::Pause.");
rEngine->ReportError(ZERR_NOSOUND, "Pause");
}
void ZSound::Unpause()
@ -90,7 +90,7 @@ void ZSound::Unpause()
if(rSound && rChannelID >= 0)
Mix_Resume(rChannelID);
else if(!rSound)
LogError("ZSound not initialized in ZSound::Unpause.");
rEngine->ReportError(ZERR_NOSOUND, "Unpause");
}
void ZSound::Stop(int fadeTime)
@ -103,7 +103,7 @@ void ZSound::Stop(int fadeTime)
Mix_HaltChannel(rChannelID);
}
else if(!rSound)
LogError("ZSound not initialized in ZSound::Stop.");
rEngine->ReportError(ZERR_NOSOUND, "Stop");
}
void ZSound::SetVolume(int volume)
@ -111,7 +111,7 @@ void ZSound::SetVolume(int volume)
if(rSound)
Mix_VolumeChunk(rSound,volume);
else
LogError("ZSound not initialized in ZSound::SetVolume.");
rEngine->ReportError(ZERR_NOSOUND, "SetVolume");
}
bool ZSound::IsLoaded()
@ -126,7 +126,7 @@ bool ZSound::IsPlaying()
else
{
if(rChannelID >= 0)
LogError("ZSound not initialized in ZSound::IsPlaying().");
rEngine->ReportError(ZERR_NOSOUND, "IsPlaying");
return false;
}
}
@ -137,7 +137,7 @@ bool ZSound::IsPaused()
return Mix_Paused(rChannelID) > 0;
else
{
LogError("ZSound not initialized in ZSound::IsPaused().");
rEngine->ReportError(ZERR_NOSOUND, "IsPaused");
return false;
}
}
@ -148,7 +148,7 @@ int ZSound::Volume()
return Mix_VolumeChunk(rSound,-1);
else
{
LogError("ZSound not initialized in ZSound::GetVolume().");
rEngine->ReportError(ZERR_NOSOUND, "GetVolume");
return -1;
}
}