Commit Graph

154 Commits (cb279c37c469c1bb9659ee88a952c79aa7879336)

Author SHA1 Message Date
Per Inge Mathisen b29e9eeba1 Fix compile error on *BSD systems. Closes ticket:820, patch by brad@comstyle.com
git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8016 4a71c877-e1ca-e34f-864e-861f7616d084
2009-09-27 19:07:10 +02:00
Giel van Schijndel 8f7322f717 Improve buildsystem for cross compiling
* Make sure to pass CXXFLAGS to ./configure as well
 * Allow for overriding of CFLAGS and CXXFLAGS when building for the building system
  - CFLAGS_FOR_BUILD
  - CXXFLAGS_FOR_BUILD

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7283 4a71c877-e1ca-e34f-864e-861f7616d084
2009-05-06 22:29:34 +02:00
Gerard Krol 71bc279c9e Fix some spelling errors in debug messages and comments. Patch by Paul Wise <pabs3>.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6832 4a71c877-e1ca-e34f-864e-861f7616d084
2009-03-11 11:51:40 +00:00
Per Inge Mathisen 42d5809ae5 Move the RPM spec file where it belongs
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6800 4a71c877-e1ca-e34f-864e-861f7616d084
2009-03-07 20:46:49 +00:00
Per Inge Mathisen 0fc9820f4a Add RPM spec file for building Warzone. Tested on Fedora 10.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6791 4a71c877-e1ca-e34f-864e-861f7616d084
2009-03-07 17:21:18 +00:00
Giel van Schijndel ab5e599100 Don't use the deprecated git-$command interface anymore, instead use "git $command"
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6707 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-22 23:42:07 +00:00
Giel van Schijndel 6e1d019403 * Update SQLite stats database
* Fix loading of stats from the SQLite database (utilised in the campaign)

