1
0
forked from 0ad/0ad

minor changes (mainly header rename) for lib overhaul

This was SVN commit r157.
This commit is contained in:
janwas 2004-03-02 23:54:51 +00:00
parent ef326e991b
commit 91cb7f7138
18 changed files with 40 additions and 37 deletions

View File

@ -117,7 +117,7 @@ CStr CStr::GetSubstring(_long start, _long len)
//Search the string for another string
_long CStr::Find(const CStr &Str)
{
_long Pos = m_String.find(Str.m_String, 0);
_long Pos = (_long)m_String.find(Str.m_String, 0);
if (Pos != tstring::npos)
return Pos;
@ -127,7 +127,7 @@ _long CStr::Find(const CStr &Str)
_long CStr::ReverseFind(const CStr &Str)
{
_long Pos = m_String.rfind(Str.m_String, m_String.length() );
_long Pos = (_long)m_String.rfind(Str.m_String, m_String.length() );
if (Pos != tstring::npos)
return Pos;
@ -398,14 +398,14 @@ ostream &operator<<(ostream &os, CStr &Str)
return os;
}
uint CStr::GetSerializedLength() const
size_t CStr::GetSerializedLength() const
{
return m_String.length()+1;
}
u8 *CStr::Serialize(u8 *buffer) const
{
uint length=m_String.length();
size_t length=m_String.length();
memcpy(buffer, m_String.c_str(), length+1);
return buffer+length+1;
}

View File

@ -173,7 +173,7 @@ public:
TCHAR &operator[](_ulong n);
// Serialization functions
virtual uint GetSerializedLength() const;
virtual size_t GetSerializedLength() const;
virtual u8 *Serialize(u8 *buffer) const;
virtual const u8 *Deserialize(const u8 *buffer, const u8 *bufferend);

View File

@ -4,7 +4,7 @@
// TODO: Optimizations, when we've decided what needs to be done.
#include "Config.h"
#include "vfs.h"
#include "res/res.h"
using namespace std;

View File

@ -53,7 +53,6 @@ TDD at http://forums.wildfiregames.com/0ad
#include "CStr.h"
#include "LogFile.h"
#include "posix.h"
#include "zip.h"
#include "misc.h"
#include <vector>

View File

@ -1,7 +1,9 @@
// last modified Thursday, May 08, 2003
#include "LogFile.h"
#include "misc.h"
#include "lib.h"
#include <sstream>
//-------------------------------------------------
//Add a hyperlink to Link.
@ -328,10 +330,14 @@ string CLogFile::Line(const PS_DISPLAY_SETTINGS &options)
{
lineText = options.file;
char temp[8];
_itoa(options.line, temp, 10);
// jw: replaced _itoa. sprintf would be good here :P
std::string str_line;
std::stringstream ss;
ss << options.line;
ss >> str_line;
lineText += ", Line ";
lineText += temp;
lineText += str_line;
lineText += ": ";
}

View File

@ -1,4 +1,5 @@
#include "posix.h"
#include "lib.h"
#include "misc.h"
#include <stdio.h>

View File

@ -12,7 +12,7 @@
#define closesocket(_fd) close(_fd)
#else
#include "win.h"
#include "sysdep/win/win_internal.h"
#define Network_GetErrorString(_error, _buf, _buflen) \
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, _error+WSABASEERR, 0, _buf, _buflen, NULL)

View File

@ -2,7 +2,7 @@
#define _Serialization_H
#include "types.h"
#include "misc.h"
#include "lib.h"
#define Serialize_int_1(_pos, _val) \
STMT( *((_pos)++) = _val&0xff; )

View File

@ -1,7 +1,7 @@
#include "SocketBase.h"
#include "NetworkInternal.h"
#include "misc.h"
#include "lib.h"
#include "CStr.h"
#include <errno.h>
@ -663,6 +663,8 @@ void CSocketBase::SendWaitLoopUpdate()
// Windows WindowProc for async event notification
#ifdef _WIN32
void WaitLoop_SocketUpdateProc(int fd, int error, uint event)
{
pthread_mutex_lock(&g_SocketSetInternal.m_Mutex);
@ -713,7 +715,7 @@ LRESULT WINAPI WaitLoop_WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
int event=LOWORD(lParam);
int error=HIWORD(lParam);
WaitLoop_SocketUpdateProc(wParam, error, event);
WaitLoop_SocketUpdateProc((int)wParam, error, event);
return FALSE;
}
default:

