Merge branch 'cpp' into qtcpp

Conflicts:
	lib/framework/Makefile.am
	lib/framework/frame.cpp
	lib/framework/framework.vcproj
	lib/framework/input.cpp
	lib/ivis_opengl/piestate.cpp
	lib/ivis_opengl/screen.cpp
	lib/ivis_opengl/textdraw.cpp
	lib/widget/Makefile.am
	lib/widget/editbox.cpp
	lib/widget/scrap.cpp
	lib/widget/widget.vcproj
	macosx/Warzone.xcodeproj/project.pbxproj
	src/Makefile.am
	src/main.cpp
	src/makefile.win32
master
Cyp 2010-12-19 16:51:27 +01:00
commit bd6b96315b
270 changed files with 2071 additions and 3341 deletions

View File

@ -4,7 +4,7 @@
DIE=0
SRCDIR=`dirname $0`
BUILDDIR=`pwd`
srcfile=src/action.c
srcfile=src/action.cpp
package=Warzone2100
debug ()

View File

@ -4,7 +4,7 @@ AC_INIT([Warzone 2100],[master],[http://wz2100.net/],[warzone2100])
AM_INIT_AUTOMAKE([1.10 tar-ustar])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([lib/framework/frame.c])
AC_CONFIG_SRCDIR([lib/framework/frame.cpp])
# HACK
@ -246,7 +246,7 @@ fi
WZ_WARNINGS_GCC="-Wall -Wextra ${WZ_Wno_}unused-parameter ${WZ_Wno_}sign-compare -Wcast-align -Wwrite-strings -Wpointer-arith ${WZ_Wno_}format-security"
WZ_WARNINGS_GCC_C="${WZ_WARNINGS_GCC} -Wstrict-prototypes -Wdeclaration-after-statement -Wc++-compat ${WZ_Wno_}c++-compat ${CFLAGS_IGNORE_WARNINGS}"
WZ_WARNINGS_GCC_CXX="${WZ_WARNINGS_GCC}"
WZ_WARNINGS_GCC_CXX="${WZ_Wno_}enum-compare ${WZ_WARNINGS_GCC}"
if test "x$enable_debug" = "xyes" ; then
if test "x$cc_icc" = "xyes" ; then
# "-fp-model precise -fp-model source -ftz -no-fma" was here
@ -279,7 +279,7 @@ elif test "x$enable_debug" = "xprofile" ; then
WZ_CPPFLAGS="${WZ_CPPFLAGS} -DNDEBUG"
LDFLAGS="-pg ${LDFLAGS}"
elif test "x$enable_debug" = "xg++" ; then
WZ_CFLAGS="${WZ_CFLAGS} -g -O2 ${WZ_WARNINGS_GCC_C} -fpermissive"
WZ_CFLAGS="${WZ_CXXFLAGS} -g -O2 ${WZ_WARNINGS_GCC_CXX}"
WZ_CXXFLAGS="${WZ_CXXFLAGS} -g -O2 ${WZ_WARNINGS_GCC_CXX}"
WZ_CPPFLAGS="${WZ_CPPFLAGS} -DDEBUG"
CC="g++"

View File

@ -1,5 +1,5 @@
#!/bin/bash
for a in {src,lib/*}/*.cpp
for a in {src,lib/*{,/*}}/*.cpp
do
b="${a%pp}"
c="${a##*/}"
@ -8,7 +8,7 @@ do
then
#echo Checking "$a"
sed -i "s/\\b${b//\//\\\\}\\b/${a//\//\\\\}/" win32/*.vcproj
sed -i "s/\\b$d\\b/$c/" {src,lib/*}/{Makefile.am,makefile.win32} lib/*/*.vcproj
sed -i "s/\\b$d\\b/$c/" {src,lib/*{,/*}}/{Makefile.am,makefile.win32} lib/*/*.vcproj
else
echo Skipping "$a".
fi

View File

@ -21,19 +21,19 @@ lib_LTLIBRARIES = libbetawidget.la
libbetawidget_la_SOURCES = \
betawidget_wrap_lua.cpp \
button.c \
imageButton.c \
font.c \
geom.c \
hBox.c \
spacer.c \
svgManager.c \
table.c \
textEntry.c \
patternManager.c \
vector.c \
widget.c \
window.c
button.cpp \
imageButton.cpp \
font.cpp \
geom.cpp \
hBox.cpp \
spacer.cpp \
svgManager.cpp \
table.cpp \
textEntry.cpp \
patternManager.cpp \
vector.cpp \
widget.cpp \
window.cpp
libbetawidget_la_CPPFLAGS = $(PANGO_CAIRO_CFLAGS) $(SVG_CAIRO_CFLAGS) $(CAIRO_CFLAGS) $(LUA_CFLAGS) -DLIB_COMPILE=1
libbetawidget_la_LDFLAGS = $(PANGO_CAIRO_LIBS) $(SVG_CAIRO_LIBS) $(CAIRO_CFLAGS) $(LUA_LIBS) $(CAIRO_LIBS) $(OPENGL_LIBS) -version-info $(LIBTOOL_VERSION) -DLIB_COMPILE=1
@ -63,11 +63,11 @@ pkginclude_HEADERS = \
noinst_HEADERS = \
lua-wrap.h
# utf.c, GLee
# utf.cpp, GLee
noinst_LTLIBRARIES = libutil.la
libutil_la_SOURCES = \
../../framework/utf.c \
../../ivis_opengl/GLee.c
../../framework/utf.cpp \
../../ivis_opengl/GLee.cpp
libutil_la_CPPFLAGS = $(SDL_CFLAGS) -DLIB_COMPILE=1
noinst_HEADERS += \

View File

@ -3,7 +3,7 @@ noinst_PROGRAMS = sdl-testapp
EXTRA_DIST = sdl-testapp.lua
sdl_testapp_SOURCES = \
sdl-testapp.c
sdl-testapp.cpp
sdl_testapp_CPPFLAGS = $(LUA_CFLAGS) $(SDL_CFLAGS) $(CAIRO_CFLAGS) -DLIB_COMPILE=1
sdl_testapp_LDADD = $(OPENGL_LIBS) $(CAIRO_LIBS) $(SDL_LIBS) $(top_builddir)/src/libbetawidget.la $(LUA_LIBS)

View File

@ -12,8 +12,8 @@ noinst_HEADERS = \
libexceptionhandler_a_SOURCES = \
dumpinfo.cpp \
exceptionhandler.c
exceptionhandler.cpp
if MINGW32
libexceptionhandler_a_SOURCES += exchndl.c
libexceptionhandler_a_SOURCES += exchndl.cpp
endif

View File

@ -155,11 +155,11 @@
>
</File>
<File
RelativePath=".\exceptionhandler.c"
RelativePath=".\exceptionhandler.cpp"
>
</File>
<File
RelativePath=".\exchndl.c"
RelativePath=".\exchndl.cpp"
>
</File>
</Filter>

View File

@ -5,8 +5,8 @@ include $(top_srcdir)/makerules/common.mk
SRC= \
dumpinfo.cpp \
exceptionhandler.c \
exchndl.c
exceptionhandler.cpp \
exchndl.cpp
LIB=exceptionhandler

View File

@ -1,9 +1,8 @@
%.tab.h %.tab.c:: %.y
%.tab.hpp %.tab.cpp:: %.y
$(YACC) $(YFLAGS) $(AM_YFLAGS) -o$@ $<
%.lex.c:: %.l
%.lex.cpp:: %.l
$(LEX) $(LFLAGS) $(AM_LFLAGS) -o$@ $<
# sed -i 's/\(fwrite(.*)\)/abs(\1)/' $@
AM_CPPFLAGS = -DYY_NO_INPUT $(WZ_CPPFLAGS) $(QT4_CFLAGS)
AM_CFLAGS = $(WZ_CFLAGS)
@ -18,22 +17,22 @@ MOCEDFILES = $(MOCHEADER:%.h=%_moc.cpp)
$(MOC4) -o $@ $<
BUILT_SOURCES = \
$(MOCEDFILES) \
resource_lexer.lex.c \
resource_parser.tab.c \
resource_parser.tab.h \
strres_lexer.lex.c \
strres_parser.tab.c \
strres_parser.tab.h
$(MOCEDFILES) \
resource_lexer.lex.cpp \
resource_parser.tab.cpp \
resource_parser.tab.hpp \
strres_lexer.lex.cpp \
strres_parser.tab.cpp \
strres_parser.tab.hpp
CLEANFILES = \
$(MOCEDFILES) \
resource_lexer.lex.c \
resource_parser.tab.c \
resource_parser.tab.h \
strres_lexer.lex.c \
strres_parser.tab.c \
strres_parser.tab.h
$(MOCEDFILES) \
resource_lexer.lex.cpp \
resource_parser.tab.cpp \
resource_parser.tab.hpp \
strres_lexer.lex.cpp \
strres_parser.tab.cpp \
strres_parser.tab.hpp
EXTRA_DIST = \
resource_lexer.l resource_parser.y \
@ -43,8 +42,8 @@ noinst_LIBRARIES = libframework.a
noinst_HEADERS = \
$(MOCHEADER) \
wzapp_c.h \
strres_parser.tab.h \
resource_parser.tab.h \
strres_parser.tab.hpp \
resource_parser.tab.hpp \
configfile.h \
crc.h \
cursors.h \
@ -83,26 +82,24 @@ noinst_HEADERS = \
libframework_a_SOURCES = \
wzapp_moc.cpp \
wzapp.cpp \
resource_lexer.lex.c \
resource_parser.tab.c \
strres_lexer.lex.c \
strres_parser.tab.c \
configfile.c \
resource_lexer.lex.cpp \
resource_parser.tab.cpp \
strres_lexer.lex.cpp \
strres_parser.tab.cpp \
configfile.cpp \
crc.cpp \
cursors16.c \
cursors32.c \
cursors.c \
debug.c \
frame.c \
frameresource.c \
i18n.c \
lexer_input.c \
SDL_framerate.c \
stdio_ext.c \
strres.c \
tagfile.c \
treap.c \
trig.c \
utf.c
libframework_a_DEPENDENCIES = $(MOCEDFILES)
cursors16.cpp \
cursors32.cpp \
cursors.cpp \
debug.cpp \
frame.cpp \
frameresource.cpp \
i18n.cpp \
lexer_input.cpp \
SDL_framerate.cpp \
stdio_ext.cpp \
strres.cpp \
tagfile.cpp \
treap.cpp \
trig.cpp \
utf.cpp

View File

@ -105,7 +105,7 @@ static code_part code_part_from_str(const char *str)
for (i = 0; i < LOG_LAST; i++) {
if (strcasecmp(code_part_names[i], str) == 0) {
return i;
return (code_part)i;
}
}
return LOG_LAST;

View File

@ -44,7 +44,8 @@ static const enum CURSOR_TYPE cursor_type = CURSOR_32;
/* Linux specific stuff */
static CURSOR currentCursor = ~(CURSOR)0;
static CURSOR currentCursor = CURSOR_MAX;
bool selfTest = false;
/************************************************************************************

View File

@ -340,7 +340,7 @@ static inline RES_DATA* resDataInit(const char *DebugName, UDWORD DataIDHash, vo
char* resID;
// Allocate memory to hold the RES_DATA structure plus the identifying string
RES_DATA* psRes = malloc(sizeof(RES_DATA) + strlen(DebugName) + 1);
RES_DATA *psRes = (RES_DATA *)malloc(sizeof(RES_DATA) + strlen(DebugName) + 1);
if (!psRes)
{
debug(LOG_ERROR, "resDataInit: Out of memory");

View File

@ -171,7 +171,7 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\configfile.c"
RelativePath=".\configfile.cpp"
>
</File>
<File
@ -179,39 +179,39 @@
>
</File>
<File
RelativePath=".\cursors.c"
RelativePath=".\cursors.cpp"
>
</File>
<File
RelativePath=".\cursors16.c"
RelativePath=".\cursors16.cpp"
>
</File>
<File
RelativePath=".\cursors32.c"
RelativePath=".\cursors32.cpp"
>
</File>
<File
RelativePath=".\debug.c"
RelativePath=".\debug.cpp"
>
</File>
<File
RelativePath=".\frame.c"
RelativePath=".\frame.cpp"
>
</File>
<File
RelativePath=".\frameresource.c"
RelativePath=".\frameresource.cpp"
>
</File>
<File
RelativePath=".\i18n.c"
RelativePath=".\i18n.cpp"
>
</File>
<File
RelativePath=".\lexer_input.c"
RelativePath=".\lexer_input.cpp"
>
</File>
<File
RelativePath=".\resource_lexer.lex.c"
RelativePath=".\resource_lexer.lex.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@ -237,19 +237,19 @@
>
</File>
<File
RelativePath=".\SDL_framerate.c"
RelativePath=".\SDL_framerate.cpp"
>
</File>
<File
RelativePath=".\stdio_ext.c"
RelativePath=".\stdio_ext.cpp"
>
</File>
<File
RelativePath=".\strres.c"
RelativePath=".\strres.cpp"
>
</File>
<File
RelativePath=".\strres_lexer.lex.c"
RelativePath=".\strres_lexer.lex.cpp"
>
</File>
<File
@ -257,19 +257,19 @@
>
</File>
<File
RelativePath=".\tagfile.c"
RelativePath=".\tagfile.cpp"
>
</File>
<File
RelativePath=".\treap.c"
RelativePath=".\treap.cpp"
>
</File>
<File
RelativePath=".\trig.c"
RelativePath=".\trig.cpp"
>
</File>
<File
RelativePath=".\utf.c"
RelativePath=".\utf.cpp"
>
</File>
<File

View File

@ -13,24 +13,24 @@ PARSERS= \
SRC= \
$(PARSERS) \
configfile.c \
configfile.cpp \
crc.cpp \
cursors16.c \
cursors32.c \
cursors.c \
debug.c \
frame.c \
frameresource.c \
i18n.c \
input.c \
lexer_input.c \
SDL_framerate.c \
stdio_ext.c \
strres.c \
tagfile.c \
treap.c \
trig.c \
utf.c
cursors16.cpp \
cursors32.cpp \
cursors.cpp \
debug.cpp \
frame.cpp \
frameresource.cpp \
i18n.cpp \
input.cpp \
lexer_input.cpp \
SDL_framerate.cpp \
stdio_ext.cpp \
strres.cpp \
tagfile.cpp \
treap.cpp \
trig.cpp \
utf.cpp
LIB=framework

View File

@ -155,7 +155,7 @@ static inline void solveDifferential2ndOrder(float *y_, float *dydt_, float acce
y = complexDouble(*y_, 0);
dydt = complexDouble(*dydt_, 0);
sqd = d > 0? complexDouble(sqrt(d), 0) : complexDouble(0, sqrt(-d)); // sqd = std::sqrt(d);
sqd = d > 0? complexDouble(sqrt((double)d), 0) : complexDouble(0, sqrt((double)-d)); // sqd = std::sqrt(d);
h1 = complexDoubleAdd(complexDouble(-friction/2, 0), sqd); // h1 = -friction/2 + sqd;
h2 = complexDoubleSub(complexDouble(-friction/2, 0), sqd); // h2 = -friction/2 - sqd;
e1 = complexDoubleExp(complexDoubleMul(h1, complexDouble(dt, 0))); // e1 = std::exp(h1*dt);

View File

@ -28,7 +28,7 @@
#include "lib/framework/resly.h"
/* Get the Yacc definitions */
#include "resource_parser.tab.h"
#include "resource_parser.tab.hpp"
extern void res_error(const char* msg);

View File

@ -34,7 +34,7 @@
#include <physfs.h>
/* Get the Yacc definitions */
#include "strres_parser.tab.h"
#include "strres_parser.tab.hpp"
#include "lib/framework/lexer_input.h"

View File

@ -228,7 +228,7 @@ static bool scan_defines(define_t *node, define_t *group)
bool success;
countGroups++;
node->group = malloc(sizeof(*node));
node->group = (define_t *)malloc(sizeof(*node));
success = scan_defines(node->group, node);
if (!success)
@ -243,7 +243,7 @@ static bool scan_defines(define_t *node, define_t *group)
}
if (*bufptr != '\0' && !group_end)
{
node->next = malloc(sizeof(*node));
node->next = (define_t *)malloc(sizeof(*node));
node = node->next;
}
}
@ -272,7 +272,7 @@ static bool init(const char *definition, const char *datafile, bool write)
fsize = PHYSFS_fileLength(fp);
assert(fsize > 0);
buffer = bufptr = malloc(fsize + 1);
buffer = bufptr = (char *)malloc(fsize + 1);
if (!buffer || !bufptr)
{
debug(LOG_FATAL, "init(): Out of memory");
@ -289,7 +289,7 @@ static bool init(const char *definition, const char *datafile, bool write)
return false;
}
current = NULL; // keeps track of parent group below
first = malloc(sizeof(*first));
first = (define_t *)malloc(sizeof(*first));
first->parent = NULL;
first->group = NULL;
first->next = NULL;
@ -388,7 +388,7 @@ static bool scan_to(element_t tag)
}
lastAccess = tag;
// Set the right node
for (; current->next && current->element < tag; current = current->next);
for (; current->next && current->element < tag; current = current->next) {}
if (current->element != tag)
{
TF_ERROR("Unknown element %#04x sought", (unsigned int)tag);
@ -831,7 +831,7 @@ uint8_t *tagRead8vDup(element_t tag, int *size)
*size = -1;
return NULL;
}
values = malloc(count);
values = (uint8_t *)malloc(count);
*size = count;
for (i = 0; i < count; i++)
{
@ -993,7 +993,7 @@ char *tagReadStringDup(element_t tag)
TF_ERROR("tagread_stringdup: Bad string format");
return NULL;
}
buffer = malloc(actualsize);
buffer = (char *)malloc(actualsize);
assert(buffer != NULL);
readsize = PHYSFS_read(handle, buffer, 1, actualsize);
if (readsize != actualsize || *(buffer + actualsize - 1) != '\0')

