| changeset 1035 | 812f837ee03f |
| parent 1019 | 6bae6c11e865 |
| child 1048 | 8611c5c02dcb |
| 1034:e761d474e204 | 1035:812f837ee03f |
|---|---|
834 } |
834 } |
835 |
835 |
836 void DeleteIndustry(Industry *i) |
836 void DeleteIndustry(Industry *i) |
837 { |
837 { |
838 BEGIN_TILE_LOOP(tile_cur, i->width, i->height, i->xy); |
838 BEGIN_TILE_LOOP(tile_cur, i->width, i->height, i->xy); |
839 if (IS_TILETYPE(tile_cur, MP_INDUSTRY)) { |
839 if (IsTileType(tile_cur, MP_INDUSTRY)) { |
840 if (_map2[tile_cur] == i->index) { |
840 if (_map2[tile_cur] == i->index) { |
841 DoClearSquare(tile_cur); |
841 DoClearSquare(tile_cur); |
842 } |
842 } |
843 } else if (IS_TILETYPE(tile_cur, MP_STATION) && _map5[tile_cur] == 0x4B) { |
843 } else if (IsTileType(tile_cur, MP_STATION) && _map5[tile_cur] == 0x4B) { |
844 DeleteOilRig(tile_cur); |
844 DeleteOilRig(tile_cur); |
845 } |
845 } |
846 END_TILE_LOOP(tile_cur, i->width, i->height, i->xy); |
846 END_TILE_LOOP(tile_cur, i->width, i->height, i->xy); |
847 |
847 |
848 i->xy = 0; |
848 i->xy = 0; |
854 |
854 |
855 static const byte _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6}; |
855 static const byte _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6}; |
856 |
856 |
857 static bool IsBadFarmFieldTile(uint tile) |
857 static bool IsBadFarmFieldTile(uint tile) |
858 { |
858 { |
859 if (IS_TILETYPE(tile,MP_CLEAR)) { |
859 if (IsTileType(tile, MP_CLEAR)) { |
860 byte m5 = _map5[tile] & 0x1C; |
860 byte m5 = _map5[tile] & 0x1C; |
861 if (m5 == 0xC || m5 == 0x10) |
861 if (m5 == 0xC || m5 == 0x10) |
862 return true; |
862 return true; |
863 return false; |
863 return false; |
864 } else if (IS_TILETYPE(tile,MP_TREES)) { |
864 } else if (IsTileType(tile, MP_TREES)) { |
865 return false; |
865 return false; |
866 } else { |
866 } else { |
867 return true; |
867 return true; |
868 } |
868 } |
869 } |
869 } |
870 |
870 |
871 static bool IsBadFarmFieldTile2(uint tile) |
871 static bool IsBadFarmFieldTile2(uint tile) |
872 { |
872 { |
873 if (IS_TILETYPE(tile,MP_CLEAR)) { |
873 if (IsTileType(tile, MP_CLEAR)) { |
874 byte m5 = _map5[tile] & 0x1C; |
874 byte m5 = _map5[tile] & 0x1C; |
875 if (m5 == 0x10) |
875 if (m5 == 0x10) |
876 return true; |
876 return true; |
877 return false; |
877 return false; |
878 } else if (IS_TILETYPE(tile,MP_TREES)) { |
878 } else if (IsTileType(tile, MP_TREES)) { |
879 return false; |
879 return false; |
880 } else { |
880 } else { |
881 return true; |
881 return true; |
882 } |
882 } |
883 } |
883 } |
887 byte or, and; |
887 byte or, and; |
888 |
888 |
889 do { |
889 do { |
890 tile = TILE_MASK(tile); |
890 tile = TILE_MASK(tile); |
891 |
891 |
892 if (IS_TILETYPE(tile, MP_CLEAR) || IS_TILETYPE(tile, MP_TREES)) { |
892 if (IsTileType(tile, MP_CLEAR) || IsTileType(tile, MP_TREES)) { |
893 |
893 |
894 or = type; |
894 or = type; |
895 if (or == 1 && (uint16)Random() <= 9362) or = 2; |
895 if (or == 1 && (uint16)Random() <= 9362) or = 2; |
896 |
896 |
897 or <<= 2; |
897 or <<= 2; |
997 for(a=1; a!=41; a+=2) { |
997 for(a=1; a!=41; a+=2) { |
998 for(dir=0; dir!=4; dir++) { |
998 for(dir=0; dir!=4; dir++) { |
999 j = a; |
999 j = a; |
1000 do { |
1000 do { |
1001 tile = TILE_MASK(tile); |
1001 tile = TILE_MASK(tile); |
1002 if (IS_TILETYPE(tile, MP_TREES)) { |
1002 if (IsTileType(tile, MP_TREES)) { |
1003 uint old_player = _current_player; |
1003 uint old_player = _current_player; |
1004 /* found a tree */ |
1004 /* found a tree */ |
1005 |
1005 |
1006 _current_player = OWNER_NONE; |
1006 _current_player = OWNER_NONE; |
1007 _industry_sound_ctr = 1; |
1007 _industry_sound_ctr = 1; |