summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2010-05-03 18:23:15 +0000
committerSimon Howard2010-05-03 18:23:15 +0000
commit7a3249ce14ac528a5cdf9ca2d0a62535cf2bb1cd (patch)
tree49859219af3586a393d86c2c4c9c1c4ef915315e /src
parentc37f757b57cbfd88d66aed1576412e311a503384 (diff)
downloadchocolate-doom-7a3249ce14ac528a5cdf9ca2d0a62535cf2bb1cd.tar.gz
chocolate-doom-7a3249ce14ac528a5cdf9ca2d0a62535cf2bb1cd.tar.bz2
chocolate-doom-7a3249ce14ac528a5cdf9ca2d0a62535cf2bb1cd.zip
Fix compiler warnings.
Subversion-branch: /branches/raven-branch Subversion-revision: 1934
Diffstat (limited to 'src')
-rw-r--r--src/hexen/mn_menu.c47
-rw-r--r--src/hexen/p_acs.c2
-rw-r--r--src/hexen/p_spec.c2
-rw-r--r--src/hexen/r_things.c5
4 files changed, 33 insertions, 23 deletions
diff --git a/src/hexen/mn_menu.c b/src/hexen/mn_menu.c
index 09a8f1ea..9f37df66 100644
--- a/src/hexen/mn_menu.c
+++ b/src/hexen/mn_menu.c
@@ -679,6 +679,32 @@ static void DrawSaveMenu(void)
DrawFileSlots(&SaveMenu);
}
+static boolean ReadDescriptionForSlot(int slot, char *description)
+{
+ FILE *fp;
+ boolean found;
+ char name[100];
+ char versionText[HXS_VERSION_TEXT_LENGTH];
+
+ sprintf(name, "%shex%d.hxs", SavePath, slot);
+
+ fp = fopen(name, "rb");
+
+ if (fp == NULL)
+ {
+ return false;
+ }
+
+ found = fread(description, HXS_DESCRIPTION_LENGTH, 1, fp) == 1
+ && fread(versionText, HXS_VERSION_TEXT_LENGTH, 1, fp) == 1;
+
+ found = found && strcmp(versionText, HXS_VERSION_TEXT) == 0;
+
+ fclose(fp);
+
+ return found;
+}
+
//===========================================================================
//
// MN_LoadSlotText
@@ -689,29 +715,12 @@ static void DrawSaveMenu(void)
void MN_LoadSlotText(void)
{
- int slot;
- FILE *fp;
- char name[100];
- char versionText[HXS_VERSION_TEXT_LENGTH];
char description[HXS_DESCRIPTION_LENGTH];
- boolean found;
+ int slot;
for (slot = 0; slot < 6; slot++)
{
- found = false;
- sprintf(name, "%shex%d.hxs", SavePath, slot);
- fp = fopen(name, "rb");
- if (fp)
- {
- fread(description, HXS_DESCRIPTION_LENGTH, 1, fp);
- fread(versionText, HXS_VERSION_TEXT_LENGTH, 1, fp);
- fclose(fp);
- if (!strcmp(versionText, HXS_VERSION_TEXT))
- {
- found = true;
- }
- }
- if (found)
+ if (ReadDescriptionForSlot(slot, description))
{
memcpy(SlotText[slot], description, SLOTTEXTLEN);
SlotStatus[slot] = 1;
diff --git a/src/hexen/p_acs.c b/src/hexen/p_acs.c
index 618bbd05..9ca9f6af 100644
--- a/src/hexen/p_acs.c
+++ b/src/hexen/p_acs.c
@@ -509,7 +509,7 @@ static boolean AddToACSStore(int map, int number, byte * args)
}
ACSStore[index].map = map;
ACSStore[index].script = number;
- *((int *) ACSStore[index].args) = *((int *) args);
+ memcpy(ACSStore[index].args, args, sizeof(int));
return true;
}
diff --git a/src/hexen/p_spec.c b/src/hexen/p_spec.c
index ca0bbfb8..03c98cbc 100644
--- a/src/hexen/p_spec.c
+++ b/src/hexen/p_spec.c
@@ -245,6 +245,8 @@ fixed_t P_FindNextHighestFloor(sector_t * sec, int currentheight)
fixed_t height = currentheight;
fixed_t heightlist[20]; // 20 adjoining sectors max!
+ heightlist[0] = 0;
+
for (i = 0, h = 0; i < sec->linecount; i++)
{
check = sec->lines[i];
diff --git a/src/hexen/r_things.c b/src/hexen/r_things.c
index 0517fd49..aeba11c4 100644
--- a/src/hexen/r_things.c
+++ b/src/hexen/r_things.c
@@ -158,7 +158,7 @@ void R_InstallSpriteLump(int lump, unsigned frame, unsigned rotation,
void R_InitSpriteDefs(char **namelist)
{
char **check;
- int i, l, intname, frame, rotation;
+ int i, l, frame, rotation;
int start, end;
// count the number of sprite names
@@ -184,13 +184,12 @@ void R_InitSpriteDefs(char **namelist)
memset(sprtemp, -1, sizeof(sprtemp));
maxframe = -1;
- intname = *(int *) namelist[i];
//
// scan the lumps, filling in the frames for whatever is found
//
for (l = start + 1; l < end; l++)
- if (*(int *) lumpinfo[l].name == intname)
+ if (!strncmp(lumpinfo[l].name, namelist[i], 4))
{
frame = lumpinfo[l].name[4] - 'A';
rotation = lumpinfo[l].name[5] - '0';