View File

@ -195,7 +195,7 @@ public:
_bool GetArgDouble (const _int& arg, double &ret);
// Get Argument count
_int GetArgCount() const { return m_Arguments.size(); }
size_t GetArgCount() const { return m_Arguments.size(); }
};
// CParser

View File

@ -9,7 +9,7 @@ Standard declarations which are included in all projects.
#ifndef PROMETHEUS_H
#define PROMETHEUS_H
#pragma warning (disable : 4786)
#pragma warning (disable : 4786) // VC6 template warning spew
#pragma warning (disable : 4291)
#include <stdio.h>

View File

@ -34,8 +34,8 @@ class Singleton
//use a cunning trick to get the singleton pointing to the start of
//the whole, rather than the start of the Singleton part of the object
int offset = (int)(T*)1 - (int)(Singleton<T>*)(T*)1;
ms_singleton = (T*)((int)this + offset);
uintptr_t offset = (uintptr_t)(T*)1 - (uintptr_t)(Singleton<T>*)(T*)1;
ms_singleton = (T*)((uintptr_t)this + offset);
}
~Singleton()

View File

@ -17,8 +17,7 @@
#define DEGTORAD(a) ((a) * (PI/180.0f))
#define RADTODEG(a) ((a) * (180.0f/PI))
#define SQR(x) ((x) * (x))
#define MAX(a,b) ((a < b) ? (b) : (a))
#define MIN(a,b) ((a < b) ? (a) : (b))
#define MAX3(a,b,c) ( MAX (MAX(a,b), c) )
#define ABS(a) ((a > 0) ? (a) : (-a))

View File

@ -1,7 +1,7 @@
#ifndef MINIPATCH_H
#define MINIPATCH_H
#include "res.h"
#include "res/res.h"
#include "Color.h"
#include "Vector3D.h"

View File

@ -21,7 +21,7 @@
#include "types.h"
#include "ogl.h"
#include "tex.h"
#include "res/res.h"
#define RENDER_STAGE_BASE (1)
#define RENDER_STAGE_TRANS (2)
@ -79,7 +79,7 @@ void CRenderer::BeginFrame()
// force rendering of any batched objects
void CRenderer::FlushFrame()
{
int i;
unsigned i;
// render base terrain
if (m_TerrainMode==WIREFRAME) {

View File

@ -14,8 +14,7 @@
//
//***********************************************************
#include "tex.h"
#include "mem.h"
#include "res/res.h"
#include "Terrain.h"
#include "LightEnv.h"
@ -38,16 +37,13 @@ CTerrain::~CTerrain ()
bool CTerrain::Load(char *filename)
{
TEX tex;
Handle h = tex_load(filename, &tex);
if(!h)
Handle ht = tex_load(filename);
if(!ht)
return false;
void* p;
tex_info(ht, 0, 0, &p);
Handle hm = tex.hm;
MEM* mem = (MEM*)h_user_data(hm, H_MEM);
const u8* data = (const u8*)mem->p;
return InitFromHeightmap(data);
return InitFromHeightmap((const u8*)p);
}
bool CTerrain::InitFromHeightmap(const u8* data)

View File

@ -12,7 +12,7 @@
#ifndef _TEXTURE_H
#define _TEXTURE_H
#include "res.h"
#include "res/res.h"
#include "CStr.h"
class CTexture

View File

@ -7,8 +7,8 @@
#include "detect.h"
#include "time.h"
#include "wsdl.h"
#include "tex.h"
#include "sdl.h"
#include "res/res.h"
// TODO: fix scrolling hack - framerate independent, use SDL
//#include "win.h" // REMOVEME