src/newgrf.cpp
changeset 7736 1119c5e38774
parent 7729 21b3ddd80928
child 7772 82b58fd5897c
equal deleted inserted replaced
7735:6c600a540a44 7736:1119c5e38774
  1679 	return ret;
  1679 	return ret;
  1680 }
  1680 }
  1681 
  1681 
  1682 static bool IndustrytilesChangeInfo(uint indtid, int numinfo, int prop, byte **bufp, int len)
  1682 static bool IndustrytilesChangeInfo(uint indtid, int numinfo, int prop, byte **bufp, int len)
  1683 {
  1683 {
       
  1684 	if (!HASBIT(_ttdpatch_flags[3], 0x07)) return true;
       
  1685 
  1684 	byte *buf = *bufp;
  1686 	byte *buf = *bufp;
  1685 	bool ret = false;
  1687 	bool ret = false;
  1686 
  1688 
  1687 	if (indtid + numinfo > NUM_INDUSTRYTILES) {
  1689 	if (indtid + numinfo > NUM_INDUSTRYTILES) {
  1688 		grfmsg(1, "IndustryTilesChangeInfo: Too many industry tiles loaded (%u), max (%u). Ignoring.", indtid + numinfo, NUM_INDUSTRYTILES);
  1690 		grfmsg(1, "IndustryTilesChangeInfo: Too many industry tiles loaded (%u), max (%u). Ignoring.", indtid + numinfo, NUM_INDUSTRYTILES);
  1791 	return ret;
  1793 	return ret;
  1792 }
  1794 }
  1793 
  1795 
  1794 static bool IndustriesChangeInfo(uint indid, int numinfo, int prop, byte **bufp, int len)
  1796 static bool IndustriesChangeInfo(uint indid, int numinfo, int prop, byte **bufp, int len)
  1795 {
  1797 {
       
  1798 	if (!HASBIT(_ttdpatch_flags[3], 0x07)) return true;
       
  1799 
  1796 	byte *buf = *bufp;
  1800 	byte *buf = *bufp;
  1797 	bool ret = false;
  1801 	bool ret = false;
  1798 
  1802 
  1799 	if (indid + numinfo > NUM_INDUSTRYTYPES) {
  1803 	if (indid + numinfo > NUM_INDUSTRYTYPES) {
  1800 		grfmsg(1, "IndustriesChangeInfo: Too many industries loaded (%u), max (%u). Ignoring.", indid + numinfo, NUM_INDUSTRYTYPES);
  1804 		grfmsg(1, "IndustriesChangeInfo: Too many industries loaded (%u), max (%u). Ignoring.", indid + numinfo, NUM_INDUSTRYTYPES);
  2921 	}
  2925 	}
  2922 }
  2926 }
  2923 
  2927 
  2924 static void IndustryMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
  2928 static void IndustryMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
  2925 {
  2929 {
       
  2930 	if (!HASBIT(_ttdpatch_flags[3], 0x07)) return;
       
  2931 
  2926 	byte *bp = &buf[4 + idcount + cidcount * 3];
  2932 	byte *bp = &buf[4 + idcount + cidcount * 3];
  2927 	uint16 groupid = grf_load_word(&bp);
  2933 	uint16 groupid = grf_load_word(&bp);
  2928 
  2934 
  2929 	if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
  2935 	if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
  2930 		grfmsg(1, "IndustryMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.",
  2936 		grfmsg(1, "IndustryMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.",
  2945 	}
  2951 	}
  2946 }
  2952 }
  2947 
  2953 
  2948 static void IndustrytileMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
  2954 static void IndustrytileMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
  2949 {
  2955 {
       
  2956 	if (!HASBIT(_ttdpatch_flags[3], 0x07)) return;
       
  2957 
  2950 	byte *bp = &buf[4 + idcount + cidcount * 3];
  2958 	byte *bp = &buf[4 + idcount + cidcount * 3];
  2951 	uint16 groupid = grf_load_word(&bp);
  2959 	uint16 groupid = grf_load_word(&bp);
  2952 
  2960 
  2953 	if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
  2961 	if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
  2954 		grfmsg(1, "IndustrytileMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.",
  2962 		grfmsg(1, "IndustrytileMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.",