Convert legacy structs and endian-swapping routines to use exact-width types

- This because I discovered my compiler makes the long 8 bytes instead of 4
This commit is contained in:
2014-04-11 00:55:57 -04:00
parent 68c8ef7ba7
commit 4db8a0943b
3 changed files with 170 additions and 168 deletions

View File

@@ -443,7 +443,7 @@ void flip_spec_node(legacy::special_node_type *spec)
flip_short(&(spec->jumpto));
}
void flip_short(short *s)
void flip_short(int16_t *s)
{
char store,*s1, *s2;
@@ -455,7 +455,7 @@ void flip_short(short *s)
}
void flip_long(long *s)
void flip_long(int32_t *s)
{
char store,*s1, *s2, *s3, *s4;
@@ -486,9 +486,9 @@ void alter_rect(legacy::Rect *r)
void flip_rect(legacy::Rect* s)
{
flip_short((short *) &(s->top));
flip_short((short *) &(s->bottom));
flip_short((short *) &(s->left));
flip_short((short *) &(s->right));
flip_short((int16_t *) &(s->top));
flip_short((int16_t *) &(s->bottom));
flip_short((int16_t *) &(s->left));
flip_short((int16_t *) &(s->right));
if(!cur_scen_is_mac) alter_rect(s);
}

View File

@@ -8,10 +8,11 @@
#include "oldstructs.h"
#include "location.h"
#include <cstdint>
void flip_long(long *s);
void flip_long(int32_t *s);
void flip_spec_node(legacy::special_node_type *spec);
void flip_short(short *s);
void flip_short(int16_t *s);
void flip_rect(legacy::Rect* s);
void port_t_d(legacy::big_tr_type* old);
@@ -21,7 +22,7 @@ void port_scenario(legacy::scenario_data_type* old);
void port_item_list(legacy::scen_item_data_type* old);
void port_out(legacy::outdoor_record_type* out);
void port_talk_nodes(legacy::talking_record_type* dummy_talk_ptr);
void port_dummy_t_d(short size,char *buffer);
//void port_dummy_t_d(short size,char *buffer);
void port_town(legacy::town_record_type* dummy_town_ptr);
void port_party(legacy::party_record_type* old);
void port_pc(legacy::pc_record_type* old);