Commit Graph

50 Commits (792a98e824c88a90473b8c011dd4a6bea1891f51)

Author SHA1 Message Date
Per Inge Mathisen d1ca417ef2 Remove redundant code and improve asserts.
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9321 4a71c877-e1ca-e34f-864e-861f7616d084
2010-02-09 20:27:19 +01:00
Guangcong Luo 357de2a6cb Apply patch #1330 provided by Cyp - Add unicode support to text boxes and game-chat
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@9101 4a71c877-e1ca-e34f-864e-861f7616d084
2010-02-09 20:04:29 +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
Buginator f0d0bd7ebe Fixes a dangling pointer issue with a global.
In certain circumstances, if you try to abort out of a MP game (maybe SP as well), it would crash after deleting the widget, since it was still referencing the pointer in the global.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6732 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-28 01:40:19 +00: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 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 13aeeafc97 Less ASSERT(false, ... crap, use ASSERT(!"description", ... instead
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5301 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-22 18:22:49 +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
Per Inge Mathisen be566a7d6d Add -Wcast-align and -Wmissing-declarations to autoconf debug builds, and fix warnings.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4403 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-28 23:28:44 +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 918be1e737 Get rid of the widget heap initialisation stuff
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4287 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-24 00:32:00 +00:00
Giel van Schijndel d4adf8fe42 Use enum `iV_fonts` instead of `int` to represent fonts in the widget code
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4261 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-23 18:12:23 +00:00
Giel van Schijndel 8421b9fee4 Turn some file-level comments in lib/widgets into Doxygen comments
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4206 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-21 15:40:23 +00:00
Giel van Schijndel de2b3ba61d Move psRetWidget into the W_SCREEN structure (instead of it being a global variable)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4205 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-21 15:40:09 +00:00
Giel van Schijndel 9895df559d Make widgCreateScreen return the screen it created or NULL on failure
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4200 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-21 14:22:42 +00:00
Giel van Schijndel 3ed3acd891 Clean up formCreate and widgAddForm:
* Make formCreate and widgAddForm take their psInit parameters as const
 * Make formCreate return the button it created or NULL on failure


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4199 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-21 14:22:36 +00:00
Giel van Schijndel 86ca2b5f06 Clean up editBoxCreate and widgAddEditBox:
* Make editBoxCreate and widgAddEditBox take their psInit parameters as const
 * Make editBoxCreate return the button it created or NULL on failure


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4198 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-21 14:22:30 +00:00
Giel van Schijndel 6ea7968f46 Clean up labelCreate and widgAddLabel:
* Make labelCreate and widgAddLabel take their psInit parameters as const
 * Make labelCreate return the button it created or NULL on failure


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4197 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-21 14:22:20 +00:00
Giel van Schijndel 7e6e7d8b1f Clean up buttonCreate and widgAddButton:
* Make buttonCreate and widgAddButton take their psInit parameters as const
 * Make buttonCreate return the button it created or NULL on failure


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4196 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-21 14:22:15 +00:00
Giel van Schijndel a4987cfefb Clean up barGraphCreate and widgAddBarGraph:
* Make barGraphCreate and widgAddBarGraph take their psInit parameters as const
 * Make barGraphCreate return the bar it created or NULL on failure


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4195 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-21 14:22:05 +00:00
Giel van Schijndel cd8365fb01 Cleanup of widgRunScreen
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4194 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-21 14:21:53 +00:00
Giel van Schijndel 20448076bf Revert part of r4184:
* Don't use abort() as it'll be triggered in non-debug builds as well, so stick with the ASSERT(FALSE, ...


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4192 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-21 13:23:35 +00:00
Giel van Schijndel d5e31eb751 Make sliderCreate return a pointer to its created slider and NULL on failure
Const correctness:
 * make sliderCreate and widgAddSlider take its psInit pointers as const


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4185 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-21 11:47:23 +00:00
Giel van Schijndel dd02289a5e Clean up sliderCreate and widgAddSlider
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4184 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-21 11:47:19 +00:00
Gerard Krol 65c56b73e3 Fix an invalid pointer reference in the widget code by making sure that the pointer to the widget currently under the mouse is cleared when the
widget is freed.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3064 4a71c877-e1ca-e34f-864e-861f7616d084
2007-12-15 14:33:56 +00:00
Giel van Schijndel f5602b4778 * Replace a large amount of strncpy() calls with the safer strlcpy()
* Fix an error in src/game.c where we would use the wrong size as parameter to strlcpy()


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2640 4a71c877-e1ca-e34f-864e-861f7616d084
2007-10-27 16:18:52 +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 33e7c70cc4 Cleanup. Remove another ton of unused code. Fix error message which is not an error.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2339 4a71c877-e1ca-e34f-864e-861f7616d084
2007-08-03 17:39:04 +00:00
Per Inge Mathisen 8a7d09141c Hopefully fix a valgrind warning
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2336 4a71c877-e1ca-e34f-864e-861f7616d084
2007-08-03 15:22:45 +00:00
Giel van Schijndel 5839fb21ea Revert r1810 since it somehow results in undefined behaviour (can't find the cause right now, so this revert is to leave the trunk in a stable state while I work on finding the cause)
PS: "Dang! That GUI code really is borked stuff!"

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1814 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-04 19:52:07 +00:00
Giel van Schijndel 376323c9dc * added an additional function to lib/widget's interface: `widgSetTipText(WIDGET* psWidget, const char* pTip)`
* intdisplay.c now uses the widget interface to set tooltips on its widgets (which is the const-correct way, and better localizes memory management code; i.e. strdup() would be the dirty-hack style alternative)
 * Change mixed space/tab indentation into tab indentation (only for one function though)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1812 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-04 18:33:36 +00:00
Giel van Schijndel 85ecafd1de * Widget functions now copy the different strings they're passed into their widget's object-struct (This takes the memory management burden of these strings from the client code into the widget-library code)
* Use decent assertion expressions for some asserts (e.g. !"string", so that debuggers actually display something more interesting than 'FALSE')

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1810 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-04 18:06:07 +00:00
Giel van Schijndel c5cb9608d1 Leave the memory management up to the memory management functions!
That is:
 * Don't use a custom memory heap implementation anymore
 * Remove all usages of HEAP code for string allocation (wasn't being used anyway due to conditional compilation)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1805 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-04 16:34:17 +00:00
Giel van Schijndel a381013dc6 Leave the memory management up to the memory management functions!
That is:
 * Don't use a custom memory heap implementation anymore
 * Use malloc & free for memory management

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1804 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-04 12:30:06 +00:00
Dennis Schridde 6fa36aa0e9 + const, - unused
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1795 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-03 13:46:50 +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
Giel van Schijndel cc17299668 * remove internal forward declarations of functions already declared in the header
* use proper constness:
  * make some functions take arguments of `const char*` rather than just `char*` (also modified some functions' return values to return `const char*` where appropiate)
 * modify rank retrieval functions to use a central array instead; currently ranklimits (i.e. the amount of kills required to promote) is hardcoded in switch statements, as is the case with the names of those ranks
 * `make -C po update-po`

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1409 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-09 22:09:27 +00:00
Dennis Schridde 8952155c7a - Add -Wextra to debug=yes, as it doesn't generate so many new warnings
- Add -Wno-nonnull to debug=strict to make it compile (Remove it from AM_CFLAGS)
- Remove -Wno-unused-label as this warning is not generated anymore
- Fix a "... from incompatible pointer type" warning which led to a lot of strings (and associated functions) in the widget area becoming const
- Maybe found the reason for images in UTF-8 strings


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1405 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-09 14:41:22 +00:00
Stefan Huehner 8c517891ea Remove the font.h header file (which had no implementation)
Remove all callers (which all were commented out)
The 'real' font implementation used lives in ivis_



git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1357 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-03 18:14:24 +00:00
Giel van Schijndel 26f2672bfd * remove macro PTRVALID
* replace all instances of PTRVALID(ptr,size) by (ptr != NULL)
 * remove asserts of style ASSERT( x == NULL || x != NULL ) because they would evaluate to true always anyhow and as such wouldn't ever trigger
 * remove macros iV_HeapAlloc and iV_HeapFree and replaced them with MALLOC and FREE respectively (that's what they expanded to anyway)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1348 4a71c877-e1ca-e34f-864e-861f7616d084
2007-04-03 13:20:41 +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 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 9aaae50baa Replaced 'Humans vs AIs' with 'Locked Teams' alliance mode.
Fixed difficulty slider applying settings to the wrong players.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@763 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-26 18:14:05 +00:00
Stefan Huehner 1395a7c69c Make some more functions static which aren't used outside their
declaring source files and which have no prototype.



git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@731 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-19 18:45:48 +00:00
Dennis Schridde d889ce9da7 Patch by Christian Ohm: "g++ fixes"
Mainly explicit casts, some type changes, a few fixes.

We need to have a look if this line creates any problems:
lib/script/interp.c @@ -329,7 +329,7 @@
- if(!RetStackRemember(CurEvent, (ip + 2)))       //Remember where to jump back later
+ if(!RetStackRemember(CurEvent, *(ip + 2)))      //Remember where to jump back later


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@719 4a71c877-e1ca-e34f-864e-861f7616d084
2006-09-17 20:39:25 +00:00
Dennis Schridde 4208601a38 - Fix string stack reset for scripts
- Clean warnings and a wrapper function for widgets
- Add an assert to intDisplayMessageButton to catch crashes better


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@631 4a71c877-e1ca-e34f-864e-861f7616d084
2006-08-25 20:38:27 +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 5175535d9d Full pathname includes
Same as in r431, but now for lib/
- converted the sources in lib/ to use full path includes instead of just the filename.
- marked places where lib/ivis_*implementation* (eg opengl) is needed, because of incomplete lib/ivis_common.

Should improve the understanding of interfaces and code organization.

(Also fixed a double slash (//) include in src/multimenu.c)



git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@432 4a71c877-e1ca-e34f-864e-861f7616d084
2006-06-02 19:34:58 +00:00
No Author 5ba7ddac6b Create final repository structure.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@362 4a71c877-e1ca-e34f-864e-861f7616d084
2007-06-28 17:47:08 +00:00