Commit Graph

56 Commits (b9b1a4bac74d321f9cf0d97b5cd552b6ce6b8362)

Author SHA1 Message Date
Dennis Schridde aac41748dc Bump copyright
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6617 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-10 18:01:48 +00:00
Giel van Schijndel c99a123b50 * Remove unused list macros: LIST_INIT and LIST_ADD
* Rename LIST_ADDEND to LIST_APPEND (because that's what it does: append to a list)
 * Clean up the assertion in LIST_REMOVE
 * Prevent a potential bug in LIST_APPEND by not initialising the psNext pointer to NULL
  - doesn't ever occur right now, for one simple reason: the only place where this macro is used is on a structure that's initialised with memset(0)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6260 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-09 22:58:04 +00:00
Buginator 21fdab0117 Modify debug output to specify the 'real' directory that physfs is using for the file in question.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5958 4a71c877-e1ca-e34f-864e-861f7616d084
2008-09-07 20:00:54 +00:00
Giel van Schijndel 76192b6534 * Make the level parser state enum a typedef (LEVELPARSER_STATE)
* When lev_error() gets called do __not__ ASSERT, use debug(LOG_ERROR, ... instead as the return value of false will be used as an indicator of failure anyway (no need to abort as it will cause the --selftest to always fail)
 * Accept empty input files for the .lev parser


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5285 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-21 17:32:03 +00:00
Giel van Schijndel 855ec725d4 Use sstrcpy|sstrcat instead of strlcpy|strlcat for manipulation of statically sized strings
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5176 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-25 13:46:49 +00:00
Giel van Schijndel 6a5ee556f6 Revert r4830:
* This should fix a heap corruption introduced with the new level_parser

Closes #9 ( http://trac.wz2100.net/ticket/9 )


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5163 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-24 12:20:23 +00:00
Per Inge Mathisen 7d0aae2e0e Add more logging, used to find previous bugfix.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5039 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-11 10:50:15 +00:00
Per Inge Mathisen 21fa30ec47 Fix bug #11641: Bad textures after third load of saved game, by making sure
we unload all level data when loading savegames.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5037 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-11 10:46:38 +00:00
Per Inge Mathisen 8e1ad51337 Improve logging
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5031 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-11 09:21:47 +00:00
Per Inge Mathisen 1423e2d742 Add path-finding test and measurement to selftest.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4890 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-02 21:06:39 +00:00
Giel van Schijndel 006ec9e71a clean up levShutDown()
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4886 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-02 19:51:23 +00:00
Giel van Schijndel e0dc2071f0 Add a new bison/yacc parser: level_parser.y:
* Change level_lexer.l: 
  * Use lev_lval to return token-data in (instead of global vars)
  * Use strdup() to return strings to the parser and let the parser take care of memory clean-up (through Bison's %destructor directive)
  * Use the token constants as generated by Bison (instead of our own custom enum)
 * Rip out the custom state machine-like level parser from levels.c (was function levParse)
  * Remove all global variables associated with this parser
  * Remove the LP_* enum which was only used by this parser
  * Move function lev_error to level_parser.y
 * The new parser provides more verbose error messages if parsing fails

NOTE: The previous state machine-parser actually maintained state in two variables, so it was rather overly complex (quadratic complexity if you like)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4830 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-28 00:04:40 +00:00
Giel van Schijndel 0928c105e9 Change global var levelLoadType to a static one
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4829 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-27 23:57:22 +00:00
Giel van Schijndel 2523625716 r4826 didn't yet fix all, apparently there was commented out code changed as well
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4827 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-27 23:30:02 +00:00
Giel van Schijndel 16cd0c108e Oops! Apparently my search&replace regexp for r4825 contained a small typo causing a syntax error: fixed it
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4826 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-27 23:25:36 +00:00
Giel van Schijndel 62d1a9e5fc * Remove constant MULTI_TYPE_START and replace it by an enumeration value: LDS_MULTI_TYPE_START
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4825 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-27 23:21:19 +00:00
Giel van Schijndel 785988922b Change functions levSetInputBuffer and levParse:
* Make them const correct
 * Pass the size parameter as a size_t (as it's a memory/buffer-size we're passing here)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4823 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-27 16:48:14 +00:00
Giel van Schijndel f7dd7eafba * Rename function levError to lev_error (bison/yacc #defines yyerror to lev_error)
* In function lev_error use ASSERT always (even in non-debug builds as it will still output a message there)
 * Don't use a single function levGetErrorData for retrieving the line no & piece of text being parsed, instead use two functions levGetErrorLine and levGetErrorText


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4822 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-27 15:59:03 +00:00
Giel van Schijndel fecc2a50d1 Change function levFindDataSet:
* Make it return it's result rather than write it in an output pointer (NULL will indicate failure instead of `false`)
 * Don't use two nested if-statements, use a single if-statement with double conditions using logical and (&&)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4819 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-27 15:27:39 +00:00
Giel van Schijndel 2a0f803c51 Const correctness
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4695 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-20 15:08:14 +00:00
Per Inge Mathisen bcf6686b7f Add saving games and basic checking of results to --selftest.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4683 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-19 13:14:10 +00:00
Per Inge Mathisen 3ee8a3ed7f Add beginnings of a game self-test. Start with --selftest command line option.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4433 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-30 14:36:11 +00:00
Dennis Schridde ee286efa0f Fix lexer memleaks
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4348 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 11:28:25 +00:00
Dennis Schridde 10f2ccfd56 TRUE->true, FALSE->false (except in scripts)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4311 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-24 16:51:17 +00:00
Per Inge Mathisen 70483d1c82 Remove unused code. Make some variables static.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3889 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-01 23:44:17 +00:00
Giel van Schijndel c51bd8ae10 * Get rid of a large quantity of unused parameters
* Turn some signed integers ("int" or "SDWORD") into unsigned integers where it made more sence (and signed integers caused warnings about comparing signed with unsigned integers)
 * At some places cast to an unsigned integer (where the type of the expression is a signed integer but the result of it logically _always_ is an absolute value)
 * Remove unused struct-type EVENT_INIT
 * Convert use of malloc->memcpy->free to one single realloc call (and now make sure to actually check realloc's return value, which wasn't done with the malloc call)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3037 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-10 23:15:46 +00:00
Giel van Schijndel 6b4cba1700 * Rename pLevelName to aLevelName (hungarian notation is a pain. Especially when it's wrong!)
* Get rid of several magic numbers
 * Some const correctness
 * Replace a huge amount of strcpy(), strcat(), strncpy() and strncat() calls with a strlcpy() and strlcat() calls respectively


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2635 4a71c877-e1ca-e34f-864e-861f7616d084
2007-10-27 14:35:35 +00:00
Per Inge Mathisen 3e04847d4d No longer any need to call iV_Reset() every time a MP game is load to avoid
a crash bug in the old font code.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2590 4a71c877-e1ca-e34f-864e-861f7616d084
2007-10-22 20:10:42 +00:00
Per Inge Mathisen 4b45e8e2e1 Some misc cleanup
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2306 4a71c877-e1ca-e34f-864e-861f7616d084
2007-08-01 15:04:16 +00:00
Per Inge Mathisen 179f89cbad Improve logging for tracking down resource loading bugs.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2294 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-31 12:47:08 +00:00
Dennis Schridde 714bcc5924 displayBuffer -> fileLoadBuffer, original patch by vs2k5. displayBuffer was abused to load nearly everything.
Reuse FILE_LOAD_BUFFER_SIZE macro, which was abandoned before. (That's also why fileLoadBuffer is now defined in src/init.c, even though the place is probably inappropriate.)
Make fileLoadBuffer static instead of malloced.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1992 4a71c877-e1ca-e34f-864e-861f7616d084
2007-07-01 00:28:49 +00:00
Dennis Schridde 165ed5ccda Cleanup, no change in behaviour.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1615 4a71c877-e1ca-e34f-864e-861f7616d084
2007-05-12 14:13:40 +00:00
Dennis Schridde ce16856887 FREE->free, MALLOC->malloc (sed+review)
This patch will create crashes where the code expects FREE to set the pointer to NULL! (Those problems should be fixed anyway.)
The only occassion where I saw this is when quiting a game, so it is not too much of an issue.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1459 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-15 10:43:05 +00:00
Gerard Krol 42ed587327 Per's removal of the memory heap system. Now MALLOC is just malloc, and not some wrapper around a wrapper that will allocate it from a specific pool.
The MSVC poject will need to be updated I guess, as some files were deleted.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1343 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-03 10:33:26 +00:00
Per Inge Mathisen 78396463a7 Fixes informed by -Wextra for graphics code. Removes much redundant code.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1147 4a71c877-e1ca-e34f-864e-861f7616d084
2007-02-19 17:18:50 +00:00
Roman C f4c4c48dd2 Patch by Gerard Krol:
replaces AND/OR macros with &&/||

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1089 4a71c877-e1ca-e34f-864e-861f7616d084
2007-02-10 16:39:39 +00:00
Dennis Schridde 49ceba7503 Add GPL notices to all sourcecode files.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1014 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-15 20:09:25 +00:00
Giel van Schijndel 9c79b6b109 ISO C 90 (or C-99 without GNU-extensions) compatibility fix:
* change all casts using the typeof() keyword to their respective typename
 * append a compiler flag for GCC (-fno-gnu-keywords) which disables GNU-specific keywords (typeof and asm only in case of C-99, inline as well if C-90 mode is used), to aid in code portability (i.e. among compilers)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@970 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-08 12:42:51 +00:00
Giel van Schijndel 68d435097e enabled some more code to compile with a C++ compiler without -fpermissive (i.e. there should be *less* compile-time errors now)
* moved several #defines to the enums where they belong
 * changed some datatypes on declaration
 * prepended casts to malloc calls (using typeof() style)
 * changed some (void*) casts to (void**) where required
 * removed several #defines and there instances and then replaced them with their corresponding values from an enum

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@969 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-07 23:50:30 +00:00
Dennis Schridde fb74a1f8dc Patch by Thomas Rast: Include string.h against warnings
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@821 4a71c877-e1ca-e34f-864e-861f7616d084
2006-11-06 14:40:07 +00:00
Dennis Schridde d3cd44148d Patch by Gerard Krol: Replace STRING with char (STRING was confusingly defined to char)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@804 4a71c877-e1ca-e34f-864e-861f7616d084
2006-11-03 21:35:50 +00:00
Stefan Huehner b3e3d17b82 Include frameresource.h directly in its users. Fixup after
the big cleanup in 748:749.




git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@750 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-23 18:38:12 +00:00
Dennis Schridde 3261a09baf BIG cleanup of headers.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@749 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-23 17:24:55 +00:00
Stefan Huehner 5215f1ab44 Make more functions static.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@735 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-20 01:12:13 +00:00
Dennis Schridde 728b9a9913 - Commit patches "code cleanup: void" and "code cleanup: const" by Stefan Huehner
- Replace every occurence of VOID with void (and LPVOID with void*)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@703 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-13 09:09:05 +00:00
Dennis Schridde 0e288f45e7 - Replace all ASSERT(( )) with ASSERT( )
- Simplify definition of ASSERT(). Now is the same for GCC and MSVC.
  This may not work on versions older than MSVC 2005. If you experience this, please report it!

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@613 4a71c877-e1ca-e34f-864e-861f7616d084
2006-08-23 12:58:48 +00:00
Dennis Schridde 62ae49b0ce Replaced all occurences of DBMB, DBPRINTF and DBERROR with their former define.
( DBPRINTF(("Message")); becomes debug( LOG_NEVER, "Message" ); )



git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@608 4a71c877-e1ca-e34f-864e-861f7616d084
2006-08-22 14:28:49 +00:00
Per Inge Mathisen 2149739999 Almost all strings and buffers are now of type char. This fixes
more than half the warnings on gcc4, and makes sure we do not
get signedness problems between platforms where char is defined
with different signedness. Also set line-ending properites for
some bison/flex files that did not have it set.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@563 4a71c877-e1ca-e34f-864e-861f7616d084
2006-08-12 16:52:37 +00:00
Per Inge Mathisen 17bc3e60b6 Some cleanup of graphics code.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@549 4a71c877-e1ca-e34f-864e-861f7616d084
2006-08-08 18:48:06 +00:00
Dennis Schridde eb7ba7e41d - Again revised the modloading(restrictions were stupid) (src/levels.c,src/init.[ch],src/multiint.c,src/main.c)
- Fixed case problem with noVideo.rpl (lib/sequence/sequence_stub.c)
- Fixed some G++ 4.1 compile problems (mostly invalid conversions) (lib/script/script_parser.y,lib/framework/frame.h,lib/framework/frameresource.c,lib/framework/frameresource.h,lib/framework/input.c,lib/framework/configfile.c,lib/framework/frame.c)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@455 4a71c877-e1ca-e34f-864e-861f7616d084
2006-07-04 13:35:01 +00:00