Add a new field type to the mini database scheme meta language: C-only-field

* This is a dummy type that causes the rest of the line to be included literally in the struct's definition
 * Use this field type to add ppIMDList (member var of BODY_STATS in statsdef.h)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5460 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-07-09 20:47:17 +00:00
parent 2d6958306e
commit c5b87954bc
5 changed files with 26 additions and 2 deletions

View File

@ -532,6 +532,10 @@ sub printRowProcessCode
. "\t\t}\n";
}
}
elsif (/C-only-field/)
{
# Ignore: this is a user defined field type, the user code (%postLoadRow) can deal with it
}
else
{
die "UKNOWN TYPE: $_";

View File

@ -23,6 +23,7 @@ sub printStructFieldType
elsif (/set/) { $$output .= "bool "; }
elsif (/enum/) { $$output .= "${$field}{\"enum\"} "; }
elsif (/IMD_model/) { $$output .= "iIMDShape* "; }
elsif (/C-only-field/) { $$output .= "${$field}{\"ctype\"} "; }
else { die "UKNOWN TYPE: $_"; }
}

View File

@ -197,6 +197,16 @@ sub parseStruct
push @{$curStruct{"fields"}}, \%field;
}
# Parse C-only fields
elsif (/^\s*(C-only-field)\s+(.*)\s+(\w+)\s*;\s*$/)
{
my %field = (type=>$1, ctype=>$2, name=>$3);
@{$field{"comment"}} = @curComment;
@curComment = ();
push @{$curStruct{"fields"}}, \%field;
}
else { die "Unmatched line: $_\n"; }
$$count++;

View File

@ -26,6 +26,10 @@ sub printStructFieldType
$$output .= "TEXT";
$$output .= " NOT NULL" unless grep(/optional/, @{${$field}{"qualifiers"}});
}
elsif (/C-only-field/)
{
#Ignore: this field type is called C-only-field for a reason
}
else
{
die "UKNOWN TYPE: $_";

View File

@ -65,8 +65,13 @@ struct BODY
end;
# The number of available weaponSlots slots on the body
count weaponSlots;
count weaponSlots;
# Engine output of this body's engine
real powerOutput;
real powerOutput;
IMD_model optional flameModel;
# list of IMDs to use for propulsion unit - up to numPropulsionStats
C-only-field iIMDShape** ppIMDList;
end;