tunnelbridge_cmd.c
changeset 2635 7ed07303448d
parent 2537 5e4ca74e995a
child 2639 eeaefdabfdfd
equal deleted inserted replaced
2634:0df9396b0067 2635:7ed07303448d
   811 			if (m5 & 0x40) {
   811 			if (m5 & 0x40) {
   812 				if (m5 & 0x20) {
   812 				if (m5 & 0x20) {
   813 					static const uint16 _new_data_table[] = {0x1002, 0x1001, 0x2005, 0x200A, 0, 0, 0, 0};
   813 					static const uint16 _new_data_table[] = {0x1002, 0x1001, 0x2005, 0x200A, 0, 0, 0, 0};
   814 					new_data = _new_data_table[((m5 & 0x18) >> 2) | (m5&1)];
   814 					new_data = _new_data_table[((m5 & 0x18) >> 2) | (m5&1)];
   815 				}	else {
   815 				}	else {
   816 					if (!(m5 & 0x18)) goto clear_it;
   816 					if (GB(m5, 3, 2) == 0) goto clear_it;
   817 					new_data = (GetTileSlope(c, NULL) == 0) ? 0x6000 : 0x6001;
   817 					new_data = (GetTileSlope(c, NULL) == 0) ? 0x6000 : 0x6001;
   818 				}
   818 				}
   819 
   819 
   820 				SetTileType(c, new_data >> 12);
   820 				SetTileType(c, new_data >> 12);
   821 				_m[c].m5 = (byte)new_data;
   821 				_m[c].m5 = (byte)new_data;
  1396 	uint32 result;
  1396 	uint32 result;
  1397 	byte m5 = _m[tile].m5;
  1397 	byte m5 = _m[tile].m5;
  1398 
  1398 
  1399 	if ((m5 & 0xF0) == 0) {
  1399 	if ((m5 & 0xF0) == 0) {
  1400 		/* This is a tunnel */
  1400 		/* This is a tunnel */
  1401 		if (((m5 & 0xCU) >> 2) == mode) {
  1401 		if (GB(m5, 2, 2) == mode) {
  1402 			/* Tranport in the tunnel is compatible */
  1402 			/* Tranport in the tunnel is compatible */
  1403 			return m5&1 ? 0x202 : 0x101;
  1403 			return m5&1 ? 0x202 : 0x101;
  1404 		}
  1404 		}
  1405 	} else if (m5 & 0x80) {
  1405 	} else if (m5 & 0x80) {
  1406 		/* This is a bridge */
  1406 		/* This is a bridge */
  1407 		result = 0;
  1407 		result = 0;
  1408 		if (((m5 & 0x6U) >> 1) == mode) {
  1408 		if (GB(m5, 1, 2) == mode) {
  1409 			/* Transport over the bridge is compatible */
  1409 			/* Transport over the bridge is compatible */
  1410 			result = m5&1 ? 0x202 : 0x101;
  1410 			result = m5&1 ? 0x202 : 0x101;
  1411 		}
  1411 		}
  1412 		if (m5 & 0x40) {
  1412 		if (m5 & 0x40) {
  1413 			/* Bridge middle part */
  1413 			/* Bridge middle part */
  1419 				else
  1419 				else
  1420 					if (mode != TRANSPORT_WATER)
  1420 					if (mode != TRANSPORT_WATER)
  1421 						return result;
  1421 						return result;
  1422 			} else {
  1422 			} else {
  1423 				/* Transport underneath */
  1423 				/* Transport underneath */
  1424 				if ((m5 & 0x18U) >> 3 != mode)
  1424 				if (GB(m5, 3, 2) != mode)
  1425 					/* Incompatible transport underneath */
  1425 					/* Incompatible transport underneath */
  1426 					return result;
  1426 					return result;
  1427 			}
  1427 			}
  1428 			/* If we've not returned yet, there is a compatible
  1428 			/* If we've not returned yet, there is a compatible
  1429 			 * transport or water beneath, so we can add it to
  1429 			 * transport or water beneath, so we can add it to