tunnelbridge_cmd.c
changeset 2422 897a01f7c624
parent 2314 82775d31c045
child 2436 7d5df545bd5d
equal deleted inserted replaced
2421:8bc8ff3a5eb5 2422:897a01f7c624
   263 	if (ti_start.z != ti_end.z)
   263 	if (ti_start.z != ti_end.z)
   264 		return_cmd_error(STR_5009_LEVEL_LAND_OR_WATER_REQUIRED);
   264 		return_cmd_error(STR_5009_LEVEL_LAND_OR_WATER_REQUIRED);
   265 
   265 
   266 
   266 
   267 	// Towns are not allowed to use bridges on slopes.
   267 	// Towns are not allowed to use bridges on slopes.
   268 	allow_on_slopes = ((!_is_ai_player || _patches.ainew_active)
   268 	allow_on_slopes = (!_is_old_ai_player
   269 	                   && _current_player != OWNER_TOWN && _patches.build_on_slopes);
   269 	                   && _current_player != OWNER_TOWN && _patches.build_on_slopes);
   270 
   270 
   271 	/* Try and clear the start landscape */
   271 	/* Try and clear the start landscape */
   272 
   272 
   273 	if (CmdFailed(ret = DoCommandByTile(ti_start.tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR)))
   273 	if (CmdFailed(ret = DoCommandByTile(ti_start.tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR)))
   408 	if (!(flags & DC_QUERY_COST)) {
   408 	if (!(flags & DC_QUERY_COST)) {
   409 		const Bridge *b = &_bridge[bridge_type];
   409 		const Bridge *b = &_bridge[bridge_type];
   410 
   410 
   411 		bridge_len += 2;	// begin and end tiles/ramps
   411 		bridge_len += 2;	// begin and end tiles/ramps
   412 
   412 
   413 		if (_current_player < MAX_PLAYERS && !(_is_ai_player && !_patches.ainew_active))
   413 		if (_current_player < MAX_PLAYERS && !_is_old_ai_player)
   414 			bridge_len = CalcBridgeLenCostFactor(bridge_len);
   414 			bridge_len = CalcBridgeLenCostFactor(bridge_len);
   415 
   415 
   416 		cost += ((int64)bridge_len * _price.build_bridge * b->price) >> 8;
   416 		cost += ((int64)bridge_len * _price.build_bridge * b->price) >> 8;
   417 	}
   417 	}
   418 
   418