unmovable_cmd.c
changeset 1901 03bf9bf99319
parent 1891 862800791170
child 1902 86b7fb11f938
equal deleted inserted replaced
1900:1f3309a61546 1901:03bf9bf99319
   120 		if (ti->map5 == 2) {
   120 		if (ti->map5 == 2) {
   121 
   121 
   122 			// statue
   122 			// statue
   123 			DrawGroundSprite(0x58C);
   123 			DrawGroundSprite(0x58C);
   124 
   124 
   125 			image = PLAYER_SPRITE_COLOR(_map_owner[ti->tile]);
   125 			image = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
   126 			image += 0x8A48;
   126 			image += 0x8A48;
   127 			if (_display_opt & DO_TRANS_BUILDINGS)
   127 			if (_display_opt & DO_TRANS_BUILDINGS)
   128 				image = (image & 0x3FFF) | 0x3224000;
   128 				image = (image & 0x3FFF) | 0x3224000;
   129 			AddSortableSpriteToDraw(image, ti->x, ti->y, 16, 16, 25, ti->z);
   129 			AddSortableSpriteToDraw(image, ti->x, ti->y, 16, 16, 25, ti->z);
   130 		} else if (ti->map5 == 3) {
   130 		} else if (ti->map5 == 3) {
   131 
   131 
   132 			// "owned by" sign
   132 			// "owned by" sign
   133 			DrawClearLandTile(ti, 0);
   133 			DrawClearLandTile(ti, 0);
   134 
   134 
   135 			AddSortableSpriteToDraw(
   135 			AddSortableSpriteToDraw(
   136 				PLAYER_SPRITE_COLOR(_map_owner[ti->tile]) + 0x92B6,
   136 				PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)) + 0x92B6,
   137 				ti->x+8, ti->y+8,
   137 				ti->x+8, ti->y+8,
   138 				1, 1,
   138 				1, 1,
   139 				10,
   139 				10,
   140 				GetSlopeZ(ti->x+8, ti->y+8)
   140 				GetSlopeZ(ti->x+8, ti->y+8)
   141 			);
   141 			);
   163 		const DrawTileSeqStruct *dtss;
   163 		const DrawTileSeqStruct *dtss;
   164 		const DrawTileSprites *t;
   164 		const DrawTileSprites *t;
   165 
   165 
   166 		if (ti->tileh) DrawFoundation(ti, ti->tileh);
   166 		if (ti->tileh) DrawFoundation(ti, ti->tileh);
   167 
   167 
   168 		ormod = PLAYER_SPRITE_COLOR(_map_owner[ti->tile]);
   168 		ormod = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
   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) {
   253 static void GetTileDesc_Unmovable(uint tile, TileDesc *td)
   253 static void GetTileDesc_Unmovable(uint tile, TileDesc *td)
   254 {
   254 {
   255 	int i = _map5[tile];
   255 	int i = _map5[tile];
   256 	if (i & 0x80) i = -1;
   256 	if (i & 0x80) i = -1;
   257 	td->str = _unmovable_tile_str[i + 1];
   257 	td->str = _unmovable_tile_str[i + 1];
   258 	td->owner = _map_owner[tile];
   258 	td->owner = GetTileOwner(tile);
   259 }
   259 }
   260 
   260 
   261 static void AnimateTile_Unmovable(uint tile)
   261 static void AnimateTile_Unmovable(uint tile)
   262 {
   262 {
   263 	/* not used */
   263 	/* not used */
   306 }
   306 }
   307 
   307 
   308 static void ClickTile_Unmovable(uint tile)
   308 static void ClickTile_Unmovable(uint tile)
   309 {
   309 {
   310 	if (_map5[tile] & 0x80) {
   310 	if (_map5[tile] & 0x80) {
   311 		ShowPlayerCompany(_map_owner[tile]);
   311 		ShowPlayerCompany(GetTileOwner(tile));
   312 	}
   312 	}
   313 }
   313 }
   314 
   314 
   315 static const TileIndexDiffC _tile_add[] = {
   315 static const TileIndexDiffC _tile_add[] = {
   316 	{ 1,  0},
   316 	{ 1,  0},
   394 	} while (--i);
   394 	} while (--i);
   395 }
   395 }
   396 
   396 
   397 static void ChangeTileOwner_Unmovable(uint tile, byte old_player, byte new_player)
   397 static void ChangeTileOwner_Unmovable(uint tile, byte old_player, byte new_player)
   398 {
   398 {
   399 	if (_map_owner[tile] != old_player)
   399 	if (!IsTileOwner(tile, old_player)) return;
   400 		return;
       
   401 
   400 
   402 	if (_map5[tile]==3 && new_player != 255) {
   401 	if (_map5[tile]==3 && new_player != 255) {
   403 		_map_owner[tile] = new_player;
   402 		_map_owner[tile] = new_player;
   404 	}	else {
   403 	}	else {
   405 		DoClearSquare(tile);
   404 		DoClearSquare(tile);