Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...

Feature #824590 » 0014-Sanity-check-space-part-genus.patch

S3_0 - Marko Lindqvist, 2021-09-10 04:22 PM

View differences:

server/rscompat.c
348 348
  return TRUE;
349 349
}
350 350

  
351

  
352
/**************************************************************************
353
  Do compatibility things after regular ruleset loading, but before
354
  sanity checking.
355
**************************************************************************/
356
void rscompat_adjust_pre_sanity(struct rscompat_info *info)
357
{
358
  if (!info->compat_mode) {
359
    /* There isn't anything here yet that should be done outside of compat
360
     * mode. */
361
    return;
362
  }
363

  
364
  if (info->ver_buildings < 10) {
365
    improvement_iterate(pimprove) {
366
      if (pimprove->genus != IG_SPECIAL
367
          && (get_potential_improvement_bonus(pimprove, NULL, EFT_SS_STRUCTURAL,
368
                                              RPT_POSSIBLE, FALSE)
369
              || get_potential_improvement_bonus(pimprove, NULL, EFT_SS_COMPONENT,
370
                                                 RPT_POSSIBLE, FALSE)
371
              || get_potential_improvement_bonus(pimprove, NULL, EFT_SS_MODULE,
372
                                                 RPT_POSSIBLE, FALSE))) {
373
        pimprove->genus = IG_SPECIAL;
374
      }
375
    } improvement_iterate_end;
376
  }
377
}
378

  
351 379
/**************************************************************************
352 380
  Do compatibility things after regular ruleset loading.
353 381
**************************************************************************/
server/rscompat.h
1
/********************************************************************** 
1
/***********************************************************************
2 2
 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 3
   This program is free software; you can redistribute it and/or modify
4 4
   it under the terms of the GNU General Public License as published by
......
48 48

  
49 49
bool rscompat_names(struct rscompat_info *info);
50 50

  
51
void rscompat_adjust_pre_sanity(struct rscompat_info *info);
51 52
void rscompat_postprocess(struct rscompat_info *info);
52 53

  
53 54
/* Functions specific to 2.6 -> 3.0 transition */
server/rssanity.c
588 588

  
589 589
      return FALSE;
590 590
    }
591
    if (pimprove->genus != IG_SPECIAL
592
        && (get_potential_improvement_bonus(pimprove, NULL, EFT_SS_STRUCTURAL,
593
                                            RPT_POSSIBLE, FALSE)
594
            || get_potential_improvement_bonus(pimprove, NULL, EFT_SS_COMPONENT,
595
                                               RPT_POSSIBLE, FALSE)
596
            || get_potential_improvement_bonus(pimprove, NULL, EFT_SS_MODULE,
597
                                               RPT_POSSIBLE, FALSE))) {
598
      ruleset_error(LOG_ERROR,
599
                    "Space part with genus other than \"Special\"");
600
      return FALSE;
601
    }
591 602
  } improvement_iterate_end;
592 603

  
593 604
  return TRUE;
server/ruleset.c
8034 8034
  }
8035 8035

  
8036 8036
  if (ok) {
8037
    rscompat_adjust_pre_sanity(&compat_info);
8038

  
8037 8039
    /* Init nations we just loaded. */
8038 8040
    update_nations_with_startpos();
8039 8041

  
......
8095 8097
  }
8096 8098

  
8097 8099
  if (ok) {
8098
    
8099 8100
    char **buffer = buffer_script ? &script_buffer : NULL;
8100 8101

  
8101 8102
    script_server_free();
8102
- 
(2-2/2)