mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r23194) -Codechange: don't cast away const needlessly
This commit is contained in:
parent
bd64bf6372
commit
4f87d2e88c
|
@ -91,7 +91,7 @@ SQString *SQVM::PrintObjVal(const SQObject &o)
|
|||
}
|
||||
}
|
||||
|
||||
void SQVM::Raise_IdxError(SQObject &o)
|
||||
void SQVM::Raise_IdxError(const SQObject &o)
|
||||
{
|
||||
SQObjectPtr oval = PrintObjVal(o);
|
||||
Raise_Error(_SC("the index '%.50s' does not exist"), _stringval(oval));
|
||||
|
|
|
@ -459,7 +459,7 @@ bool SQVM::DerefInc(SQInteger op,SQObjectPtr &target, SQObjectPtr &self, SQObjec
|
|||
#define sarg1 (*(const_cast<SQInt32 *>(&_i_._arg1)))
|
||||
#define arg2 (_i_._arg2)
|
||||
#define arg3 (_i_._arg3)
|
||||
#define sarg3 ((SQInteger)*((signed char *)&_i_._arg3))
|
||||
#define sarg3 ((SQInteger)*((const signed char *)&_i_._arg3))
|
||||
|
||||
SQRESULT SQVM::Suspend()
|
||||
{
|
||||
|
@ -742,7 +742,7 @@ exception_restore:
|
|||
continue;
|
||||
case _OP_LOAD: TARGET = ci->_literals[arg1]; continue;
|
||||
case _OP_LOADINT: TARGET = (SQInteger)arg1; continue;
|
||||
case _OP_LOADFLOAT: TARGET = *((SQFloat *)&arg1); continue;
|
||||
case _OP_LOADFLOAT: TARGET = *((const SQFloat *)&arg1); continue;
|
||||
case _OP_DLOAD: TARGET = ci->_literals[arg1]; STK(arg2) = ci->_literals[arg3];continue;
|
||||
case _OP_TAILCALL:
|
||||
temp_reg = STK(arg1);
|
||||
|
@ -1434,7 +1434,7 @@ bool SQVM::DeleteSlot(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr
|
|||
_table(self)->Remove(key);
|
||||
}
|
||||
else {
|
||||
Raise_IdxError((SQObject &)key);
|
||||
Raise_IdxError((const SQObject &)key);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public:
|
|||
|
||||
void Raise_Error(const SQChar *s, ...);
|
||||
void Raise_Error(SQObjectPtr &desc);
|
||||
void Raise_IdxError(SQObject &o);
|
||||
void Raise_IdxError(const SQObject &o);
|
||||
void Raise_CompareError(const SQObject &o1, const SQObject &o2);
|
||||
void Raise_ParamTypeError(SQInteger nparam,SQInteger typemask,SQInteger type);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
|||
const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
|
||||
src_px++;
|
||||
|
||||
const uint8 *src_n_ln = src_n + *(uint32 *)src_n;
|
||||
const uint8 *src_n_ln = src_n + *(const uint32 *)src_n;
|
||||
src_n += 4;
|
||||
|
||||
uint32 *dst_end = dst + bp->skip_left;
|
||||
|
@ -296,7 +296,7 @@ void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width,
|
|||
assert(!_screen_disable_anim);
|
||||
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
|
||||
uint32 *dst = (uint32 *)video;
|
||||
uint32 *usrc = (uint32 *)src;
|
||||
const uint32 *usrc = (const uint32 *)src;
|
||||
uint8 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
|
||||
|
||||
for (; height > 0; height--) {
|
||||
|
@ -309,7 +309,7 @@ void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width,
|
|||
dst += _screen.pitch;
|
||||
/* Copy back the anim-buffer */
|
||||
memcpy(anim_line, usrc, width * sizeof(uint8));
|
||||
usrc = (uint32 *)((uint8 *)usrc + width);
|
||||
usrc = (const uint32 *)((const uint8 *)usrc + width);
|
||||
anim_line += this->anim_buf_width;
|
||||
|
||||
/* Okay, it is *very* likely that the image we stored is using
|
||||
|
@ -336,12 +336,12 @@ void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, in
|
|||
assert(!_screen_disable_anim);
|
||||
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
|
||||
uint32 *udst = (uint32 *)dst;
|
||||
uint32 *src = (uint32 *)video;
|
||||
uint8 *anim_line;
|
||||
const uint32 *src = (const uint32 *)video;
|
||||
const uint8 *anim_line;
|
||||
|
||||
if (this->anim_buf == NULL) return;
|
||||
|
||||
anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
|
||||
anim_line = ((const uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
|
||||
|
||||
for (; height > 0; height--) {
|
||||
memcpy(udst, src, width * sizeof(uint32));
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "../stdafx.h"
|
||||
#include "32bpp_base.hpp"
|
||||
|
||||
void *Blitter_32bppBase::MoveTo(const void *video, int x, int y)
|
||||
void *Blitter_32bppBase::MoveTo(void *video, int x, int y)
|
||||
{
|
||||
return (uint32 *)video + x + y * _screen.pitch;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ void Blitter_32bppBase::DrawRect(void *video, int width, int height, uint8 colou
|
|||
void Blitter_32bppBase::CopyFromBuffer(void *video, const void *src, int width, int height)
|
||||
{
|
||||
uint32 *dst = (uint32 *)video;
|
||||
uint32 *usrc = (uint32 *)src;
|
||||
const uint32 *usrc = (const uint32 *)src;
|
||||
|
||||
for (; height > 0; height--) {
|
||||
memcpy(dst, usrc, width * sizeof(uint32));
|
||||
|
@ -51,7 +51,7 @@ void Blitter_32bppBase::CopyFromBuffer(void *video, const void *src, int width,
|
|||
void Blitter_32bppBase::CopyToBuffer(const void *video, void *dst, int width, int height)
|
||||
{
|
||||
uint32 *udst = (uint32 *)dst;
|
||||
uint32 *src = (uint32 *)video;
|
||||
const uint32 *src = (const uint32 *)video;
|
||||
|
||||
for (; height > 0; height--) {
|
||||
memcpy(udst, src, width * sizeof(uint32));
|
||||
|
@ -63,7 +63,7 @@ void Blitter_32bppBase::CopyToBuffer(const void *video, void *dst, int width, in
|
|||
void Blitter_32bppBase::CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch)
|
||||
{
|
||||
uint32 *udst = (uint32 *)dst;
|
||||
uint32 *src = (uint32 *)video;
|
||||
const uint32 *src = (const uint32 *)video;
|
||||
|
||||
for (; height > 0; height--) {
|
||||
memcpy(udst, src, width * sizeof(uint32));
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
class Blitter_32bppBase : public Blitter {
|
||||
public:
|
||||
/* virtual */ uint8 GetScreenDepth() { return 32; }
|
||||
/* virtual */ void *MoveTo(const void *video, int x, int y);
|
||||
/* virtual */ void *MoveTo(void *video, int x, int y);
|
||||
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
|
||||
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
|
||||
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
|
||||
|
|
|
@ -40,7 +40,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
|||
/* skip upper lines in src_px and src_n */
|
||||
for (uint i = bp->skip_top; i != 0; i--) {
|
||||
src_px = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
|
||||
src_n += *(uint32 *)src_n;
|
||||
src_n += *(const uint32 *)src_n;
|
||||
}
|
||||
|
||||
/* skip lines in dst */
|
||||
|
@ -58,7 +58,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
|||
src_px++;
|
||||
|
||||
/* next src_n line begins here */
|
||||
const uint8 *src_n_ln = src_n + *(uint32 *)src_n;
|
||||
const uint8 *src_n_ln = src_n + *(const uint32 *)src_n;
|
||||
src_n += 4;
|
||||
|
||||
/* we will end this line when we reach this point */
|
||||
|
|
|
@ -23,7 +23,7 @@ void Blitter_8bppBase::DrawColourMappingRect(void *dst, int width, int height, P
|
|||
} while (--height);
|
||||
}
|
||||
|
||||
void *Blitter_8bppBase::MoveTo(const void *video, int x, int y)
|
||||
void *Blitter_8bppBase::MoveTo(void *video, int x, int y)
|
||||
{
|
||||
return (uint8 *)video + x + y * _screen.pitch;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ void Blitter_8bppBase::DrawRect(void *video, int width, int height, uint8 colour
|
|||
void Blitter_8bppBase::CopyFromBuffer(void *video, const void *src, int width, int height)
|
||||
{
|
||||
uint8 *dst = (uint8 *)video;
|
||||
uint8 *usrc = (uint8 *)src;
|
||||
const uint8 *usrc = (const uint8 *)src;
|
||||
|
||||
for (; height > 0; height--) {
|
||||
memcpy(dst, usrc, width * sizeof(uint8));
|
||||
|
@ -56,7 +56,7 @@ void Blitter_8bppBase::CopyFromBuffer(void *video, const void *src, int width, i
|
|||
void Blitter_8bppBase::CopyToBuffer(const void *video, void *dst, int width, int height)
|
||||
{
|
||||
uint8 *udst = (uint8 *)dst;
|
||||
uint8 *src = (uint8 *)video;
|
||||
const uint8 *src = (const uint8 *)video;
|
||||
|
||||
for (; height > 0; height--) {
|
||||
memcpy(udst, src, width * sizeof(uint8));
|
||||
|
@ -68,7 +68,7 @@ void Blitter_8bppBase::CopyToBuffer(const void *video, void *dst, int width, int
|
|||
void Blitter_8bppBase::CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch)
|
||||
{
|
||||
uint8 *udst = (uint8 *)dst;
|
||||
uint8 *src = (uint8 *)video;
|
||||
const uint8 *src = (const uint8 *)video;
|
||||
|
||||
for (; height > 0; height--) {
|
||||
memcpy(udst, src, width * sizeof(uint8));
|
||||
|
|
|
@ -19,7 +19,7 @@ class Blitter_8bppBase : public Blitter {
|
|||
public:
|
||||
/* virtual */ uint8 GetScreenDepth() { return 8; }
|
||||
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
|
||||
/* virtual */ void *MoveTo(const void *video, int x, int y);
|
||||
/* virtual */ void *MoveTo(void *video, int x, int y);
|
||||
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
|
||||
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
|
||||
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
* @param y How much you want to scroll to the bottom.
|
||||
* @return A new destination pointer moved the the requested place.
|
||||
*/
|
||||
virtual void *MoveTo(const void *video, int x, int y) = 0;
|
||||
virtual void *MoveTo(void *video, int x, int y) = 0;
|
||||
|
||||
/**
|
||||
* Draw a pixel with a given colour on the video-buffer.
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) {};
|
||||
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) {};
|
||||
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||
/* virtual */ void *MoveTo(const void *video, int x, int y) { return NULL; };
|
||||
/* virtual */ void *MoveTo(void *video, int x, int y) { return NULL; };
|
||||
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour) {};
|
||||
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour) {};
|
||||
/* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width) {};
|
||||
|
|
Loading…
Reference in New Issue