- Fixed issues with loading scenarios caused by the struct alignments added in revision 63.

- Fixed a potential memory leak in load_scenario() in which new was essentially called twice in a row.
- Added a max_items() function to the town record classes, in preparation for an eventual removal of the limit on preset items.

git-svn-id: http://openexile.googlecode.com/svn/trunk@66 4ebdad44-0ea0-11de-aab3-ff745001d230
This commit is contained in:
2009-05-22 20:49:20 +00:00
parent 032d6b86bf
commit 0578e51b6f
9 changed files with 302 additions and 279 deletions

View File

@@ -862,11 +862,11 @@ void draw_terrain(){
from_rect = calc_rect(i,3);
Draw_Some_Item(fields_gworld,from_rect,ter_draw_gworld,where_draw,1,0);
}
for (x = 0; x < 64; x++)
for (x = 0; x < town->max_items(); x++)
if ((cen_x + q - 4 == town->preset_items[x].loc.x) &&
(cen_y + r - 4 == town->preset_items[x].loc.y) && (town->preset_items[x].code >= 0)) {
}
for (x = 0; x < 60; x++)
for (x = 0; x < town->max_monst(); x++)
if ((cen_x + q - 4 == town->creatures(x).start_loc.x) &&
(cen_y + r - 4 == town->creatures(x).start_loc.y) && (town->creatures(x).number != 0)) {
}
@@ -956,7 +956,7 @@ void draw_monsts() {
location where_draw,store_loc;
GrafPtr cur_port;
for (i = 0; i < 60; i++)
for (i = 0; i < town->max_monst(); i++)
if (town->creatures(i).number != 0) {
where_draw.x = town->creatures(i).start_loc.x - cen_x + 4;
where_draw.y = town->creatures(i).start_loc.y - cen_y + 4;
@@ -1014,7 +1014,7 @@ void draw_items() {
short pic_num;
GrafPtr cur_port;
for (i = 0; i < 64; i++) {
for (i = 0; i < town->max_items(); i++) {
if (town->preset_items[i].code >= 0) {
where_draw.x = town->preset_items[i].loc.x - cen_x + 4;
where_draw.y = town->preset_items[i].loc.y - cen_y + 4;

View File

@@ -21,7 +21,7 @@ void draw_one_tiny_terrain_spot (short i,short j,unsigned short terrain_to_draw)
void Draw_Some_Item ( GWorldPtr src_gworld,Rect src_rect,GWorldPtr targ_gworld,location target,
char masked,short main_win);
//void rect_draw_some_item (GWorldPtr src_gworld,Rect src_rect,GWorldPtr targ_gworld,Rect targ_rect,char masked,short main_win);
Rect get_template_rect (unsigned char type_wanted);
Rect get_template_rect (unsigned short type_wanted);
void draw_frames();
void place_location();
void place_just_location();