Descent3/dd_sndlib/ssl_lib.cpp

63 lines
1.3 KiB
C++
Raw Normal View History

2024-04-16 03:43:29 +00:00
/*
* $Source: $
* $Revision: 3 $
* $Author: Chris $
* $Date: 10/08/99 4:28p $
*
* This takes care of any code not exclusive to Win32 Ds3dlib.cpp but part of library
*
* $Log: /DescentIII/Main/dd_sndlib/ssl_lib.cpp $
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 3 10/08/99 4:28p Chris
* Added the forcefield and glass breaking override options
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 2 4/06/99 8:29p Samir
* added error check system.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 1 4/06/99 8:16p Samir
* Initial rev.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
*/
#include "ssl_lib.h"
#include "pserror.h"
#include "pstring.h"
#include <string.h>
2024-04-16 18:56:40 +00:00
llsSystem::llsSystem() {
m_lib_error_code = SSL_OK;
m_geometry = NULL;
2024-04-16 03:43:29 +00:00
}
2024-04-16 18:56:40 +00:00
void llsSystem::CheckForErrors() {
// if a fatal error occurred, quit and display an error
// non fatal errors should be put inside a logfile, or just mprinted out.
2024-04-16 03:43:29 +00:00
2024-04-16 18:56:40 +00:00
strcpy(m_error_text, "Internal Sound Error: ");
m_lib_error_code = SSL_OK;
2024-04-16 03:43:29 +00:00
}
2024-04-16 18:56:40 +00:00
void llsSystem::ErrorText(char *fmt, ...) {
va_list arglist;
char buf[128];
int len, slen;
2024-04-16 03:43:29 +00:00
2024-04-16 18:56:40 +00:00
slen = strlen(m_error_text);
2024-04-16 03:43:29 +00:00
2024-04-16 18:56:40 +00:00
if ((slen + 2) > sizeof(m_error_text)) {
return;
}
2024-04-16 03:43:29 +00:00
2024-04-16 18:56:40 +00:00
strcat(m_error_text, "\n");
va_start(arglist, fmt);
len = Pvsprintf(buf, 128, fmt, arglist);
va_end(arglist);
if (len < 0)
return;
2024-04-16 03:43:29 +00:00
2024-04-16 18:56:40 +00:00
if ((slen + strlen(buf) + 1) > sizeof(m_error_text)) {
return;
}
strcat(m_error_text, buf);
2024-04-16 03:43:29 +00:00
}