Commit Graph

63 Commits (43d449aec7e837c658cfb93a502a6138c15ca0e0)

Author SHA1 Message Date
Buginator edb644a03b Fix (and add missing) headers to files.
2009  Warzone Resurrection Project -> 2010  Warzone 2100 Project

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@11298 4a71c877-e1ca-e34f-864e-861f7616d084
2010-07-28 18:58:33 +02:00
Buginator 19696a3f16 Cleanup main so we only have 1 atexit() call for our system shutdown routine, instead of hiding multiple shutdown routines using atexit() for each.
Currently, we have 1 atexit for our main shutdown routine, and 1 atexit call for the exception handler.



Fix mem leak for mod list.

Also dump allocator stats for MSVC people

2.3: r10251

refs ticket:1673


git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@10262 4a71c877-e1ca-e34f-864e-861f7616d084
2010-03-14 09:21:16 +01:00
Buginator 0aff0b46cf Add a new debug flag type, LOG_FATAL.
This is used to differentiate LOG_ERROR (which is a *non* fatal error, but a error none the less) and fatal errors which result in program termination with no *visible* output (on windows/macs) on our end because of the crappy GUI functions so we usually dump it to stderr.txt and there is no clue that the program had to exit for whatever reason.

Hopefully, this will be helpful to windows people so they can differentiate between *our* exit/abort routines, and crashes that occur in drivers which look exactly the same since they get dumped back to the desktop with no visible clue why.

LOG_FATAL is *always* on in both debug & release builds.

On LOG_FATAL debug lines, on windows, we now throw up a modal dialog box with the current error message.  At this time, this only happens when we have a error, and we use abort() right after the error, which makes it fatal.

That explains why this touches ~60 files :)


git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8320 4a71c877-e1ca-e34f-864e-861f7616d084
2009-11-22 16:19:51 +01:00
Giel van Schijndel 6bdbda9343 Allow code passing and retrieving of enums as vararg parameters in C++ as well.
In C++ enums are treated differently from integers in some cases, causing GCC to emit some rather nasty abort()-like code (x86/x64 instruction "ud2a") when used as the type for va_arg().

This was the compiler message generated:
{{{
stack.c:339: warning: ‘INTERP_TYPE’ is promoted to ‘int’ when passed through ‘...’
stack.c:339: note: (so you should pass ‘int’ not ‘INTERP_TYPE’ to ‘va_arg’)
stack.c:339: note: if this code is reached, the program will abort
}}}

NOTE: Compiling as C++ now works (as does the produced code), using: {{{./configure CC=g++ CFLAGS=-fpermissive --enable-debug=relaxed}}}

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6957 4a71c877-e1ca-e34f-864e-861f7616d084
2009-04-06 13:09:10 +02:00
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
Dennis Schridde fcca92459c We no longer need to respect 8-char filename limits, be clear in naming instead
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6616 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-10 17:23:23 +00:00
Dennis Schridde cbbc58d1e9 Move files which extend a c std library header to a filename of similar name
Extension functions dealing with ...
 * strings are in string_ext.h
 * stdio (namely printf variants) are in stdio_ext.h
 * math are in math_ext.h

These headers are no longer included by frame.h

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6613 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-10 17:23:09 +00:00
Giel van Schijndel 906f766b8a * When using a va_list multiple times make sure to va_copy it first
* Make sure to call va_end on all instances of va_list when we're done with it

