unmovable_cmd.c
changeset 2026 567e3bc9af72
parent 1981 3c9c682f1212
child 2049 538e73c53f54
equal deleted inserted replaced
2025:6d1723144029 2026:567e3bc9af72
    23 	Player *p;
    23 	Player *p;
    24 
    24 
    25 	SET_EXPENSES_TYPE(EXPENSES_PROPERTY);
    25 	SET_EXPENSES_TYPE(EXPENSES_PROPERTY);
    26 
    26 
    27 	/* Find player that has HQ flooded, and reset their location_of_house */
    27 	/* Find player that has HQ flooded, and reset their location_of_house */
    28 	if (_current_player == OWNER_WATER)	{
    28 	if (_current_player == OWNER_WATER) {
    29 		bool dodelete = false;
    29 		bool dodelete = false;
    30 
    30 
    31 		FOR_ALL_PLAYERS(p) {
    31 		FOR_ALL_PLAYERS(p) {
    32 			if (p->location_of_house == tile) {
    32 			if (p->location_of_house == tile) {
    33 				dodelete = true;
    33 				dodelete = true;
   169 
   169 
   170 		t = &_unmovable_display_datas[ti->map5 & 0x7F];
   170 		t = &_unmovable_display_datas[ti->map5 & 0x7F];
   171 		DrawGroundSprite(t->ground_sprite | ormod);
   171 		DrawGroundSprite(t->ground_sprite | ormod);
   172 
   172 
   173 		foreach_draw_tile_seq(dtss, t->seq) {
   173 		foreach_draw_tile_seq(dtss, t->seq) {
   174 			image =	dtss->image;
   174 			image = dtss->image;
   175 			if (_display_opt & DO_TRANS_BUILDINGS) {
   175 			if (_display_opt & DO_TRANS_BUILDINGS) {
   176 				image = (image & 0x3FFF) | 0x03224000;
   176 				image = (image & 0x3FFF) | 0x03224000;
   177 			} else {
   177 			} else {
   178 				image |= ormod;
   178 				image |= ormod;
   179 			}
   179 			}
   200 	if (m5 & 0x80) {
   200 	if (m5 & 0x80) {
   201 		if (_current_player == OWNER_WATER) return DestroyCompanyHQ(tile, DC_EXEC);
   201 		if (_current_player == OWNER_WATER) return DestroyCompanyHQ(tile, DC_EXEC);
   202 		return_cmd_error(STR_5804_COMPANY_HEADQUARTERS_IN);
   202 		return_cmd_error(STR_5804_COMPANY_HEADQUARTERS_IN);
   203 	}
   203 	}
   204 
   204 
   205 	if (m5 == 3)	// company owned land
   205 	if (m5 == 3) // company owned land
   206 		return DoCommandByTile(tile, 0, 0, flags, CMD_SELL_LAND_AREA);
   206 		return DoCommandByTile(tile, 0, 0, flags, CMD_SELL_LAND_AREA);
   207 
   207 
   208 	// checks if you're allowed to remove unmovable things
   208 	// checks if you're allowed to remove unmovable things
   209 	if (_game_mode != GM_EDITOR && _current_player != OWNER_WATER && ((flags & DC_AUTO || !_cheats.magic_bulldozer.value)) )
   209 	if (_game_mode != GM_EDITOR && _current_player != OWNER_WATER && ((flags & DC_AUTO || !_cheats.magic_bulldozer.value)) )
   210 		return_cmd_error(STR_5800_OBJECT_IN_THE_WAY);
   210 		return_cmd_error(STR_5800_OBJECT_IN_THE_WAY);
   396 {
   396 {
   397 	if (!IsTileOwner(tile, old_player)) return;
   397 	if (!IsTileOwner(tile, old_player)) return;
   398 
   398 
   399 	if (_map5[tile]==3 && new_player != 255) {
   399 	if (_map5[tile]==3 && new_player != 255) {
   400 		SetTileOwner(tile, new_player);
   400 		SetTileOwner(tile, new_player);
   401 	}	else {
   401 	} else {
   402 		DoClearSquare(tile);
   402 		DoClearSquare(tile);
   403 	}
   403 	}
   404 }
   404 }
   405 
   405 
   406 const TileTypeProcs _tile_type_unmovable_procs = {
   406 const TileTypeProcs _tile_type_unmovable_procs = {