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 [c278e9bdc7]:

To Artifact [8147a9749f]:


2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
}

static void parse_order_block(void) {
  // OP_MISC1, OP_MISC1_C, etc = properties (_C=reverse)
  // 0x1000...0x10FF = Have flag
  // OP_RET = end of block
  Uint16 beg,ptr;
  if(!main_options['U']) ParseError("(Not implemented yet)\n"); //TODO: remove this when it is implemented properly in exec.c too
  orders=malloc(0x4000*sizeof(Uint16));
  if(!orders) fatal("Allocation failed\n");
  nxttok();
  if(tokent==TF_INT) {
    if(tokenv<1 || tokenv>254) ParseError("Order number out of range\n");
    beg=ptr=tokenv;
    nxttok();







|







2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
}

static void parse_order_block(void) {
  // OP_MISC1, OP_MISC1_C, etc = properties (_C=reverse)
  // 0x1000...0x10FF = Have flag
  // OP_RET = end of block
  Uint16 beg,ptr;
  if(!main_options['U']) ParseError("Experimental/unstable feature\n"); //TODO: remove this when it is implemented properly in exec.c too
  orders=malloc(0x4000*sizeof(Uint16));
  if(!orders) fatal("Allocation failed\n");
  nxttok();
  if(tokent==TF_INT) {
    if(tokenv<1 || tokenv>254) ParseError("Order number out of range\n");
    beg=ptr=tokenv;
    nxttok();
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231

2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
      case OP_USERFLAG:
        tokenv=look_hash(glohash,HASH_SIZE,0x1000,0x10FF,0,"user flags");
        if(!tokenv) ParseError("User flag ^%s not defined\n",tokenstr);
        orders[ptr++]=tokenv;
        break;
      default: ParseError("Unexpected token in (Order) block\n");
    }
    nxttok();
    while(tokent!=TF_CLOSE) {
      if(Tokenf(TF_MACRO|TF_EQUAL) || !Tokenf(TF_NAME)) ParseError("Unexpected token in (Order) block\n");
      if(ptr>=0x3FFE) ParseError("Out of order memory\n");
      switch(tokenv) {
        case OP_MISC1: case OP_MISC1_C:
        case OP_MISC2: case OP_MISC2_C:
        case OP_MISC3: case OP_MISC3_C:
        case OP_MISC4: case OP_MISC4_C:
        case OP_MISC5: case OP_MISC5_C:
        case OP_MISC6: case OP_MISC6_C:
        case OP_MISC7: case OP_MISC7_C:
        case OP_TEMPERATURE: case OP_TEMPERATURE_C:
        case OP_DENSITY: case OP_DENSITY_C:
        case OP_XLOC: case OP_XLOC_C:
        case OP_YLOC: case OP_YLOC_C:
        case OP_IMAGE: case OP_IMAGE_C:
          orders[ptr++]=tokenv;
          break;
        default: ParseError("Unexpected token in (Order) block\n");
      }
      nxttok();
    }
    orders[ptr++]=OP_RET;

  }
  if(!norders) ParseError("Empty (Order) block\n");
  orders=realloc(orders,ptr*sizeof(Uint16))?:orders;
  nxttok();
}

static void set_class_orders(void) {
  int i,j,k;
  if(main_options['C']) {
    for(j=1;j<=norders;j++) {
      printf("Order %d =",j);







<
|



















<


>



<







2201
2202
2203
2204
2205
2206
2207

2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227

2228
2229
2230
2231
2232
2233

2234
2235
2236
2237
2238
2239
2240
      case OP_USERFLAG:
        tokenv=look_hash(glohash,HASH_SIZE,0x1000,0x10FF,0,"user flags");
        if(!tokenv) ParseError("User flag ^%s not defined\n",tokenstr);
        orders[ptr++]=tokenv;
        break;
      default: ParseError("Unexpected token in (Order) block\n");
    }

    while(nxttok(),tokent!=TF_CLOSE) {
      if(Tokenf(TF_MACRO|TF_EQUAL) || !Tokenf(TF_NAME)) ParseError("Unexpected token in (Order) block\n");
      if(ptr>=0x3FFE) ParseError("Out of order memory\n");
      switch(tokenv) {
        case OP_MISC1: case OP_MISC1_C:
        case OP_MISC2: case OP_MISC2_C:
        case OP_MISC3: case OP_MISC3_C:
        case OP_MISC4: case OP_MISC4_C:
        case OP_MISC5: case OP_MISC5_C:
        case OP_MISC6: case OP_MISC6_C:
        case OP_MISC7: case OP_MISC7_C:
        case OP_TEMPERATURE: case OP_TEMPERATURE_C:
        case OP_DENSITY: case OP_DENSITY_C:
        case OP_XLOC: case OP_XLOC_C:
        case OP_YLOC: case OP_YLOC_C:
        case OP_IMAGE: case OP_IMAGE_C:
          orders[ptr++]=tokenv;
          break;
        default: ParseError("Unexpected token in (Order) block\n");
      }

    }
    orders[ptr++]=OP_RET;
    nxttok();
  }
  if(!norders) ParseError("Empty (Order) block\n");
  orders=realloc(orders,ptr*sizeof(Uint16))?:orders;

}

static void set_class_orders(void) {
  int i,j,k;
  if(main_options['C']) {
    for(j=1;j<=norders;j++) {
      printf("Order %d =",j);