From c94ae1420382f98f4de22456285bd5367e4a53c7 Mon Sep 17 00:00:00 2001 From: "Gergely POLONKAI (W00d5t0ck)" Date: Mon, 2 Sep 2013 23:29:58 +0200 Subject: [PATCH] Created GsweHouseData struct to hold house data, including starting sign --- swe-glib/src/gswe-moment.c | 12 +++++++++--- swe-glib/src/gswe-moment.h | 6 ++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/swe-glib/src/gswe-moment.c b/swe-glib/src/gswe-moment.c index 91d8bdf..503f13c 100644 --- a/swe-glib/src/gswe-moment.c +++ b/swe-glib/src/gswe-moment.c @@ -304,10 +304,16 @@ gswe_moment_calculate_house_positions(GsweMoment *moment) moment->priv->house_list = NULL; for (i = 12; i >= 1; i--) { - gdouble *cusp = g_new0(gdouble, 1); + GsweHouseData *house_data = g_new0(GsweHouseData, 1); - *cusp = cusps[i]; - moment->priv->house_list = g_list_prepend(moment->priv->house_list, cusp); + house_data->house = i; + house_data->cusp_position = cusps[i]; + + if ((house_data->sign = g_hash_table_lookup(gswe_sign_info_table, GINT_TO_POINTER((gint)ceilf(cusps[i] / 30.0)))) == NULL) { + g_error("Calculations brought an unknown sign!"); + } + + moment->priv->house_list = g_list_prepend(moment->priv->house_list, house_data); } moment->priv->house_revision = moment->priv->revision; diff --git a/swe-glib/src/gswe-moment.h b/swe-glib/src/gswe-moment.h index e17d043..d80046f 100644 --- a/swe-glib/src/gswe-moment.h +++ b/swe-glib/src/gswe-moment.h @@ -60,6 +60,12 @@ typedef struct { guint revision; } GswePlanetData; +typedef struct { + guint house; + gdouble cusp_position; + GsweSignInfo *sign; +} GsweHouseData; + typedef struct { GsweMoonPhase phase; gdouble illumination;