This fixes #276 and #269.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6670 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-21 21:09:37 +00:00
Giel van Schijndel 4d150cfcc8 Remove testing code which is no longer needed (because src/stats-db2.* serves the same purpose now)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6650 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-15 13:05:19 +00:00
Giel van Schijndel d862f39362 Don't add a separating comma if we've already printed the last column definition
This was done when we'd have a C-only-field.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6649 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-15 12:46:45 +00:00
Giel van Schijndel 57de43c140 * Generate CREATE VIEW statements in the SQL schema
* Use these VIEWs instead of rather complicated SELECT statements in the C SQLite loading code

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6646 4a71c877-e1ca-e34f-864e-861f7616d084
2009-02-15 12:32:29 +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
Giel van Schijndel 1f4e369cf2 * Add a new struct-level qualifier: %csv-field-override
- This qualifier allows overriding of CSV field numbers given in base classes
  - This is required for the WEAPON stats because it differs from most other stats in that it doesn't have the "designable" field as the last CSV field
 * Specify all CSV field numbers for the fields in struct WEAPON
 * Generate SQL INSERT statements from weapons.txt


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6553 4a71c877-e1ca-e34f-864e-861f7616d084
2009-01-22 22:18:48 +00:00
Giel van Schijndel 3d92823e49 * Use the more readable $arrayreference->[$index] and $hashreference->{$key} instead of ${$arrayreference}[$index] and ${$hashreference}{$key} respectively
* Use 'my $var = $expression || "";' instead of 'my $var = ""; $var = $expression if $expression;'

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6366 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-23 13:32:02 +00:00
Giel van Schijndel 8f6eb3c17c Use || as shortcut operator (I used "or" before, which didn't work as expected due to having a too low precedence) in assignment to $valprefix and $valsuffix to circumvent having to test explicitly whether they exist
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6365 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-23 00:18:12 +00:00
Giel van Schijndel d11d2411bd * Prevent writing to regex-capture variables, e.g. \$1
- Use a temporary variable instead


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6346 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-17 08:51:07 +00:00
Giel van Schijndel fb91a247d5 Handle C-only-fields properly when they're at the end of a struct
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6341 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 17:43:32 +00:00
Giel van Schijndel bec2172caa Allow passing of multiple strings for an enum value
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6339 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 17:25:40 +00:00
Giel van Schijndel 83b2440a3d Don't produce lines filled with only spaces (produce an empty one instead)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6336 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 16:28:20 +00:00
Giel van Schijndel 167510f3e7 * Add the option to specify custom string values for enums (which are * used when processing the database contents)
- New enum-field level qualifier: `%string "<string to use>";`
 * Use this to specify the custom strings for enum SENSOR_TYPE

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6335 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 16:28:17 +00:00
Giel van Schijndel 27856b5de5 * Make sure to wrap the produced SQL INSERT statements in a TRANSACTION
* At the start of a new struct's data place the name of that struct

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6333 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 16:28:12 +00:00
Giel van Schijndel 5dc4adb8d5 Add Doxygen comments to the produced STATS_(BASE|COMPONENT) macros as well, to give Doxygen a chance to properly document structures that use these macros
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6329 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 14:08:23 +00:00
Giel van Schijndel 4e43102df3 Add the ability to retrieve the current row number by means of $rowNum
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6324 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 03:33:43 +00:00
Giel van Schijndel 47eb9bd6bc * Make sure to use "FROM" before "INNER JOIN"
* Assign the return value of sqlite3_step to "rc" not the result boolean of that return value compared with SQLITE_ROW
 * For enums allow the enumerator's name with undersquores ''and'' spaces


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6323 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 03:08:04 +00:00
Giel van Schijndel 1835d9aa04 Add a new code generator to generate a series of INSERT statements from the CSV files to fill a database with
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6322 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 02:20:42 +00:00
Giel van Schijndel 4b0072ffb5 * Remove unused parameters
* Remove duplicated code


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6321 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 02:18:53 +00:00
Giel van Schijndel 001f2f90ea Store enums as text
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6318 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 01:41:48 +00:00
Giel van Schijndel 8a8bc660ee Use string comparison for enums instead of stuffing integers in the database
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6317 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 01:20:02 +00:00
Giel van Schijndel 91dbb225df Use .schema.sql as default output extension for SQL CREATE TABLE definitions
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6314 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-16 00:22:10 +00:00
Giel van Schijndel d2c8fbc5a8 * Change the database meta language script parser such that it's first parameter has to be a valid relative path to the code generator to use
* Change the make rules for all files produced from the database meta language such that they have the language parser and code generator as dependency as well (i.e. if they change their files will be rebuilt)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6312 4a71c877-e1ca-e34f-864e-861f7616d084
2008-11-15 21:39:00 +00:00
Giel van Schijndel 46002d39d9 Use WZ_DECL_MAY_ALIAS for the BASE_STATS "derived" structures because we perform "type punning" on these pointers in a similar fashion to the BASE_OBJECT hierarchy.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6177 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-16 13:49:05 +00:00
Giel van Schijndel e81ac54c92 Mark removeAfterNewLine as static
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6149 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-14 12:58:53 +00:00
Giel van Schijndel 2c8a322504 * Don't manually maintain a line-count variable as Perl does this (I found out while reading the Camel book) automatically in the $. variable
* Include the filename of the currently being parsed file in error messages
 * Make sure to reset Perl's line counter ($.) when we start parsing a new file (when using <> as file handle)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6101 4a71c877-e1ca-e34f-864e-861f7616d084
2008-10-01 14:53:46 +00:00
Giel van Schijndel 409eebce0e Make sure to #include <sqlite3.h> instead of "lib/sqlite3/sqlite3.h"
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6035 4a71c877-e1ca-e34f-864e-861f7616d084
2008-09-16 20:21:50 +00:00
Giel van Schijndel c1fb0af729 * -mwindows is a linker flag, so move it from CFLAGS and CXXFLAGS to LDFLAGS
* autorevision is a command line utility, not a GUI program, so strip the -mwindows flag from its linker flags

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5646 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-23 13:48:50 +00:00
Giel van Schijndel 8344514617 Make sure to use the %prefix and %suffix when declaring pointers to structs
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5524 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-12 21:39:49 +00:00
Giel van Schijndel aad47ff640 Add a new struct level qualifier: %fetchByRow
* User code can use this to provide code that the SQLite code generator can use to get a pointer to some other struct
 * Make it so that you can only declare member fields with a `struct` type when the respective struct has a %fetchByRow directive in it
 * Generate loading code for struct-type fields in the c_sqliteload codegenerator by means of the code provided by the %fetchByRow directive


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5523 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-12 21:30:05 +00:00
Giel van Schijndel b464ee82a5 Don't generate SQL code (that's SQL statements for table definitions as well as SQLite loading code) for fields of type C-only-field
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5520 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-12 20:36:45 +00:00
Giel van Schijndel 9eb61150c0 Add a new datatype to the mini database schema meta language: `struct`
* Allows "linking" in the database to other struct instances
 * Will be represented as a pointer to the target struct in the C datastructures
 * Will be represented as an integer ID in tables


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5519 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-12 19:48:39 +00:00
Giel van Schijndel caa467d9ee * Improve error message generated on type mismatch by code generator c_sqliteload
* Fix a syntax error in code generator sql_tabledef and add and initialize the used variables to produce an error message


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5518 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-12 19:17:08 +00:00
Giel van Schijndel 2e5fab25f8 Attach line numbers to the AST of field declarations, and use it when reporting field-related errors
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5513 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 22:14:09 +00:00
Giel van Schijndel 65dee90e74 Accept all of ([US]D?WORD|[US]BYTE) as "transition" types in the mini database schema meta language
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5511 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 21:53:10 +00:00
Giel van Schijndel e33f083aaf Give errors when encountering unmatched struct-level and enum-level directives
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5510 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 21:48:34 +00:00
Giel van Schijndel 7f75a8f3c7 Add a new %nomacro directive to prevent macro definition of a struct and its children if the parent of that struct has a %macro directive
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5505 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 16:41:59 +00:00
Giel van Schijndel 05bf9bdcd8 Declare UDWORDs as UDWORD in the C code (doh!) not as unsigned int...
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5502 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 15:33:48 +00:00
Giel van Schijndel d8d2ad0dd6 Add a transition type "UDWORD" to the mini database schema meta language
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5501 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 15:30:32 +00:00
Giel van Schijndel 975ecbbb95 Add copies of strings declared with the "string" type in the struct definitions; thus have the structs take ownership of these strings (they're allocated with strdup)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5499 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 14:48:39 +00:00
Giel van Schijndel 8ce0412a28 * Add new %macro, %macroprefix and %macrosuffix directives to the mini database schema meta language
* Generate macro definitions similar to our current "inheritance-like" structure as created by macros when the above %macro directive is used


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5498 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 14:02:17 +00:00
Giel van Schijndel b16526e0a9 Move the code for generating the forward declaration of the SQLite loading function to a separate function of its own: printLoadFunc
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5497 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 13:30:25 +00:00
Giel van Schijndel 4452048964 Don't use a default value for %valprefix when either %valprefix or %valsuffix has been specified
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5495 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 13:06:02 +00:00
Giel van Schijndel 51370fcdbd Add a new enum-level directive: %valsuffix which (similar to %valprefix) adds a suffix to al enum's values
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5491 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-11 11:17:08 +00:00