diff options
author | Simon Howard | 2008-02-04 22:43:11 +0000 |
---|---|---|
committer | Simon Howard | 2008-02-04 22:43:11 +0000 |
commit | 65ed2a3208db93eef0f25f5d9c046c77cb7eb980 (patch) | |
tree | e109a340f85128a24922e6c485d4df48d56d4dc8 /textscreen/txt_table.c | |
parent | aff2bd33f46df242be24e9f75e9ef1a2a6d9184f (diff) | |
download | chocolate-doom-65ed2a3208db93eef0f25f5d9c046c77cb7eb980.tar.gz chocolate-doom-65ed2a3208db93eef0f25f5d9c046c77cb7eb980.tar.bz2 chocolate-doom-65ed2a3208db93eef0f25f5d9c046c77cb7eb980.zip |
Update chocolate-setup to the new screen mode config system.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1042
Diffstat (limited to 'textscreen/txt_table.c')
-rw-r--r-- | textscreen/txt_table.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/textscreen/txt_table.c b/textscreen/txt_table.c index 8b31af24..29798906 100644 --- a/textscreen/txt_table.c +++ b/textscreen/txt_table.c @@ -33,14 +33,18 @@ #include "txt_strut.h" #include "txt_table.h" -static void TXT_TableDestructor(TXT_UNCAST_ARG(table)) +// Remove all entries from a table + +void TXT_ClearTable(TXT_UNCAST_ARG(table)) { TXT_CAST_ARG(txt_table_t, table); int i; // Free all widgets + // Skip over the first (num_columns) widgets in the array, as these + // are the column struts used to control column width - for (i=0; i<table->num_widgets; ++i) + for (i=table->columns; i<table->num_widgets; ++i) { if (table->widgets[i] != NULL) { @@ -48,9 +52,16 @@ static void TXT_TableDestructor(TXT_UNCAST_ARG(table)) } } - // Free table resources + // Shrink the table to just the column strut widgets + + table->num_widgets = table->columns; +} + +static void TXT_TableDestructor(TXT_UNCAST_ARG(table)) +{ + TXT_CAST_ARG(txt_table_t, table); - free(table->widgets); + TXT_ClearTable(table); } static int TableRows(txt_table_t *table) |