Free Hero Mesh

Check-in [8809d628a4]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.
Overview
Comment:Correct some mistakes in the level loading
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8809d628a434aa123f68728be2c41dac7a54d4eb
User & Date: user on 2020-11-16 22:44:48
Other Links: manifest | tags
Context
2020-11-17
00:51
Add possibility to select levels. check-in: 5b7677692b user: user tags: trunk
2020-11-16
22:44
Correct some mistakes in the level loading check-in: 8809d628a4 user: user tags: trunk
04:55
Correct the license check-in: f14e1a7d44 user: user tags: trunk
Changes

Modified exec.c from [47586b49e3] to [ca6634bfb7].

76
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
Uint32 objalloc(Uint16 c) {
  // Allocates a new object of the given class; links into the event list but not into the playfield.
  // All fields are initialized by the class or to zero.
  // Does not send any messages or otherwise notify anyone that it has been created.
  // Returns VOIDLINK if object cannot be created.
  Uint32 n;
  Class*cl=classes[c];
  Object*o=calloc(1,sizeof(Object)+cl->uservars*sizeof(Value));
  if(!c || !cl || cl->cflags&(CF_GROUP|CF_NOCLASS2)) goto bad;

  if(!o) fatal("Allocation failed\n");
  o->class=c;
  o->generation=generation_number;
#define C(x) o->x=cl->x;
  C(height) C(weight) C(climb) C(density) C(volume) C(strength) C(arrivals) C(departures) C(temperature)
  C(shape) C(shovable) C(oflags)
  C(sharp[0]) C(sharp[1]) C(sharp[2]) C(sharp[3])







|

>







76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Uint32 objalloc(Uint16 c) {
  // Allocates a new object of the given class; links into the event list but not into the playfield.
  // All fields are initialized by the class or to zero.
  // Does not send any messages or otherwise notify anyone that it has been created.
  // Returns VOIDLINK if object cannot be created.
  Uint32 n;
  Class*cl=classes[c];
  Object*o=0;
  if(!c || !cl || cl->cflags&(CF_GROUP|CF_NOCLASS2)) goto bad;
  o=calloc(1,sizeof(Object)+cl->uservars*sizeof(Value));
  if(!o) fatal("Allocation failed\n");
  o->class=c;
  o->generation=generation_number;
#define C(x) o->x=cl->x;
  C(height) C(weight) C(climb) C(density) C(volume) C(strength) C(arrivals) C(departures) C(temperature)
  C(shape) C(shovable) C(oflags)
  C(sharp[0]) C(sharp[1]) C(sharp[2]) C(sharp[3])

Modified main.c from [d1369c2f61] to [1983533b19].

203
204
205
206
207
208
209


210
211
212
213
214
215
216
  int i,n,x,y,z;
  Uint16 lo=0;
  Uint32 o;
  Uint32 mru[2];
  if(lvl<0 && level_index && -lvl<=level_nindex) {
    lo=-lvl;
    lvl=level_index[~lvl];


  }
  if(lvl<0) return "Invalid level ID";
  if(!buf) return "Cannot find level";
  free(level_title);
  level_title=0;
  annihilate();
  generation_number=TY_MAXTYPE+1;







>
>







203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
  int i,n,x,y,z;
  Uint16 lo=0;
  Uint32 o;
  Uint32 mru[2];
  if(lvl<0 && level_index && -lvl<=level_nindex) {
    lo=-lvl;
    lvl=level_index[~lvl];
    p=buf=read_lump(FIL_LEVEL,lvl,&sz,0);
    end=buf+sz;
  }
  if(lvl<0) return "Invalid level ID";
  if(!buf) return "Cannot find level";
  free(level_title);
  level_title=0;
  annihilate();
  generation_number=TY_MAXTYPE+1;