Free Hero Mesh

Check-in [e93f746d5e]
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:When a level is changed, set the user state to unsolved even if no solution has been recorded.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e93f746d5e99c9cbb20f09c1716c6c0d1cf803a8
User & Date: user on 2022-03-09 04:46:26
Other Links: manifest | tags
Context
2022-03-09
05:01
Correct the implementation of BroadcastAnd check-in: cb7aff32a7 user: user tags: trunk
04:46
When a level is changed, set the user state to unsolved even if no solution has been recorded. check-in: e93f746d5e user: user tags: trunk
04:05
In the picture editor, ensure the pick function works even if caps lock and/or num lock is activated. check-in: cc72ae321f user: user tags: trunk
Changes

Modified edit.c from [cc13f87281] to [fbb61cd5b6].

101
102
103
104
105
106
107

108
109

110













111
112
113
114
115
116
117
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) return;
  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;