Shadowrun: Awakened 29 September 2011 - Build 871
Functions
util.cpp File Reference
#include "machine.h"
#include "types.h"
#include "macros.h"
#include "util.h"
#include "light.h"
#include "global.h"
#include "ui.h"
#include <sys/time.h>
#include <unistd.h>
Include dependency graph for util.cpp:

Go to the source code of this file.

Functions

void rt_finalize (void)
unsigned int rt_freemem (void *addr)
void * rt_getmem (unsigned int bytes)
int rt_meminuse (void)
void rt_sleep (int msec)
void rtbomb (const char *msg)
void rtmesg (const char *msg)

Function Documentation

void rt_finalize ( void  )

Definition at line 183 of file video.cpp.

References video::next_frame(), rt_sleep(), timerstart(), timerstop(), and timertime().

                       {
    timerstart();
    if(global_usegraphics)
        do { rt_sleep(10); timerstop(); }
        while(timertime() < 10 && video->next_frame());
#ifdef _WINDOWS
    else rt_sleep(10000);
#endif
}
unsigned int rt_freemem ( void *  addr)

Definition at line 181 of file util.cpp.

References rt_mem_in_use.

Referenced by DeallocateImage(), and trace_shm().

                                     {
  unsigned int bytes;

  free(addr);

  bytes=0;
  rt_mem_in_use -= bytes; 
  return bytes;
}
void* rt_getmem ( unsigned int  bytes)

Definition at line 168 of file util.cpp.

References rt_mem_in_use, and rtbomb().

Referenced by AllocateImage(), engrid_cell(), engrid_object(), fakeimage(), LoadVol(), newbndbox(), newbox(), newcylinder(), newextvol(), newfcylinder(), newgrid(), newlight(), newplane(), newquadric(), newring(), newscalarvol(), newsphere(), newstri(), newtri(), readppm(), readtga(), rt_texture(), and trace_shm().

                                     {
  void * mem;

  mem=malloc( bytes );
  if (mem!=NULL) { 
    rt_mem_in_use += bytes;
  } 
  else {
    rtbomb("No more memory!!!!");
  }
  return mem;
}
int rt_meminuse ( void  )

Definition at line 164 of file util.cpp.

References rt_mem_in_use.

                      {
  return rt_mem_in_use;
}  
void rt_sleep ( int  msec)

Definition at line 78 of file util.cpp.

                        {
    usleep(msec*1000);
}
void rtbomb ( const char *  msg)

Definition at line 191 of file util.cpp.

References MSG_ABORT, MSG_ERR, rt_finalize(), and rt_ui_message().

Referenced by AllocateImage(), and rt_getmem().

                              {
    rt_ui_message(MSG_ERR, msg);
    rt_ui_message(MSG_ABORT, "Rendering Aborted.");

  rt_finalize();
  exit(1);
}
void rtmesg ( const char *  msg)

Definition at line 199 of file util.cpp.

References MSG_0, and rt_ui_message().

Referenced by rt_boundthresh().

                              {
    rt_ui_message(MSG_0, msg);
}

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net