Similar to r5930 (which fixed ticket:50)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5931 4a71c877-e1ca-e34f-864e-861f7616d084
2008-09-05 20:10:47 +00:00
Per Inge Mathisen 8419a7008b Use calloc instead of malloc+memset, and make sure we clear the right memory.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5181 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-25 15:40:56 +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
Roman C d89f43106d Make sure we print out script call stack when division by zero occurs.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5152 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-23 14:29:11 +00:00
Giel van Schijndel 4e60f65e8f Don't #include "script_parser.tab.h" in lib/script/stack.c as we don't depend on the parser's token definitions there
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4856 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-29 15:18:42 +00:00
Giel van Schijndel 61c8bbc4b9 * Don't "Guarantee nul-termination" after snprintf as snprintf does that itself already (per the C99 spec)
* Use strlcpy for copying strings instead of snprintf "%s"
 * Don't cast the return value from vsnprintf to (void)
 * When we use va_start make sure to use va_end as well...
 * Fix indentation


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4785 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-26 14:21:41 +00:00
Roman C 2734594eef Don't abuse interpCheckEquiv() since most type checking is done during compilation.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4659 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-16 19:14:58 +00:00
Dennis Schridde f888cc5b69 Revert 4344-4347, 4355, 4357, 4358, 4362: They caused too much slowdown in the scripting engine
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4379 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-27 18:38:25 +00:00
Dennis Schridde e6e09ee72a Differ between deep (i.e. incl strings) and non-deep (just the pointer) copies
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4362 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 21:43:39 +00:00
Dennis Schridde 9bffb40f82 stackPop can utilise stackReduce
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4357 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 15:01:15 +00:00
Dennis Schridde 3eecd4fd7b Move interp*2string to script*2string
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4356 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 14:57:35 +00:00
Dennis Schridde 10670360cd Cleaned stackPush and stackShutdown, stackRemoveTop can remove more than 1 item now.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4355 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 13:52:31 +00:00
Dennis Schridde 44d2b96472 Removed unused (commented out) chunk of stack manipulation
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4354 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 13:27:19 +00:00
Dennis Schridde 480314fed0 Enhance copeprint capabilities and add more 2string functions for the scripting engine.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4340 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 00:45:03 +00:00
Dennis Schridde ce8e1d1846 - Generic cleanup
- Strings are not equivalent to anything, only convertible (mistake in one of my last commits)
- Clarify names
- Print user types


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4339 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 00:27:56 +00:00
Dennis Schridde 679bfea007 Cleanup stackPopParams and make it handle the different INTERP_VAL types correctly.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4325 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-24 22:09:31 +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
Giel van Schijndel bd37e62cb2 * Replace a lot of strncat(dst, src, sizeof(dst) - strlen(dst) - 1) calls with the less bloated strlcat(dst, src, sizeof(dst)) form
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2637 4a71c877-e1ca-e34f-864e-861f7616d084
2007-10-27 15:47:17 +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
Giel van Schijndel e06c186bd6 * Replace a _lot_ of strcpy(), strcat() and sprintf() calls with the safer strncpy(), strncat() and snprintf() respectively
* Refactor NETlogEntry() to use the array of strings (packetname[]) instead of a large switch-statement with a lot of copy & pasted code


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2617 4a71c877-e1ca-e34f-864e-861f7616d084
2007-10-24 21:11:29 +00:00
Per Inge Mathisen 077433f02f Audit more globals not being set correctly to NULL.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1850 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-12 17:56:34 +00:00
Giel van Schijndel 704c6bc653 * Use decent assertion expressions for some asserts (e.g. !"string", so that debuggers actually display something more interesting than 'FALSE')
* Remove usage of widgCopyString

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1807 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-04 16:49:58 +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
Roman C 89f67fc187 Scripting Engine:
-fixed local string variables now being cleared between function calls
-implemented a setBit() scripting function to work with bitfields

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1318 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-01 16:22:01 +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
Dennis Schridde 711af01772 New MSVC project files with custom build rules to support automatic lexer/parser generation.
The include changes might break other buildsystem, I'll fix that when I am back on Linux.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@983 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-09 21:13:58 +00:00
Giel van Schijndel 38a3d8ee82 * cast some void*(*) variables to their respective types
* remove -fno-gnu-keywords from GCC because it seems to be only for C++/ObjectC (Doh!), and the variant for C (being -fno-asm) additionally disables inlines which we definitely don't want disabled
 * remove a large function which reserves memory without it ever being used *at*all* (from hci.*, mapdisplay.* and intelmap.c), also remove a function parameter from another function in mapdisplay.c, (it was this parameter that required the other functions to reserve memory)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@971 4a71c877-e1ca-e34f-864e-861f7616d084
