902 |
902 |
903 static void Disaster7_Init(void) |
903 static void Disaster7_Init(void) |
904 { |
904 { |
905 int index = GB(Random(), 0, 4); |
905 int index = GB(Random(), 0, 4); |
906 Industry *i; |
906 Industry *i; |
907 int maxloop = 15; |
907 uint m; |
908 |
908 |
909 do { |
909 for (m = 0; m < 15; m++) { |
910 FOR_ALL_INDUSTRIES(i) { |
910 FOR_ALL_INDUSTRIES(i) { |
911 if (i->xy != 0 && i->type == IT_COAL_MINE && --index < 0) { |
911 if (i->xy != 0 && i->type == IT_COAL_MINE && --index < 0) { |
912 |
912 |
913 SetDParam(0, i->town->index); |
913 SetDParam(0, i->town->index); |
914 AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES, |
914 AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES, |
915 NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy + TileDiffXY(1, 1), 0); |
915 NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy + TileDiffXY(1, 1), 0); |
916 |
916 |
917 { |
917 { |
918 TileIndex tile = i->xy; |
918 TileIndex tile = i->xy; |
919 TileIndexDiff step = TileOffsByDir(GB(Random(), 0, 2)); |
919 TileIndexDiff step = TileOffsByDir(GB(Random(), 0, 2)); |
920 |
920 uint n; |
921 int count = 30; |
921 |
922 do { |
922 for (n = 0; n < 30; i++) { |
923 DisasterClearSquare(tile); |
923 DisasterClearSquare(tile); |
924 tile = TILE_MASK(tile + step); |
924 tile = TILE_MASK(tile + step); |
925 } while (--count); |
925 } |
926 } |
926 } |
927 return; |
927 return; |
928 } |
928 } |
929 } |
929 } |
930 } while (--maxloop != 0); |
930 } |
931 } |
931 } |
932 |
932 |
933 static DisasterInitProc * const _disaster_initprocs[] = { |
933 static DisasterInitProc * const _disaster_initprocs[] = { |
934 Disaster0_Init, |
934 Disaster0_Init, |
935 Disaster1_Init, |
935 Disaster1_Init, |