Free Hero Mesh

Diff
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.

Differences From Artifact [cc13f87281]:

To Artifact [fbb61cd5b6]:


101
102
103
104
105
106
107

108
109
110













111
112
113
114
115
116
117
  if(!size || !data) fatal("Error in string builder\n");
  write_lump(FIL_LEVEL,LUMP_CLASS_DEF,size,data);
  sqlite3_free(data);
}

static inline void version_change(void) {
  long sz=0;

  unsigned char*buf=read_lump(FIL_SOLUTION,level_id,&sz);
  if(!buf) return;
  if(sz>2 && (buf[0]|(buf[1]<<8))==level_version) ++level_version;













  free(buf);
}

static void save_obj(sqlite3_str*s,const Object*o,const Object**m,Uint8 x,Uint8 y) {
  static Uint8 r=0;
  static Uint8 rx,ry;
  const Object*p=0;







>

|

>
>
>
>
>
>
>
>
>
>
>
>
>







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
  if(!size || !data) fatal("Error in string builder\n");
  write_lump(FIL_LEVEL,LUMP_CLASS_DEF,size,data);
  sqlite3_free(data);
}

static inline void version_change(void) {
  long sz=0;
  int n;
  unsigned char*buf=read_lump(FIL_SOLUTION,level_id,&sz);
  if(!buf) goto us;
  if(sz>2 && (buf[0]|(buf[1]<<8))==level_version) ++level_version;
  free(buf);
  us:
  // Set user state to unsolved, if applicable
  buf=read_userstate(FIL_LEVEL,level_id,&sz);
  if(!buf) return;
  if(sz>2) {
    n=(buf[sz-2]<<8)|buf[sz-1];
    if(sz-n>=6 && (buf[n+2]<<8)+buf[n+3]==level_version) {
      buf[n+2]=(level_version-1)>>8;
      buf[n+3]=level_version-1;
      write_userstate(FIL_LEVEL,level_id,sz,buf);
    }
  }
  free(buf);
}

static void save_obj(sqlite3_str*s,const Object*o,const Object**m,Uint8 x,Uint8 y) {
  static Uint8 r=0;
  static Uint8 rx,ry;
  const Object*p=0;