2007-01-08 13:40:12 +00:00
Roman C cc5f4ef441 -new 'height-map' radar mode (CTRL+TAB to cycle through radar modes)
-revamped radar modes management

Scripting engine:
-some interpreter speedups
-new script function to modify map tile height from scripts
-made numeric pad keys 0-9 accessible from scripts

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@927 4a71c877-e1ca-e34f-864e-861f7616d084
2006-12-26 16:39:07 +00:00
Roman C 14cd4b60cc Scripting engine update:
-void pointer is now compatible with any other pointer type
-strings can now be directly compared using '==' and '!=' operators
-added a linguistic chat message parser with some generic messages predefined - to be used for Human<->AI and AI<->AI communication
Note: chat_lexer.l should be compiled using an additional -i switch for case-insensitive lexer

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@898 4a71c877-e1ca-e34f-864e-861f7616d084
2006-12-16 14:59:50 +00:00
Roman C ca6d0af961 Fixed a bug which was preventing script increment/decrement operators to function properly
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@895 4a71c877-e1ca-e34f-864e-861f7616d084
2006-12-06 18:57:17 +00:00
Roman C 10daf67ea4 -added increase/decrease operators (seems to have a minor flaw atm though)
-fixed MSVC compilation issues and wrong casts in initializations

Scripting Engine:
-lexer will now skip all macros in script files - allows to use macros in IDEs
-float data type can now be used in boolean expressions
-fixed visibility check in initEnumStruct() script function
-fixed playerLoaded() script function
-added some new script functions
-Object.weapon now also works with structures
-added decrement/increment operators

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@889 4a71c877-e1ca-e34f-864e-861f7616d084
2006-12-02 23:27:00 +00:00
Dennis Schridde fafa69842f x86_64 fixes by Pseudonym404. (Incl. some minor other changes, eg in src/game.c)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@854 4a71c877-e1ca-e34f-864e-861f7616d084
2006-11-25 01:26:05 +00:00
Roman C e3b77d82d2 Script functions can now take float data type as parameters and return value
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@848 4a71c877-e1ca-e34f-864e-861f7616d084
2006-11-17 17:07:03 +00:00
Roman C dacc1de1ca Scripting engine overhaul - Part I
-compiler and parts of interpreter now use union to store different data types
-got rid of a great deal of pointer->integer casts

-ASSERT() now outputs last event (or function) called by scripts
-implemented float data type support for the scripting engine - basic functionality at the moment

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@846 4a71c877-e1ca-e34f-864e-861f7616d084
2006-11-16 14:30:29 +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
Roman C 3ea3f99f73 Patch by Gerard Krol: lesswarnings
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@802 4a71c877-e1ca-e34f-864e-861f7616d084
2006-11-02 20:15:08 +00:00
Roman C 9be9d21e09 -automatic target assignment will now give low priority to half-built structures when looking for a target (structures getting full HP upon construction begin was an exploit against unit AI)
-fixed line endings in macro.h
-applied Christian Ohm's "032 - Fixes for src-aiexperience.c-h" and "037 - g++ fix" patches
-made warzone report loading of all *.lev files

Scripting:
-fixed implicit bool/int to string convertion for the scripting language
-STRUCTURESTAT can now be checked for being 0 with NULLSTRUCTURESTAT
-minor scripting function fixes

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@794 4a71c877-e1ca-e34f-864e-861f7616d084
2006-10-24 13:05:40 +00:00
Roman C b7627bd9c8 Minor cleanup: replaced VOID with void.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@772 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-30 23:57:38 +00:00
Roman C e34c09439c -New script callbacks
-Added ability to rename players through scripts
-New savegame version: 34 (as a result of the previous point)
-Fixed double messages in online games
-Minor cleanups

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@771 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-30 23:09: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
Roman C 15b02fe669 Fixed script compilation bugs,
further scripting enhancements.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@729 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-19 16:07:06 +00:00