Merge pull request #16 from gergelypolonkai/bug-15
Add error reporting to add_points()
This commit is contained in:
commit
f21ce84b17
@ -1143,7 +1143,11 @@ gswe_moment_get_planet(GsweMoment *moment, GswePlanet planet, GError **err)
|
|||||||
static void
|
static void
|
||||||
add_points(GswePlanetData *planet_data, GsweMoment *moment)
|
add_points(GswePlanetData *planet_data, GsweMoment *moment)
|
||||||
{
|
{
|
||||||
guint point;
|
guint point;
|
||||||
|
GsweSignInfo *sign_info;
|
||||||
|
GswePlanetInfo *planet_info;
|
||||||
|
GsweElement element;
|
||||||
|
GsweQuality quality;
|
||||||
|
|
||||||
gswe_moment_calculate_planet(
|
gswe_moment_calculate_planet(
|
||||||
moment,
|
moment,
|
||||||
@ -1151,23 +1155,37 @@ add_points(GswePlanetData *planet_data, GsweMoment *moment)
|
|||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
point = GPOINTER_TO_INT(g_hash_table_lookup(
|
sign_info = gswe_planet_data_get_sign_info(planet_data);
|
||||||
|
|
||||||
|
if (G_UNLIKELY(sign_info == NULL)) {
|
||||||
|
g_error("Planet data calculation failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
planet_info = gswe_planet_data_get_planet_info(planet_data);
|
||||||
|
|
||||||
|
if (G_UNLIKELY(planet_info == NULL)) {
|
||||||
|
g_error("Planet data calculation failed. No planet info.");
|
||||||
|
}
|
||||||
|
|
||||||
|
element = gswe_sign_info_get_element(sign_info);
|
||||||
|
point = GPOINTER_TO_INT(g_hash_table_lookup(
|
||||||
moment->priv->element_points,
|
moment->priv->element_points,
|
||||||
GINT_TO_POINTER(planet_data->sign_info->element)
|
GINT_TO_POINTER(element)
|
||||||
)) + planet_data->planet_info->points;
|
)) + gswe_planet_info_get_points(planet_info);
|
||||||
g_hash_table_replace(
|
g_hash_table_replace(
|
||||||
moment->priv->element_points,
|
moment->priv->element_points,
|
||||||
GINT_TO_POINTER(planet_data->sign_info->element),
|
GINT_TO_POINTER(element),
|
||||||
GINT_TO_POINTER(point)
|
GINT_TO_POINTER(point)
|
||||||
);
|
);
|
||||||
|
|
||||||
point = GPOINTER_TO_INT(g_hash_table_lookup(
|
quality = gswe_sign_info_get_quality(sign_info);
|
||||||
|
point = GPOINTER_TO_INT(g_hash_table_lookup(
|
||||||
moment->priv->quality_points,
|
moment->priv->quality_points,
|
||||||
GINT_TO_POINTER(planet_data->sign_info->quality)
|
GINT_TO_POINTER(quality)
|
||||||
)) + planet_data->planet_info->points;
|
)) + gswe_planet_info_get_points(planet_info);
|
||||||
g_hash_table_replace(
|
g_hash_table_replace(
|
||||||
moment->priv->quality_points,
|
moment->priv->quality_points,
|
||||||
GINT_TO_POINTER(planet_data->sign_info->quality),
|
GINT_TO_POINTER(quality),
|
||||||
GINT_TO_POINTER(point)
|
GINT_TO_POINTER(point)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user