View File

@ -144,7 +144,7 @@ bool treapAdd(TREAP_NODE** psTreap, const char* key, const char* string)
*/
const size_t key_size = strlen(key) + 1;
const size_t string_size = strlen(string) + 1;
TREAP_NODE * const psNew = malloc(sizeof(*psNew) + key_size + string_size);
TREAP_NODE * const psNew = (TREAP_NODE *)malloc(sizeof(*psNew) + key_size + string_size);
if (psNew == NULL)
{

View File

@ -150,7 +150,7 @@ uint16_t iAtan2(int32_t s, int32_t c)
int32_t iSqrt(uint32_t n)
{
uint32_t r = sqrt(n); // Calculate square root, rounded down. Excess precision does not change the result.
uint32_t r = sqrt((double)n); // Calculate square root, rounded down. Excess precision does not change the result.
// Check that we got the right result.
ASSERT((int32_t)(r*r - n) <= 0 && (int32_t)((r + 1)*(r + 1) - n) > 0, "Too badly broken sqrt function, iSqrt(%u) = %u.", (unsigned)n, (unsigned)r);
@ -163,7 +163,7 @@ int32_t i64Sqrt(uint64_t n)
uint64_t r;
if (sizeof(void *) > 4)
{
r = sqrt(n); // Calculate square root, usually rounded down. Excess precision may result in rounding down instead of up, which is fine.
r = sqrt((double)n); // Calculate square root, usually rounded down. Excess precision may result in rounding down instead of up, which is fine.
}
else
{

View File

@ -335,7 +335,7 @@ char *UTF16toUTF8(const utf_16_char *unicode_string, size_t *nbytes)
const size_t utf8_length = utf16_utf8_buffer_length(unicode_string);
// Allocate memory to hold the UTF-8 encoded string (plus a terminating nul char)
char* utf8_string = malloc(utf8_length + 1);
char* utf8_string = (char *)malloc(utf8_length + 1);
char* curOutPos = utf8_string;
if (utf8_string == NULL)
@ -398,7 +398,7 @@ utf_16_char *UTF8toUTF16(const char* utf8_string, size_t *nbytes)
const size_t unicode_length = utf8_as_utf16_buf_size(utf8_string);
// Allocate memory to hold the UTF-16 encoded string (plus a terminating nul)
utf_16_char* unicode_string = malloc(sizeof(utf_16_char) * (unicode_length + 1));
utf_16_char* unicode_string = (utf_16_char *)malloc(sizeof(utf_16_char) * (unicode_length + 1));
utf_16_char* curOutPos = unicode_string;
if (unicode_string == NULL)
@ -463,7 +463,7 @@ char *UTF32toUTF8(const utf_32_char *unicode_string, size_t *nbytes)
const size_t utf8_length = utf32_utf8_buffer_length(unicode_string);
// Allocate memory to hold the UTF-8 encoded string (plus a terminating nul char)
char* utf8_string = malloc(utf8_length + 1);
char* utf8_string = (char *)malloc(utf8_length + 1);
char* curOutPos = utf8_string;
if (utf8_string == NULL)
@ -495,7 +495,7 @@ utf_32_char *UTF8toUTF32(const char *utf8_string, size_t *nbytes)
const size_t unicode_length = UTF8CharacterCount(utf8_string);
// Allocate memory to hold the UTF-32 encoded string (plus a terminating nul)
utf_32_char* unicode_string = malloc(sizeof(utf_32_char) * (unicode_length + 1));
utf_32_char* unicode_string = (utf_32_char *)malloc(sizeof(utf_32_char) * (unicode_length + 1));
utf_32_char* curOutPos = unicode_string;
if (unicode_string == NULL)

View File

@ -1,9 +1,8 @@
%.tab.h %.tab.c:: %.y
%.tab.hpp %.tab.cpp:: %.y
$(YACC) $(YFLAGS) $(AM_YFLAGS) -o$@ $<
%.lex.c:: %.l
%.lex.cpp:: %.l
$(LEX) $(LFLAGS) $(AM_LFLAGS) -o$@ $<
# sed -i 's/\(fwrite(.*)\)/abs(\1)/' $@
AM_CPPFLAGS = -DYY_NO_INPUT $(SDL_CFLAGS) $(WZ_CPPFLAGS)
AM_CFLAGS = $(WZ_CFLAGS)
@ -12,21 +11,21 @@ AM_LFLAGS = $(FLEX_FLAGS)
AM_YFLAGS = -d
BUILT_SOURCES = \
audp_lexer.lex.c \
audp_parser.tab.c \
audp_parser.tab.h
audp_lexer.lex.cpp \
audp_parser.tab.cpp \
audp_parser.tab.hpp
CLEANFILES = \
audp_lexer.lex.c \
audp_parser.tab.c \
audp_parser.tab.h
audp_lexer.lex.cpp \
audp_parser.tab.cpp \
audp_parser.tab.hpp
EXTRA_DIST = \
audp_lexer.l audp_parser.y
noinst_LIBRARIES = libgamelib.a
noinst_HEADERS = \
audp_parser.tab.h \
audp_parser.tab.hpp \
anim.h \
animobj.h \
gtime.h \
@ -34,12 +33,12 @@ noinst_HEADERS = \
parser.h
libgamelib_a_SOURCES = \
anim.c \
animobj.c \
audp_lexer.lex.c \
audp_parser.tab.c \
gtime.c \
hashtable.c
anim.cpp \
animobj.cpp \
audp_lexer.lex.cpp \
audp_parser.tab.cpp \
gtime.cpp \
hashtable.cpp
libgamelib_a_LIBADD = $(top_builddir)/lib/ivis_opengl/libivis_opengl.a \
$(top_builddir)/lib/ivis_common/libivis_common.a $(top_builddir)/lib/framework/libframework.a

View File

@ -35,7 +35,10 @@
#include "lib/framework/types.h"
#include "lib/ivis_common/imd.h"
/***************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif //__cplusplus
#define ANIM_MAX_STR 256
#define ANIM_DELAYED 0xFFFE
@ -117,6 +120,8 @@ UWORD anim_GetFrame3D(ANIM3D *psAnim, UWORD uwObj, UDWORD udwGraphicsT
Vector3i *psVecScale);
void anim_SetVals(char szFileName[], UWORD uwAnimID);
/***************************************************************************/
#ifdef __cplusplus
}
#endif //__cplusplus
#endif /* _ANIM_H_ */

View File

@ -27,7 +27,7 @@
#include "lib/gamelib/parser.h"
/* Get the Yacc definitions */
#include "audp_parser.tab.h"
#include "audp_parser.tab.hpp"
// fwrite declared with warn_unused_result, resulting in mysterious errors in "%%" on some distros.
static inline bool no_warn_unused_result(int ignore) { if (ignore) {} return true; }

View File

@ -167,15 +167,15 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\anim.c"
RelativePath=".\anim.cpp"
>
</File>
<File
RelativePath=".\animobj.c"
RelativePath=".\animobj.cpp"
>
</File>
<File
RelativePath=".\audp_lexer.lex.c"
RelativePath=".\audp_lexer.lex.cpp"
>
</File>
<File
@ -183,11 +183,11 @@
>
</File>
<File
RelativePath=".\gtime.c"
RelativePath=".\gtime.cpp"
>
</File>
<File
RelativePath=".\hashtable.c"
RelativePath=".\hashtable.cpp"
>
</File>
</Filter>

View File

@ -205,7 +205,7 @@ void hashTable_InsertElement(HASHTABLE *psTable, void *psElement, intptr_t iKey1
udwHashIndex = hashTable_GetHashKey( psTable, iKey1, iKey2 );
/* get node from heap */
psNode = malloc(sizeof(HASHNODE));
psNode = (HASHNODE *)malloc(sizeof(HASHNODE));
/* set node elements */
psNode->iKey1 = iKey1;

View File

@ -11,10 +11,10 @@ PARSERS= \
SRC= \
$(PARSERS) \
anim.c \
animobj.c \
gtime.c \
hashtable.c
anim.cpp \
animobj.cpp \
gtime.cpp \
hashtable.cpp
LIB=gamelib

View File

@ -23,6 +23,15 @@
#include <physfs.h>
#ifdef __cplusplus
extern "C"
{
#endif //__cplusplus
extern bool ParseResourceFile(PHYSFS_file* fileHandle);
#ifdef __cplusplus
}
#endif //__cplusplus
#endif /* _PARSER_H_ */

View File

@ -3,5 +3,5 @@ AM_CXXFLAGS = $(WZ_CXXFLAGS)
AM_CPPFLAGS = $(SDL_CFLAGS) $(WZ_CPPFLAGS)
noinst_LIBRARIES = libiniparser.a
noinst_HEADERS = dictionary.h iniparser.h
libiniparser_a_SOURCES = dictionary.c iniparser.c
libiniparser_a_SOURCES = dictionary.cpp iniparser.cpp
EXTRA_DIST = LICENSE AUTHORS

View File

@ -148,11 +148,11 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\dictionary.c"
RelativePath=".\dictionary.cpp"
>
</File>
<File
RelativePath=".\iniparser.c"
RelativePath=".\iniparser.cpp"
>
</File>
</Filter>

View File

@ -4,8 +4,8 @@ top_builddir=$(top_srcdir)
include $(top_srcdir)/makerules/common.mk
SRC= \
dictionary.c \
iniparser.c \
dictionary.cpp \
iniparser.cpp \
LIB=iniparser

View File

@ -23,12 +23,12 @@ noinst_HEADERS = \
textdraw.h
libivis_common_a_SOURCES = \
bitimage.c \
imd.c \
imdload.c \
jpeg_encoder.c \
pieclip.c \
piestate.c \
png_util.c
bitimage.cpp \
imd.cpp \
imdload.cpp \
jpeg_encoder.cpp \
pieclip.cpp \
piestate.cpp \
png_util.cpp
libivis_common_a_LIBADD = $(top_builddir)/lib/framework/libframework.a

View File

@ -70,7 +70,7 @@ IMAGEFILE *iV_LoadImageFile(const char *fileName)
numImages += (*ptr == '\n') ? 1 : 0;
ptr++;
}
ImageFile = malloc(sizeof(IMAGEFILE) + sizeof(IMAGEDEF) * numImages);
ImageFile = (IMAGEFILE *)malloc(sizeof(IMAGEFILE) + sizeof(IMAGEDEF) * numImages);
ImageFile->ImageDefs = (IMAGEDEF*)(ImageFile + 1); // we allocated extra space for it
ptr = pFileData;
numImages = 0;
@ -92,10 +92,10 @@ IMAGEFILE *iV_LoadImageFile(const char *fileName)
{
tPages = ImageDef->TPageID;
}
while (ptr < pFileData + pFileSize && *ptr++ != '\n'); // skip rest of line
while (ptr < pFileData + pFileSize && *ptr++ != '\n') {} // skip rest of line
}
dot = strrchr(fileName, '/'); // go to last path character
dot = (char *)strrchr(fileName, '/'); // go to last path character
dot++; // skip it
strcpy(texFileName, dot); // make a copy
dot = strchr(texFileName, '.'); // find extension

View File

@ -94,7 +94,7 @@ static bool _imd_load_polys( const char **ppFileData, iIMDShape *s, int pieVersi
poly->flags = flags;
poly->npnts = npnts;
poly->pindex = malloc(sizeof(*poly->pindex) * poly->npnts);
poly->pindex = (VERTEXID *)malloc(sizeof(*poly->pindex) * poly->npnts);
if (poly->pindex == NULL)
{
debug(LOG_ERROR, "(_load_polys) [poly %u] memory alloc fail (poly indices)", i);
@ -170,7 +170,7 @@ static bool _imd_load_polys( const char **ppFileData, iIMDShape *s, int pieVersi
int nFrames, framesPerLine, frame;
nFrames = MAX(1, s->numFrames);
poly->texCoord = malloc(sizeof(*poly->texCoord) * nFrames * poly->npnts);
poly->texCoord = (Vector2f *)malloc(sizeof(*poly->texCoord) * nFrames * poly->npnts);
ASSERT_OR_RETURN(false, poly->texCoord, "Out of memory allocating texture coordinates");
framesPerLine = OLD_TEXTURE_SIZE_FIX / (poly->texAnim.x * OLD_TEXTURE_SIZE_FIX);
for (j = 0; j < poly->npnts; j++)
@ -425,7 +425,7 @@ static BOOL _imd_load_points( const char **ppFileData, iIMDShape *s )
dz = dia2.z - cen.z;
rad_sq = dx*dx + dy*dy + dz*dz;
rad = sqrt(rad_sq);
rad = sqrt((double)rad_sq);
// second pass (find tight sphere)
for (p = s->points; p < s->points + s->npoints; p++)
@ -439,7 +439,7 @@ static BOOL _imd_load_points( const char **ppFileData, iIMDShape *s )
if (old_to_p_sq>rad_sq)
{
// this point outside current sphere
old_to_p = sqrt(old_to_p_sq);
old_to_p = sqrt((double)old_to_p_sq);
// radius of new sphere
rad = (rad + old_to_p) / 2.;
// rad**2 for next compare

View File

@ -150,31 +150,31 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\bitimage.c"
RelativePath=".\bitimage.cpp"
>
</File>
<File
RelativePath=".\imd.c"
RelativePath=".\imd.cpp"
>
</File>
<File
RelativePath=".\imdload.c"
RelativePath=".\imdload.cpp"
>
</File>
<File
RelativePath=".\jpeg_encoder.c"
RelativePath=".\jpeg_encoder.cpp"
>
</File>
<File
RelativePath=".\pieclip.c"
RelativePath=".\pieclip.cpp"
>
</File>
<File
RelativePath=".\piestate.c"
RelativePath=".\piestate.cpp"
>
</File>
<File
RelativePath=".\png_util.c"
RelativePath=".\png_util.cpp"
>
</File>
</Filter>

View File

@ -4,13 +4,13 @@ top_builddir=$(top_srcdir)
include $(top_srcdir)/makerules/common.mk
SRC= \
bitimage.c \
imd.c \
imdload.c \
jpeg_encoder.c \
pieclip.c \
piestate.c \
png_util.c
bitimage.cpp \
imd.cpp \
imdload.cpp \
jpeg_encoder.cpp \
pieclip.cpp \
piestate.cpp \
png_util.cpp
LIB=ivis_common

View File

@ -155,7 +155,7 @@ BOOL iV_loadImage_PNG(const char *fileName, iV_Image *image)
image->width = png_get_image_width(png_ptr, info_ptr);
image->height = png_get_image_height(png_ptr, info_ptr);
image->depth = png_get_channels(png_ptr, info_ptr);
image->bmp = malloc(image->height * png_get_rowbytes(png_ptr, info_ptr));
image->bmp = (unsigned char *)malloc(image->height * png_get_rowbytes(png_ptr, info_ptr));
{
unsigned int i = 0;
@ -219,7 +219,7 @@ static void internal_saveImage_PNG(const char *fileName, const iV_Image *image,
}
row_stride = image->width * channelsPerPixel * image->depth / 8;
scanlines = malloc(sizeof(const char*) * image->height);
scanlines = (unsigned char **)malloc(sizeof(unsigned char *) * image->height);
if (scanlines == NULL)
{
debug(LOG_ERROR, "pie_PNGSaveFile: Couldn't allocate memory\n");
@ -304,7 +304,7 @@ void iV_saveImage_JPEG(const char *fileName, const iV_Image *image)
return;
}
buffer = malloc(sizeof(const char*) * image->height * image->width);
buffer = (unsigned char *)malloc(sizeof(const char*) * image->height * image->width); // Suspect it should be sizeof(unsigned char)*3 == 3 here, not sizeof(const char *) == 8.
if (buffer == NULL)
{
debug(LOG_ERROR, "pie_JPEGSaveFile: Couldn't allocate memory\n");
@ -319,7 +319,7 @@ void iV_saveImage_JPEG(const char *fileName, const iV_Image *image)
memcpy(buffer + row_stride * currentRow, &image->bmp[row_stride * (image->height - currentRow - 1)], row_stride);
}
jpeg = malloc(sizeof(const char*) * image->height * image->width);
jpeg = (unsigned char *)malloc(sizeof(const char*) * image->height * image->width); // Suspect it should be something else here, but sizeof(const char *) == 8 is hopefully big enough...
if (jpeg == NULL)
{
debug(LOG_ERROR, "pie_JPEGSaveFile: Couldn't allocate memory\n");

View File

@ -8,21 +8,21 @@ noinst_HEADERS = \
screen.h
libivis_opengl_a_SOURCES = \
ivi.c \
pieblitfunc.c \
piedraw.c \
piefunc.c \
piematrix.c \
piemode.c \
piepalette.c \
piestate.c \
rendmode.c \
screen.c \
tex.c \
textdraw.c
ivi.cpp \
pieblitfunc.cpp \
piedraw.cpp \
piefunc.cpp \
piematrix.cpp \
piemode.cpp \
piepalette.cpp \
piestate.cpp \
rendmode.cpp \
screen.cpp \
tex.cpp \
textdraw.cpp
if !SYSTEM_GLEE
libivis_opengl_a_SOURCES += GLee.c
libivis_opengl_a_SOURCES += GLee.cpp
noinst_HEADERS += GLee.h
endif

View File

@ -150,55 +150,55 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\GLee.c"
RelativePath=".\GLee.cpp"
>
</File>
<File
RelativePath=".\ivi.c"
RelativePath=".\ivi.cpp"
>
</File>
<File
RelativePath=".\pieblitfunc.c"
RelativePath=".\pieblitfunc.cpp"
>
</File>
<File
RelativePath=".\piedraw.c"
RelativePath=".\piedraw.cpp"
>
</File>
<File
RelativePath=".\piefunc.c"
RelativePath=".\piefunc.cpp"
>
</File>
<File
RelativePath=".\piematrix.c"
RelativePath=".\piematrix.cpp"
>
</File>
<File
RelativePath=".\piemode.c"
RelativePath=".\piemode.cpp"
>
</File>
<File
RelativePath=".\piepalette.c"
RelativePath=".\piepalette.cpp"
>
</File>
<File
RelativePath=".\piestate.c"
RelativePath=".\piestate.cpp"
>
</File>
<File
RelativePath=".\rendmode.c"
RelativePath=".\rendmode.cpp"
>
</File>
<File
RelativePath=".\screen.c"
RelativePath=".\screen.cpp"
>
</File>
<File
RelativePath=".\tex.c"
RelativePath=".\tex.cpp"
>
</File>
<File
RelativePath=".\textdraw.c"
RelativePath=".\textdraw.cpp"
>
</File>
</Filter>

View File

@ -6,19 +6,19 @@ include $(top_srcdir)/makerules/common.mk
CPPFLAGS := $(CPPFLAGS) -I$(top_srcdir)/lib/ivis_opengl
SRC= \
GLee.c \
ivi.c \
pieblitfunc.c \
piedraw.c \
piefunc.c \
piematrix.c \
piemode.c \
piepalette.c \
piestate.c \
rendmode.c \
screen.c \
tex.c \
textdraw.c
GLee.cpp \
ivi.cpp \
pieblitfunc.cpp \
piedraw.cpp \
piefunc.cpp \
piematrix.cpp \
piemode.cpp \
piepalette.cpp \
piestate.cpp \
rendmode.cpp \
screen.cpp \
tex.cpp \
textdraw.cpp
LIB=ivis_opengl

View File

@ -287,11 +287,11 @@ void pie_DownLoadRadar(UDWORD *buffer, int width, int height, bool filter)
char *black;
/* Find power of two size */
while (width > (w *= 2));
while (height > (h *= 2));
while (width > (w *= 2)) {}
while (height > (h *= 2)) {}
pie_SetTexturePage(radarTexture);
black = calloc(1, w * h * 4);
black = (char *)calloc(1, w * h * 4);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, black);
free(black);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);

View File

@ -374,7 +374,7 @@ static void pie_DrawShadow(iIMDShape *shape, int flag, int flag_data, Vector3f*
// enlarge
EDGE* newstack;
edgelistsize *= 2;
newstack = realloc(edgelist, sizeof(EDGE) * edgelistsize);
newstack = (EDGE *)realloc(edgelist, sizeof(EDGE) * edgelistsize);
if (newstack == NULL)
{
debug(LOG_FATAL, "pie_DrawShadow: Out of memory!");
@ -409,7 +409,7 @@ static void pie_DrawShadow(iIMDShape *shape, int flag, int flag_data, Vector3f*
edge_count = j;
// then store it in the imd
shape->nShadowEdges = edge_count;
shape->shadowEdgeList = realloc(shape->shadowEdgeList, sizeof(EDGE) * shape->nShadowEdges);
shape->shadowEdgeList = (EDGE *)realloc(shape->shadowEdgeList, sizeof(EDGE) * shape->nShadowEdges);
memcpy(shape->shadowEdgeList, edgelist, sizeof(EDGE) * shape->nShadowEdges);
}
}

View File

@ -50,7 +50,7 @@
*/
// Variables for the coloured mouse cursor
static CURSOR MouseCursor = 0;
static CURSOR MouseCursor = CURSOR_ARROW;
static IMAGEFILE* MouseCursors = NULL;
static uint16_t MouseCursorIDs[CURSOR_MAX];
static GLuint shaderProgram[SHADER_MAX];
@ -73,7 +73,7 @@ static char *readShaderBuf(const char *name)
debug(LOG_3D, "Reading...[directory: %s] %s", PHYSFS_getRealDir(name), name);
ASSERT_OR_RETURN(0, fp != NULL, "Could not open %s", name);
filesize = PHYSFS_fileLength(fp);
buffer = malloc(filesize + 1);
buffer = (char *)malloc(filesize + 1);
if (buffer)
{
PHYSFS_read(fp, buffer, 1, filesize);

View File

@ -23,7 +23,7 @@
iSurface *iV_SurfaceCreate(int width, int height)
{
iSurface *s = malloc(sizeof(iSurface));
iSurface *s = (iSurface *)malloc(sizeof(iSurface));
if (!s)
{

View File

@ -419,7 +419,7 @@ void screenDoDumpToDiskIfRequired(void)
image.width = screenWidth;
image.height = screenHeight;
image.bmp = malloc(channelsPerPixel * image.width * image.height);
image.bmp = (unsigned char *)malloc(channelsPerPixel * image.width * image.height);
if (image.bmp == NULL)
{
image.width = 0; image.height = 0;

View File

@ -77,7 +77,7 @@ int pie_AddTexPage(iV_Image *s, const char* filename, int slot, int maxTextureSi
}
/* Use first unused slot */
for (i = slot; i < iV_TEX_MAX && _TEX_PAGE[i].name[0] != '\0'; i++);
for (i = slot; i < iV_TEX_MAX && _TEX_PAGE[i].name[0] != '\0'; i++) {}
if (i == _TEX_INDEX)
{
@ -208,7 +208,7 @@ void pie_MakeTexPageTCMaskName(char * filename)
if (strncmp(filename, "page-", 5) == 0)
{
int i;
for( i = 5; i < iV_TEXNAME_MAX-1 && isdigit(filename[i]); i++);
for ( i = 5; i < iV_TEXNAME_MAX-1 && isdigit(filename[i]); i++) {}
filename[i] = '\0';
strcat(filename, iV_TEXNAME_TCSUFFIX);
}

View File

@ -13,9 +13,9 @@ noinst_HEADERS = \
nettypes.h
libnetplay_a_SOURCES = \
netjoin_stub.c \
netlog.c \
netplay.c \
netjoin_stub.cpp \
netlog.cpp \
netplay.cpp \
netqueue.cpp \
netsocket.cpp \
nettypes.cpp

View File

@ -6,9 +6,9 @@ include $(top_srcdir)/makerules/common.mk
SUBDIRS=miniupnpc
SRC= \
netjoin_stub.c \
netlog.c \
netplay.c \
netjoin_stub.cpp \
netlog.cpp \
netplay.cpp \
netqueue.cpp \
nettypes.cpp \
netsocket.cpp

View File

@ -913,7 +913,7 @@ static int upnp_init(void *asdf)
debug(LOG_NET, "UPnP device found: %s %s\n", dev->descURL, dev->st);
descXML = miniwget_getaddr(dev->descURL, &descXMLsize, lanaddr, sizeof(lanaddr));
descXML = (char *)miniwget_getaddr(dev->descURL, &descXMLsize, lanaddr, sizeof(lanaddr));
debug(LOG_NET, "LAN address: %s", lanaddr);
if (descXML)
{
@ -1962,7 +1962,7 @@ static ssize_t readLobbyResponse(Socket* sock, unsigned int timeout)
// Get status message
free(NetPlay.MOTD);
NetPlay.MOTD = malloc(MOTDLength + 1);
NetPlay.MOTD = (char *)malloc(MOTDLength + 1);
result = readAll(sock, NetPlay.MOTD, MOTDLength, timeout);
if (result != MOTDLength)
goto error;
@ -3094,7 +3094,7 @@ static void sendDebugSync(uint8_t *buf, uint32_t bufLen, uint32_t time)
NETend();
}
static uint8_t debugSyncTmpBuf[1000000];
static uint8_t debugSyncTmpBuf[2000000];
static void recvDebugSync(NETQUEUE queue)
{
uint32_t time = 0;
@ -3144,12 +3144,15 @@ bool checkDebugSync(uint32_t checkGameTime, uint32_t checkCrc)
// Dump our version, and also erase it, so we only dump it at most once.
debug(LOG_ERROR, "Inconsistent sync debug at gameTime %u. My version has %u lines, CRC = 0x%08X.", syncDebugGameTime[index], syncDebugNum[index], ~syncDebugCrcs[index] & 0xFFFFFFFF);
bufSize += snprintf((char *)debugSyncTmpBuf + bufSize, ARRAY_SIZE(debugSyncTmpBuf) - bufSize, "===== BEGIN gameTime=%u, %u lines, CRC 0x%08X =====\n", syncDebugGameTime[index], syncDebugNum[index], ~syncDebugCrcs[index] & 0xFFFFFFFF);
bufSize = MIN(bufSize, ARRAY_SIZE(debugSyncTmpBuf)); // snprintf will not overflow debugSyncTmpBuf, but returns as much as it would have printed if possible.
for (i = 0; i < syncDebugNum[index]; ++i)
{
bufSize += snprintf((char *)debugSyncTmpBuf + bufSize, ARRAY_SIZE(debugSyncTmpBuf) - bufSize, "[%s] %s\n", syncDebugFunctions[index][i], syncDebugStrings[index][i]);
bufSize = MIN(bufSize, ARRAY_SIZE(debugSyncTmpBuf)); // snprintf will not overflow debugSyncTmpBuf, but returns as much as it would have printed if possible.
free(syncDebugStrings[index][i]);
}
bufSize += snprintf((char *)debugSyncTmpBuf + bufSize, ARRAY_SIZE(debugSyncTmpBuf) - bufSize, "===== END gameTime=%u, %u lines, CRC 0x%08X =====\n", syncDebugGameTime[index], syncDebugNum[index], ~syncDebugCrcs[index] & 0xFFFFFFFF);
bufSize = MIN(bufSize, ARRAY_SIZE(debugSyncTmpBuf)); // snprintf will not overflow debugSyncTmpBuf, but returns as much as it would have printed if possible.
if (numDumps < 5)
{
++numDumps;
@ -3272,7 +3275,7 @@ static void addToBanList(const char *ip, const char *name)
if (!IPlist)
{
IPlist = malloc(sizeof(PLAYER_IP) * MAX_BANS + 1);
IPlist = (PLAYER_IP *)malloc(sizeof(PLAYER_IP) * MAX_BANS + 1);
if (!IPlist)
{
debug(LOG_FATAL, "Out of memory!");

View File

@ -150,15 +150,15 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\netjoin_stub.c"
RelativePath=".\netjoin_stub.cpp"
>
</File>
<File
RelativePath=".\netlog.c"
RelativePath=".\netlog.cpp"
>
</File>
<File
RelativePath=".\netplay.c"
RelativePath=".\netplay.cpp"
>
</File>
<File
@ -198,39 +198,39 @@
Name="src files"
>
<File
RelativePath=".\miniupnpc\igd_desc_parse.c"
RelativePath=".\miniupnpc\igd_desc_parse.cpp"
>
</File>
<File
RelativePath=".\miniupnpc\minisoap.c"
RelativePath=".\miniupnpc\minisoap.cpp"
>
</File>
<File
RelativePath=".\miniupnpc\minissdpc.c"
RelativePath=".\miniupnpc\minissdpc.cpp"
>
</File>
<File
RelativePath=".\miniupnpc\miniupnpc.c"
RelativePath=".\miniupnpc\miniupnpc.cpp"
>
</File>
<File
RelativePath=".\miniupnpc\miniwget.c"
RelativePath=".\miniupnpc\miniwget.cpp"
>
</File>
<File
RelativePath=".\miniupnpc\minixml.c"
RelativePath=".\miniupnpc\minixml.cpp"
>
</File>
<File
RelativePath=".\miniupnpc\upnpcommands.c"
RelativePath=".\miniupnpc\upnpcommands.cpp"
>
</File>
<File
RelativePath=".\miniupnpc\upnperrors.c"
RelativePath=".\miniupnpc\upnperrors.cpp"
>
</File>
<File
RelativePath=".\miniupnpc\upnpreplyparse.c"
RelativePath=".\miniupnpc\upnpreplyparse.cpp"
>
</File>
</Filter>

View File

@ -1,9 +1,8 @@
%.tab.h %.tab.c:: %.y
%.tab.hpp %.tab.cpp:: %.y
$(YACC) $(YFLAGS) $(AM_YFLAGS) -o$@ $<
%.lex.c:: %.l
%.lex.cpp:: %.l
$(LEX) $(LFLAGS) $(AM_LFLAGS) -o$@ $<
# sed -i 's/\(fwrite(.*)\)/abs(\1)/' $@
AM_CPPFLAGS = -DYY_NO_INPUT $(SDL_CFLAGS) $(WZ_CPPFLAGS)
AM_CFLAGS = $(WZ_CFLAGS)
@ -12,20 +11,20 @@ AM_LFLAGS = $(FLEX_FLAGS)
AM_YFLAGS = -d
BUILT_SOURCES = \
chat_lexer.lex.c \
chat_parser.tab.c \
chat_parser.tab.h \
script_lexer.lex.c \
script_parser.tab.c \
script_parser.tab.h
chat_lexer.lex.cpp \
chat_parser.tab.cpp \
chat_parser.tab.hpp \
script_lexer.lex.cpp \
script_parser.tab.cpp \
script_parser.tab.hpp
CLEANFILES = \
chat_lexer.lex.c \
chat_parser.tab.c \
chat_parser.tab.h \
script_lexer.lex.c \
script_parser.tab.c \
script_parser.tab.h
chat_lexer.lex.cpp \
chat_parser.tab.cpp \
chat_parser.tab.hpp \
script_lexer.lex.cpp \
script_parser.tab.cpp \
script_parser.tab.hpp
EXTRA_DIST = \
chat_lexer.l chat_parser.y \
@ -33,8 +32,8 @@ EXTRA_DIST = \
noinst_LIBRARIES = libscript.a
noinst_HEADERS = \
chat_parser.tab.h \
script_parser.tab.h \
chat_parser.tab.hpp \
script_parser.tab.hpp \
chat_processing.h \
codeprint.h \
event.h \
@ -45,15 +44,15 @@ noinst_HEADERS = \
stack.h
libscript_a_SOURCES = \
chat_lexer.lex.c \
chat_parser.tab.c \
codeprint.c \
event.c \
eventsave.c \
interpreter.c \
script.c \
script_lexer.lex.c \
script_parser.tab.c \
stack.c
chat_lexer.lex.cpp \
chat_parser.tab.cpp \
codeprint.cpp \
event.cpp \
eventsave.cpp \
interpreter.cpp \
script.cpp \
script_lexer.lex.cpp \
script_parser.tab.cpp \
stack.cpp
libscript_a_LIBADD = $(top_builddir)/lib/framework/libframework.a

View File

@ -32,7 +32,7 @@
#include "lib/script/chat_processing.h"
/* Get the Yacc definitions */
#include "chat_parser.tab.h"
#include "chat_parser.tab.hpp"
// fwrite declared with warn_unused_result, resulting in mysterious errors in "%%" on some distros.
static inline bool no_warn_unused_result(int ignore) { if (ignore) {} return true; }

View File

@ -35,7 +35,7 @@ void cpPrintVal(INTERP_VAL value)
{
if (value.type & VAL_REF)
{
value.type &= ~VAL_REF;
value.type = (INTERP_TYPE)(value.type & ~VAL_REF);
debug( LOG_NEVER, "type: %5s, value: %i (ref)",
scriptTypeToString(value.type), value.v.ival );
return;
@ -77,7 +77,7 @@ void cpPrintVal(INTERP_VAL value)
/* Display a value from a program that has been packed with an opcode */
void cpPrintPackedVal(INTERP_VAL *ip)
{
INTERP_VAL data = { (ip->v.ival & OPCODE_DATAMASK), {0} };
INTERP_VAL data = {(INTERP_TYPE)(ip->v.ival & OPCODE_DATAMASK), {0}};
data.v = (ip + 1)->v;
cpPrintVal(data);
@ -217,7 +217,7 @@ void cpPrintProgram(SCRIPT_CODE *psProg)
end = (INTERP_VAL*)((UBYTE*)ip + psProg->size);
triggerCode = (psProg->numTriggers > 0);
opcode = (ip->v.ival >> OPCODE_SHIFT);
opcode = (OPCODE)(ip->v.ival >> OPCODE_SHIFT);
data = (ip->v.ival & OPCODE_DATAMASK);
while (ip < end)
@ -313,7 +313,7 @@ void cpPrintProgram(SCRIPT_CODE *psProg)
break;
case OP_BINARYOP:
case OP_UNARYOP:
debug( LOG_NEVER, "-> %s", scriptOpcodeToString(data) );
debug( LOG_NEVER, "-> %s", scriptOpcodeToString((OPCODE)data) );
break;
case OP_EXIT:
break;

View File

@ -297,13 +297,13 @@ BOOL eventInitValueFuncs(SDWORD maxType)
{
ASSERT(asReleaseFuncs == NULL, "eventInitValueFuncs: array already initialised");
asCreateFuncs = calloc(maxType, sizeof(*asCreateFuncs));
asCreateFuncs = (VAL_CREATE_FUNC *)calloc(maxType, sizeof(*asCreateFuncs));
if (!asCreateFuncs)
{
debug(LOG_SCRIPT, "eventInitValueFuncs: Out of memory");
return false;
}
asReleaseFuncs = calloc(maxType, sizeof(*asReleaseFuncs));
asReleaseFuncs = (VAL_RELEASE_FUNC *)calloc(maxType, sizeof(*asReleaseFuncs));
if (!asReleaseFuncs)
{
debug(LOG_SCRIPT, "eventInitValueFuncs: Out of memory");
@ -356,7 +356,7 @@ BOOL eventNewContext(SCRIPT_CODE *psCode, CONTEXT_RELEASE release,
ASSERT(psCode != NULL, "eventNewContext: Invalid code pointer");
// Get a new context
psContext = calloc(1, sizeof(*psContext));
psContext = (SCRIPT_CONTEXT *)calloc(1, sizeof(*psContext));
if (psContext == NULL)
{
ASSERT(false, "eventNewContext: Out of memory");
@ -436,7 +436,7 @@ BOOL eventNewContext(SCRIPT_CODE *psCode, CONTEXT_RELEASE release,
while (val >= 0)
{
psNewChunk = malloc(sizeof(VAL_CHUNK));
psNewChunk = (VAL_CHUNK *)malloc(sizeof(VAL_CHUNK));
if (psNewChunk == NULL)
{
for(psNewChunk=psContext->psGlobals; psNewChunk; psNewChunk = psNextChunk)
@ -850,7 +850,7 @@ static BOOL eventInitTrigger(ACTIVE_TRIGGER **ppsTrigger, SCRIPT_CONTEXT *psCont
}
// Get a trigger object
psNewTrig = malloc(sizeof(ACTIVE_TRIGGER));
psNewTrig = (ACTIVE_TRIGGER *)malloc(sizeof(ACTIVE_TRIGGER));
if (psNewTrig == NULL)
{
debug(LOG_ERROR, "eventInitTrigger: Out of memory");
@ -887,7 +887,7 @@ BOOL eventLoadTrigger(UDWORD time, SCRIPT_CONTEXT *psContext,
"eventLoadTrigger: Trigger out of range" );
// Get a trigger object
psNewTrig = malloc(sizeof(ACTIVE_TRIGGER));
psNewTrig = (ACTIVE_TRIGGER *)malloc(sizeof(ACTIVE_TRIGGER));
if (psNewTrig == NULL)
{
debug( LOG_FATAL, "eventLoadTrigger: out of memory" );
@ -922,7 +922,7 @@ BOOL eventAddPauseTrigger(SCRIPT_CONTEXT *psContext, UDWORD event, UDWORD offset
"eventAddTrigger: Event out of range" );
// Get a trigger object
psNewTrig = malloc(sizeof(ACTIVE_TRIGGER));
psNewTrig = (ACTIVE_TRIGGER *)malloc(sizeof(ACTIVE_TRIGGER));
if (psNewTrig == NULL)
{
debug(LOG_ERROR, "eventAddPauseTrigger: Out of memory");

View File

@ -168,7 +168,7 @@ static BOOL bCurCallerIsEvent = false;
#define TRCPRINTOPCODE(x) \
if (interpTrace) \
debug( LOG_NEVER, "%s", scriptOpcodeToString(x) )
debug( LOG_NEVER, "%s", scriptOpcodeToString((OPCODE)x) )
#define TRCPRINTSTACKTOP() \
if (interpTrace) \
@ -979,12 +979,12 @@ BOOL interpCheckEquiv(INTERP_TYPE to, INTERP_TYPE from)
if (to & VAL_REF)
{
toRef = true;
to &= ~VAL_REF;
to = (INTERP_TYPE)(to & ~VAL_REF);
}
if (from & VAL_REF)
{
fromRef = true;
from &= ~VAL_REF;
from = (INTERP_TYPE)(from & ~VAL_REF);
}
if (toRef != fromRef)
{

Some files were not shown because too many files have changed in this diff Show More