many C-string -> std::string replacements and some additional code taken from OpenLieroX

git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@87 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
albertzeyer
2009-07-22 15:17:41 +00:00
parent cb3c2e2502
commit 5fcc021293
73 changed files with 12091 additions and 6988 deletions

View File

@@ -10,12 +10,14 @@
* not platform-specific).
*/
#include "CGraphics.h"
#include "keen.h"
#include "keenext.h"
#include "CGraphics.h"
#include "sdl/CVideoDriver.h"
#include "sdl/video/colourtable.h"
#include "sdl/CVideoDriver.h"
#include "CLogFile.h"
#include "StringUtils.h"
CGraphics::CGraphics() {
HQBitmap = NULL;
@@ -591,13 +593,13 @@ int c;
}
// font drawing functions
void CGraphics::drawFont(unsigned char *text, int xoff, int yoff, int highlight)
void CGraphics::drawFont(const std::string& text, int xoff, int yoff, int highlight)
{
unsigned int i,x=xoff,y;
int c;
y = yoff;
for(i=0;i<strlen( (char*) text);i++)
for(i=0;i<text.size();i++)
{
c = text[i];
if (!c) break;
@@ -614,15 +616,14 @@ int c;
}
}
}
void CGraphics::sb_font_draw(const unsigned char *text, int xoff, int yoff)
void CGraphics::sb_font_draw(const std::string& text, int xoff, int yoff)
{
unsigned int i,x,y;
x=xoff;
y=yoff;
for(i=0;i<strlen( (char*) text);i++)
for(i=0;i<text.size();i++)
{
if (!text[i]) break;
if (text[i]!=13)
{
sb_drawCharacter(x, y, text[i]);
@@ -636,13 +637,13 @@ void CGraphics::sb_font_draw(const unsigned char *text, int xoff, int yoff)
}
}
void CGraphics::sb_mask_font_draw(unsigned char *text, int xoff, int yoff, char mask)
void CGraphics::sb_mask_font_draw(const std::string& text, int xoff, int yoff, char mask)
{
unsigned int i,x,y;
x=xoff;
y=yoff;
for(i=0;i<strlen( (char*) text);i++)
for(i=0;i<text.size();i++)
{
if (!text[i]) break;
if (text[i]!=13)
@@ -659,15 +660,14 @@ unsigned int i,x,y;
}
void CGraphics::sb_color_font_draw(unsigned char *text, int xoff, int yoff, unsigned int colour, unsigned short bgcolour)
void CGraphics::sb_color_font_draw(const std::string& text, int xoff, int yoff, unsigned int colour, unsigned short bgcolour)
{
unsigned int i,x,y;
x=xoff;
y=yoff;
for(i=0;i<strlen( (char*) text);i++)
for(i=0;i< text.size(); i++)
{
if (!text[i]) break;
if (text[i]!=13)
{
sb_drawColorcharacter(x, y, text[i], colour, bgcolour);
@@ -681,14 +681,13 @@ unsigned int i,x,y;
}
}
void CGraphics::sb_font_draw_inverse(unsigned char *text, int xoff, int yoff)
void CGraphics::sb_font_draw_inverse(const std::string& text, int xoff, int yoff)
{
unsigned int i,x=xoff,y;
y=yoff;
for(i=0;i<strlen( (char*) text);i++)
for(i=0;i< text.size();i++)
{
if (!text[i]) break;
if (text[i]!=13)
{
sb_drawCharacterinverse(x, y, text[i]);
@@ -725,18 +724,12 @@ void CGraphics::renderHQBitmap()
}
}
void CGraphics::loadHQGraphics(unsigned char episode, unsigned char level, char *datadir)
void CGraphics::loadHQGraphics(unsigned char episode, unsigned char level, const std::string& datadir)
{
char buf[256];
char buf2[256];
SDL_Rect screen_rect;
memset(buf,0,256);
memset(buf2,0,256);
formatPathString(buf,datadir);
sprintf(buf2,"%slevel%dep%d.bmp",buf,level,episode);
std::string buf = formatPathString(datadir);
std::string buf2 = buf + "level" + itoa(level) + "ep" + itoa(episode) + ".bmp";
screen_rect.x = 0;
screen_rect.y = 0;