projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
moved color handling functions to separate source files for BD engine
[rocksndiamonds.git]
/
src
/
game_bd
/
bd_bdcff.c
diff --git
a/src/game_bd/bd_bdcff.c
b/src/game_bd/bd_bdcff.c
index 1a204a2fb17b26c888d796694fd157aa687258f6..53fc4c91a15718ad6f0c59bd0d0a16959798323c 100644
(file)
--- a/
src/game_bd/bd_bdcff.c
+++ b/
src/game_bd/bd_bdcff.c
@@
-14,9
+14,6
@@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <glib.h>
-#include <glib/gi18n.h>
-
#include <errno.h>
#include "main_bd.h"
#include <errno.h>
#include "main_bd.h"
@@
-140,7
+137,7
@@
static boolean attrib_is_valid_for_caveset(const char *attrib)
return FALSE;
}
return FALSE;
}
-static boolean struct_set_property(
gpointer
str, const GdStructDescriptor *prop_desc,
+static boolean struct_set_property(
void *
str, const GdStructDescriptor *prop_desc,
const char *attrib, const char *param, int ratio)
{
char **params;
const char *attrib, const char *param, int ratio)
{
char **params;
@@
-163,7
+160,7
@@
static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_
if (strcasecmp(prop_desc[i].identifier, attrib) == 0)
{
/* found the identifier */
if (strcasecmp(prop_desc[i].identifier, attrib) == 0)
{
/* found the identifier */
-
gpointer value = G_
STRUCT_MEMBER_P(str, prop_desc[i].offset);
+
void *value =
STRUCT_MEMBER_P(str, prop_desc[i].offset);
/* these point to the same, but to avoid the awkward cast syntax */
int *ivalue = value;
/* these point to the same, but to avoid the awkward cast syntax */
int *ivalue = value;
@@
-204,7
+201,7
@@
static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_
for (j = 0; j < prop_desc[i].count && params[paramindex] != NULL; j++)
{
boolean success = FALSE;
for (j = 0; j < prop_desc[i].count && params[paramindex] != NULL; j++)
{
boolean success = FALSE;
-
g
double res;
+ double res;
switch (prop_desc[i].type)
{
switch (prop_desc[i].type)
{
@@
-254,6
+251,7
@@
static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_
break;
case GD_TYPE_PROBABILITY:
break;
case GD_TYPE_PROBABILITY:
+ errno = 0; /* must be reset before calling strtod() to detect overflow/underflow */
res = strtod(params[paramindex], NULL);
if (errno == 0 && res >= 0 && res <= 1)
{
res = strtod(params[paramindex], NULL);
if (errno == 0 && res >= 0 && res <= 1)
{
@@
-268,6
+266,7
@@
static boolean struct_set_property(gpointer str, const GdStructDescriptor *prop_
break;
case GD_TYPE_RATIO:
break;
case GD_TYPE_RATIO:
+ errno = 0; /* must be reset before calling strtod() to detect overflow/underflow */
res = strtod (params[paramindex], NULL);
if (errno == 0 && res >= 0 && res <= 1)
{
res = strtod (params[paramindex], NULL);
if (errno == 0 && res >= 0 && res <= 1)
{
@@
-356,7
+355,7
@@
static boolean replay_store_more_from_bdcff(GdReplay *replay, const char *param)
}
/* report all remaining tags; called after the above function. */
}
/* report all remaining tags; called after the above function. */
-static void replay_report_unknown_tags_func(const char *attrib, const char *param,
gpointer
data)
+static void replay_report_unknown_tags_func(const char *attrib, const char *param,
void *
data)
{
Warn("unknown replay tag '%s'", attrib);
}
{
Warn("unknown replay tag '%s'", attrib);
}
@@
-487,7
+486,7
@@
static boolean cave_process_tags_func(const char *attrib, const char *param, GdC
}
/* report all remaining tags; called after the above function. */
}
/* report all remaining tags; called after the above function. */
-static void cave_report_and_copy_unknown_tags_func(char *attrib, char *param,
gpointer
data)
+static void cave_report_and_copy_unknown_tags_func(char *attrib, char *param,
void *
data)
{
GdCave *cave = (GdCave *)data;
{
GdCave *cave = (GdCave *)data;
@@
-1060,7
+1059,7
@@
boolean gd_caveset_load_from_bdcff(const char *contents)
strcasecmp(params[0], gd_cave_properties[i].identifier) == 0)
{
/* found identifier */
strcasecmp(params[0], gd_cave_properties[i].identifier) == 0)
{
/* found identifier */
-
gpointer value = G_
STRUCT_MEMBER_P (cave, gd_cave_properties[i].offset);
+
void *value =
STRUCT_MEMBER_P (cave, gd_cave_properties[i].offset);
*((GdElement *) value) = gd_get_element_from_string (params[1]);
break;
*((GdElement *) value) = gd_get_element_from_string (params[1]);
break;
@@
-1194,12
+1193,12
@@
boolean gd_caveset_load_from_bdcff(const char *contents)
object.element = cave->initial_border;
object.fill_element = cave->initial_border;
object.element = cave->initial_border;
object.fill_element = cave->initial_border;
- cave->objects = list_prepend(cave->objects, get
MemCo
py(&object, sizeof(object)));
+ cave->objects = list_prepend(cave->objects, get
_memc
py(&object, sizeof(object)));
object.x1 = 19;
object.y1 = 0; /* 19, as it is also the border */
object.x1 = 19;
object.y1 = 0; /* 19, as it is also the border */
- cave->objects = list_prepend(cave->objects, get
MemCo
py(&object, sizeof(object))); /* another */
+ cave->objects = list_prepend(cave->objects, get
_memc
py(&object, sizeof(object))); /* another */
}
}
}
}
}
}